请输入您要查询的百科知识:

 

词条 Module:Unicode chart
释义 -- This module constructs Unicode tables.

local p = {}

local getArgs = require('Module:Arguments').getArgs

function p._main(args)

local cellpadding = tonumber(args.cellpadding) or 5

local header0 = '{| border="1" cellspacing="0" cellpadding="' .. cellpadding

local titlesize = args.titlesize or "large"

local header1 = '" class="wikitable nounderlines Unicode" style="border-collapse:collapse;background:#FFFFFF;font-size:' .. titlesize

local rowbackground = args.rowbackground or "#F8F8F8"

local header2 = ';text-align:center"\| colspan="17" style="background:' .. rowbackground

local header3 = ';font-size:small" |'

local name = args.name

if type(name) ~= "string" then

error("name must be a string", 1)

end

local headtext

if args.headtext then

headtext = args.headtext

else

if type(args.link) == "string" then

local titleObject = mw.title.new(args.link)

headtext = "" .. args.name .. ""

else

headtext = args.name

end

end

local noterefs = args.noterefs or ""

local header4 = '
[https://www.unicode.org/charts/PDF/U'

-- start must be a number or a decimal string

if not (type(args.start) == "number" or type(args.start) == "string") then

error("start is not a string or a number")

end

local start = tonumber(args.start)

local header5 = '.pdf Official Unicode Consortium chart] (PDF)\|- style="background:'

local header6 = ';font-size:small"\| style="width:'

local firstColumnWidth = args.first_column_width or "45pt"

local header7 = '"  '

local columnWidth = args.column_width or "20pt"

-- do not hardcode the hexadecimal part: generate it here

local hexchars = "0123456789ABCDEF"

local header8 =

for i = 1, 16 do

local c = string.sub(hexchars, i, i)

header8 = header8 .. ' || style="width:' .. columnWidth .. ';" | ' .. c

end

-- Finally, create the header.

local header =

header0 .. header1 .. header2 .. header3

.. name .. noterefs .. header4 .. string.format("%04X", start)

.. header5 .. rowbackground .. header6 .. firstColumnWidth

.. header7 .. header8

-- Use the positional arguments as the names of the characters.

local argnum = 1

local current = start

local body =

while args[argnum] ~= nil do

local row = '|-\| style="background:' .. rowbackground .. ';font-size:small" | '

row = row .. string.format('U+%04Xx\', current / 16)

local nxt = current + 16

while current < nxt do

local prefix = ""

local suffix = ""

local ch = mw.ustring.char(border)

if args[argnum] == "border" then

argnum = argnum + 1

prefix = ''

suffix = ''

end

if args.show_codepoint == false or args.show_codepoint == "false" then

row = row .. mw.ustring.format('| title="%s" | %s&#x%04X;%s\', args[argnum], prefix, current, suffix)

else

row = row .. mw.ustring.format('| title="U+%04X: %s" | %s&#x%04X;%s\', current, args[argnum], prefix, current, suffix)

end

current = current + 1

argnum = argnum + 1

end

body = body .. row

end

-- Make the final return string.

local footer

= '|-\| colspan="17" style="background:' .. rowbackground

.. ";font-size:small\\" | Notes"

.. notes .. "\|}"

end

function p.main(frame)

return p._main(getArgs(frame))

end

return p

随便看

 

开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。

 

Copyright © 2023 OENC.NET All Rights Reserved
京ICP备2021023879号 更新时间:2024/11/11 1:50:29