aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers
diff options
context:
space:
mode:
authorAlexander Krotov <ilabdsf@gmail.com>2018-08-31 18:51:16 +0300
committerAlexander Krotov <ilabdsf@gmail.com>2018-08-31 18:51:16 +0300
commit3ddb7c9d3e337bf692c6328ca6466f3b1930e6c3 (patch)
treed10fe03e512a9c7ed444145f88ea044612a8e2fa /src/Text/Pandoc/Writers
parent56685e8735e62af2855ae5703a10829979f32a46 (diff)
downloadpandoc-3ddb7c9d3e337bf692c6328ca6466f3b1930e6c3.tar.gz
Muse writer: simplify inline list rendering
Diffstat (limited to 'src/Text/Pandoc/Writers')
-rw-r--r--src/Text/Pandoc/Writers/Muse.hs27
1 files changed, 12 insertions, 15 deletions
diff --git a/src/Text/Pandoc/Writers/Muse.hs b/src/Text/Pandoc/Writers/Muse.hs
index 3681fcc0d..123ca94e4 100644
--- a/src/Text/Pandoc/Writers/Muse.hs
+++ b/src/Text/Pandoc/Writers/Muse.hs
@@ -424,7 +424,7 @@ renderInlineList (x:xs) = do
start <- asks envInlineStart
afterSpace <- asks envAfterSpace
topLevel <- asks envTopLevel
- r <- inlineToMuse x
+ r <- local (\env -> env { envInlineStart = False }) $ inlineToMuse x
opts <- asks envOptions
let isNewline = (x == SoftBreak && writerWrapText opts == WrapPreserve) || x == LineBreak
lst' <- local (\env -> env { envInlineStart = isNewline
@@ -435,23 +435,20 @@ renderInlineList (x:xs) = do
else pure (r <> lst')
-- | Normalize and convert list of Pandoc inline elements to Muse.
-inlineListToMuse'' :: PandocMonad m
- => Bool
- -> [Inline]
- -> Muse m Doc
-inlineListToMuse'' start lst = do
+inlineListToMuse :: PandocMonad m
+ => [Inline]
+ -> Muse m Doc
+inlineListToMuse lst = do
lst' <- (normalizeInlineList . fixNotes) <$> preprocessInlineList (map (removeKeyValues . replaceSmallCaps) lst)
- topLevel <- asks envTopLevel
- afterSpace <- asks envAfterSpace
- local (\env -> env { envInlineStart = start
- , envAfterSpace = afterSpace || (start && not topLevel)
- }) $ renderInlineList lst'
+ renderInlineList lst'
inlineListToMuse' :: PandocMonad m => [Inline] -> Muse m Doc
-inlineListToMuse' = inlineListToMuse'' True
-
-inlineListToMuse :: PandocMonad m => [Inline] -> Muse m Doc
-inlineListToMuse = inlineListToMuse'' False
+inlineListToMuse' lst = do
+ topLevel <- asks envTopLevel
+ afterSpace <- asks envAfterSpace
+ local (\env -> env { envInlineStart = True
+ , envAfterSpace = afterSpace || not topLevel
+ }) $ inlineListToMuse lst
-- | Convert Pandoc inline element to Muse.
inlineToMuse :: PandocMonad m