diff options
author | John MacFarlane <jgm@berkeley.edu> | 2021-05-27 10:49:45 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2021-05-27 10:49:45 -0700 |
commit | cbe16b2866abd8d0e4c15f027562b4b2bed3f01e (patch) | |
tree | 64db92ea488edcc5949e57657b0c8c91f4a92bcb /src/Text/Pandoc/Citeproc | |
parent | 834da53058069fe50da510fa86e0807a7ff7868f (diff) | |
download | pandoc-cbe16b2866abd8d0e4c15f027562b4b2bed3f01e.tar.gz |
Citeproc: Don't detect math elements as locators.
Closes #7321.
Diffstat (limited to 'src/Text/Pandoc/Citeproc')
-rw-r--r-- | src/Text/Pandoc/Citeproc/Locator.hs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/Text/Pandoc/Citeproc/Locator.hs b/src/Text/Pandoc/Citeproc/Locator.hs index 44416ca12..dbedc08d9 100644 --- a/src/Text/Pandoc/Citeproc/Locator.hs +++ b/src/Text/Pandoc/Citeproc/Locator.hs @@ -181,6 +181,7 @@ pPageUnit = roman <|> plainUnit plainUnit = do ts <- many1 (notFollowedBy pSpace >> notFollowedBy pLocatorPunct >> + notFollowedBy pMath >> anyToken) let s = stringify ts -- otherwise look for actual digits or -s @@ -211,6 +212,12 @@ pMatchChar msg f = satisfyTok f' <?> msg pSpace :: LocatorParser Inline pSpace = satisfyTok (\t -> isSpacey t || t == Str "\160") <?> "space" +pMath :: LocatorParser Inline +pMath = satisfyTok isMath + where + isMath (Math{}) = True + isMath _ = False + satisfyTok :: (Inline -> Bool) -> LocatorParser Inline satisfyTok f = tokenPrim show (\sp _ _ -> sp) (\tok -> if f tok then Just tok |