Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add posibility to parse multiple line definitions #378

Closed
wants to merge 15 commits into from

Commits on May 25, 2022

  1. Add posibility to parse multiple line definitions

    bosd
    
    refactored code to allow multiple lines to be parsed.
    
    Restructuring was needed.
    
    As we want to output the lines in the order of the invoice file.
    
    Independent of the order of the template file.
    
    Example yaml input
    
    lines:
    
     - start: Barcode
    
       end:  Netto totaal
    
       line: (?P<line_note>(FOOD))
    
     - start: Barcode
    
       end:  Netto totaal
    
       line: (?P<description>(.+))\s+(?P<price>\d+\d+)
    
    it is also possible to contentate multi line tags.
    
    alternative example sammymaystone.
    
    lines:
    
     - start: Item\s+Quantity\s+Rate\s+Amount
    
       end:  Subtotal
    
       first_line: 'Service (?P<item>\w)\s+(?P<qty>\S+)\s+.(?P<unitprice>\d+.\d{2})\s+.?(?P<linetotal>\d+.\d{2})'
    
       line: '(?P<item>.*)'
    
       skip_line: ['Pino \w'] # 'Description:', Notes:,
    
       last_line: '(?P<desc>Parts:.*)'
    
       types:
    
         qty: int
    
         unitprice: float
    
         linetotal: float
    
    input:
    
    Service A                                                                 12                      0.00         20.00
    
    Description: Repair
    
    Notes: Replaced capacitor
    
    Parts: 1 x cap_a
    
    Tax: 0.2%
    
    output:
    
    {'item': 'A\nDescription: Repair\nNotes: Replaced capacitor', 'qty': 12, 'unitprice': 10.0, 'linetotal': 120.0, 'desc': 'Parts: 1 x cap_a'}
    bosd committed May 25, 2022
    Configuration menu
    Copy the full SHA
    aa2bff4 View commit details
    Browse the repository at this point in the history

Commits on May 29, 2022

  1. Fixup! Flake8

    bosd committed May 29, 2022
    Configuration menu
    Copy the full SHA
    daec273 View commit details
    Browse the repository at this point in the history

Commits on May 30, 2022

  1. Fixup2! Flake8

    bosd committed May 30, 2022
    Configuration menu
    Copy the full SHA
    fbf63cc View commit details
    Browse the repository at this point in the history

Commits on Jun 24, 2022

  1. Configuration menu
    Copy the full SHA
    3036565 View commit details
    Browse the repository at this point in the history

Commits on Jun 28, 2022

  1. Configuration menu
    Copy the full SHA
    0faae0a View commit details
    Browse the repository at this point in the history

Commits on Sep 24, 2022

  1. Add posibility to parse multiple line definitions

    bosd
    
    refactored code to allow multiple lines to be parsed.
    
    Restructuring was needed.
    
    As we want to output the lines in the order of the invoice file.
    
    Independent of the order of the template file.
    
    Example yaml input
    
    lines:
    
     - start: Barcode
    
       end:  Netto totaal
    
       line: (?P<line_note>(FOOD))
    
     - start: Barcode
    
       end:  Netto totaal
    
       line: (?P<description>(.+))\s+(?P<price>\d+\d+)
    
    it is also possible to contentate multi line tags.
    
    alternative example sammymaystone.
    
    lines:
    
     - start: Item\s+Quantity\s+Rate\s+Amount
    
       end:  Subtotal
    
       first_line: 'Service (?P<item>\w)\s+(?P<qty>\S+)\s+.(?P<unitprice>\d+.\d{2})\s+.?(?P<linetotal>\d+.\d{2})'
    
       line: '(?P<item>.*)'
    
       skip_line: ['Pino \w'] # 'Description:', Notes:,
    
       last_line: '(?P<desc>Parts:.*)'
    
       types:
    
         qty: int
    
         unitprice: float
    
         linetotal: float
    
    input:
    
    Service A                                                                 12                      0.00         20.00
    
    Description: Repair
    
    Notes: Replaced capacitor
    
    Parts: 1 x cap_a
    
    Tax: 0.2%
    
    output:
    
    {'item': 'A\nDescription: Repair\nNotes: Replaced capacitor', 'qty': 12, 'unitprice': 10.0, 'linetotal': 120.0, 'desc': 'Parts: 1 x cap_a'}
    bosd committed Sep 24, 2022
    Configuration menu
    Copy the full SHA
    1455833 View commit details
    Browse the repository at this point in the history
  2. Fixup! Flake8

    bosd committed Sep 24, 2022
    Configuration menu
    Copy the full SHA
    1a0d473 View commit details
    Browse the repository at this point in the history
  3. Fixup2! Flake8

    bosd committed Sep 24, 2022
    Configuration menu
    Copy the full SHA
    bfb0410 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    1ba4cab View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    fde98ed View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    2d93234 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    41caefc View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    ad6ee6d View commit details
    Browse the repository at this point in the history

Commits on Sep 25, 2022

  1. Configuration menu
    Copy the full SHA
    436ade8 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    3f29118 View commit details
    Browse the repository at this point in the history