local p = local fetch = nil -- lazy load
local function load_political_party_module if fetch
local function page_exist(page_name) if not page_name then return false end if mw.title.new(page_name).exists then return true end return falseend
local function simplify_rowspan(text) text = mw.ustring.gsub(text or , 'rowspan="1"%s*', ) return textend
local function ifblank(one, two) return (((one or "") ~= "") and one or two) or ""end
local function getData(args) local display_name = nil local yesno = require('Module:Yesno') if args[1]
true then display_name = args[1] elseif yesno(args.full)
true then display_name = "" .. display_name .. "" end
local text = nil if yesno(args.no_link)
local color = args.colour or args.color if not color then load_political_party_module color = fetch end return text, colorend
function p._cell(args) if not args[1] then return end local text, color = getData(args) local line1 = 'rowspan="%s" style="width: 2px; color:inherit; background-color: %s;" data-sort-value="%s" |\n' local line2 = '| scope="row" rowspan="%s" style="text-align: left;" | %s' local rowspan = tonumber(args.rowspan) or 1 line1 = string.format(line1, rowspan, color, args[1]) line2 = string.format(line2, rowspan, text)
return simplify_rowspan(line1 .. line2)end
function p._box(args) if not args[1] then return end local text, color = getData(args) local seats if args.seats then seats = ' (' .. args.seats .. ')' end seats = seats or local outline = args.outline or 'black' local legend = '
' .. text .. seats .. '' return legendendfunction p.cell(frame) local getArgs = require('Module:Arguments').getArgs local args = getArgs(frame) local check = require('Module:Check for unknown parameters')._check local tracking = check(frame:getParent.args) return p._cell(args) .. trackingend
function p.box(frame) local getArgs = require('Module:Arguments').getArgs local args = getArgs(frame) return p._box(args)end
return p