diff options
-rw-r--r-- | src/Text/Pandoc/Writers/Muse.hs | 13 | ||||
-rw-r--r-- | test/Tests/Writers/Muse.hs | 9 |
2 files changed, 16 insertions, 6 deletions
diff --git a/src/Text/Pandoc/Writers/Muse.hs b/src/Text/Pandoc/Writers/Muse.hs index 4e7ce377a..d1e407026 100644 --- a/src/Text/Pandoc/Writers/Muse.hs +++ b/src/Text/Pandoc/Writers/Muse.hs @@ -101,7 +101,7 @@ writeMuse opts document = , envInsideBlock = False , envInlineStart = True , envInsideLinkDescription = False - , envAfterSpace = True + , envAfterSpace = False , envOneLine = False } @@ -223,7 +223,7 @@ blockToMuse (DefinitionList items) = do => ([Inline], [[Block]]) -> Muse m Doc definitionListItemToMuse (label, defs) = do - label' <- local (\env -> env { envOneLine = True }) $ inlineListToMuse' label + label' <- local (\env -> env { envOneLine = True, envAfterSpace = True }) $ inlineListToMuse' label contents <- vcat <$> mapM descriptionToMuse defs let ind = offset label' return $ hang ind label' contents @@ -439,14 +439,15 @@ renderInlineList (x:xs) = do -- | Normalize and convert list of Pandoc inline elements to Muse. inlineListToMuse'' :: PandocMonad m - => Bool - -> [Inline] - -> Muse m Doc + => Bool + -> [Inline] + -> Muse m Doc inlineListToMuse'' start lst = do lst' <- (normalizeInlineList . fixNotes) <$> preprocessInlineList (map (removeKeyValues . replaceSmallCaps) lst) topLevel <- asks envTopLevel + afterSpace <- asks envAfterSpace local (\env -> env { envInlineStart = start - , envAfterSpace = start && not topLevel + , envAfterSpace = afterSpace || (start && not topLevel) }) $ renderInlineList lst' inlineListToMuse' :: PandocMonad m => [Inline] -> Muse m Doc diff --git a/test/Tests/Writers/Muse.hs b/test/Tests/Writers/Muse.hs index 44fdd5b7e..ff66d1d65 100644 --- a/test/Tests/Writers/Muse.hs +++ b/test/Tests/Writers/Muse.hs @@ -121,6 +121,15 @@ tests = [ testGroup "block elements" , " <verbatim></verbatim> foo :: second description" , " <verbatim></verbatim> > bar :: third description" ] + , "definition list terms starting with list markers" =: + definitionList [ (text "first definition", [plain $ text "first description"]) + , (str "-", [plain $ text "second description"]) + , (str "1.", [plain $ text "third description"]) + ] + =?> unlines [ " first definition :: first description" + , " <verbatim></verbatim>- :: second description" + , " <verbatim></verbatim>1. :: third description" + ] ] -- Test that lists of the same type and style are separated with two blanklines , testGroup "sequential lists" |