aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorMichael Thompson <what_is_it_to_do_anything@yahoo.com>2012-03-07 11:35:18 -0500
committerMichael Thompson <what_is_it_to_do_anything@yahoo.com>2012-03-07 11:35:18 -0500
commit698eb059b76376063bb10c86a328c814b3aaa2cf (patch)
tree7d55ad6e63801873e7e5ff1351b40d04aa32e357 /src/Text/Pandoc
parent30cafd913a03fce20c55d065f1cd0cadec55375f (diff)
downloadpandoc-698eb059b76376063bb10c86a328c814b3aaa2cf.tar.gz
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.