diff options
| author | John MacFarlane <[email protected]> | 2022-01-08 16:54:00 -0800 |
|---|---|---|
| committer | John MacFarlane <[email protected]> | 2022-01-08 16:57:59 -0800 |
| commit | 2b51f54e19373381df7f71f3094f97cc79dd82d2 (patch) | |
| tree | d47f15f5ab5b52de5793a2f935381fcc1616b710 | |
| parent | 268bec1808958f96d860e2bbb8718ece29f0ed1e (diff) | |
toLocatorMap: store keys as lowercase.
We want to do a case-insensitive comparison when parsing
locators, so that e.g. both `Chap.` and `chap.` work.
Previously we lowercase terms when doing the lookup,
but they weren't lowercased in the map itself, which
led to locator-detection breaking for German (where the
terms have uppercase letters).
See
https://groups.google.com/d/msgid/pandoc-discuss/1dd44886-7b79-4e5f-97ec-57b91113df36n%40googlegroups.com
| -rw-r--r-- | src/Text/Pandoc/Citeproc/Locator.hs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Citeproc/Locator.hs b/src/Text/Pandoc/Citeproc/Locator.hs index 0b8f79922..35d5388b0 100644 --- a/src/Text/Pandoc/Citeproc/Locator.hs +++ b/src/Text/Pandoc/Citeproc/Locator.hs @@ -276,7 +276,9 @@ toLocatorMap locale = go tname locmap = case M.lookup tname (localeTerms locale) of Nothing -> locmap - Just ts -> foldr (\x -> M.insert (snd x) tname) locmap ts + Just ts -> foldr (\x -> M.insert (T.toCaseFold $ snd x) tname) locmap ts +-- we store keys in "case-folded" (lowercase) form, so that both +-- "Chap." and "chap." will match, for example. locatorTerms :: [Text] locatorTerms = |
