diff --git a/MANUAL.markdown b/MANUAL.markdown index a39f89bb7..c4f03521c 100644 --- a/MANUAL.markdown +++ b/MANUAL.markdown @@ -932,6 +932,10 @@ need to make small edits to restore compatibility for one or the other. hledger does not allow separate dates for individual postings, unlike c++ ledger. +Likewise, hledger does not support per-posting cleared status. It does +ignore a cleared flag (`*`) at the start of a posting, so that the account +name is parsed correctly. + #### Features not supported c++ ledger features not currently supported include: modifier and periodic diff --git a/hledger-lib/Hledger/Read/JournalReader.hs b/hledger-lib/Hledger/Read/JournalReader.hs index 2fd3aa73a..5606ff204 100644 --- a/hledger-lib/Hledger/Read/JournalReader.hs +++ b/hledger-lib/Hledger/Read/JournalReader.hs @@ -388,7 +388,7 @@ ledgereffectivedate actualdate = do return edate ledgerstatus :: GenParser Char JournalContext Bool -ledgerstatus = try (do { many1 spacenonewline; char '*' "status"; return True } ) <|> return False +ledgerstatus = try (do { many spacenonewline; char '*' "status"; return True } ) <|> return False ledgercode :: GenParser Char JournalContext String ledgercode = try (do { many1 spacenonewline; char '(' "code"; code <- anyChar `manyTill` char ')'; return code } ) <|> return "" @@ -442,6 +442,7 @@ ledgerposting :: GenParser Char JournalContext Posting ledgerposting = do many1 spacenonewline status <- ledgerstatus + many spacenonewline account <- transactionaccountname let (ptype, account') = (postingTypeFromAccountName account, unbracket account) amount <- postingamount diff --git a/tests/cleared-marker.test b/tests/cleared-marker.test new file mode 100644 index 000000000..32e427758 --- /dev/null +++ b/tests/cleared-marker.test @@ -0,0 +1,55 @@ +# report cleared transactions only +# +bin/hledger -f- print --cleared +<<< +2010/1/1 x + a 1 + b + +2010/1/2 * x + a 1 + b + +2010/1/3 * + a 1 + b +>>> +2010/01/02 * x + a 1 + b -1 + +2010/01/03 * + a 1 + b -1 + +# report uncleared transactions only +bin/hledger -f- print --uncleared +<<< +2010/1/1 x + a 1 + b + +2010/1/2 * x + a 1 + b + +2010/1/3 * + a 1 + b +>>> +2010/01/01 x + a 1 + b -1 + +# we don't yet support cleared postings, except we should ignore the marker when parsing them +bin/hledger -f- balance --no-total +<<< +2010/1/1 + a 1 + *a 2 + * a 4 + b + +>>> + 7 a + -7 b