From 939f7184c9e7b3c57a9f15d0941c9deae4ca16b1 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Wed, 7 Oct 2015 16:41:49 -0700 Subject: [PATCH] journal: make "end comment" optional, like ledger The "comment" directive longer requires an "end comment", and will extend to the end of the file(s) without it. --- doc/manual.md | 5 ++--- hledger-lib/Hledger/Read/JournalReader.hs | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/doc/manual.md b/doc/manual.md index 57122312d..04c90993a 100644 --- a/doc/manual.md +++ b/doc/manual.md @@ -530,9 +530,8 @@ Lines in the journal beginning with a semicolon (`;`) or hash (`#`) or asterisk (`*`) are comments, and will be ignored. (Asterisk comments make it easy to treat your journal like an org-mode outline in emacs.) -Also, anything between -[`comment` and `end comment` directives](#multi-line-comments) is a -(multi-line) comment. +Also, anything between [`comment` and `end comment` directives](#multi-line-comments) is a (multi-line) comment. +If there is no `end comment`, the comment extends to the end of the file. You can attach comments to a transaction by writing them after the description and/or indented on the following lines (before the diff --git a/hledger-lib/Hledger/Read/JournalReader.hs b/hledger-lib/Hledger/Read/JournalReader.hs index edebc7741..ec3861c57 100644 --- a/hledger-lib/Hledger/Read/JournalReader.hs +++ b/hledger-lib/Hledger/Read/JournalReader.hs @@ -995,7 +995,7 @@ multilinecommentp = do string "comment" >> many spacenonewline >> newline go where - go = try (string "end comment" >> newline >> return ()) + go = try (eof <|> (string "end comment" >> newline >> return ())) <|> (anyLine >> go) anyLine = anyChar `manyTill` newline