git.iko.soy/typeable/pandoc
on master help sign in
LaTeX reader: another small efficiency improvement.
commitcc543cf5b64cccc91ad6a1a455831b8c3f6d80b2 authorJohn MacFarlane <jgm@berkeley.edu> dateSun 28 Feb 2021, 14:34 (6 years ago) parentf6cf038
1 file changed+12−6
src/Text/Pandoc/Readers/LaTeX.hs+12−6
src/Text/Pandoc/Readers/LaTeX.hs+12−6
@@ -1855,12 +1855,18 @@ orderedList' = try $ do
18551855
18561856block :: PandocMonad m => LP m Blocks
18571857block = do
1858− res <- (mempty <$ spaces1)
1859− <|> environment
1860− <|> macroDef (rawBlock "latex")
1861− <|> blockCommand
1862− <|> paragraph
1863− <|> grouped block
1858+ Tok _ toktype _ <- lookAhead anyTok
1859+ res <- (case toktype of
1860+ Newline -> mempty <$ spaces1
1861+ Spaces -> mempty <$ spaces1
1862+ Comment -> mempty <$ spaces1
1863+ Word -> paragraph
1864+ CtrlSeq "begin" -> environment
1865+ CtrlSeq _ -> macroDef (rawBlock "latex")
1866+ <|> blockCommand
1867+ _ -> mzero)
1868+ <|> paragraph
1869+ <|> grouped block
18641870 trace (T.take 60 $ tshow $ B.toList res)
18651871 return res
18661872