"ഘടകം: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 pframeargs = frame:getParentgetArgs(frame)
local args = pframe.args
return p._Zh(args)
end
Line 67 ⟶ 69:
local t1 -- whether traditional Chinese characters go first
if (args["first"] == nil) then
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"] ~= "" and args["s"] == args["t"]) then
args["c"] = args["s"]
args["s"] = ""nil
args["t"] = ""nil
end
 
Line 106 ⟶ 108:
local val = args[part]
local cat = ""
-- if (valhas associated ~=category "")add thenit
if (ccats[part]) then
-- if has associated category add it
ifcat = (cats[part]) then
end
cat = cats[part]
if (ISOlang[part]) then -- add language if needed
end
ifparams = {["lang"] = (ISOlang[part]), then["xml:lang"] --= add language if neededISOlang[part]}
val = mw.text.tag({name="span",attrs=params, content=val})
params = {["lang"] = ISOlang[part], ["xml:lang"] = ISOlang[part]}
elseif (part == "p") then -- italicise pinyin
val = mw.text.tag({name="span",attrs=params, content=val})
elseif (partval == "p''") then.. --val italicise.. pinyin"''"
valelseif (part == "''l") ..then val-- ..put "''"literals in quotes
elseif (partval == '"l")' then.. --val put.. literals in quotes'"'
end
val = '"' .. val .. '"'
-- build this entry
end
if (no) or part == "l" then
-- build this entry
ifbody (no)= orbody .. labels[part] ==.. cat .. "l: " then.. val .. "; "
else
body = body .. "[[" .. wlinks[part] .. "|" .. labels[part] .. cat"]]" .. cat ..": " .. val .. "; "
else
body = body .. "[[" .. wlinks[part] .. "|" .. labels[part] .. "]]" .. cat ..": " .. val .. "; "
end
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
c =if (args[1]) then
if (c > "")= thenargs[1] -- if there is treat it as Chinese
if (c) then
params = {["lang"] = ISOlang[part"c"], ["xml:lang"] = ISOlang[part"c"]}
if (c > "") then -- if there is treat it as Chinese
c = mw.text.tag({name="span",attrs=params, content=c})
params = {["lang"] = ISOlang["c"], ["xml:lang"] = ISOlang["c"]}
body = body ..return "[[" .. wlinks[part"c"] .. "|" .. labels[part"c"] .. "]]" .. catcats["c"] .. ": " .. val .. "; "c
c = mw.text.tag({name="span",attrs=params, content=c})
return "[[" .. wlinks["c"] .. "|" .. labels["c"] .. "]]" .. cats["c"] .. ": " .. c
end
end
return ""
end
"https://ml.wikipedia.org/wiki/ഘടകം:Zh" എന്ന താളിൽനിന്ന് ശേഖരിച്ചത്