aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers/ConTeXt.hs
diff options
context:
space:
mode:
authorickc <ickc@users.noreply.github.com>2016-05-09 19:24:40 -0700
committerickc <ickc@users.noreply.github.com>2016-05-09 19:24:40 -0700
commit0ae60a91535a8f55f3061f36fdb3a54f6ddda85d (patch)
treef0c74ae411967ed5f67bd8b0bdf175ee5ca964ab /src/Text/Pandoc/Writers/ConTeXt.hs
parent846fa8704618e7e544313f5b3b627ccb6e65b550 (diff)
parentf7601297f0ff184a59efdc3ea279137fc6012eef (diff)
downloadpandoc-0ae60a91535a8f55f3061f36fdb3a54f6ddda85d.tar.gz
Merge pull request #1 from jgm/master
Merge from jgm's master
Diffstat (limited to 'src/Text/Pandoc/Writers/ConTeXt.hs')
-rw-r--r--src/Text/Pandoc/Writers/ConTeXt.hs12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/ConTeXt.hs b/src/Text/Pandoc/Writers/ConTeXt.hs
index 498e2d10f..8d54d62bd 100644
--- a/src/Text/Pandoc/Writers/ConTeXt.hs
+++ b/src/Text/Pandoc/Writers/ConTeXt.hs
@@ -279,7 +279,17 @@ blockListToConTeXt lst = liftM vcat $ mapM blockToConTeXt lst
-- | Convert list of inline elements to ConTeXt.
inlineListToConTeXt :: [Inline] -- ^ Inlines to convert
-> State WriterState Doc
-inlineListToConTeXt lst = liftM hcat $ mapM inlineToConTeXt lst
+inlineListToConTeXt lst = liftM hcat $ mapM inlineToConTeXt $ addStruts lst
+ -- We add a \strut after a line break that precedes a space,
+ -- or the space gets swallowed
+ where addStruts (LineBreak : s : xs) | isSpacey s =
+ LineBreak : RawInline (Format "context") "\\strut " : s :
+ addStruts xs
+ addStruts (x:xs) = x : addStruts xs
+ addStruts [] = []
+ isSpacey Space = True
+ isSpacey (Str ('\160':_)) = True
+ isSpacey _ = False
-- | Convert inline element to ConTeXt
inlineToConTeXt :: Inline -- ^ Inline to convert