aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2021-02-20 22:14:31 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2021-02-20 22:14:31 -0800
commitcec541e54cd947c8032f9148db18104cd1a48783 (patch)
treed1c20801fdc8c295fb2ac14389e4a565c9ac180f /src/Text/Pandoc/Readers
parent31b8f60ea82d96b370cf4a765c46c18004ff6fa8 (diff)
downloadpandoc-cec541e54cd947c8032f9148db18104cd1a48783.tar.gz
LaTeX reader: Another small improvement to macro handling.
Diffstat (limited to 'src/Text/Pandoc/Readers')
-rw-r--r--src/Text/Pandoc/Readers/LaTeX/Parsing.hs7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Readers/LaTeX/Parsing.hs b/src/Text/Pandoc/Readers/LaTeX/Parsing.hs
index fc8542894..953747d2f 100644
--- a/src/Text/Pandoc/Readers/LaTeX/Parsing.hs
+++ b/src/Text/Pandoc/Readers/LaTeX/Parsing.hs
@@ -461,16 +461,15 @@ doMacros' n inp = do
case inp of
Tok spos (CtrlSeq "begin") _ : Tok _ Symbol "{" :
Tok _ Word name : Tok _ Symbol "}" : ts
- -> handleMacros macros n spos name ts
+ -> handleMacros macros n spos name ts <|> return inp
Tok spos (CtrlSeq "end") _ : Tok _ Symbol "{" :
Tok _ Word name : Tok _ Symbol "}" : ts
- -> handleMacros macros n spos ("end" <> name) ts
+ -> handleMacros macros n spos ("end" <> name) ts <|> return inp
Tok _ (CtrlSeq "expandafter") _ : t : ts
-> combineTok t <$> doMacros' n ts
Tok spos (CtrlSeq name) _ : ts
- -> handleMacros macros n spos name ts
+ -> handleMacros macros n spos name ts <|> return inp
_ -> return inp
- <|> return inp
where
combineTok (Tok spos (CtrlSeq name) x) (Tok _ Word w : ts)