eliasp · GitHub

A transaction with a code which contains (…) confuses hledger and it shows the trailing ) as the beginning of the transaction's payee | description.

Given a transaction llike the one below:

2025-09-03=2025-09-03 (DIG. KARTE (ANDROID) ) Nexi Germany GmbH | 2025-09-02T16:20 Debitk.12 2026-12
    foo:bar:account1            -35.16
    blah:blub:account2           35.16

I'd expect this to be parsed as:

{
    "tcode": "DIG. KARTE (ANDROID)",
    "tcomment": "",
    "tdate": "2025-09-03",
    "tdate2": "2025-09-03",
    "tdescription": "Nexi Germany GmbH | 2025-09-02T16:20 Debitk.12 2026-12"
}

…but in reality, it is:

{
    "tcode": "DIG. KARTE (ANDROID",
    "tcomment": "",
    "tdate": "2025-09-03",
    "tdate2": "2025-09-03",
    "tdescription": ") Nexi Germany GmbH | 2025-09-02T16:20 Debitk.12 2026-12"
}

The corresponding broken parsing code is:

codep = option "" $ do
try $ do
skipNonNewlineSpaces1
char '('
code <- takeWhileP Nothing $ \c -> c /= ')' && c /= '\n'
char ')' <?> "closing bracket ')' for transaction code"
pure code

Unfortunately, I lack the required langauge skills to fix this.

$ hledger --version
hledger 1.51.2, linux-x86_64

Read the original on github.com ↗