Módulo:zh-han
La documentación para este módulo puede ser creada en Módulo:zh-han/doc
local export = {}
local radicals = {
"一","丨","丶","丿","乙","亅",
"二","亠","人","儿","入","八","冂","冖","冫","几","凵","刀","力","勹","匕","匚","匸","十","卜","卩","厂","厶","又",
"口","囗","土","士","夂","夊","夕","大","女","子","宀","寸","小","尢","尸","屮","山","巛","工","己","巾","干","幺","广","廴","廾","弋","弓","彐","彡","彳",
"心","戈","戶","手","支","攴","文","斗","斤","方","无","日","曰","月","木","欠","止","歹","殳","毋","比","毛","氏","气","水","火","爪","父","爻","爿","片","牙","牛","犬",
"玄","玉","瓜","瓦","甘","生","用","田","疋","疒","癶","白","皮","皿","目","矛","矢","石","示","禸","禾","穴","立",
"竹","米","糸","缶","网","羊","羽","老","而","耒","耳","聿","肉","臣","自","至","臼","舌","舛","舟","艮","色","艸","虍","虫","血","行","衣","襾",
"見","角","言","谷","豆","豕","豸","貝","赤","走","足","身","車","辛","辰","辵","邑","酉","釆","里",
"金","長","門","阜","隶","隹","雨","靑","非",
"面","革","韋","韭","音","頁","風","飛","食","首","香",
"馬","骨","高","髟","鬥","鬯","鬲","鬼",
"魚","鳥","鹵","鹿","麥","麻",
"黃","黍","黑","黹",
"黽","鼎","鼓","鼠",
"鼻","齊",
"齒",
"龍","龜",
"龠"
}
local simplified_radical = {
['讠']='言',['门']='門',['饣']='食',['飞']='飛',['马']='馬',['见']='見',['贝']='貝',['纟']='糸',['车']='車',['长']='長',['韦']='韋',['风']='風',['钅']='金',['鸟']='鳥',['竜']='龍',['龙']='龍',['页']='頁',['斉']='齊',['齐']='齊',['麦']='麥',['亀']='龜',['龟']='龜',['鱼']='魚',['黾']='黽',['鼡']='鼠',['歯']='齒',['齿']='齒',['卤']='鹵',['𬺞']='龜',['丬']='爿',
}
function export.mostrar(frame)
--local title = frame:getParent():getTitle() es el título de la plantilla no el de la página
local title = mw.title.getCurrentTitle().fullText
local kangxi
local text = { insert = table.insert }
local p = mw.title.new(title.."-bw.png", 6)
if p and p.fileExists then
text:insert("[[File:"..title.."-bw.png|500px|thumb|Orden de los trazos]]")
end
if mw.ustring.len(title) == 1 then
local clave = mw.ustring.codepoint(title)
local ruta = 'Módulo:zh-han/datos/'..string.format("%06X",clave):sub(1,3)
local m = mw.loadData(ruta)
kangxi = m[clave]
else
local m = mw.loadData('Módulo:zh-han/datos/compuestos')
kangxi = m[title]
end
assert(kangxi, "El carácter no se encuentra en la base de datos")
assert(radicals[kangxi[2]] == (simplified_radical[kangxi[1]] or kangxi[1]), "Radical number (rn) and radical (rad) do not match")
text:insert("Carácter Han.\n")
if kangxi.head then
text:insert(":*'''Título: '''"..frame:extensionTag("ref", "Si el título de la página no coincide con la imagen es debido a imposibilidades técnicas.").."\n")
end
text:insert(":*'''Radical Kangxi:''' "..kangxi[1].."\n")
text:insert(":*'''Número de radical:''' "..tostring(kangxi[2]).."\n")
text:insert(":*'''Trazos adicionales:''' "..tostring(kangxi.as))
if kangxi.asj then
text:insert(" (chino), " .. tostring(kangxi.asj) .. " (japonés)")
elseif kangxi.asc then
text:insert(" (chino tradicional), " .. tostring(kangxi.asc) .. " (chino simplificado)")
elseif kangxi.ask then
text:insert(" (chino), " .. tostring(kangxi.ask) .. " (coreano)")
elseif kangxi.asjk then
text:insert(" (chino), " .. tostring(kangxi.asjk) .. " (japonés y coreano)")
elseif kangxi.asj0 then
text:insert(" (chino y coreano), " .. tostring(kangxi.asj0) .. " (japonés)")
elseif kangxi.ask0 then
text:insert(" (chino y japonés), " .. tostring(kangxi.ask0) .. " (coreano)")
elseif kangxi.asc0 then
text:insert(" (chino tradicional y japonés), " .. tostring(kangxi.asc0) .. " (chino simplificado)")
elseif kangxi.asc00 then
text:insert(" (chino tradicional, japonés y coreano), " .. tostring(kangxi.asc00) .. " (chino simplificado)")
elseif kangxi.ascj then
text:insert(" (chino tradicional), " .. tostring(kangxi.ascj) .. " (chino simplificado y japonés)")
elseif kangxi.ascj0 then
text:insert(" (chino tradicional y coreano), " .. tostring(kangxi.ascj0) .. " (chino simplificado y japonés)")
elseif kangxi.asm then
text:insert(" (chino tradicional), " .. tostring(kangxi.asm) .. " (chino continental)")
elseif kangxi.asmj then
text:insert(" (chino tradicional), " .. tostring(kangxi.asmj) .. " (chino continental y japonés)")
elseif kangxi.asmj0 then
text:insert(" (chino tradicional y coreano), " .. tostring(kangxi.asmj0) .. " (chino continental y japonés)")
elseif kangxi.asm0 then
text:insert(" (chino tradicional y japonés), " .. tostring(kangxi.asm0) .. " (chino continental)")
elseif kangxi.asm00 then
text:insert(" (chino tradicional, japonés y coreano), " .. tostring(kangxi.asm00) .. " (chino continental)")
elseif kangxi.ascjk then
text:insert(" (chino tradicional), " .. tostring(kangxi.ascjk) .. " (chino simplificado, japonés y coreano)")
elseif kangxi.asmjk then
text:insert(" (chino tradicional), " .. tostring(kangxi.asmjk) .. " (chino continental, japonés y coreano)")
elseif kangxi.asmjk0 then
text:insert(" (chino tradicional de Taiwán), " .. tostring(kangxi.asmjk0) .. " (chino, japonés y coreano)")
end
text:insert('\n')
text:insert(":*'''Número de trazos:''' "..kangxi.sn)
local primer_parentesis = false
if kangxi.snj then
text:insert((primer_parentesis and ", " or " (chino), ") .. kangxi.snj .. " (japonés)")
primer_parentesis = true
end
if kangxi.snc then
text:insert((primer_parentesis and ", " or " (chino tradicional), ") .. kangxi.snc .. " (chino simplificado)")
primer_parentesis = true
end
if kangxi.snk then
text:insert((primer_parentesis and ", " or " (chino), ") .. kangxi.snk .. " (coreano)")
primer_parentesis = true
end
if kangxi.snjk then
text:insert((primer_parentesis and ", " or " (chino), ") .. kangxi.snjk .. " (japonés y coreano)")
primer_parentesis = true
end
if kangxi.snj0 then
text:insert((primer_parentesis and ", " or " (chino y coreano), ") .. kangxi.snj0 .. " (japonés)")
primer_parentesis = true
end
if kangxi.snk0 then
text:insert((primer_parentesis and ", " or " (chino y japonés), ") .. kangxi.snk0 .. " (coreano)")
primer_parentesis = true
end
if kangxi.snc0 then
text:insert((primer_parentesis and ", " or " (chino tradicional y japonés), ") .. kangxi.snc0 .. " (chino simplificado)")
primer_parentesis = true
end
if kangxi.snc00 then
text:insert((primer_parentesis and ", " or " (chino tradicional, japonés y coreano), ") .. kangxi.snc00 .. " (chino simplificado)")
primer_parentesis = true
end
if kangxi.sncj then
text:insert((primer_parentesis and ", " or " (chino tradicional), ") .. kangxi.sncj .. " (chino simplificado y japonés)")
primer_parentesis = true
end
if kangxi.sncj0 then
text:insert((primer_parentesis and ", " or " (chino tradicional y coreano), ") .. kangxi.sncj0 .. " (chino simplificado y japonés)")
primer_parentesis = true
end
if kangxi.snm then
text:insert((primer_parentesis and ", " or " (chino tradicional), ") .. kangxi.snm .. " (chino continental)")
primer_parentesis = true
end
if kangxi.snmj then
text:insert((primer_parentesis and ", " or " (chino tradicional), ") .. kangxi.snmj .. " (chino continental y japonés)")
primer_parentesis = true
end
if kangxi.snmj0 then
text:insert((primer_parentesis and ", " or " (chino tradicional y coreano), ") .. kangxi.snmj0 .. " (chino continental y japonés)")
primer_parentesis = true
end
if kangxi.snm0 then
text:insert((primer_parentesis and ", " or " (chino tradicional y japonés), ") .. kangxi.snm0 .. " (chino continental)")
primer_parentesis = true
end
if kangxi.snm00 then
text:insert((primer_parentesis and ", " or " (chino tradicional, japonés y coreano), ") .. kangxi.snm00 .. " (chino continental)")
primer_parentesis = true
end
if kangxi.sncjk then
text:insert((primer_parentesis and ", " or " (chino tradicional), ") .. kangxi.sncjk .. " (chino simplificado, japonés y coreano)")
primer_parentesis = true
end
if kangxi.snmjk then
text:insert((primer_parentesis and ", " or " (chino tradicional), ") .. kangxi.snmjk .. " (chino continental, japonés y coreano)")
primer_parentesis = true
end
if kangxi.snmjk0 then
text:insert((primer_parentesis and ", " or " (chino tradicional de Taiwán), ") .. kangxi.snmjk0 .. " (chino, japonés y coreano)")
primer_parentesis = true
end
text:insert("\n")
if kangxi.four then
text:insert(":*'''Código de las cuatro esquinas:''' "..kangxi.four:sub(1,4)..frame:extensionTag("sub", kangxi.four:sub(5,5)).."\n")
end
if kangxi.canj then
text:insert(":*'''Entrada(s) Cangji:''' "..kangxi.canj.."\n")
end
if kangxi.ids then
text:insert(":*'''Secuencia(s) de descripción ideográfica:''' "..kangxi.ids.."\n")
end
text:insert('\n')
return table.concat(text)
end
return export