invoice2data icon indicating copy to clipboard operation
invoice2data copied to clipboard

plugins: lines: add support for sets of regexes to legacy syntax

Open rmilecki opened this issue 3 years ago • 1 comments

If someone insists on using the old syntax for the "lines" plugin this
change will allow using multiple sets of parsing rules.

Example:
lines:
    - start: Item\s+Discount\s+Price$
    end: \s+Total
    line: (?P<description>.+)\s+(?P<discount>\d+.\d+)\s+(?P<price>\d+\d+)
    - start: Item\s+Price$
    end: \s+Total
    line: (?P<description>.+)\s+(?P<price>\d+\d+)

rmilecki avatar Sep 25 '22 10:09 rmilecki

This change depends on the https://github.com/invoice-x/invoice2data/pull/407

Personally I'd rather against extending the old syntax. That one will always have some limitations and I think we should encourage people to move to the new (parser-based) YAML syntax.

It seems @bosd however prefers the old syntax (see https://github.com/invoice-x/invoice2data/pull/378 discusson) so I prepared this pull request to discuss / consider.

rmilecki avatar Sep 25 '22 10:09 rmilecki

This was a draft to show how next rules syntax can be adapted to the old lines syntax. For now https://github.com/invoice-x/invoice2data/pull/407 got closed, so I'm closing this one too. I'm planning to get back working on rules later.

rmilecki avatar Feb 03 '23 23:02 rmilecki