Module:Infobox election/sandbox: Difference between revisions

Content deleted Content added
Undid revision 1300036746 by Pppery (talk)
Allow _label
Line 7:
-- Helper functions --
local notblank = function (v) return (mw.text.trim(v or "") ~= "") end
local ifblank = function (v, aalt1, alt2) return notblank(v) and v or a(notblank(alt1) and alt1 or alt2) end
local ucfirst = function (s) return mw.ustring.upper(mw.ustring.sub(s,1,1)) .. mw.ustring.gsub(mw.ustring.sub(s,2), '_', ' ') end
 
Line 68:
if always or ( notblank(rargs[cellType .. '1']) or notblank(rargs[cellType .. '2']) or notblank(rargs[cellType .. '3']) ) then
output('|-')
output('! style="width:75px;text-align:left" |' .. (ifblank(rargs[cellType .. '_label'], title, ucfirst(cellType or ''))))
output(centeredCell(cellType .. '1'))
output(centeredCell(cellType .. '2'))
Line 209:
end
-- Final round --
threeCells('final_round', ifblank(rargs.final_round_label, 'Final round'))
-- Primary or presidential --
if rtype == 'primary' or rtype == 'presidential' then