summaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-03-08 19:06:32 +0100
committerJohn MacFarlane <jgm@berkeley.edu>2017-03-08 19:06:32 +0100
commitfd35661646b87c4960f6c610de06c891c78e9aab (patch)
treed2c9206b186b534c497f38f27af4c9fb04e89b86 /src/Text/Pandoc
parentc91f168fc93f22b8c281fb2933052ff6da63d47b (diff)
Remove space at beginning/end of RST code span.
Otherwise we get invalid RST. There seems to be no way to escape the space. Closes #3496.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Writers/RST.hs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/RST.hs b/src/Text/Pandoc/Writers/RST.hs
index f1de2ab0e..2657afa2a 100644
--- a/src/Text/Pandoc/Writers/RST.hs
+++ b/src/Text/Pandoc/Writers/RST.hs
@@ -459,7 +459,10 @@ inlineToRST (Quoted DoubleQuote lst) = do
else return $ "“" <> contents <> "”"
inlineToRST (Cite _ lst) =
inlineListToRST lst
-inlineToRST (Code _ str) = return $ "``" <> text str <> "``"
+inlineToRST (Code _ str) =
+ -- we trim the string because the delimiters must adjoin a
+ -- non-space character; see #3496
+ return $ "``" <> text (trim str) <> "``"
inlineToRST (Str str) = do
opts <- gets stOptions
return $ text $