diff options
author | Alexander Krotov <ilabdsf@gmail.com> | 2018-01-18 15:35:43 +0300 |
---|---|---|
committer | Alexander Krotov <ilabdsf@gmail.com> | 2018-01-18 15:35:43 +0300 |
commit | a516198d47bcc31e72e56e04bde976d9178142aa (patch) | |
tree | a0acc3492b4ce79cdbf8e78e3da49015ddc0e206 | |
parent | 5f57094a47c18d1849f7cd5e9306bf05d6187881 (diff) | |
download | pandoc-a516198d47bcc31e72e56e04bde976d9178142aa.tar.gz |
Muse reader: fix parsing of code at the beginning of paragraph
-rw-r--r-- | src/Text/Pandoc/Readers/Muse.hs | 8 | ||||
-rw-r--r-- | test/Tests/Readers/Muse.hs | 3 |
2 files changed, 5 insertions, 6 deletions
diff --git a/src/Text/Pandoc/Readers/Muse.hs b/src/Text/Pandoc/Readers/Muse.hs index b06b6e550..d378fe676 100644 --- a/src/Text/Pandoc/Readers/Muse.hs +++ b/src/Text/Pandoc/Readers/Muse.hs @@ -718,17 +718,13 @@ nbsp = try $ do code :: PandocMonad m => MuseParser m (F Inlines) code = try $ do - pos <- getPosition - sp <- if sourceColumn pos == 1 - then pure mempty - else skipMany1 spaceChar >> pure B.space - char '=' + atStart $ char '=' contents <- many1Till (noneOf "\n\r" <|> (newline <* notFollowedBy newline)) $ char '=' guard $ not $ null contents guard $ head contents `notElem` " \t\n" guard $ last contents `notElem` " \t\n" notFollowedBy $ satisfy isLetter - return $ return (sp B.<> B.code contents) + return $ return $ B.code contents codeTag :: PandocMonad m => MuseParser m (F Inlines) codeTag = do diff --git a/test/Tests/Readers/Muse.hs b/test/Tests/Readers/Muse.hs index 948df2ac2..edbb3b290 100644 --- a/test/Tests/Readers/Muse.hs +++ b/test/Tests/Readers/Muse.hs @@ -153,6 +153,9 @@ tests = ] =?> para "foo =bar" <> para "baz= foo" + + , "Code at the beginning of paragraph but not first column" =: + " - =foo=" =?> bulletList [ para $ code "foo" ] ] , "Code tag" =: "<code>foo(bar)</code>" =?> para (code "foo(bar)") |