aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2010-11-18 14:16:18 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2010-11-18 14:16:18 -0800
commit6390103509caba5930c8ac45d31364b244607547 (patch)
tree062f45d312266e8bfef966b6df69bb7c94813dee
parentbbb60a2586f29785fd9ba592770bc2f7842deba4 (diff)
downloadpandoc-6390103509caba5930c8ac45d31364b244607547.tar.gz
Markdown citation parser: small refactoring for clarity.
-rw-r--r--src/Text/Pandoc/Readers/Markdown.hs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs
index 851cf25e7..d59f8a71a 100644
--- a/src/Text/Pandoc/Readers/Markdown.hs
+++ b/src/Text/Pandoc/Readers/Markdown.hs
@@ -1325,6 +1325,10 @@ blankSpace = try $ do
guard $ length res > 0
guard $ length (filter (=='\n') res) <= 1
+noneOfUnlessEscaped :: [Char] -> GenParser Char st Char
+noneOfUnlessEscaped cs =
+ try (char '\\' >> oneOf cs) <|> noneOf cs
+
textualCite :: GenParser Char ParserState [Citation]
textualCite = try $ do
(_, key) <- citeKey
@@ -1382,7 +1386,7 @@ locator = try $ do
locatorWord :: GenParser Char st String
locatorWord = try $ do
spnl
- wd <- many1 $ (try $ char '\\' >> oneOf "];, \t\n") <|> noneOf "];, \t\n"
+ wd <- many1 $ noneOfUnlessEscaped "];, \t\n"
guard $ any isDigit wd
return wd