don't treat comments as part of ledger transaction descriptions

This commit is contained in:
Simon Michael 2009-04-10 05:37:26 +00:00
parent eb3ec063d0
commit 69ce8b9a8e
2 changed files with 4 additions and 4 deletions

View File

@ -311,10 +311,7 @@ ledgerTransaction = do
date <- ledgerdate <?> "entry"
status <- ledgerstatus
code <- ledgercode
-- ledger treats entry comments as part of the description, we will too
-- desc <- many (noneOf ";\n") <?> "description"
-- let description = reverse $ dropWhile (==' ') $ reverse desc
description <- many1 (noneOf "\n") <?> "description"
description <- liftM rstrip (many1 (noneOf ";\n") <?> "description")
comment <- ledgercomment
restofline
postings <- ledgerpostings

View File

@ -564,6 +564,9 @@ tests = [
$ isLeft $ parseWithCtx ledgerTransaction "2009/1/1\n"
assertBool "ledgerTransaction should require some postings"
$ 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
parseWithCtx ledgerHistoricalPrice price1_str `parseis` price1