"ഘടകം:Zh" എന്ന താളിന്റെ പതിപ്പുകൾ തമ്മിലുള്ള വ്യത്യാസം
Content deleted Content added
add extra check in check for s and t the same, in case they're null/empty |
Try using arguments module, and simply code based on it |
||
വരി 1:
local p = {}
-- load arguments module to simplify handling of args
local getArgs = require('Module:Arguments').getArgs
-- articles in which traditional Chinese preceeds simplified Chinese
Line 58 ⟶ 61:
function p.Zh(frame)
local
return p._Zh(args)
end
Line 67 ⟶ 69:
local t1 -- whether traditional Chinese characters go first
if (args["first"]
t1 = args["first"] == "t"▼
else▼
local title = mw.title.getCurrentTitle()
t1 = t1st[title.text] == true
▲ else
▲ t1 = args["first"] == "t"
end
-- based on setting/preference specify order
Line 92 ⟶ 94:
-- Treat Simplified + Traditional as Chinese if they're the same
if (args["s"]
args["c"] = args["s"]
args["s"] =
args["t"] =
end
Line 106 ⟶ 108:
local val = args[part]
local cat = ""
-- if
if (ISOlang[part]) then -- add language if needed
▲ end
params = {["lang"] = ISOlang[part], ["xml:lang"] = ISOlang[part]}▼
elseif (part == "p") then -- italicise pinyin
▲ val = mw.text.tag({name="span",attrs=params, content=val})
▲ end
if (no) or part == "l" then
▲ -- build this entry
▲ else
body = body .. "[[" .. wlinks[part] .. "|" .. labels[part] .. "]]" .. cat ..": " .. val .. "; "▼
end
end
വരി 132:
return string.sub(body, 1, -3) -- chop off final semicolon and space
else --no named parameters; see if there's an unnamed first parameter
▲ if (c) then
▲ if (c > "") then -- if there is treat it as Chinese
▲
▲ c = mw.text.tag({name="span",attrs=params, content=c})
end
return ""
end
|