git.iko.soy/typeable/pandoc
on master help sign in
CommonMark writer: correctly ignore LaTeX raw blocks when not raw_tex (#4533)

Issue #4527.

commit13538ce6eb1e8bf60d556bdfe551f75a89c8bf3d authorquasicomputational <quasicomputational@gmail.com> dateThu 5 Apr 2018, 16:53 (9 years ago) parentff3ed5c
2 files changed+22−1
src/Text/Pandoc/Writers/CommonMark.hs+1−1 test/command/4527.md+21
src/Text/Pandoc/Writers/CommonMark.hs+1−1
@@ -116,7 +116,7 @@ blockToNodes _ (CodeBlock (_,classes,_) xs) ns = return
116116blockToNodes opts (RawBlock fmt xs) ns
117117 | fmt == Format "html" && isEnabled Ext_raw_html opts
118118 = return (node (HTML_BLOCK (T.pack xs)) [] : ns)
119− | fmt == Format "latex" || fmt == Format "tex" && isEnabled Ext_raw_tex opts
119+ | (fmt == Format "latex" || fmt == Format "tex") && isEnabled Ext_raw_tex opts
120120 = return (node (CUSTOM_BLOCK (T.pack xs) T.empty) [] : ns)
121121 | otherwise = return ns
122122blockToNodes opts (BlockQuote bs) ns = do
test/command/4527.mdnew file+21
@@ -0,0 +1,21 @@
1+# Raw TeX blocks in CommonMark with and without raw_tex
2+
3+```
4+% pandoc -f latex -t commonmark-raw_tex
5+\someunknowncommand
6+
7+Hello.
8+^D
9+Hello.
10+```
11+
12+```
13+% pandoc -f latex -t commonmark+raw_tex
14+\someunknowncommand
15+
16+Hello.
17+^D
18+\someunknowncommand
19+
20+Hello.
21+```