diff options
| author | John MacFarlane <jgm@berkeley.edu> | 2022-04-01 10:41:33 -0700 |
|---|---|---|
| committer | John MacFarlane <jgm@berkeley.edu> | 2022-04-01 10:41:33 -0700 |
| commit | 1b97846be265588817c74db2ab3d8f8ba82ea82a (patch) | |
| tree | 972dd81057e5653f63ecaffbfc829fa72247db81 /src | |
| parent | 98ff548c5e2da1d32925097739ac66ba80dd6712 (diff) | |
Fix regression with `ascii_identifiers` and Turkish undotted i.
Closes #8003.
Diffstat (limited to 'src')
| -rw-r--r-- | src/Text/Pandoc/Asciify.hs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Asciify.hs b/src/Text/Pandoc/Asciify.hs index 5b84542bf..b7ee6c216 100644 --- a/src/Text/Pandoc/Asciify.hs +++ b/src/Text/Pandoc/Asciify.hs @@ -18,11 +18,15 @@ import Data.Text (Text) import qualified Data.Text as T toAsciiText :: Text -> Text -toAsciiText = T.filter isAscii . TN.normalize (TN.NFD) +toAsciiText = T.filter isAscii . T.map specialCase . TN.normalize (TN.NFD) + where + specialCase '\x131' = 'i' -- Turkish undotted i + specialCase c = c toAsciiChar :: Char -> Maybe Char toAsciiChar c = case T.unpack (TN.normalize TN.NFD (T.singleton c)) of (x:xs) | isAscii x , all isMark xs -> Just x + ['\x131'] -> Just 'i' -- Turkish undotted i _ -> Nothing |
