From 3ac6f72f988da20af7d460868fc1971b3ea63758 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Tue, 14 Dec 2010 19:34:28 -0800 Subject: Fixed preamble parsing in LaTeX reader. --- src/Text/Pandoc/Readers/LaTeX.hs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/Text/Pandoc') 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 -- cgit v1.2.3