Fixed preamble parsing in LaTeX reader.
This commit is contained in:
parent
34d30efc5c
commit
3ac6f72f98
1 changed files with 8 additions and 2 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue