don't treat comments as part of ledger transaction descriptions
This commit is contained in:
parent
eb3ec063d0
commit
69ce8b9a8e
@ -311,10 +311,7 @@ ledgerTransaction = do
|
|||||||
date <- ledgerdate <?> "entry"
|
date <- ledgerdate <?> "entry"
|
||||||
status <- ledgerstatus
|
status <- ledgerstatus
|
||||||
code <- ledgercode
|
code <- ledgercode
|
||||||
-- ledger treats entry comments as part of the description, we will too
|
description <- liftM rstrip (many1 (noneOf ";\n") <?> "description")
|
||||||
-- desc <- many (noneOf ";\n") <?> "description"
|
|
||||||
-- let description = reverse $ dropWhile (==' ') $ reverse desc
|
|
||||||
description <- many1 (noneOf "\n") <?> "description"
|
|
||||||
comment <- ledgercomment
|
comment <- ledgercomment
|
||||||
restofline
|
restofline
|
||||||
postings <- ledgerpostings
|
postings <- ledgerpostings
|
||||||
|
|||||||
3
Tests.hs
3
Tests.hs
@ -564,6 +564,9 @@ tests = [
|
|||||||
$ isLeft $ parseWithCtx ledgerTransaction "2009/1/1\n"
|
$ isLeft $ parseWithCtx ledgerTransaction "2009/1/1\n"
|
||||||
assertBool "ledgerTransaction should require some postings"
|
assertBool "ledgerTransaction should require some postings"
|
||||||
$ isLeft $ parseWithCtx ledgerTransaction "2009/1/1 a\n"
|
$ isLeft $ parseWithCtx ledgerTransaction "2009/1/1 a\n"
|
||||||
|
let t = parseWithCtx ledgerTransaction "2009/1/1 a ;comment\n b 1\n"
|
||||||
|
assertBool "ledgerTransaction should not include a comment in the description"
|
||||||
|
$ either (const False) ((== "a") . ltdescription) p
|
||||||
|
|
||||||
,"ledgerHistoricalPrice" ~: do
|
,"ledgerHistoricalPrice" ~: do
|
||||||
parseWithCtx ledgerHistoricalPrice price1_str `parseis` price1
|
parseWithCtx ledgerHistoricalPrice price1_str `parseis` price1
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user