Skip to content

Commit

Permalink
Muse reader: parse empty comments correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Krotov committed Dec 19, 2017
1 parent c0cc927 commit f6abf15
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/Text/Pandoc/Readers/Muse.hs
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,7 @@ blockElements = choice [ comment
comment :: PandocMonad m => MuseParser m (F Blocks)
comment = try $ do
char ';'
space
many $ noneOf "\n"
optionMaybe (spaceChar >> (many $ noneOf "\n"))
eol
return mempty

Expand Down
2 changes: 2 additions & 0 deletions test/Tests/Readers/Muse.hs
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,8 @@ tests =
, testGroup "Comments"
[ "Comment tag" =: "<comment>\nThis is a comment\n</comment>" =?> (mempty::Blocks)
, "Line comment" =: "; Comment" =?> (mempty::Blocks)
, "Empty comment" =: ";" =?> (mempty::Blocks)
, "Text after empty comment" =: ";\nfoo" =?> para "foo" -- Make sure we don't consume newline while looking for whitespace
, "Not a comment (does not start with a semicolon)" =: " ; Not a comment" =?> para (text "; Not a comment")
, "Not a comment (has no space after semicolon)" =: ";Not a comment" =?> para (text ";Not a comment")
]
Expand Down

0 comments on commit f6abf15

Please sign in to comment.