From 41627ed62c57d9e51a89352bc843d8265f1bc83f Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Mon, 5 Dec 2016 00:50:17 +0100 Subject: Man writer: Ensure that periods are escaped at beginning of line. Closes #3270. --- src/Text/Pandoc/Writers/Man.hs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/Text/Pandoc') 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 -- cgit v1.2.3