git.iko.soy/typeable/pandoc
on master help sign in
LaTeX reader: fix bugs omitting raw tex.
b806bffJohn MacFarlane
src/Text/Pandoc/Readers/LaTeX.hs+7−2
@@ -1644,7 +1644,9 @@ blockCommand = try $ do
1644 let names = ordNub [name', name]
1644 let names = ordNub [name', name]
1645 let rawDefiniteBlock = do
1645 let rawDefiniteBlock = do
1646 guard $ isBlockCommand name
1646 guard $ isBlockCommand name
1647− rawBlock "latex" <$> getRawCommand name (txt <> star)
1647+ rawcontents <- getRawCommand name (txt <> star)
1648+ (guardEnabled Ext_raw_tex >> return (rawBlock "latex" rawcontents))
1649+ <|> ignore rawcontents
1648 -- heuristic: if it could be either block or inline, we
1650 -- heuristic: if it could be either block or inline, we
1649 -- treat it if block if we have a sequence of block
1651 -- treat it if block if we have a sequence of block
1650 -- commands followed by a newline. But we stop if we
1652 -- commands followed by a newline. But we stop if we
@@ -1656,7 +1658,10 @@ blockCommand = try $ do
1656 guard $ "start" `T.isPrefixOf` n
1658 guard $ "start" `T.isPrefixOf` n
1657 let rawMaybeBlock = try $ do
1659 let rawMaybeBlock = try $ do
1658 guard $ not $ isInlineCommand name
1660 guard $ not $ isInlineCommand name
1659− curr <- rawBlock "latex" <$> getRawCommand name (txt <> star)
1661+ rawcontents <- getRawCommand name (txt <> star)
1662+ curr <- (guardEnabled Ext_raw_tex >>
1663+ return (rawBlock "latex" rawcontents))
1664+ <|> ignore rawcontents
1660 rest <- many $ notFollowedBy startCommand *> blockCommand
1665 rest <- many $ notFollowedBy startCommand *> blockCommand
1661 lookAhead $ blankline <|> startCommand
1666 lookAhead $ blankline <|> startCommand
1662 return $ curr <> mconcat rest
1667 return $ curr <> mconcat rest
test/command/3494.md+1−1
@@ -25,7 +25,7 @@
25<td style="text-align: left;">thank you</td>
25<td style="text-align: left;">thank you</td>
26</tr>
26</tr>
27<tr class="odd">
27<tr class="odd">
28−<td style="text-align: right;"><p><em>blah</em></p></td>
28+<td style="text-align: right;"><em>blah</em></td>
29<td style="text-align: left;"><em>blah</em></td>
29<td style="text-align: left;"><em>blah</em></td>
30<td style="text-align: left;"><em>blah</em></td>
30<td style="text-align: left;"><em>blah</em></td>
31</tr>
31</tr>
test/command/3577.md−2
@@ -15,11 +15,9 @@
15 \caption{Subfigure with Subfloat}
15 \caption{Subfigure with Subfloat}
16\end{figure}
16\end{figure}
17^D
17^D
18−
19<figure>
18<figure>
20<img src="img1.jpg" alt="Caption 1" /><figcaption>Caption 1</figcaption>
19<img src="img1.jpg" alt="Caption 1" /><figcaption>Caption 1</figcaption>
21</figure>
20</figure>
22−
23<figure>
21<figure>
24<img src="img2.jpg" alt="Caption 2" /><figcaption>Caption 2</figcaption>
22<img src="img2.jpg" alt="Caption 2" /><figcaption>Caption 2</figcaption>
25</figure>
23</figure>
test/command/3983.md+3−3
@@ -1,5 +1,5 @@
1```
1```
2−pandoc -f latex -t native
2+pandoc -f latex+raw_tex -t native
3\def\filename@area{foo:bar:baz}
3\def\filename@area{foo:bar:baz}
4\makeatletter
4\makeatletter
5\graphicspath\expandafter{\expandafter{\filename@area}}%
5\graphicspath\expandafter{\expandafter{\filename@area}}%
@@ -10,7 +10,7 @@ pandoc -f latex -t native
10```
10```
11
11
12```
12```
13−pandoc -f latex -t native
13+pandoc -f latex+raw_tex -t native
14\makeatletter
14\makeatletter
15 \newcommand\urlfootnote@[1]{\footnote{\url@{#1}}}
15 \newcommand\urlfootnote@[1]{\footnote{\url@{#1}}}
16 \DeclareRobustCommand{\urlfootnote}{\hyper@normalise\urlfootnote@}
16 \DeclareRobustCommand{\urlfootnote}{\hyper@normalise\urlfootnote@}
@@ -21,7 +21,7 @@ pandoc -f latex -t native
21```
21```
22
22
23```
23```
24−pandoc -f latex -t native
24+pandoc -f latex+raw_tex -t native
25\def\foo{bar}
25\def\foo{bar}
26\expandafter\bam\foo
26\expandafter\bam\foo
27^D
27^D
test/command/4527.md+17−2
@@ -1,7 +1,7 @@
1# Raw TeX blocks in CommonMark with and without raw_tex
1# Raw TeX blocks in CommonMark with and without raw_tex
2
2
3```
3```
4−% pandoc -f latex -t commonmark-raw_tex
4+% pandoc -f latex+raw_tex -t commonmark-raw_tex
5\someunknowncommand
5\someunknowncommand
6
6
7Hello.
7Hello.
@@ -10,7 +10,7 @@ Hello.
10```
10```
11
11
12```
12```
13−% pandoc -f latex -t commonmark+raw_tex
13+% pandoc -f latex+raw_tex -t commonmark+raw_tex
14\someunknowncommand
14\someunknowncommand
15
15
16Hello.
16Hello.
@@ -19,3 +19,18 @@ Hello.
19
19
20Hello.
20Hello.
21```
21```
22+
23+```
24+% pandoc -f latex -t native
25+\maketitle
26+^D
27+[]
28+```
29+
30+```
31+% pandoc -f latex -t rst
32+\maketitle
33+Hello.
34+^D
35+Hello.
36+```