local export = {}
local sub = mw.ustring.sub
local eras = {
{ "]", { "bronze-shang", "oracle" } },
{ "]", { "bronze" } },
{ "]", { "bronze-spring" } },
{ "]", { "bronze-warring", "silk", "slip" } },
{ "'']'' (]'da derlenmiş)", { "zhou", "ancient", "odd", "seal", "vulgar" } },
{ "''Liushutong'' (]'de derlenmiş)", { "bigseal" } },
{ "''Yazıtsal değişim'' (]'de derlenmiş)", { "clerical" } }
}
local scripts = {
= "]",
= "]",
= "]",
= "]",
= "]",
= "]",
= "]",
= "''Shizhoupian'' yazıtları",
= "Antik metinler",
= "Tuhaf karakter",
= "]",
= "Kaba karakter",
= "Kopyalanmış antik metinler",
= "]",
}
local hide_scripts = { "oracle", "bronze", "seal", "bigseal" }
local script_abbrev = {
= "bronze",
= "bronze",
= "bronze",
= "bronze",
= "bronze",
= "bronze",
= "oracle",
= "oracle",
= "oracle",
= "oracle",
= "silk",
= "silk",
= "silk",
= "slip",
= "slip",
= "silk",
= "seal",
= "seal",
= "bigseal",
}
function export.main(frame)
local args = frame:getParent().args
local pagename = mw.title.getCurrentTitle().subpageText
local target_page = args or pagename
local showEras, showScripts, showImgs, hideText = {}, {}, {}, {}
local success, data_module = pcall(mw.loadData, "Modül:zh/veri/glif-veri/" .. target_page)
local char_data = {
= {},
= {},
= {},
= {},
= {},
= {},
}
count = 0
if not frame:getParent().args then
for _, era in ipairs(eras) do
local count_era = 0
for _, script in ipairs(era) do
local img_link = pagename .. "-" .. script .. ".svg"
local img_file = mw.title.new("Media:" .. img_link)
if img_file.exists and not img_file.isRedirect then
count = count + 1
count_era = count_era + 1
table.insert(showScripts, "\n!" .. scripts)
table.insert(showImgs, "\n| style=\"padding: 8px;\"|]")
end
end
if count_era > 0 then
table.insert(showEras, "\n! colspan=\"" .. count_era .. "\"|" .. era)
end
end
end
if success then
local img_count = 0
for _, img in ipairs(data_module) do
img_count = img_count + 1
end
success = success and mw.title.new("Media:ACC-" .. data_module .. ".svg").exists
end
if success then
local capacity = 8
for _, img in ipairs(data_module) do
table.insert(char_data], '<td><div class="gallerybox"' ..
'>\n<div style="text-align:center; padding:8px" class="thumb">[[Dosya:ACC-' .. img ..
'.svg|60px]]\n<div class="gallerytext">\n<p><small>' .. img .. '</small></p>\n</div>\n</div>\n</div>\n</td>')
end
for _, script in ipairs(hide_scripts) do
if char_data then
local script_concat = { "\n----\n<table class=\"gallery\">\n<caption><b>", scripts, "</b></caption>\n" }
script_data = char_data
for i = 0, math.ceil(#script_data / capacity) - 1 do
table.insert(script_concat, "<tr>")
for j = 1, capacity do
table.insert(script_concat, script_data or nil)
end
table.insert(script_concat, "</tr>")
end
table.insert(script_concat, "\n</table>")
table.insert(hideText, table.concat(script_concat))
end
end
table.insert(hideText, '\n|- class="vsHide"\n| width="100%" align="left" colspan="' .. (count == 0 and 1 or count) ..
'|\n----<div class="toccolours mw-collapsible mw-collapsed"><b>Kaynakça</b>:' ..
'<div class="mw-collapsible-content">\nÇoğunlukla Richard Sears\'tan\' ' ..
"[http://hanziyuan.net/#" ..
target_page .. " Çince Köken Bilgisi sitesi] ([[c:Commons:Ancient Chinese characters/Richard Sears Agreement" ..
"|yetki]]),<br>Çince karakterlerin antik biçimlerinin çeşitli koleksiyonlarından veri çeker" ..
", bunlardan bazıları da şunlardır:\n* ''Shuowen Jiezi'' (küçük ölçekli), \n* ''Jinwen Bian'' (bronz yazıtlar)" ..
", \n* ''Liushutong'' (Liushutong karakterleri) ve \n* ''Yinxu Jiaguwen Bian'' (fal yazıtları).</div></div>")
end
if ( success or count > 0 ) and not frame:getParent().args then
glyph_forms = =] .. (success and ' vsSwitcher" data-toggle-category="forms' or "") ..
[=[" cellpadding=7 style="border-spacing: 1px; border: 1px solid darkgray; text-align:center"
! class="vsToggleElement" colspan="]=] .. (count == 0 and 1 or count) ..
=] .. target_page .. =] ..
(count > 0
and "\n|-" .. table.concat(showEras) .. "\n|-" .. table.concat(showScripts) .. "\n|-" .. table.concat(showImgs)
or "") ..
(success
and "\n|- class=\"vsHide\"\n| align=\"center\" colspan=\"" .. (count == 0 and 1 or count) ..
"|" .. table.concat(hideText, "")
or "")
else
glyph_forms = ""
end
local phonText = {}
local list = mw.loadData("Modül:zh-glif/fonetik/liste")
phonComp = list or nil
if phonComp then
table.insert(phonText,
'\n|-\n| style="padding: 0;" colspan="' .. (count == 0 and 1 or count) .. '"|' ..
'<div class="NavFrame" style="border: 0px; text-align:center; padding: 0; margin: 0;" cellpadding="6">' ..
'<div class="NavHead" style="font-size:105%; text-align:center; background: transparent; padding: 5px 0;" cellpadding="3">' ..
'Aynı ] olan karakterler' ..
' (<span class="Hani">]</span>)' ..
' <small>(])</small> ' ..
'</div>' ..
'<div class="NavContent">' ..
'\n{| class="wikitable" style="border: 0px; margin: 0; width: 100%; border-style: hidden; border-top: 1px;"' ..
'\n|-\n! align="center"|\n!Eski Çince'
)
local phonData = mw.loadData("Modül:zh-glif/fonetik")
local m_och = require("Modül:och-söyleniş").retrieve_pron
for item in mw.text.gsplit(phonData, "") do
table.insert(phonText, '\n|-\n| align="center" |<span class="Hani">]</span>')
local IPA = m_och(item, nil, true)
if IPA then
table.insert(phonText, '\n|<small><span class="IPA">' .. IPA .. '</span></small>')
end
end
table.insert(phonText, '\n|}\n</div></div>')
end
table.insert(phonText, '\n|}')
return glyph_forms .. table.concat(phonText)
end
return export