summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2016-12-05 00:50:17 +0100
committerJohn MacFarlane <jgm@berkeley.edu>2016-12-05 00:50:17 +0100
commit41627ed62c57d9e51a89352bc843d8265f1bc83f (patch)
treedff99ae2007e3835087d6a8ad3819a38d65ddb7e /src
parent33b4bc837196582956d8bd5538b6676be6a0f8e9 (diff)
Man writer: Ensure that periods are escaped at beginning of line.
Closes #3270.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Writers/Man.hs6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Writers/Man.hs b/src/Text/Pandoc/Writers/Man.hs
index 3dd89f17e..98b08b08b 100644
--- a/src/Text/Pandoc/Writers/Man.hs
+++ b/src/Text/Pandoc/Writers/Man.hs
@@ -300,10 +300,6 @@ blockListToMan opts blocks =
-- | Convert list of Pandoc inline elements to man.
inlineListToMan :: WriterOptions -> [Inline] -> State WriterState Doc
--- if list starts with ., insert a zero-width character \& so it
--- won't be interpreted as markup if it falls at the beginning of a line.
-inlineListToMan opts lst@(Str ('.':_) : _) = mapM (inlineToMan opts) lst >>=
- (return . (text "\\&" <>) . hcat)
inlineListToMan opts lst = mapM (inlineToMan opts) lst >>= (return . hcat)
-- | Convert Pandoc inline element to man.
@@ -335,6 +331,8 @@ inlineToMan opts (Cite _ lst) =
inlineListToMan opts lst
inlineToMan _ (Code _ str) =
return $ text $ "\\f[C]" ++ escapeCode str ++ "\\f[]"
+inlineToMan _ (Str str@('.':_)) =
+ return $ afterBreak "\\&" <> text (escapeString str)
inlineToMan _ (Str str) = return $ text $ escapeString str
inlineToMan opts (Math InlineMath str) =
inlineListToMan opts $ texMathToInlines InlineMath str