Fixed bug with escaped % in LaTeX reader.

Also added tests.  Closes #710.
This commit is contained in:
John MacFarlane 2013-01-20 19:21:13 -08:00
parent 00fe1dba31
commit 9cc1cf1f40
3 changed files with 9 additions and 1 deletions

View file

@ -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) =

View file

@ -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}

View file

@ -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 "}"]]