Module:government: Difference between revisions

Removed old code
No edit summary
(Removed old code)
Line 7: Line 7:
-- COLOUR DATA
-- COLOUR DATA
local data = mw.loadData("Module:government/data")
local data = mw.loadData("Module:government/data")
local l_data = mw.loadData("Module:languages/data")


local function pluralize(word)
local function pluralize(word)
Line 16: Line 15:
end
end
return word .. "s"
return word .. "s"
end
function export.generate(frame)
local args = getArgs(frame)
local label = ""
local colour = ""
if not args[1] then
error("First argument required")
end
if data[args[1]] then
label = data[args[1]].label
colour = args[2] or data[args[1]].colour
else
label = args[1]
colour = args[2] or nil
end
local to_Return = "["
if args["prep"] then
to_Return = to_Return .. "+ <i>[[" .. args["prep"] .. "#" .. l_data[args["l"]].name .. "|" .. args["prep"] .. "]]</i> "
end
if colour then
to_Return = to_Return .. "<span style=\"background-color: #" .. colour .. ";\">+" .. label .. "</span>"
else
to_Return = to_Return .. "+" .. label
end
if args["t"] then
to_Return = to_Return .. " = " .. args["t"]
end
to_Return = to_Return .. "]"
if args["l"] and args["pos"] then
to_Return = to_Return .. "[[Category:" .. l_data[args["l"]].name .. " " .. pluralize(args["pos"]) .. " governing the " .. label .. "]]"
end
return to_Return
end
end