aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2012-03-07 10:50:08 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2012-03-07 10:50:08 -0800
commit45aed516285d171a1d4113c4095e91dbb78eac60 (patch)
tree31aab082c399aad08ff41634137f97f53e446376 /src/Text/Pandoc
parent8a8d4a8abc4e24de814d4c610c8160033462694c (diff)
parent698eb059b76376063bb10c86a328c814b3aaa2cf (diff)
downloadpandoc-45aed516285d171a1d4113c4095e91dbb78eac60.tar.gz
Merge pull request #437 from michaelt/patch-1
escape initial dot in code lines
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Writers/Man.hs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/Man.hs b/src/Text/Pandoc/Writers/Man.hs
index d3735efa7..a0ac16b85 100644
--- a/src/Text/Pandoc/Writers/Man.hs
+++ b/src/Text/Pandoc/Writers/Man.hs
@@ -112,7 +112,11 @@ escapeString = escapeStringUsing manEscapes
-- | Escape a literal (code) section for Man.
escapeCode :: String -> String
-escapeCode = escapeStringUsing (manEscapes ++ backslashEscapes "\t ")
+escapeCode = concat . intersperse "\n" . map escapeLine . lines where
+ escapeLine codeline =
+ case escapeStringUsing (manEscapes ++ backslashEscapes "\t ") codeline of
+ a@('.':_) -> "\\&" ++ a
+ b -> b
-- We split inline lists into sentences, and print one sentence per
-- line. groff/troff treats the line-ending period differently.