local p = {} local output_mt = {} function output_mt:insert(str) self.n = self.n + 1 self[self.n] = str end function output_mt:insert_format(...) self:insert(string.format(...)) end output_mt.join = table.concat output_mt.__index = output_mt local function Output() return setmetatable({ n = 0 }, output_mt) end function p.show_modules() local output = Output() output:insert [[ Character name data modules, organized by first three digits of codepoint in hexadecimal base]] for i = -1, 0xF do if i >= 0 then output:insert_format('\! %X', i) else output:insert '\!' end end output:insert '\|-' local prev = -1 local row local found_module = false for i = 0, 0x10F do local first_two_digits = math.floor(i / 0x10) if first_two_digits ~= prev then if found_module then output:insert(row:join()) end found_module = false row = Output{} row:insert_format("\|-\! %02Xx", first_two_digits) prev = first_two_digits end row:insert '\| ' local name_module = ('Module:Unicode data/names/%03X'):format(i) if mw.title.new(name_module).exists then local first_cp = i * 0x1000 row:insert_format("U+%04X– U+%04X", name_module, first_cp, first_cp + 0xFFF) found_module = true end end output:insert "\|}" return output:join() end return p
随便看 |
|
开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。
|