aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <[email protected]>2022-09-09 10:30:01 -0700
committerJohn MacFarlane <[email protected]>2022-09-09 10:30:01 -0700
commit35a3fb7e833c01f0352914a23727dff0145e7304 (patch)
tree1023c3f51ccf035377582783a4b27fb2fa12e4fb
parent47dcb5720e6f3bb334df5fb58b0fbe32c062a4a4 (diff)
Citeproc: Require a digit for an implicit "page" locator...
inside explicit locator syntax `{...}`. Previously a locator specified as `{}` would be rendered as `p.` with nothing after it. Closes #8288.
-rw-r--r--src/Text/Pandoc/Citeproc/Locator.hs6
-rw-r--r--test/command/pandoc-citeproc-locators-delimited.md2
2 files changed, 4 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Citeproc/Locator.hs b/src/Text/Pandoc/Citeproc/Locator.hs
index 35d5388b0..9e5daf0c5 100644
--- a/src/Text/Pandoc/Citeproc/Locator.hs
+++ b/src/Text/Pandoc/Citeproc/Locator.hs
@@ -80,9 +80,9 @@ pLocatorDelimited locMap = try $ do
pLocatorLabelDelimited :: LocatorMap -> LocatorParser (Text, Text, Bool)
pLocatorLabelDelimited locMap
- = pLocatorLabel' locMap lim <|> return ("", "page", True)
- where
- lim = stringify <$> anyToken
+ = pLocatorLabel' locMap (stringify <$> anyToken)
+ <|> (("", "page", True) <$ lookAhead (pMatchChar "digit" isDigit))
+ <|> (pure ("", "", True))
pLocatorIntegrated :: LocatorMap -> LocatorParser LocatorInfo
pLocatorIntegrated locMap = try $ do
diff --git a/test/command/pandoc-citeproc-locators-delimited.md b/test/command/pandoc-citeproc-locators-delimited.md
index 97db169b9..08c58c051 100644
--- a/test/command/pandoc-citeproc-locators-delimited.md
+++ b/test/command/pandoc-citeproc-locators-delimited.md
@@ -100,7 +100,7 @@ Unbalanced curly } ends early[^18]
[^6]: Subsequent, p. {(a)}.
-[^7]: Ibid-with-locator.
+[^7]: Ibid.
[^8]: Ibid 123-35 numbers are suffix.