aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2021-11-10 08:52:04 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2021-11-10 08:52:04 -0800
commit6fb2973a582116cd515c6f7e68794cca22955511 (patch)
treefffb8dee5375909c43e0b3e575fd87a6a26b3438
parent03f9a0c61eddff1d34537d767bd91cf395eae500 (diff)
downloadpandoc-6fb2973a582116cd515c6f7e68794cca22955511.tar.gz
Fix parsing of `%` in bibtex fields.
Closes #7678 (a bug introduced by 0a45f26).
-rw-r--r--src/Text/Pandoc/Citeproc/BibTeX.hs9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/Text/Pandoc/Citeproc/BibTeX.hs b/src/Text/Pandoc/Citeproc/BibTeX.hs
index 66bb9bbe3..a8e5622ed 100644
--- a/src/Text/Pandoc/Citeproc/BibTeX.hs
+++ b/src/Text/Pandoc/Citeproc/BibTeX.hs
@@ -844,11 +844,10 @@ inBraces :: BibParser Text
inBraces = do
char '{'
res <- manyTill
- ( take1WhileP (\c -> c /= '{' && c /= '}' && c /= '\\' && c /= '%')
- <|> (char '\\' >> ( (char '{' >> return "\\{")
- <|> (char '}' >> return "\\}")
- <|> return "\\"))
- <|> ("" <$ (char '%' >> anyLine))
+ ( take1WhileP (\c -> c /= '{' && c /= '}' && c /= '\\')
+ <|> (char '\\' >> (do c <- oneOf "{}"
+ return $ T.pack ['\\',c])
+ <|> return "\\")
<|> (braced <$> inBraces)
) (char '}')
return $ T.concat res