CommonMark writer: correctly ignore LaTeX raw blocks when not raw_tex (#4533)

Issue #4527.
This commit is contained in:
quasicomputational 2018-04-05 16:53:42 +01:00 committed by John MacFarlane
parent ff3ed5c9f8
commit 13538ce6eb
2 changed files with 22 additions and 1 deletions

View file

@ -116,7 +116,7 @@ blockToNodes _ (CodeBlock (_,classes,_) xs) ns = return
blockToNodes opts (RawBlock fmt xs) ns
| fmt == Format "html" && isEnabled Ext_raw_html opts
= return (node (HTML_BLOCK (T.pack xs)) [] : ns)
| fmt == Format "latex" || fmt == Format "tex" && isEnabled Ext_raw_tex opts
| (fmt == Format "latex" || fmt == Format "tex") && isEnabled Ext_raw_tex opts
= return (node (CUSTOM_BLOCK (T.pack xs) T.empty) [] : ns)
| otherwise = return ns
blockToNodes opts (BlockQuote bs) ns = do

21
test/command/4527.md Normal file
View file

@ -0,0 +1,21 @@
# Raw TeX blocks in CommonMark with and without raw_tex
```
% pandoc -f latex -t commonmark-raw_tex
\someunknowncommand
Hello.
^D
Hello.
```
```
% pandoc -f latex -t commonmark+raw_tex
\someunknowncommand
Hello.
^D
\someunknowncommand
Hello.
```