diff options
-rw-r--r-- | src/Text/Pandoc/Writers/Muse.hs | 9 | ||||
-rw-r--r-- | test/Tests/Writers/Muse.hs | 1 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Writers/Muse.hs b/src/Text/Pandoc/Writers/Muse.hs index ae23a4f9b..c71708e23 100644 --- a/src/Text/Pandoc/Writers/Muse.hs +++ b/src/Text/Pandoc/Writers/Muse.hs @@ -510,9 +510,7 @@ inlineListStartsWithAlnum _ = return False renderInlineList :: PandocMonad m => [Inline] -> Muse m Doc -renderInlineList [] = do - start <- asks envInlineStart - pure $ if start then "<verbatim></verbatim>" else "" +renderInlineList [] = pure "" renderInlineList (x:xs) = do start <- asks envInlineStart afterSpace <- asks envAfterSpace @@ -545,8 +543,11 @@ inlineListToMuse :: PandocMonad m inlineListToMuse lst = do lst' <- normalizeInlineList . fixNotes <$> preprocessInlineList (map (removeKeyValues . replaceSmallCaps) lst) insideAsterisks <- asks envInsideAsterisks + start <- asks envInlineStart modify $ \st -> st { stUseTags = False } -- Previous character is likely a '>' or some other markup - local (\env -> env { envNearAsterisks = insideAsterisks }) $ renderInlineList lst' + if start && null lst' + then pure "<verbatim></verbatim>" + else local (\env -> env { envNearAsterisks = insideAsterisks }) $ renderInlineList lst' inlineListToMuse' :: PandocMonad m => [Inline] -> Muse m Doc inlineListToMuse' lst = do diff --git a/test/Tests/Writers/Muse.hs b/test/Tests/Writers/Muse.hs index 8dacaf89d..7a07f39b7 100644 --- a/test/Tests/Writers/Muse.hs +++ b/test/Tests/Writers/Muse.hs @@ -545,6 +545,7 @@ tests = [ testGroup "block elements" "remove soft break" $ "a" <> softbreak <> "b" =?> ("a b" :: String) , "line break" =: "a" <> linebreak <> "b" =?> "a<br>\nb" + , "line break at the end" =: "a" <> linebreak =?> "a<br>" , "no newline after line break in header" =: header 1 ("a" <> linebreak <> "b") =?> "* a<br>b" , "no softbreak in header" =: header 1 ("a" <> softbreak <> "b") =?> "* a b" ] |