diff options
Diffstat (limited to 'src/Text/Pandoc/Readers')
-rw-r--r-- | src/Text/Pandoc/Readers/LaTeX.hs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs index f02d7a564..70a913a1b 100644 --- a/src/Text/Pandoc/Readers/LaTeX.hs +++ b/src/Text/Pandoc/Readers/LaTeX.hs @@ -120,7 +120,8 @@ anyEnvironment = try $ do -- | Process LaTeX preamble, extracting metadata. processLaTeXPreamble :: GenParser Char ParserState () processLaTeXPreamble = - skipMany $ notFollowedBy' anyEnvironment >> block + skipMany $ choice [ bibliographic, unknownCommand, + commentBlock, skipToken ] -- | Parse LaTeX and return 'Pandoc'. parseLaTeX :: GenParser Char ParserState Pandoc @@ -156,7 +157,9 @@ block = choice [ hrule , itemBlock , unknownEnvironment , ignore - , unknownCommand ] <?> "block" + , unknownCommand + , skipToken + ] <?> "block" -- -- header blocks @@ -435,6 +438,9 @@ unknownCommand = try $ do commandsToIgnore :: [String] commandsToIgnore = ["special","pdfannot","pdfstringdef","bibliography"] +skipToken :: GenParser Char ParserState Block +skipToken = satisfy (/='\\') >> spaces >> return Null + commentBlock :: GenParser Char st Block commentBlock = comment >> return Null |