Module:government: Difference between revisions

ਕੋਈ ਸੋਧ ਸਾਰ ਨਹੀਂ
(Removed old code)
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.get_by_code(args[1])
local language = m_languages.find_by_code(args[1])
if args[2] == nil then error("Second parameter is missing") end
if args[2] == nil then error("Second parameter is missing") end
local show = "["
local show = "["
Line 28: Line 28:
local i = 2
local i = 2
if language == nil then i = 1 end
while args[i] do
while args[i] do
if i > 2 then
if #show > 1 then
append("; ''or'' ")
append("; ''or'' ")
end
end
Line 85: Line 87:
local form, colour
local form, colour
if mw.ustring.find(temp, "^%:[^%(%<%[%+%/%:]+") then
if mw.ustring.find(temp, "^%:[^%(%<%[%+%/%:]+") then
if language == nil then error("A language code must be specified in the first parameter for the link function to work") end
temp_append("'''")
temp_append("'''")
while mw.ustring.find(temp, "^%:[^%(%<%[%+%/%:]+") do
while mw.ustring.find(temp, "^%:[^%(%<%[%+%/%:]+") do
Line 112: Line 115:
end
end
temp_append(glossary(form, colour))
temp_append(glossary(form, colour))
if args["pos"] then
if language and args["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(args["pos"]) .. " governing the " .. form .. "]]")
temp_append("[[Category:" .. language.name .. " " .. pluralize(args["pos"]) .. " governing the " .. form .. "]]")