diff options
author | John MacFarlane <fiddlosopher@gmail.com> | 2013-01-20 19:21:13 -0800 |
---|---|---|
committer | John MacFarlane <fiddlosopher@gmail.com> | 2013-01-20 19:21:13 -0800 |
commit | 9cc1cf1f4098ad6a22eedeaf8e6d846ce7fbf5c3 (patch) | |
tree | 8fcb570e2871d8fe1a7cd90a438b2a23def4682b | |
parent | 00fe1dba311cab8a317c25986723be6122489dff (diff) | |
download | pandoc-9cc1cf1f4098ad6a22eedeaf8e6d846ce7fbf5c3.tar.gz |
Fixed bug with escaped % in LaTeX reader.
Also added tests. Closes #710.
-rw-r--r-- | src/Text/Pandoc/Readers/LaTeX.hs | 2 | ||||
-rw-r--r-- | tests/latex-reader.latex | 4 | ||||
-rw-r--r-- | tests/latex-reader.native | 4 |
3 files changed, 9 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs index 5362b1b53..05a71bd2b 100644 --- a/src/Text/Pandoc/Readers/LaTeX.hs +++ b/src/Text/Pandoc/Readers/LaTeX.hs @@ -690,6 +690,8 @@ handleIncludes = handleIncludes' [] -- parents parameter prevents infinite include loops handleIncludes' :: [FilePath] -> String -> IO String handleIncludes' _ [] = return [] +handleIncludes' parents ('\\':'%':xs) = + ("\\%"++) `fmap` handleIncludes' parents xs handleIncludes' parents ('%':xs) = handleIncludes' parents $ drop 1 $ dropWhile (/='\n') xs handleIncludes' parents ('\\':xs) = diff --git a/tests/latex-reader.latex b/tests/latex-reader.latex index a1a4909d5..2ebdfed99 100644 --- a/tests/latex-reader.latex +++ b/tests/latex-reader.latex @@ -841,4 +841,8 @@ Notes can go in quotes.\footnote{ In quote. This paragraph should not be part of the note, as it is not indented. +\section{Escaped characters} + +\$ \% \& \# \_ \{ \} + \end{document} diff --git a/tests/latex-reader.native b/tests/latex-reader.native index 014852249..28bbad89c 100644 --- a/tests/latex-reader.native +++ b/tests/latex-reader.native @@ -370,4 +370,6 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA [Para [Str "Notes",Space,Str "can",Space,Str "go",Space,Str "in",Space,Str "quotes.",Note [Para [Str "In",Space,Str "quote."]]]] ,OrderedList (1,Decimal,Period) [[Para [Str "And",Space,Str "in",Space,Str "list",Space,Str "items.",Note [Para [Str "In",Space,Str "list."]]]]] -,Para [Str "This",Space,Str "paragraph",Space,Str "should",Space,Str "not",Space,Str "be",Space,Str "part",Space,Str "of",Space,Str "the",Space,Str "note,",Space,Str "as",Space,Str "it",Space,Str "is",Space,Str "not",Space,Str "indented."]] +,Para [Str "This",Space,Str "paragraph",Space,Str "should",Space,Str "not",Space,Str "be",Space,Str "part",Space,Str "of",Space,Str "the",Space,Str "note,",Space,Str "as",Space,Str "it",Space,Str "is",Space,Str "not",Space,Str "indented."] +,Header 1 ("",[],[]) [Str "Escaped",Space,Str "characters"] +,Para [Str "$",Space,Str "%",Space,Str "&",Space,Str "#",Space,Str "_",Space,Str "{",Space,Str "}"]] |