Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WiktionaryThe Free Dictionary
Search

Module:zh-glyph

From Wiktionary, the free dictionary

The followingdocumentation is located atModule:zh-glyph/documentation.[edit]
Useful links:subpage listlinkstransclusionstestcasessandbox

Backend for{{Han etym}}.

localconcat=table.concatlocalinsert=table.insertlocalload_data=mw.loadDatalocalnew_title=mw.title.newlocalprocess_params=require("Module:parameters").processlocaldata=load_data("Module:zh/data/glyph-data")localexport={}locallarge_pages={["大"]=true,["子"]=true,["年"]=true,["方"]=true,["日"]=true,["王"]=true}-- FIXME: temporary solution to avoid going over the expensive function call limit-- these pages generally have very few actually existing images so we could perhaps modify the data module insteadfunctionexport.main(frame)localboolean={type="boolean"}localargs=process_params(frame:getParent().args,{[1]=true,["no_img"]=boolean,["no_phon"]=boolean,})localtarget_page=args[1]orload_data("Module:headword/data").pagenamelocalshowEras,showScripts,showImgs,hideText={},{},{},{}localsuccess,data_module=pcall(load_data,"Module:zh/data/glyph-data/"..target_page)localchar_data={["bronze"]={},["oracle"]={},["silk"]={},["slip"]={},["seal"]={},["bigseal"]={},}localcount=0ifnotargs.no_imgthenfor_,erainipairs(data.eras)dolocalcount_era=0for_,scriptinipairs(era[2])dolocalimg_link=target_page.."-"..script..".svg"localimg_file=new_title("Media:"..img_link)ifimg_file.existsandnotimg_file.isRedirectthencount=count+1count_era=count_era+1insert(showScripts,"\n!"..data.scripts[script])insert(showImgs,"\n| style=\"padding: 8px;\"|[[File:"..img_link.."|60px|class=mw-invert skin-invert]]")endendifcount_era>0theninsert(showEras,"\n! colspan=\""..count_era.."\"|"..era[1])endendendifsuccessandnotlarge_pages[target_page]thensuccess=falselocaltitles={}for_,imginipairs(data_module[1])dotable.insert(titles,"Media:ACC-"..img..".svg")endlocalbatch=mw.title.newBatch(titles):lookupExistence():getTitles()fori=1,#(batch)doimg=data_module[1][i]ifbatch[i].existsthensuccess=trueinsert(char_data[data.script_abbrev[img:match("^.[\128-\191]*")]],'<div class="gallerybox" style="display:inline-block"'..'><div style="text-align:center">[[File:ACC-'..img..'.svg|60px|class=mw-invert skin-invert]]<div class="gallerytext"><small>'..img..'</small></div></div></div>')endendifsuccessthenfori,scriptinipairs(data.hide_scripts)doifchar_data[script][1]thenifi~=1theninsert(hideText,"<hr>")endinsert(hideText,"<div class=\"gallery\"><div><b>"..data.scripts[script].."</b></div>"..concat(char_data[script]).."</div>")endendinsert(hideText,'\n|- class="vsHide"\n| width="100%" align="left" colspan="'..(count==0and1orcount)..'|\n<div class="standard-box mw-collapsible mw-collapsed"><b>References</b>:'..'<div class="mw-collapsible-content">\nMostly from Richard Sears\' '.."[http://hanziyuan.net/#"..target_page.." Chinese Etymology site] ([[c:Commons:Ancient Chinese characters/Richard Sears Agreement".."|authorisation]]),<br>which in turn draws data from various collections of ancient forms of Chinese characters"..", including:\n* ''Shuowen Jiezi'' (small seal),\n* ''Jinwen Bian'' (bronze inscriptions)"..",\n* ''Liushutong'' (Liushutong characters) and\n* ''Yinxu Jiaguwen Bian'' (oracle bone script).</div></div>")endendlocalglyph_formsif(successorcount>0)andnotargs.no_imgthenglyph_forms="<div style=\"overflow:auto;width:fit-content;max-width:100%\">\n"..[=[{| class="wikitable zh-glyph]=]..(successand' vsSwitcher" data-toggle-category="forms'or"")..[=[" cellpadding=7 style="border-spacing: 1px; border: 1px solid var(--wikt-palette-grey-7,darkgray); text-align:center"! class="vsToggleElement" colspan="]=]..(count==0and1orcount)..[=[" |Historical forms of the character <span lang="zh-Hant" class="Hani">]=]..target_page..[=[</span>]=]..(count>0and"\n|-"..concat(showEras).."\n|-"..concat(showScripts).."\n|-"..concat(showImgs)or"")..(successand"\n|- class=\"vsHide\"\n| align=\"center\" colspan=\""..(count==0and1orcount).."|"..concat(hideText,"")or"").."\n|}\n</div>"elseglyph_forms=""endlocalphonText={}locallist=load_data("Module:zh-glyph/phonetic/list")localphonComp=list[target_page]ornilifphonCompandnotargs.no_phontheninsert(phonText,'\n'..'<div class="NavFrame" style="border:0px; max-width: 37em; text-align:center;">'..'<div class="NavHead" style="font-size:105%; border:1px solid var(--border-color-base, #a2a9b1); background-color:var(--wikt-palette-indigo-3, #e0defa); text-align:center; margin:0">'..'Characters in the same [[Wiktionary:About Chinese/phonetic series|phonetic series]]'..' (<span class="Hani">[['..phonComp..']]</span>)'..' <small>([[Wiktionary:About Chinese/references|Zhengzhang, 2003]])</small>&nbsp; '..'</div>'..'<div class="NavContent" style="border-top: 0">'..'\n{| class="wikitable zh-glyph" style="margin-top: 0; width: 100%; display: table; border-top: 0"'..'\n|-\n! align="center" style="border-top: 0"|\n! style="border-top: 0" | Old Chinese')localphonData=load_data("Module:zh-glyph/phonetic")localm_och=require("Module:och-pron").retrieve_pronforiteminphonData[phonComp]:gmatch(".[\128-\191]*")doinsert(phonText,'\n|-\n| align="center" |<span class="Hani">[['..item..'#Chinese|'..item..']]</span>')localIPA=m_och(item,nil,true)ifIPAtheninsert(phonText,'\n|<small><span class="IPA">'..IPA..'</span></small>')endendinsert(phonText,'\n|}\n</div></div>')endreturnglyph_forms..concat(phonText)endreturnexport
Retrieved from "https://en.wiktionary.org/w/index.php?title=Module:zh-glyph&oldid=88138748"
Category:

[8]ページ先頭

©2009-2025 Movatter.jp