git.iko.soy/typeable/pandoc
on master help sign in
Muse reader: fix parsing of code at the beginning of paragraph
commita516198d47bcc31e72e56e04bde976d9178142aa authorAlexander Krotov <ilabdsf@gmail.com> dateThu 18 Jan 2018, 15:35 (9 years ago) parent5f57094
2 files changed+5−6
src/Text/Pandoc/Readers/Muse.hs+2−6 test/Tests/Readers/Muse.hs+3
src/Text/Pandoc/Readers/Muse.hs+2−6
@@ -718,17 +718,13 @@ nbsp = try $ do
718718
719719code :: PandocMonad m => MuseParser m (F Inlines)
720720code = try $ do
721− pos <- getPosition
722− sp <- if sourceColumn pos == 1
723− then pure mempty
724− else skipMany1 spaceChar >> pure B.space
725− char '='
721+ atStart $ char '='
726722 contents <- many1Till (noneOf "\n\r" <|> (newline <* notFollowedBy newline)) $ char '='
727723 guard $ not $ null contents
728724 guard $ head contents `notElem` " \t\n"
729725 guard $ last contents `notElem` " \t\n"
730726 notFollowedBy $ satisfy isLetter
731− return $ return (sp B.<> B.code contents)
727+ return $ return $ B.code contents
732728
733729codeTag :: PandocMonad m => MuseParser m (F Inlines)
734730codeTag = do
test/Tests/Readers/Muse.hs+3
@@ -153,6 +153,9 @@ tests =
153153 ] =?>
154154 para "foo =bar" <>
155155 para "baz= foo"
156+
157+ , "Code at the beginning of paragraph but not first column" =:
158+ " - =foo=" =?> bulletList [ para $ code "foo" ]
156159 ]
157160
158161 , "Code tag" =: "<code>foo(bar)</code>" =?> para (code "foo(bar)")