git.iko.soy/typeable/pandoc
on master help sign in
Fixed bug with escaped % in LaTeX reader.

Also added tests. Closes #710.

commit9cc1cf1f4098ad6a22eedeaf8e6d846ce7fbf5c3 authorJohn MacFarlane <fiddlosopher@gmail.com> dateSun 20 Jan 2013, 19:21 (14 years ago) parent00fe1db
3 files changed+9−1
src/Text/Pandoc/Readers/LaTeX.hs+2 tests/latex-reader.latex+4 tests/latex-reader.native+3−1
src/Text/Pandoc/Readers/LaTeX.hs+2
@@ -690,6 +690,8 @@ handleIncludes = handleIncludes' []
690690-- parents parameter prevents infinite include loops
691691handleIncludes' :: [FilePath] -> String -> IO String
692692handleIncludes' _ [] = return []
693+handleIncludes' parents ('\\':'%':xs) =
694+ ("\\%"++) `fmap` handleIncludes' parents xs
693695handleIncludes' parents ('%':xs) = handleIncludes' parents
694696 $ drop 1 $ dropWhile (/='\n') xs
695697handleIncludes' parents ('\\':xs) =
tests/latex-reader.latex+4
@@ -841,4 +841,8 @@ Notes can go in quotes.\footnote{ In quote.
841841This paragraph should not be part of the note, as it is not
842842indented.
843843
844+\section{Escaped characters}
845+
846+\$ \% \& \# \_ \{ \}
847+
844848\end{document}
tests/latex-reader.native+3−1
@@ -370,4 +370,6 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA
370370 [Para [Str "Notes",Space,Str "can",Space,Str "go",Space,Str "in",Space,Str "quotes.",Note [Para [Str "In",Space,Str "quote."]]]]
371371,OrderedList (1,Decimal,Period)
372372 [[Para [Str "And",Space,Str "in",Space,Str "list",Space,Str "items.",Note [Para [Str "In",Space,Str "list."]]]]]
373−,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."]]
373+,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."]
374+,Header 1 ("",[],[]) [Str "Escaped",Space,Str "characters"]
375+,Para [Str "$",Space,Str "%",Space,Str "&",Space,Str "#",Space,Str "_",Space,Str "{",Space,Str "}"]]