journal, csv: comment lines can also start with *

As in Ledger. This means you can embed emacs org/outline-mode nodes in
your journal file and manipulate it like an outline.
This commit is contained in:
Simon Michael 2014-12-27 14:35:05 -08:00
parent a719cb8f6e
commit 9c68944c79
3 changed files with 8 additions and 3 deletions

View File

@ -383,7 +383,9 @@ P 2010/1/1 € $1.40
#### Comments
- A semicolon (`;`) or hash (`#`) in column 0 starts a journal comment line, which hledger will ignore.
- A semicolon (`;`) or hash (`#`) or asterisk (`*`) in column 0 starts
a journal comment line, which hledger will ignore. (Asterisk allows you
to embed emacs org/outline-mode nodes and treat your journal like an outline.)
- A semicolon after a transaction's description and/or indented on the following lines
starts a transaction comment.

View File

@ -410,7 +410,7 @@ commentline :: Stream [Char] m t => ParsecT [Char] CsvRules m ()
commentline = many spacenonewline >> commentchar >> restofline >> return () <?> "comment line"
commentchar :: Stream [Char] m t => ParsecT [Char] CsvRules m Char
commentchar = oneOf ";#"
commentchar = oneOf ";#*"
directive :: Stream [Char] m t => ParsecT [Char] CsvRules m (DirectiveName, String)
directive = do

View File

@ -905,7 +905,10 @@ followingcommentp =
return $ unlines $ samelinecomment:newlinecomments
comment :: Stream [Char] m Char => ParsecT [Char] JournalContext m String
comment = commentStartingWith "#;"
comment = commentStartingWith commentchars
commentchars :: [Char]
commentchars = "#;*"
semicoloncomment :: Stream [Char] m Char => ParsecT [Char] JournalContext m String
semicoloncomment = commentStartingWith ";"