git.iko.soy/typeable/pandoc
on master help sign in
CommonMark writer: correctly ignore LaTeX raw blocks when not raw_tex (#4533)
13538cequasicomputational
src/Text/Pandoc/Writers/CommonMark.hs+1−1
@@ -116,7 +116,7 @@ blockToNodes _ (CodeBlock (_,classes,_) xs) ns = return
116blockToNodes opts (RawBlock fmt xs) ns
116blockToNodes opts (RawBlock fmt xs) ns
117 | fmt == Format "html" && isEnabled Ext_raw_html opts
117 | fmt == Format "html" && isEnabled Ext_raw_html opts
118 = return (node (HTML_BLOCK (T.pack xs)) [] : ns)
118 = 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
120 = return (node (CUSTOM_BLOCK (T.pack xs) T.empty) [] : ns)
120 = return (node (CUSTOM_BLOCK (T.pack xs) T.empty) [] : ns)
121 | otherwise = return ns
121 | otherwise = return ns
122blockToNodes opts (BlockQuote bs) ns = do
122blockToNodes 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+```