Module:government
Jump to navigation
Jump to search
See {{with}}
. To add to the recognised argument list, edit Module:government/data.
local export = {}
local getArgs = require('Module:Arguments').getArgs
-- COLOUR DATA
local data = {
-- base cases
["nominative"] = {["label"] = "nominative", ["colour"] = "ffb3ba"},
["accusative"] = {["label"] = "accusative", ["colour"] = "ffdfba"},
["dative"] = {["label"] = "dative", ["colour"] = "ffffba"},
["genitive"] = {["label"] = "genitive", ["colour"] = "baffc9"},
["locative"] = {["label"] = "locative", ["colour"] = "bae1ff"},
["instrumental"] = {["label"] = "instrumental", ["colour"] = "f1b3ff"},
-- laefevian cases
["illative"] = {["label"] = "illative", ["colour"] = data["locative"].colour},
}
-- ALIASES
data["nom"] = data["nominative"]
data["acc"] = data["accusative"]
data["dat"] = data["dative"]
data["gen"] = data["genitive"]
data["loc"] = data["locative"]
data["ins"] = data["instrumental"]
data["inst"] = data["instrumental"]
data["ill"] = data["illative"]
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
if colour then
return "[<span style=\"background-color: #" .. colour .. ";\">+" .. label .. "</span>]"
else
return "[+" .. label .. "]"
end
end
return export
--[[
Debug console test string:
=p.generate(mw.getCurrentFrame():newChild{title="whatever",args={"accusative"}})
]]