Fix regression with ascii_identifiers and Turkish undotted i.

Closes #8003.
This commit is contained in:
John MacFarlane 2022-04-01 10:41:33 -07:00
parent 98ff548c5e
commit 1b97846be2
2 changed files with 11 additions and 1 deletions

View file

@ -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

6
test/command/8003.md Normal file
View file

@ -0,0 +1,6 @@
```
% pandoc -f markdown+ascii_identifiers
# Işık
^D
<h1 id="isik">ık</h1>
```