Module:Election results/sandbox: Difference between revisions

Content deleted Content added
+
+
Line 99:
:tag('td')
:wikitext(string.format('\[\[%s\]\]', args['vp' .. v]))
if args['party_name' .. v] then
row
:tag('td')
:wikitext(string.format('\[\[%s\|%s\]\]', args['party' .. v], args['party_name' .. v]))
else
row
:tag('td')
:wikitext(string.format('\[\[%s\]\]', args['party' .. v]))
end
local cell = mw.html.create('td')
cell
:css('text-align', 'right')
if args['votes' .. v] then
cell
:wikitext(fmt(args['votes' .. v]))
end
row:node(cell)
local cell = mw.html.create('td')
cell
:css('text-align', 'right')
if args['votes' .. v] then
cell
:wikitext(string.format('%.2f%%', args['votes' .. v] / valid * 100))
end
row:node(cell)
elseif cand then
row
:tag('td')
:wikitext(string.format('\[\[%s\]\]', args['cand' .. v]))
if args['party_name' .. v] then
row
:tag('td')
:wikitext(string.format('\[\[%s\|%s\]\]', args['party' .. v], args['party_name' .. v]))
else
row
:tag('td')
:wikitext(string.format('\[\[%s\]\]', args['party' .. v]))
end
local cell = mw.html.create('td')
cell
:css('text-align', 'right')
if args['votes' .. v] then
cell
:wikitext(fmt(args['votes' .. v]))
end
row:node(cell)
local cell = mw.html.create('td')
cell
:css('text-align', 'right')
if args['votes' .. v] then
cell
:wikitext(string.format('%.2f%%', args['votes' .. v] / valid * 100))
end
row:node(cell)
elseif seats then
if args['party_name' .. v] then
row
:tag('td')
:wikitext(string.format('\[\[%s\|%s\]\]', args['party' .. v], args['party_name' .. v]))
else
row
:tag('td')
:wikitext(string.format('\[\[%s\]\]', args['party' .. v]))
end
row:node(cell)
local cell = mw.html.create('td')
cell
:css('text-align', 'right')
if args['votes' .. v] then
cell
:wikitext(string.formatfmt('%.2f%%', args['votes' .. v] / valid * 100))
end
row:node(cell)
local cell = mw.html.create('td')
cell
:css('text-align', 'right')
if args['votes' .. v] then
cell
:wikitext(fmtstring.format('%.2f%%', args['votes' .. v] / valid * 100))
end
row:node(cell)
local cell = mw.html.create('td')
cell
:css('text-align', 'right')
if args['seats' .. v] then
cell
:wikitext(args['seats' .. v])
end
row:node(cell)
local cell = mw.html.create('td')
cell
:css('text-align', 'right')
if args['sc' .. v] then
cell
:wikitext(args['sc' .. v])
end
row:node(cell)
end
row:node(cell)
elseif seats then
if args['party_name' .. v] then
row
:tag('td')
:wikitext(string.format('\[\[%s\|%s\]\]', args['party' .. v], args['party_name' .. v]))
else
row
:tag('td')
:wikitext(string.format('\[\[%s\]\]', args['party' .. v]))
end
local cell = mw.html.create('td')
cell
:css('text-align', 'right')
if args['votes' .. v] then
cell
:wikitext(fmt(args['votes' .. v]))
end
row:node(cell)
local cell = mw.html.create('td')
cell
:css('text-align', 'right')
if args['votes' .. v] then
cell
:wikitext(string.format('%.2f%%', args['votes' .. v] / valid * 100))
end
row:node(cell)
local cell = mw.html.create('td')
cell
:css('text-align', 'right')
if args['seats' .. v] then
cell
:wikitext(args['seats' .. v])
end
row:node(cell)
local cell = mw.html.create('td')
cell
:css('text-align', 'right')
if args['sc' .. v] then
cell
:wikitext(args['sc' .. v])
end
row:node(cell)
end
root:node(row)
end