summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/mkiv/char-ini.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/mkiv/char-ini.lua')
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/char-ini.lua25
1 files changed, 23 insertions, 2 deletions
diff --git a/Master/texmf-dist/tex/context/base/mkiv/char-ini.lua b/Master/texmf-dist/tex/context/base/mkiv/char-ini.lua
index a9ea52ccece..3cebeabd946 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/char-ini.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/char-ini.lua
@@ -14,7 +14,7 @@ if not modules then modules = { } end modules ['char-ini'] = {
local utfchar, utfbyte, utfvalues, ustring, utotable = utf.char, utf.byte, utf.values, utf.ustring, utf.totable
local concat, unpack, tohash, insert = table.concat, table.unpack, table.tohash, table.insert
local next, tonumber, type, rawget, rawset = next, tonumber, type, rawget, rawset
-local format, lower, gsub = string.format, string.lower, string.gsub
+local format, lower, gsub, find = string.format, string.lower, string.gsub, string.find
local P, R, S, Cs = lpeg.P, lpeg.R, lpeg.S, lpeg.Cs
if not characters then require("char-def") end
@@ -942,6 +942,7 @@ end)
local specialchars = allocate() characters.specialchars = specialchars -- lazy table
local descriptions = allocate() characters.descriptions = descriptions -- lazy table
+local synonyms = allocate() characters.synonyms = synonyms -- lazy table
setmetatableindex(specialchars, function(t,u)
if u then
@@ -975,7 +976,9 @@ setmetatableindex(descriptions, function(t,k)
for u, c in next, data do
local d = c.description
if d then
- d = gsub(d," ","")
+ if find(d," ") then
+ d = gsub(d," ","")
+ end
d = lower(d)
t[d] = u
end
@@ -987,6 +990,24 @@ setmetatableindex(descriptions, function(t,k)
return d
end)
+setmetatableindex(synonyms, function(t,k)
+ for u, c in next, data do
+ local s = c.synonyms
+ if s then
+ if find(s," ") then
+ s = gsub(s," ","")
+ end
+ -- s = lower(s) -- is already lowercase
+ t[s] = u
+ end
+ end
+ local s = rawget(t,k)
+ if not s then
+ t[s] = s
+ end
+ return s
+end)
+
function characters.unicodechar(asked)
local n = tonumber(asked)
if n then