Module:government: Difference between revisions

Jump to navigation Jump to search
ਕੋਈ ਸੋਧ ਸਾਰ ਨਹੀਂ
No edit summary
No edit summary
Line 19: Line 19:
function export.show(frame)
function export.show(frame)
local args = getArgs(frame)
local args = getArgs(frame)
local language = m_languages.find_by_code(args[1])
local language, pos
if mw.ustring.find(args[1], "^[a-z]+%s+[a-z]+$") then
language, pos = mw.ustring.match(args[1], "^([a-z]+)%s+([a-z]+)$")
language = m_languages.find_by_code(language)
pos = ( language ~= nil and (data[pos] or pos) ) or nil
else
language = m_languages.find_by_code(args[1])
pos = data[args["pos"]] or args["pos"]
end
if (language and args[2] == nil) or args[1] == nil then error("Entry parameter is missing") end
if (language and args[2] == nil) or args[1] == nil then error("Entry parameter is missing") end
if language == nil and pos then error("The |pos parameter requires the language code to be specified in the first parameter") end
local show = "["
local show = "["
Line 124: Line 135:
end
end
temp_append(glossary(form, colour))
temp_append(glossary(form, colour))
if language and args["pos"] then
if language and pos then
if data[form] then form = data[form].label end
if data[form] then form = data[form].label end
temp_append("[[Category:" .. language.name .. " " .. pluralize(data[args["pos"]] or args["pos"]) .. " governing the " .. form .. "]]")
temp_append("[[Category:" .. language.name .. " " .. pluralize(pos) .. " governing the " .. form .. "]]")
end
end
else
else

Navigation menu