Module:Unicode chart/sandbox: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
 
(14 intermediate revisions by the same user not shown)
Line 95:
 
local function getCategory(codepoint)
-- local category = mCategory.long_names[
-- mUnicode.lookup_category(codepoint.int)
-- ]
local category = mUnicode.lookup_control(codepoint.int)
if category ~= "unassigned" then
Line 144 ⟶ 141:
local function getAliasAbbr(codepoint)
local tbl = getAliasValues(codepoint.int, "abbreviation")
local alias =return tbl[1] or nil
return alias
end
Line 205 ⟶ 201:
end
local function abbrCell(abbr)
cell:addClass("abbr-boxcell")
cell:tag("div"):addClass("abbr-box"):wikitext(abbr)
end
Line 212 ⟶ 208:
local category = getCategory(codepoint)
cell:addClass(category)
cell:addClass(mCategory.long_names[mUnicode.lookup_category(codepoint.int)])
local abbr = getCellAbbr(codepoint, category, args)
Line 222 ⟶ 217:
local unicodeChar = '&#x'.. codepoint.hex .. ';'
unicodeChar = linkChar(unicodeChar, codepoint, args) or unicodeChar
-- if (args['link_sub'] and args['link_sub'][codepoint.int]) then
-- unicodeChar = '[[' .. args['link_sub'][codepoint.int]
-- .. '|' .. unicodeChar .. ']]'
-- elseif args['link'] == "wiki" then
-- local redir = mRedirect.luaMain(unicodeChar, false)
-- --unicodeChar = '[[' .. redir .. '|' .. unicodeChar .. ']]'
-- unicodeChar = expandTemplate('Link if exists', {unicodeChar})
-- elseif args['link'] == "wikt" then
-- unicodeChar = '[[wikt:' .. unicodeChar .. '|' .. unicodeChar .. ']]'
-- end
if args['wrapper'] then
unicodeChar = expandTemplate(args['wrapper'], {unicodeChar})
elseif args['font'] then
cell:css("font-family", "'" .. args['font'] .. "'")
end
if args['suffix'] and args['suffix'][codepoint.int] then
unicodeChar = unicodeChar
.. '&#x' .. args['suffix'][codepoint.int] .. ';'
cell:addClass("modified")
-- end
if args['wrapper'] then
-- unicodeChar = expandTemplate(args['Link if existswrapper'], {unicodeChar})
-- elseif args['linkfont'] == "wiki" then
cell:css("font-family", "'" .. args['font'] .. "'")
--unicodeChar = tostring(
-- mw.html.create("div")
-- :css("font-family", "'" .. args['font'] .. "'")
-- :wikitext(unicodeChar)
--)
end
cell:wikitext(unicodeChar)
Line 273 ⟶ 263:
local row = body:tag("tr")
row:tag("th"):wikitext("U+".. rowHex .. "<i>x</i>")
:attr("rowspan", "2")
for colIndex=0, 15 do
local cell = row:tag("td")
--rowHex .. string.format("%X", colIndex)
createCell(cell,
newCodepoint(rowHexrowIndex*16 .. string.format("%X",+ colIndex)),
args
)
end
local subrow = body:tag("tr")
for colIndex=0, 15 do
subrow:tag("td"):addClass("codepoint")
:wikitext(string.format("%04X", rowIndex*16 + colIndex))
end
end
Line 360 ⟶ 357:
end
end
-- look up block by na,e
if args['blockname'] then
local range = mUnicode.get_block_info(args['blockname'])
Line 370 ⟶ 369:
args
)
-- block given as start and end of range
elseif args['rangestart'] and args['rangeend'] then
return createTable(