Muse reader: require that comment semicolons are in the first column
Fixes #4551
This commit is contained in:
parent
34d8ffbcfc
commit
6be0139145
2 changed files with 2 additions and 0 deletions
|
@ -348,6 +348,7 @@ blockElements = do
|
||||||
-- | Parse a line comment, starting with @;@ in the first column.
|
-- | Parse a line comment, starting with @;@ in the first column.
|
||||||
comment :: PandocMonad m => MuseParser m (F Blocks)
|
comment :: PandocMonad m => MuseParser m (F Blocks)
|
||||||
comment = try $ do
|
comment = try $ do
|
||||||
|
getPosition >>= \pos -> guard (sourceColumn pos == 1)
|
||||||
char ';'
|
char ';'
|
||||||
optional (spaceChar >> many (noneOf "\n"))
|
optional (spaceChar >> many (noneOf "\n"))
|
||||||
eol
|
eol
|
||||||
|
|
|
@ -521,6 +521,7 @@ tests =
|
||||||
, "Text after empty comment" =: ";\nfoo" =?> para "foo" -- Make sure we don't consume newline while looking for whitespace
|
, "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 (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")
|
, "Not a comment (has no space after semicolon)" =: ";Not a comment" =?> para (text ";Not a comment")
|
||||||
|
, "Not a comment (semicolon not in the first column)" =: " - ; foo" =?> bulletList [para "; foo"]
|
||||||
]
|
]
|
||||||
, testGroup "Headers"
|
, testGroup "Headers"
|
||||||
[ "Part" =:
|
[ "Part" =:
|
||||||
|
|
Loading…
Add table
Reference in a new issue