Module:User:Theknightwho/DUCET
Appearance
- This module sandbox lacks a documentation subpage. Please create it.
- Useful links: root page • root page’s subpages • links • transclusions • testcases • sandbox
local u = mw.ustring.char
local ducet = mw.title.new("User:Theknightwho/Unicode/DUCET"):getContent()
local serial = {}
for line in ducet:gmatch("([^\n]+)%f[%z\n]") do
if not line:find("^@") then
for char in line:gmatch("[^ ]+") do
if char == ";" then
break
else
char = tonumber(char, 16)
table.insert(serial, u(char))
end
end
for type, w1, w2, w3 in line:gmatch("%[([%.%*])(%x+)%.(%x+)%.(%x+)%]") do
if type == "*" then
table.insert(serial, "\253")
else
table.insert(serial, "\254")
end
for _, w in ipairs{w1, w2, w3} do
w = tonumber(w, 16)
table.insert(serial, u(w))
end
end
table.insert(serial, "\255")
end
end
local ret = table.concat(serial)
ret = ret:gsub(".", function(m)
return "\\" .. m:byte()
end)
return ret