diff options
-rw-r--r-- | src/Tests/Readers/LaTeX.hs | 9 | ||||
-rw-r--r-- | src/Text/Pandoc/Readers/LaTeX.hs | 4 |
2 files changed, 11 insertions, 2 deletions
diff --git a/src/Tests/Readers/LaTeX.hs b/src/Tests/Readers/LaTeX.hs index 7ea4c73ee..6d28441f8 100644 --- a/src/Tests/Readers/LaTeX.hs +++ b/src/Tests/Readers/LaTeX.hs @@ -41,6 +41,15 @@ tests = [ testGroup "basic" header 1 ("text" +++ space +++ link "/url" "" "link") ] + , testGroup "space and comments" + [ "blank lines + space at beginning" =: + "\n \n hi" =?> para "hi" + , "blank lines + space + comments" =: + "% my comment\n\n \n % another\n\nhi" =?> para "hi" + , "comment in paragraph" =: + "hi % this is a comment\nthere\n" =?> para "hi there" + ] + , testGroup "citations" [ natbibCitations , biblatexCitations diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs index 83b74a489..dca745b56 100644 --- a/src/Text/Pandoc/Readers/LaTeX.hs +++ b/src/Text/Pandoc/Readers/LaTeX.hs @@ -136,8 +136,8 @@ processLaTeXPreamble = do -- | Parse LaTeX and return 'Pandoc'. parseLaTeX :: GenParser Char ParserState Pandoc parseLaTeX = do - skipMany $ spaces >> comment spaces + skipMany $ comment >> spaces blocks <- try (processLaTeXPreamble >> environment "document") <|> (many block >>~ (spaces >> eof)) state <- getState @@ -528,7 +528,7 @@ skipChar = do return Null commentBlock :: GenParser Char st Block -commentBlock = comment >> return Null +commentBlock = many1 (comment >> spaces) >> return Null -- -- inline |