Module:Unicode chart/sandbox: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
Line 15:
-- General settings
-------------------
local charForm = '&#x%s;'
local pdfLink = "[https://www.unicode.org/charts/PDF/%s.pdf"
.. " Official Unicode Consortium code chart] (PDF)"
Line 84 ⟶ 83:
-- Sundry small functions
-------------------------
local function splitColonList(strList)
local tab = {}
local abbs = mw.text.split(strList, '[;\n\t]')
for _,v in pairs(abbs) do
local tmp = mw.text.split(v, ':')
for _,v in pairs(tmp) do
if tmp[1] and tmp[2] then
tab[fromHex(tmp[1])] = mw.text.trim(tmp[2])
end
end
end
return tab
end
 
local function expandTemplate(template, argslist)
return frame:expandTemplate{
Line 198 ⟶ 211:
cell:css("font-family", "'" .. args['font'] .. "'")
end
if args['suffix'][codepoint.int] then
unicodeChar = unicodeChar
.. string'&#x' ..format(charForm, args['suffix'][codepoint.int]) .. ';'
end
cell:wikitext(unicodeChar)
Line 309 ⟶ 323:
-- Main
---------------------
 
local function splitColonList(strList)
local tab = {}
local str = ""
local abbs = mw.text.split(strList, '[;\n\t]')
for _,v in pairs(abbs) do
local tmp = mw.text.split(v, ':')
str = str .. '['
local tmp = mw.text.split(v, ':')
for _,v in pairs(tmp) do
if tmp[1] and tmp[2] then
tab[fromHex(tmp[1])] = mw.text.trim(tmp[2])
str = str .. '(' .. fromHex(tmp[1]) .. ':' .. tmp[2] .. ')'
end
end
str = str .. ']'
end
return tab
end
 
function p.main(frameArg)
frame = frameArg