git.iko.soy/typeable/pandoc
on master help sign in
Muse reader: require that comment semicolons are in the first column

Fixes #4551

commit6be013914513d2dd8ef7f141b1e3fd59cee7d3f7 authorAlexander Krotov <ilabdsf@gmail.com> dateSun 15 Apr 2018, 12:17 (9 years ago) parent34d8ffb
2 files changed+2
src/Text/Pandoc/Readers/Muse.hs+1 test/Tests/Readers/Muse.hs+1
src/Text/Pandoc/Readers/Muse.hs+1
@@ -348,6 +348,7 @@ blockElements = do
348348-- | Parse a line comment, starting with @;@ in the first column.
349349comment :: PandocMonad m => MuseParser m (F Blocks)
350350comment = try $ do
351+ getPosition >>= \pos -> guard (sourceColumn pos == 1)
351352 char ';'
352353 optional (spaceChar >> many (noneOf "\n"))
353354 eol
test/Tests/Readers/Muse.hs+1
@@ -521,6 +521,7 @@ tests =
521521 , "Text after empty comment" =: ";\nfoo" =?> para "foo" -- Make sure we don't consume newline while looking for whitespace
522522 , "Not a comment (does not start with a semicolon)" =: " ; Not a comment" =?> para (text "; Not a comment")
523523 , "Not a comment (has no space after semicolon)" =: ";Not a comment" =?> para (text ";Not a comment")
524+ , "Not a comment (semicolon not in the first column)" =: " - ; foo" =?> bulletList [para "; foo"]
524525 ]
525526 , testGroup "Headers"
526527 [ "Part" =: