diff options
author | John MacFarlane <jgm@berkeley.edu> | 2021-02-28 14:34:04 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2021-02-28 14:34:04 -0800 |
commit | cc543cf5b64cccc91ad6a1a455831b8c3f6d80b2 (patch) | |
tree | fa21ee68fa23d34ea7f8ba7134054a5b1dc12c1c /src/Text | |
parent | f6cf03857b59776f4f44ea831787231f7f93da96 (diff) | |
download | pandoc-cc543cf5b64cccc91ad6a1a455831b8c3f6d80b2.tar.gz |
LaTeX reader: another small efficiency improvement.
Diffstat (limited to 'src/Text')
-rw-r--r-- | src/Text/Pandoc/Readers/LaTeX.hs | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs index 4956b90cb..4062e8a53 100644 --- a/src/Text/Pandoc/Readers/LaTeX.hs +++ b/src/Text/Pandoc/Readers/LaTeX.hs @@ -1855,12 +1855,18 @@ orderedList' = try $ do block :: PandocMonad m => LP m Blocks block = do - res <- (mempty <$ spaces1) - <|> environment - <|> macroDef (rawBlock "latex") - <|> blockCommand - <|> paragraph - <|> grouped block + Tok _ toktype _ <- lookAhead anyTok + res <- (case toktype of + Newline -> mempty <$ spaces1 + Spaces -> mempty <$ spaces1 + Comment -> mempty <$ spaces1 + Word -> paragraph + CtrlSeq "begin" -> environment + CtrlSeq _ -> macroDef (rawBlock "latex") + <|> blockCommand + _ -> mzero) + <|> paragraph + <|> grouped block trace (T.take 60 $ tshow $ B.toList res) return res |