diff options
author | John MacFarlane <jgm@berkeley.edu> | 2019-10-11 10:00:09 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2019-10-11 10:00:33 -0700 |
commit | 9e3e195dd45f298e3d0a66ef36a4e5763256c98f (patch) | |
tree | 467df855de7e83450f88139f68291138644b9af6 /src/Text/Pandoc | |
parent | 7c2dd0359b8ece3df91af81338274008c0740a69 (diff) | |
download | pandoc-9e3e195dd45f298e3d0a66ef36a4e5763256c98f.tar.gz |
Fix `gfm_auto_identifiers` behavior with emojis.
Closes #5813.
Note that we also now use emoji names for emojis
when `ascii_identifiers` is enabled.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r-- | src/Text/Pandoc/Shared.hs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Shared.hs b/src/Text/Pandoc/Shared.hs index 4ce5ba1d0..bcaa48ea1 100644 --- a/src/Text/Pandoc/Shared.hs +++ b/src/Text/Pandoc/Shared.hs @@ -463,8 +463,15 @@ isPara _ = False -- letters, digits, and the characters _-. inlineListToIdentifier :: Extensions -> [Inline] -> String inlineListToIdentifier exts = - dropNonLetter . filterAscii . toIdent . stringify + dropNonLetter . filterAscii . toIdent . stringify . walk unEmojify where + unEmojify :: [Inline] -> [Inline] + unEmojify + | extensionEnabled Ext_gfm_auto_identifiers exts || + extensionEnabled Ext_ascii_identifiers exts = walk unEmoji + | otherwise = id + unEmoji (Span ("",["emoji"],[("data-emoji",ename)]) _) = Str ename + unEmoji x = x dropNonLetter | extensionEnabled Ext_gfm_auto_identifiers exts = id | otherwise = dropWhile (not . isAlpha) |