aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers
diff options
context:
space:
mode:
authorMichael Hoffmann <brennan.brisad@gmail.com>2020-07-08 23:37:30 +0200
committerMichael Hoffmann <brennan.brisad@gmail.com>2020-07-08 23:52:28 +0200
commit09ea10e2b1d8c746422e1a05562b37db4c71be55 (patch)
tree51412c1060620e4aeef3e912fe460ce79f374c44 /src/Text/Pandoc/Writers
parent804e8eeed2fbcd0b4a52ad908b8ccccf89563097 (diff)
downloadpandoc-09ea10e2b1d8c746422e1a05562b37db4c71be55.tar.gz
Escape starting periods in ms writer code blocks
If a line of ms code block output starts with a period (.), it should be prepended by '\&' so that it is not interpreted as a roff command. Fixes #6505
Diffstat (limited to 'src/Text/Pandoc/Writers')
-rw-r--r--src/Text/Pandoc/Writers/Ms.hs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/Ms.hs b/src/Text/Pandoc/Writers/Ms.hs
index 81de40045..b6522b352 100644
--- a/src/Text/Pandoc/Writers/Ms.hs
+++ b/src/Text/Pandoc/Writers/Ms.hs
@@ -204,7 +204,9 @@ blockToMs opts (CodeBlock attr str) = do
literal ".IP" $$
literal ".nf" $$
literal "\\f[C]" $$
- hlCode $$
+ ((case T.uncons str of
+ Just ('.',_) -> literal "\\&"
+ _ -> mempty) <> hlCode) $$
literal "\\f[]" $$
literal ".fi"
blockToMs opts (LineBlock ls) = do