diff options
author | Michael Hoffmann <brennan.brisad@gmail.com> | 2020-07-08 23:37:30 +0200 |
---|---|---|
committer | Michael Hoffmann <brennan.brisad@gmail.com> | 2020-07-08 23:52:28 +0200 |
commit | 09ea10e2b1d8c746422e1a05562b37db4c71be55 (patch) | |
tree | 51412c1060620e4aeef3e912fe460ce79f374c44 /test/Tests | |
parent | 804e8eeed2fbcd0b4a52ad908b8ccccf89563097 (diff) | |
download | pandoc-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 'test/Tests')
-rw-r--r-- | test/Tests/Writers/Ms.hs | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/test/Tests/Writers/Ms.hs b/test/Tests/Writers/Ms.hs new file mode 100644 index 000000000..d73603314 --- /dev/null +++ b/test/Tests/Writers/Ms.hs @@ -0,0 +1,37 @@ +{-# LANGUAGE NoImplicitPrelude #-} +{-# LANGUAGE OverloadedStrings #-} +module Tests.Writers.Ms (tests) where + +import Prelude +import Test.Tasty +import Tests.Helpers +import Text.Pandoc +import Text.Pandoc.Builder + +infix 4 =: +(=:) :: (ToString a, ToPandoc a) + => String -> (a, String) -> TestTree +(=:) = test (purely (writeMs def . toPandoc)) + +tests :: [TestTree] +tests = [ testGroup "code blocks" + [ "basic" + =: codeBlock "hello" + =?> unlines + [ ".IP" + , ".nf" + , "\\f[C]" + , "hello" + , "\\f[]" + , ".fi"] + , "escape starting ." + =: codeBlock ". hello" + =?> unlines + [ ".IP" + , ".nf" + , "\\f[C]" + , "\\&. hello" + , "\\f[]" + , ".fi"] + ] + ] |