aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorAlexander Krotov <ilabdsf@gmail.com>2018-04-16 11:40:18 +0300
committerAlexander Krotov <ilabdsf@gmail.com>2018-04-16 11:40:18 +0300
commitf39931fd6c86a4bf7a651f9e2f5667bfad99bcca (patch)
treec56545b122cd66c52b76c7a313b777eb89a5acc7 /src/Text/Pandoc
parent8ca012f139d09d77a878e049cf9972efc026674e (diff)
downloadpandoc-f39931fd6c86a4bf7a651f9e2f5667bfad99bcca.tar.gz
Muse writer: escape definition list terms starting with list markers
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Writers/Muse.hs13
1 files changed, 7 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