LaTeX reader: handle escaped & inside table cell.

Closes #3708.
This commit is contained in:
John MacFarlane 2017-05-29 22:45:49 +02:00
parent 230a1b89e8
commit 5ec384eb60
2 changed files with 20 additions and 3 deletions

View file

@ -1494,9 +1494,11 @@ parseTableRow :: PandocMonad m
-> [String] -- ^ suffixes
-> LP m [Blocks]
parseTableRow cols prefixes suffixes = try $ do
let tableCellRaw = many (notFollowedBy
(amp <|> lbreak <|>
(() <$ try (string "\\end"))) >> anyChar)
let tableCellRaw = concat <$> many
(do notFollowedBy (amp <|> lbreak <|> (() <$ try (string "\\end")))
many1 (noneOf "&%\n\r\\")
<|> try (string "\\&")
<|> count 1 anyChar)
let minipage = try $ controlSeq "begin" *> string "{minipage}" *>
env "minipage"
(skipopts *> spaces' *> optional braced *> spaces' *> blocks)

15
test/command/3708.md Normal file
View file

@ -0,0 +1,15 @@
```
% pandoc -f latex -t native
\begin{tabular}{cc}
A & B\&1 \\
C & D
\end{tabular}
^D
[Table [] [AlignCenter,AlignCenter] [0.0,0.0]
[[]
,[]]
[[[Plain [Str "A"]]
,[Plain [Str "B&1"]]]
,[[Plain [Str "C"]]
,[Plain [Str "D"]]]]]
```