git.iko.soy/typeable/pandoc
on master help sign in
Muse reader: fix parsing of code at the beginning of paragraph
a516198Alexander Krotov
src/Text/Pandoc/Readers/Muse.hs+2−6
@@ -718,17 +718,13 @@ nbsp = try $ do
718
718
719code :: PandocMonad m => MuseParser m (F Inlines)
719code :: PandocMonad m => MuseParser m (F Inlines)
720code = try $ do
720code = 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 '='
726 contents <- many1Till (noneOf "\n\r" <|> (newline <* notFollowedBy newline)) $ char '='
722 contents <- many1Till (noneOf "\n\r" <|> (newline <* notFollowedBy newline)) $ char '='
727 guard $ not $ null contents
723 guard $ not $ null contents
728 guard $ head contents `notElem` " \t\n"
724 guard $ head contents `notElem` " \t\n"
729 guard $ last contents `notElem` " \t\n"
725 guard $ last contents `notElem` " \t\n"
730 notFollowedBy $ satisfy isLetter
726 notFollowedBy $ satisfy isLetter
731− return $ return (sp B.<> B.code contents)
727+ return $ return $ B.code contents
732
728
733codeTag :: PandocMonad m => MuseParser m (F Inlines)
729codeTag :: PandocMonad m => MuseParser m (F Inlines)
734codeTag = do
730codeTag = do
test/Tests/Readers/Muse.hs+3
@@ -153,6 +153,9 @@ tests =
153 ] =?>
153 ] =?>
154 para "foo =bar" <>
154 para "foo =bar" <>
155 para "baz= foo"
155 para "baz= foo"
156+
157+ , "Code at the beginning of paragraph but not first column" =:
158+ " - =foo=" =?> bulletList [ para $ code "foo" ]
156 ]
159 ]
157
160
158 , "Code tag" =: "<code>foo(bar)</code>" =?> para (code "foo(bar)")
161 , "Code tag" =: "<code>foo(bar)</code>" =?> para (code "foo(bar)")