10,731
edits
TheNightAvl (talk | contribs) mNo edit summary |
TheNightAvl (talk | contribs) (Added categorisation) |
||
Line 5: | Line 5: | ||
-- 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 ending = mw.ustring.sub(word, -1) | |||
if ending == "h" and mw.ustring.sub(word, -2, -1) == "s" then ending = "sh" end | |||
if ending == "s" or ending == "z" or ending == "x" or ending == "sh" then | |||
return word .. "es" | |||
end | |||
return word .. "s" | |||
end | |||
function export.generate(frame) | function export.generate(frame) | ||
Line 22: | Line 32: | ||
colour = args[2] or nil | colour = args[2] or nil | ||
end | end | ||
local to_Return = "" | |||
if colour then | if colour then | ||
to_Return = "[<span style=\"background-color: #" .. colour .. ";\">+" .. label .. "</span>]" | |||
else | else | ||
to_Return = "[+" .. label .. "]" | |||
end | |||
if args["l"] and args["pos"] then | |||
to_Return = to_Return .. "[[Category:" .. l_data[args["l"]].name .. " " .. pluralize(args["pos"]) .. " governing the " .. label .. "]]" | |||
end | end | ||
return to_Return | |||
end | end | ||