aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2021-03-07 15:49:02 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2021-03-07 15:49:02 -0800
commit5aa73bd0a2820a0c89b5990dbe53abfdd5ade32d (patch)
tree8d1fb9a0de3a76540223b9fe2178a8d4d12a1f75 /src/Text/Pandoc
parent75d4bca8628347e15d477a803b8459efcd61314f (diff)
downloadpandoc-5aa73bd0a2820a0c89b5990dbe53abfdd5ade32d.tar.gz
LaTeX reader: handle table cells containing `&` in `\verb`.
Closes #7129.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Readers/LaTeX/Table.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/LaTeX/Table.hs b/src/Text/Pandoc/Readers/LaTeX/Table.hs
index 2ea9caf58..7833da081 100644
--- a/src/Text/Pandoc/Readers/LaTeX/Table.hs
+++ b/src/Text/Pandoc/Readers/LaTeX/Table.hs
@@ -134,6 +134,11 @@ parseTableRow :: PandocMonad m
-> LP m Row
parseTableRow blocks inline envname prefsufs = do
notFollowedBy (spaces *> end_ envname)
+ -- contexts that can contain & that is not colsep:
+ let canContainAmp (Tok _ (CtrlSeq "begin") _) = True
+ canContainAmp (Tok _ (CtrlSeq "verb") _) = True
+ canContainAmp (Tok _ (CtrlSeq "Verb") _) = True
+ canContainAmp _ = False
-- add prefixes and suffixes in token stream:
let celltoks (pref, suff) = do
prefpos <- getPosition
@@ -142,7 +147,7 @@ parseTableRow blocks inline envname prefsufs = do
((lookAhead (controlSeq "parbox") >>
void blocks) -- #5711
<|>
- (lookAhead (controlSeq "begin") >> void inline)
+ (lookAhead (satisfyTok canContainAmp) >> void inline)
<|>
(lookAhead (symbol '$') >> void inline))
<|>