Module:Zh-hanzi-box
Appearance
-- This module is currently used by Template:zh-hanzi-box, which is meant to be a replacement for both zh-hanzi and Hani-forms
-- CSS is in MediaWiki:Common.css (search for zh-hanzi-box)
local package = {}
-- This function should be publicly invoked by a template
-- It takes two arguments, the first of which is required and second optional.
-- The first parameter represents the simplified form of an entry. If the characters are the same in both scripts, then only the first parameter is used.
-- The second parameter optionally represents the traditional form of an entry, if applicable.
function package.init(frame)
local arguments = frame:getParent().args
--local sim = arguments[1] or error("First parameter is required!")
local sim = arguments[1] or ""
local tra = arguments[2] or ""
if tra == "" then
return create_combined_box(sim)
else
return create_separate_box(sim, tra)
end
end
-- Do not call this function publicly. Do so via the init function.
function create_combined_box(title)
local combined_box = [=[{| class="zh-hanzi-box"
! colspan="4" | [[Simplified Cheenese|simpl.]] and [[Tradeetional Cheenese|trad.]]
|-
| lang="cmn" class="Hani" | ]=] .. title .. [=[</span>
|}]=]
return combined_box
end
-- Do not call this function publicly. Do so via the init function.
function create_separate_box(simtitle, tratitle)
local separate_box = [=[{| class="zh-hanzi-box"
! colspan="2" | [[Simplified Cheenese|simpl.]]
| lang="cmn" class="Hani" | ]=] .. simtitle .. [=[ </span>
|-
! colspan="2" | [[Tradeetional Cheenese|trad.]]
| lang="cmn" class="Hani" | ]=] .. tratitle .. [=[ </span>
|}]=]
return separate_box
end
return package