https://en.wikipedia.org/w/index.php?action=history&feed=atom&title=Module%3AElection_results-STV%2Fsandbox Module:Election results-STV/sandbox - Revision history 2025-06-11T00:48:15Z Revision history for this page on the wiki MediaWiki 1.45.0-wmf.4 https://en.wikipedia.org/w/index.php?title=Module:Election_results-STV/sandbox&diff=1225688521&oldid=prev Closed Limelike Curves: Accept with numbers with commas 2024-05-26T02:37:21Z <p>Accept with numbers with commas</p> <p><b>New page</b></p><div>require(&#039;strict&#039;)<br /> local p = {}<br /> local political_party = require(&#039;Module:Political party&#039;)<br /> <br /> function p.main(frame)<br /> local function parsenum(x)<br /> return parsenum(x.gsub(&quot;,&quot;, &quot;&quot;))<br /> end<br /> local args = require(&#039;Module:Arguments&#039;).getArgs(frame)<br /> local index, headings, showtotal = {}, {}, {}<br /> local cols, rounds = 0, 1<br /> local valid = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}<br /> local invalidblank = {parsenum(args.invalidblank) or 0,}<br /> local invalid = {parsenum(args.invalid) or 0}<br /> local blank = {parsenum(args.blank) or 0}<br /> local totalvotes = {parsenum(args.totalvotes)}<br /> local electorate = {parsenum(args.electorate)}<br /> local turnout = {parsenum(args.turnout)}<br /> local row, secondrow<br /> local tracking = &#039;&#039;<br /> local max_rows = 0<br /> <br /> -- helper functions<br /> local lang = mw.getContentLanguage()<br /> local function fmt(n)<br /> return n and parsenum(n) and lang:formatNum(parsenum(n)) or nil<br /> end<br /> local function pct(n, d)<br /> n, d = parsenum(n), parsenum(d)<br /> if n and d and d &gt; 0 then<br /> return string.format(&#039;%.2f&#039;, n / d * 100)<br /> end<br /> return &#039;&amp;ndash;&#039;<br /> end<br /> local function tonumdash(s)<br /> if s then<br /> s = mw.ustring.gsub(s, &#039;&amp;[MmNn][Dd][Aa][Ss][Hh];&#039;, &#039;-&#039;)<br /> s = mw.ustring.gsub(s, &#039;&amp;[Mm][Ii][Nn][Uu][Ss];&#039;, &#039;-&#039;)<br /> s = mw.ustring.gsub(s, &#039;[—–−]&#039;, &#039;-&#039;)<br /> return parsenum(s) or 0<br /> end<br /> end<br /> local function unlink(s)<br /> if s then<br /> s = s:match(&quot;^[^%[]-%[%[([^%]]-)|[^%]]-%]%].*$&quot;) or s<br /> s = s:match(&quot;^[^%[]-%[%[([^%]]-)%]%].*$&quot;) or s<br /> end<br /> return s<br /> end<br /> local function get_color(color, party)<br /> if color == nil then<br /> local party = unlink(party) or &#039;&#039;<br /> if party ~= &#039;&#039; then<br /> color = political_party._fetch({party, &#039;color&#039;})<br /> end<br /> end<br /> <br /> if color ~= nil then<br /> color = mw.ustring.gsub(color, &#039;&amp;(#)35;&#039;, &#039;%1&#039;)<br /> end<br /> return color<br /> end<br /> <br /> -- preprocess the input<br /> local stop_flag = false<br /> local i = 0<br /> local has_votes = args[&#039;votes&#039; .. i]<br /> local has_votes2 = args[&#039;votes&#039; .. i .. &#039;_2&#039;]<br /> local has_votes3 = args[&#039;votes&#039; .. i .. &#039;_3&#039;]<br /> local has_votes4 = args[&#039;votes&#039; .. i .. &#039;_4&#039;]<br /> local has_votes5 = args[&#039;votes&#039; .. i .. &#039;_5&#039;]<br /> local has_votes6 = args[&#039;votes&#039; .. i .. &#039;_6&#039;]<br /> local has_votes7 = args[&#039;votes&#039; .. i .. &#039;_7&#039;]<br /> local has_votes8 = args[&#039;votes&#039; .. i .. &#039;_8&#039;]<br /> local has_votes9 = args[&#039;votes&#039; .. i .. &#039;_9&#039;]<br /> local has_votes10 = args[&#039;votes&#039; .. i .. &#039;_10&#039;]<br /> local has_votes11 = args[&#039;votes&#039; .. i .. &#039;_11&#039;]<br /> local has_votes12 = args[&#039;votes&#039; .. i .. &#039;_12&#039;]<br /> local has_votes13 = args[&#039;votes&#039; .. i .. &#039;_13&#039;]<br /> local has_party = args[&#039;party&#039; .. i]<br /> local has_nopercentage = args[&#039;nopercentage&#039;]<br /> while stop_flag == false do<br /> stop_flag = true<br /> for kk = 1, 20 do<br /> i = i + 1<br /> for k, key in ipairs({&#039;cand&#039;, &#039;party&#039;, &#039;ivotes&#039;, &#039;ipct&#039;, &#039;totalvotes&#039;, &#039;acolor&#039;, &#039;rcolor&#039;}) do<br /> if args[key .. i] then<br /> headings[key] = true<br /> stop_flag = false<br /> max_rows = i &gt; max_rows and i or max_rows<br /> end<br /> end<br /> if args[&#039;row&#039; .. i] then<br /> stop_flag = false<br /> max_rows = i &gt; max_rows and i or max_rows<br /> end<br /> if args[&#039;row&#039; .. i] or args[&#039;cand&#039; .. i] or args[&#039;header&#039; .. i] then<br /> table.insert(index, i)<br /> if args[&#039;votes&#039; .. i] then<br /> if parsenum(args[&#039;votes&#039; .. i]) then showtotal.votes = 1 end<br /> local votesi = parsenum(args[&#039;votes&#039; .. i]) or 0<br /> args[&#039;votes&#039; .. i] = votesi<br /> valid[1] = valid[1] + votesi<br /> has_votes = true<br /> end<br /> if args[&#039;party&#039; .. i] then<br /> has_party = true<br /> end<br /> if args[&#039;votes&#039; .. i .. &#039;_2&#039;] then<br /> has_votes2 = true<br /> end<br /> if args[&#039;votes&#039; .. i .. &#039;_3&#039;] then<br /> has_votes3 = true<br /> end<br /> if args[&#039;votes&#039; .. i .. &#039;_4&#039;] then<br /> has_votes4 = true<br /> end<br /> if args[&#039;votes&#039; .. i .. &#039;_5&#039;] then<br /> has_votes5 = true<br /> end<br /> if args[&#039;votes&#039; .. i .. &#039;_6&#039;] then<br /> has_votes6 = true<br /> end<br /> if args[&#039;votes&#039; .. i .. &#039;_7&#039;] then<br /> has_votes7 = true<br /> end<br /> if args[&#039;votes&#039; .. i .. &#039;_8&#039;] then<br /> has_votes8 = true<br /> end<br /> if args[&#039;votes&#039; .. i .. &#039;_9&#039;] then<br /> has_votes9 = true<br /> end<br /> if args[&#039;votes&#039; .. i .. &#039;_10&#039;] then<br /> has_votes10 = true<br /> end<br /> if args[&#039;votes&#039; .. i .. &#039;_11&#039;] then<br /> has_votes11 = true<br /> end<br /> if args[&#039;votes&#039; .. i .. &#039;_12&#039;] then<br /> has_votes12 = true<br /> end<br /> if args[&#039;votes&#039; .. i .. &#039;_13&#039;] then<br /> has_votes13 = true<br /> end<br /> if args[&#039;nopercentage&#039;] then<br /> has_nopercentage = true<br /> end<br /> if args[&#039;votes&#039; .. i .. &#039;_2&#039;] then<br /> if parsenum(args[&#039;votes&#039; .. i .. &#039;_2&#039;]) then showtotal.votes_2 = 1 end<br /> local votesi = parsenum(args[&#039;votes&#039; .. i .. &#039;_2&#039;]) or 0<br /> args[&#039;votes&#039; .. i .. &#039;_2&#039;] = votesi<br /> valid[2] = valid[2] + votesi<br /> end<br /> if args[&#039;votes&#039; .. i .. &#039;_3&#039;] then<br /> if parsenum(args[&#039;votes&#039; .. i .. &#039;_3&#039;]) then showtotal.votes_3 = 1 end<br /> local votesi = parsenum(args[&#039;votes&#039; .. i .. &#039;_3&#039;]) or 0<br /> args[&#039;votes&#039; .. i .. &#039;_3&#039;] = votesi<br /> valid[3] = valid[3] + votesi<br /> end<br /> if args[&#039;votes&#039; .. i .. &#039;_4&#039;] then<br /> if parsenum(args[&#039;votes&#039; .. i .. &#039;_4&#039;]) then showtotal.votes_4 = 1 end<br /> local votesi = parsenum(args[&#039;votes&#039; .. i .. &#039;_4&#039;]) or 0<br /> args[&#039;votes&#039; .. i .. &#039;_4&#039;] = votesi<br /> valid[4] = valid[4] + votesi<br /> end<br /> if args[&#039;votes&#039; .. i .. &#039;_5&#039;] then<br /> if parsenum(args[&#039;votes&#039; .. i .. &#039;_5&#039;]) then showtotal.votes_5 = 1 end<br /> local votesi = parsenum(args[&#039;votes&#039; .. i .. &#039;_5&#039;]) or 0<br /> args[&#039;votes&#039; .. i .. &#039;_5&#039;] = votesi<br /> valid[5] = valid[5] + votesi<br /> end<br /> if args[&#039;votes&#039; .. i .. &#039;_6&#039;] then<br /> if parsenum(args[&#039;votes&#039; .. i .. &#039;_6&#039;]) then showtotal.votes_6 = 1 end<br /> local votesi = parsenum(args[&#039;votes&#039; .. i .. &#039;_6&#039;]) or 0<br /> args[&#039;votes&#039; .. i .. &#039;_6&#039;] = votesi<br /> valid[6] = valid[6] + votesi<br /> end<br /> if args[&#039;votes&#039; .. i .. &#039;_7&#039;] then<br /> if parsenum(args[&#039;votes&#039; .. i .. &#039;_7&#039;]) then showtotal.votes_7 = 1 end<br /> local votesi = parsenum(args[&#039;votes&#039; .. i .. &#039;_7&#039;]) or 0<br /> args[&#039;votes&#039; .. i .. &#039;_7&#039;] = votesi<br /> valid[7] = valid[7] + votesi<br /> end<br /> if args[&#039;votes&#039; .. i .. &#039;_8&#039;] then<br /> if parsenum(args[&#039;votes&#039; .. i .. &#039;_8&#039;]) then showtotal.votes_8 = 1 end<br /> local votesi = parsenum(args[&#039;votes&#039; .. i .. &#039;_8&#039;]) or 0<br /> args[&#039;votes&#039; .. i .. &#039;_8&#039;] = votesi<br /> valid[8] = valid[8] + votesi<br /> end<br /> if args[&#039;votes&#039; .. i .. &#039;_9&#039;] then<br /> if parsenum(args[&#039;votes&#039; .. i .. &#039;_9&#039;]) then showtotal.votes_9 = 1 end<br /> local votesi = parsenum(args[&#039;votes&#039; .. i .. &#039;_9&#039;]) or 0<br /> args[&#039;votes&#039; .. i .. &#039;_9&#039;] = votesi<br /> valid[9] = valid[9] + votesi<br /> end<br /> if args[&#039;votes&#039; .. i .. &#039;_10&#039;] then<br /> if parsenum(args[&#039;votes&#039; .. i .. &#039;_10&#039;]) then showtotal.votes_10 = 1 end<br /> local votesi = parsenum(args[&#039;votes&#039; .. i .. &#039;_10&#039;]) or 0<br /> args[&#039;votes&#039; .. i .. &#039;_10&#039;] = votesi<br /> valid[10] = valid[10] + votesi<br /> end<br /> if args[&#039;votes&#039; .. i .. &#039;_11&#039;] then<br /> if parsenum(args[&#039;votes&#039; .. i .. &#039;_11&#039;]) then showtotal.votes_11 = 1 end<br /> local votesi = parsenum(args[&#039;votes&#039; .. i .. &#039;_11&#039;]) or 0<br /> args[&#039;votes&#039; .. i .. &#039;_11&#039;] = votesi<br /> valid[11] = valid[11] + votesi<br /> end<br /> if args[&#039;votes&#039; .. i .. &#039;_12&#039;] then<br /> if parsenum(args[&#039;votes&#039; .. i .. &#039;_12&#039;]) then showtotal.votes_12 = 1 end<br /> local votesi = parsenum(args[&#039;votes&#039; .. i .. &#039;_12&#039;]) or 0<br /> args[&#039;votes&#039; .. i .. &#039;_12&#039;] = votesi<br /> valid[12] = valid[12] + votesi<br /> end<br /> if args[&#039;votes&#039; .. i .. &#039;_13&#039;] then<br /> if parsenum(args[&#039;votes&#039; .. i .. &#039;_13&#039;]) then showtotal.votes_13 = 1 end<br /> local votesi = parsenum(args[&#039;votes&#039; .. i .. &#039;_13&#039;]) or 0<br /> args[&#039;votes&#039; .. i .. &#039;_13&#039;] = votesi<br /> valid[13] = valid[13] + votesi<br /> end<br /> end<br /> end<br /> end<br /> <br /> local ovalid = {valid[1], valid[2], valid[3], valid[4], valid[5], valid[6], valid[7], valid[8], valid[9], valid[10], valid[11], valid[12], valid[13]}<br /> if has_votes or args[&#039;valid&#039;] then<br /> max_rows = max_rows + 1<br /> local i = max_rows<br /> table.insert(index, i)<br /> args[&#039;row&#039; .. i] = &#039;Total&#039;<br /> args[&#039;votes&#039; .. i] = showtotal.votes and valid[1] or nil<br /> args[&#039;votes&#039; .. i .. &#039;_2&#039;] = showtotal.votes_2 and valid[2] or nil<br /> args[&#039;votes&#039; .. i .. &#039;_3&#039;] = showtotal.votes_3 and valid[3] or nil<br /> args[&#039;votes&#039; .. i .. &#039;_4&#039;] = showtotal.votes_4 and valid[4] or nil<br /> args[&#039;votes&#039; .. i .. &#039;_5&#039;] = showtotal.votes_5 and valid[5] or nil<br /> args[&#039;votes&#039; .. i .. &#039;_6&#039;] = showtotal.votes_6 and valid[6] or nil<br /> args[&#039;votes&#039; .. i .. &#039;_7&#039;] = showtotal.votes_7 and valid[7] or nil<br /> args[&#039;votes&#039; .. i .. &#039;_8&#039;] = showtotal.votes_8 and valid[8] or nil<br /> args[&#039;votes&#039; .. i .. &#039;_9&#039;] = showtotal.votes_9 and valid[9] or nil<br /> args[&#039;votes&#039; .. i .. &#039;_10&#039;] = showtotal.votes_10 and valid[10] or nil<br /> args[&#039;votes&#039; .. i .. &#039;_11&#039;] = showtotal.votes_11 and valid[11] or nil<br /> args[&#039;votes&#039; .. i .. &#039;_12&#039;] = showtotal.votes_12 and valid[12] or nil<br /> args[&#039;votes&#039; .. i .. &#039;_13&#039;] = showtotal.votes_13 and valid[13] or nil<br /> args[&#039;colour&#039; .. i] = &#039;inherit&#039;<br /> args[&#039;color&#039; .. i] = &#039;inherit&#039;<br /> args[&#039;font-weight&#039; .. i] = &#039;bold&#039;<br /> args[&#039;class&#039; .. i] = &#039;sortbottom&#039;<br /> ovalid[1] = parsenum(args[&#039;valid&#039;]) or valid[1]<br /> ovalid[2] = parsenum(args[&#039;valid2&#039;]) or valid[2]<br /> ovalid[3] = parsenum(args[&#039;valid3&#039;]) or valid[3]<br /> ovalid[4] = parsenum(args[&#039;valid4&#039;]) or valid[4]<br /> ovalid[5] = parsenum(args[&#039;valid5&#039;]) or valid[5]<br /> ovalid[6] = parsenum(args[&#039;valid6&#039;]) or valid[6]<br /> ovalid[7] = parsenum(args[&#039;valid7&#039;]) or valid[7]<br /> ovalid[8] = parsenum(args[&#039;valid8&#039;]) or valid[8]<br /> ovalid[9] = parsenum(args[&#039;valid9&#039;]) or valid[9]<br /> ovalid[10] = parsenum(args[&#039;valid10&#039;]) or valid[10]<br /> ovalid[11] = parsenum(args[&#039;valid11&#039;]) or valid[11]<br /> ovalid[12] = parsenum(args[&#039;valid12&#039;]) or valid[12]<br /> ovalid[13] = parsenum(args[&#039;valid3&#039;]) or valid[13]<br /> end<br /> <br /> -- build the table<br /> local root = mw.html.create(args[&#039;embed&#039;] and &#039;&#039; or &#039;table&#039;)<br /> if args[&#039;embed&#039;] == nil then<br /> root<br /> :addClass(&#039;wikitable sortable&#039;)<br /> :tag(&#039;caption&#039;)<br /> :wikitext(args.caption)<br /> :done()<br /> end<br /> <br /> local topcell = nil<br /> if args[&#039;image&#039;] then<br /> topcell = root<br /> :tag(&#039;th&#039;)<br /> :css(&#039;text-align&#039;, &#039;center&#039;)<br /> :css(&#039;background&#039;, &#039;#F8F9FA&#039;)<br /> :wikitext(args[&#039;image&#039;])<br /> end<br /> if args[&#039;reporting&#039;] then<br /> if (topcell == nil) then<br /> topcell = root<br /> :tag(&#039;td&#039;)<br /> :css(&#039;text-align&#039;, &#039;center&#039;)<br /> :css(&#039;background&#039;, &#039;#F8F9FA&#039;)<br /> end<br /> topcell:tag(&#039;div&#039;)<br /> :addClass(&#039;center&#039;)<br /> :wikitext(frame:expandTemplate{<br /> title = &#039;percentage bar&#039;,<br /> args = {args.reporting, <br /> args.reporting .. &#039;% reporting&#039;,<br /> [&#039;width&#039;] = &#039;200px&#039;,<br /> [&#039;hex&#039;] = &#039;1BCE0E&#039;<br /> }})<br /> end<br /> <br /> row = args[&#039;embed&#039;] and mw.html.create(&#039;&#039;) or root:tag(&#039;tr&#039;)<br /> if not has_party then<br /> row<br /> :tag(&#039;th&#039;)<br /> :wikitext(&#039;Candidate&#039; or args.candtitle)<br /> :attr(&#039;scope&#039;, &#039;col&#039;)<br /> :attr(&#039;rowspan&#039;, 2)<br /> :done()<br /> cols = cols + 1<br /> else<br /> row<br /> :tag(&#039;th&#039;)<br /> :wikitext(&#039;Candidate&#039; or args.candtitle)<br /> :attr(&#039;scope&#039;, &#039;col&#039;)<br /> :attr(&#039;rowspan&#039;, 2)<br /> :attr(&#039;colspan&#039;, 2)<br /> :done()<br /> cols = cols + 2<br /> end<br /> if has_party then<br /> row<br /> :tag(&#039;th&#039;)<br /> :wikitext(&#039;Party&#039; or args.partytitle)<br /> :attr(&#039;rowspan&#039;, 2)<br /> :attr(&#039;scope&#039;, &#039;col&#039;)<br /> :done()<br /> cols = cols + 1<br /> end<br /> secondrow = args[&#039;embed&#039;] and mw.html.create(&#039;&#039;) or root:tag(&#039;tr&#039;)<br /> if not has_nopercentage then<br /> row<br /> :tag(&#039;th&#039;)<br /> :wikitext(&#039;First count&#039;)<br /> :attr(&#039;colspan&#039;, 2)<br /> if has_votes2 then<br /> row<br /> :tag(&#039;th&#039;)<br /> :wikitext(&#039;Second count&#039;)<br /> :attr(&#039;colspan&#039;, 2)<br /> end<br /> if has_votes3 then<br /> row<br /> :tag(&#039;th&#039;)<br /> :wikitext(&#039;Third count&#039;)<br /> :attr(&#039;colspan&#039;, 2)<br /> end<br /> if has_votes4 then<br /> row<br /> :tag(&#039;th&#039;)<br /> :wikitext(&#039;Fourth count&#039;)<br /> :attr(&#039;colspan&#039;, 2)<br /> end<br /> if has_votes5 then<br /> row<br /> :tag(&#039;th&#039;)<br /> :wikitext(&#039;Fifth count&#039;)<br /> :attr(&#039;colspan&#039;, 2)<br /> end<br /> if has_votes6 then<br /> row<br /> :tag(&#039;th&#039;)<br /> :wikitext(&#039;Sixth count&#039;)<br /> :attr(&#039;colspan&#039;, 2)<br /> end<br /> if has_votes7 then<br /> row<br /> :tag(&#039;th&#039;)<br /> :wikitext(&#039;Seventh count&#039;)<br /> :attr(&#039;colspan&#039;, 2)<br /> end<br /> if has_votes8 then<br /> row<br /> :tag(&#039;th&#039;)<br /> :wikitext(&#039;Eighth count&#039;)<br /> :attr(&#039;colspan&#039;, 2)<br /> end<br /> if has_votes9 then<br /> row<br /> :tag(&#039;th&#039;)<br /> :wikitext(&#039;Ninth count&#039;)<br /> :attr(&#039;colspan&#039;, 2)<br /> end<br /> if has_votes10 then<br /> row<br /> :tag(&#039;th&#039;)<br /> :wikitext(&#039;Tenth count&#039;)<br /> :attr(&#039;colspan&#039;, 2)<br /> end<br /> if has_votes11 then<br /> row<br /> :tag(&#039;th&#039;)<br /> :wikitext(&#039;Eleventh count&#039;)<br /> :attr(&#039;colspan&#039;, 2)<br /> end<br /> if has_votes12 then<br /> row<br /> :tag(&#039;th&#039;)<br /> :wikitext(&#039;Twelfth count&#039;)<br /> :attr(&#039;colspan&#039;, 2)<br /> end<br /> if has_votes13 then<br /> row<br /> :tag(&#039;th&#039;)<br /> :wikitext(&#039;Thirteenth count&#039;)<br /> :attr(&#039;colspan&#039;, 2)<br /> end<br /> elseif has_nopercentage then<br /> row<br /> :tag(&#039;th&#039;)<br /> :wikitext(&#039;First&lt;br&gt;preferences&#039;)<br /> :attr(&#039;colspan&#039;, 2)<br /> :attr(&#039;rowspan&#039;, 2)<br /> cols = cols + 2<br /> if has_votes2 then<br /> row<br /> :tag(&#039;th&#039;)<br /> :wikitext(&#039;Subsequent counts&#039;)<br /> :attr(&#039;colspan&#039;, 15)<br /> end<br /> end<br /> if not has_nopercentage then<br /> secondrow<br /> :tag(&#039;th&#039;)<br /> :wikitext(&#039;Votes&#039;)<br /> :attr(&#039;scope&#039;, &#039;col&#039;)<br /> :done()<br /> :tag(&#039;th&#039;)<br /> :wikitext(&#039;%&#039;)<br /> :attr(&#039;scope&#039;, &#039;col&#039;)<br /> :done()<br /> cols = cols + 2<br /> if has_votes2 then<br /> secondrow<br /> :tag(&#039;th&#039;)<br /> :wikitext(&#039;Votes&#039;)<br /> :attr(&#039;scope&#039;, &#039;col&#039;)<br /> :done()<br /> :tag(&#039;th&#039;)<br /> :wikitext(&#039;%&#039;)<br /> :attr(&#039;scope&#039;, &#039;col&#039;)<br /> :done()<br /> cols = cols + 2<br /> end<br /> if has_votes3 then<br /> secondrow<br /> :tag(&#039;th&#039;)<br /> :wikitext(&#039;Votes&#039;)<br /> :attr(&#039;scope&#039;, &#039;col&#039;)<br /> :done()<br /> :tag(&#039;th&#039;)<br /> :wikitext(&#039;%&#039;)<br /> :attr(&#039;scope&#039;, &#039;col&#039;)<br /> :done()<br /> cols = cols + 2<br /> end<br /> if has_votes4 then<br /> secondrow<br /> :tag(&#039;th&#039;)<br /> :wikitext(&#039;Votes&#039;)<br /> :attr(&#039;scope&#039;, &#039;col&#039;)<br /> :done()<br /> :tag(&#039;th&#039;)<br /> :wikitext(&#039;%&#039;)<br /> :attr(&#039;scope&#039;, &#039;col&#039;)<br /> :done()<br /> cols = cols + 2<br /> end<br /> if has_votes5 then<br /> secondrow<br /> :tag(&#039;th&#039;)<br /> :wikitext(&#039;Votes&#039;)<br /> :attr(&#039;scope&#039;, &#039;col&#039;)<br /> :done()<br /> :tag(&#039;th&#039;)<br /> :wikitext(&#039;%&#039;)<br /> :attr(&#039;scope&#039;, &#039;col&#039;)<br /> :done()<br /> cols = cols + 2<br /> end<br /> if has_votes6 then<br /> secondrow<br /> :tag(&#039;th&#039;)<br /> :wikitext(&#039;Votes&#039;)<br /> :attr(&#039;scope&#039;, &#039;col&#039;)<br /> :done()<br /> :tag(&#039;th&#039;)<br /> :wikitext(&#039;%&#039;)<br /> :attr(&#039;scope&#039;, &#039;col&#039;)<br /> :done()<br /> cols = cols + 2<br /> end<br /> if has_votes7 then<br /> secondrow<br /> :tag(&#039;th&#039;)<br /> :wikitext(&#039;Votes&#039;)<br /> :attr(&#039;scope&#039;, &#039;col&#039;)<br /> :done()<br /> :tag(&#039;th&#039;)<br /> :wikitext(&#039;%&#039;)<br /> :attr(&#039;scope&#039;, &#039;col&#039;)<br /> :done()<br /> cols = cols + 2<br /> end<br /> if has_votes8 then<br /> secondrow<br /> :tag(&#039;th&#039;)<br /> :wikitext(&#039;Votes&#039;)<br /> :attr(&#039;scope&#039;, &#039;col&#039;)<br /> :done()<br /> :tag(&#039;th&#039;)<br /> :wikitext(&#039;%&#039;)<br /> :attr(&#039;scope&#039;, &#039;col&#039;)<br /> :done()<br /> cols = cols + 2<br /> end<br /> if has_votes9 then<br /> secondrow<br /> :tag(&#039;th&#039;)<br /> :wikitext(&#039;Votes&#039;)<br /> :attr(&#039;scope&#039;, &#039;col&#039;)<br /> :done()<br /> :tag(&#039;th&#039;)<br /> :wikitext(&#039;%&#039;)<br /> :attr(&#039;scope&#039;, &#039;col&#039;)<br /> :done()<br /> cols = cols + 2<br /> end<br /> if has_votes10 then<br /> secondrow<br /> :tag(&#039;th&#039;)<br /> :wikitext(&#039;Votes&#039;)<br /> :attr(&#039;scope&#039;, &#039;col&#039;)<br /> :done()<br /> :tag(&#039;th&#039;)<br /> :wikitext(&#039;%&#039;)<br /> :attr(&#039;scope&#039;, &#039;col&#039;)<br /> :done()<br /> cols = cols + 2<br /> end<br /> if has_votes11 then<br /> secondrow<br /> :tag(&#039;th&#039;)<br /> :wikitext(&#039;Votes&#039;)<br /> :attr(&#039;scope&#039;, &#039;col&#039;)<br /> :done()<br /> :tag(&#039;th&#039;)<br /> :wikitext(&#039;%&#039;)<br /> :attr(&#039;scope&#039;, &#039;col&#039;)<br /> :done()<br /> cols = cols + 2<br /> end<br /> if has_votes12 then<br /> secondrow<br /> :tag(&#039;th&#039;)<br /> :wikitext(&#039;Votes&#039;)<br /> :attr(&#039;scope&#039;, &#039;col&#039;)<br /> :done()<br /> :tag(&#039;th&#039;)<br /> :wikitext(&#039;%&#039;)<br /> :attr(&#039;scope&#039;, &#039;col&#039;)<br /> :done()<br /> cols = cols + 2<br /> end<br /> if has_votes13 then<br /> secondrow<br /> :tag(&#039;th&#039;)<br /> :wikitext(&#039;Votes&#039;)<br /> :attr(&#039;scope&#039;, &#039;col&#039;)<br /> :done()<br /> :tag(&#039;th&#039;)<br /> :wikitext(&#039;%&#039;)<br /> :attr(&#039;scope&#039;, &#039;col&#039;)<br /> :done()<br /> cols = cols + 2<br /> end<br /> elseif has_nopercentage then<br /> if has_votes2 then<br /> secondrow<br /> :tag(&#039;th&#039;)<br /> :wikitext(&#039;2&#039;)<br /> :attr(&#039;scope&#039;, &#039;col&#039;)<br /> :done()<br /> cols = cols + 1<br /> end<br /> if has_votes3 then<br /> secondrow<br /> :tag(&#039;th&#039;)<br /> :wikitext(&#039;3&#039;)<br /> :attr(&#039;scope&#039;, &#039;col&#039;)<br /> :done()<br /> cols = cols + 1<br /> end<br /> if has_votes4 then<br /> secondrow<br /> :tag(&#039;th&#039;)<br /> :wikitext(&#039;4&#039;)<br /> :attr(&#039;scope&#039;, &#039;col&#039;)<br /> :done()<br /> cols = cols + 1<br /> end<br /> if has_votes5 then<br /> secondrow<br /> :tag(&#039;th&#039;)<br /> :wikitext(&#039;5&#039;)<br /> :attr(&#039;scope&#039;, &#039;col&#039;)<br /> :done()<br /> cols = cols + 1<br /> end<br /> if has_votes6 then<br /> secondrow<br /> :tag(&#039;th&#039;)<br /> :wikitext(&#039;6&#039;)<br /> :attr(&#039;scope&#039;, &#039;col&#039;)<br /> :done()<br /> cols = cols + 1<br /> end<br /> if has_votes7 then<br /> secondrow<br /> :tag(&#039;th&#039;)<br /> :wikitext(&#039;7&#039;)<br /> :attr(&#039;scope&#039;, &#039;col&#039;)<br /> :done()<br /> cols = cols + 1<br /> end<br /> if has_votes8 then<br /> secondrow<br /> :tag(&#039;th&#039;)<br /> :wikitext(&#039;8&#039;)<br /> :attr(&#039;scope&#039;, &#039;col&#039;)<br /> :done()<br /> cols = cols + 1<br /> end<br /> if has_votes9 then<br /> secondrow<br /> :tag(&#039;th&#039;)<br /> :wikitext(&#039;9&#039;)<br /> :attr(&#039;scope&#039;, &#039;col&#039;)<br /> :done()<br /> cols = cols + 1<br /> end<br /> if has_votes10 then<br /> secondrow<br /> :tag(&#039;th&#039;)<br /> :wikitext(&#039;10&#039;)<br /> :attr(&#039;scope&#039;, &#039;col&#039;)<br /> :done()<br /> cols = cols + 1<br /> end<br /> if has_votes11 then<br /> secondrow<br /> :tag(&#039;th&#039;)<br /> :wikitext(&#039;11&#039;)<br /> :attr(&#039;scope&#039;, &#039;col&#039;)<br /> :done()<br /> cols = cols + 1<br /> end<br /> if has_votes12 then<br /> secondrow<br /> :tag(&#039;th&#039;)<br /> :wikitext(&#039;12&#039;)<br /> :attr(&#039;scope&#039;, &#039;col&#039;)<br /> :done()<br /> cols = cols + 1<br /> end<br /> if has_votes13 then<br /> secondrow<br /> :tag(&#039;th&#039;)<br /> :wikitext(&#039;13&#039;)<br /> :attr(&#039;scope&#039;, &#039;col&#039;)<br /> :done()<br /> cols = cols + 1<br /> end<br /> end<br /> <br /> if topcell then<br /> topcell:attr(&#039;colspan&#039;, cols)<br /> end<br /> <br /> local rsuff = (rounds &gt; 1) and {&#039;&#039;, &#039;_2&#039;} or (rounds &gt; 2) and {&#039;&#039;, &#039;_3&#039;} or (rounds &gt; 3) and {&#039;&#039;, &#039;_4&#039;} or (rounds &gt; 4) and {&#039;&#039;, &#039;_5&#039;} or (rounds &gt; 5) and {&#039;&#039;, &#039;_6&#039;} or (rounds &gt; 6) and {&#039;&#039;, &#039;_7&#039;} or (rounds &gt; 7) and {&#039;&#039;, &#039;_8&#039;} or (rounds &gt; 8) and {&#039;&#039;, &#039;_9&#039;} or (rounds &gt; 9) and {&#039;&#039;, &#039;_10&#039;} or (rounds &gt; 10) and {&#039;&#039;, &#039;_11&#039;} or (rounds &gt; 11) and {&#039;&#039;, &#039;_12&#039;} or (rounds &gt; 12) and {&#039;&#039;, &#039;_13&#039;} or {&#039;&#039;}<br /> for i, v in ipairs(index) do<br /> local has_votesrow = args[&#039;votes&#039; .. v] or args[&#039;ivotes&#039; .. v] or args[&#039;avotes&#039; .. v] or args[&#039;ipct&#039; .. v] or args[&#039;apct&#039; .. v] or args[&#039;atotal&#039; .. v]<br /> local has_votesrow2 = args[&#039;votes&#039; .. v .. &#039;_2&#039;] or args[&#039;ivotes&#039; .. v .. &#039;_2&#039;] or args[&#039;avotes&#039; .. v .. &#039;_2&#039;] or args[&#039;ipct&#039; .. v .. &#039;_2&#039;]<br /> local has_votesrow3 = args[&#039;votes&#039; .. v .. &#039;_3&#039;] or args[&#039;ivotes&#039; .. v .. &#039;_3&#039;] or args[&#039;avotes&#039; .. v .. &#039;_3&#039;] or args[&#039;ipct&#039; .. v .. &#039;_3&#039;]<br /> local has_votesrow4 = args[&#039;votes&#039; .. v .. &#039;_4&#039;] or args[&#039;ivotes&#039; .. v .. &#039;_4&#039;] or args[&#039;avotes&#039; .. v .. &#039;_4&#039;] or args[&#039;ipct&#039; .. v .. &#039;_4&#039;]<br /> local has_votesrow5 = args[&#039;votes&#039; .. v .. &#039;_5&#039;] or args[&#039;ivotes&#039; .. v .. &#039;_5&#039;] or args[&#039;avotes&#039; .. v .. &#039;_5&#039;] or args[&#039;ipct&#039; .. v .. &#039;_5&#039;]<br /> local has_votesrow6 = args[&#039;votes&#039; .. v .. &#039;_6&#039;] or args[&#039;ivotes&#039; .. v .. &#039;_6&#039;] or args[&#039;avotes&#039; .. v .. &#039;_6&#039;] or args[&#039;ipct&#039; .. v .. &#039;_6&#039;]<br /> local has_votesrow7 = args[&#039;votes&#039; .. v .. &#039;_7&#039;] or args[&#039;ivotes&#039; .. v .. &#039;_7&#039;] or args[&#039;avotes&#039; .. v .. &#039;_7&#039;] or args[&#039;ipct&#039; .. v .. &#039;_7&#039;]<br /> local has_votesrow8 = args[&#039;votes&#039; .. v .. &#039;_8&#039;] or args[&#039;ivotes&#039; .. v .. &#039;_8&#039;] or args[&#039;avotes&#039; .. v .. &#039;_8&#039;] or args[&#039;ipct&#039; .. v .. &#039;_8&#039;]<br /> local has_votesrow9 = args[&#039;votes&#039; .. v .. &#039;_9&#039;] or args[&#039;ivotes&#039; .. v .. &#039;_9&#039;] or args[&#039;avotes&#039; .. v .. &#039;_9&#039;] or args[&#039;ipct&#039; .. v .. &#039;_9&#039;]<br /> local has_votesrow10 = args[&#039;votes&#039; .. v .. &#039;_10&#039;] or args[&#039;ivotes&#039; .. v .. &#039;_10&#039;] or args[&#039;avotes&#039; .. v .. &#039;_10&#039;] or args[&#039;ipct&#039; .. v .. &#039;_10&#039;]<br /> local has_votesrow11 = args[&#039;votes&#039; .. v .. &#039;_11&#039;] or args[&#039;ivotes&#039; .. v .. &#039;_11&#039;] or args[&#039;avotes&#039; .. v .. &#039;_11&#039;] or args[&#039;ipct&#039; .. v .. &#039;_11&#039;]<br /> local has_votesrow12 = args[&#039;votes&#039; .. v .. &#039;_12&#039;] or args[&#039;ivotes&#039; .. v .. &#039;_12&#039;] or args[&#039;avotes&#039; .. v .. &#039;_12&#039;] or args[&#039;ipct&#039; .. v .. &#039;_12&#039;]<br /> local has_votesrow13 = args[&#039;votes&#039; .. v .. &#039;_13&#039;] or args[&#039;ivotes&#039; .. v .. &#039;_13&#039;] or args[&#039;avotes&#039; .. v .. &#039;_13&#039;] or args[&#039;ipct&#039; .. v .. &#039;_13&#039;]<br /> row = root:tag(&#039;tr&#039;)<br /> :addClass(args[&#039;class&#039; .. v])<br /> :css(&#039;font-weight&#039;, args[&#039;font-weight&#039; .. v])<br /> <br /> -- determine the colors<br /> local color = get_color(args[&#039;colour&#039; .. v] or args[&#039;color&#039; .. v] or nil, args[&#039;party&#039; .. v])<br /> local rcolor = get_color(args[&#039;rcolour&#039; .. v] or args[&#039;rcolor&#039; .. v] or nil)<br /> <br /> if args[&#039;row&#039; .. v] and has_party then<br /> row<br /> :css(&#039;background-color&#039;, rcolor)<br /> :tag(&#039;td&#039;)<br /> :attr(&#039;colspan&#039;, 3)<br /> :wikitext(args[&#039;row&#039; .. v])<br /> end<br /> if has_party and not args[&#039;row&#039; .. v] then<br /> row<br /> :tag(&#039;td&#039;)<br /> :css(&#039;width&#039;, &#039;0px&#039;)<br /> :css(&#039;background-color&#039;, color)<br /> end<br /> if args[&#039;cand&#039; .. v] then<br /> row<br /> :css(&#039;background-color&#039;, rcolor)<br /> :tag(&#039;td&#039;)<br /> :attr(&#039;rowspan&#039;, args[&#039;candspan&#039; .. v] or args[&#039;aspan&#039; .. v])<br /> :wikitext(args[&#039;cand&#039; .. v])<br /> end<br /> if has_party and not args[&#039;row&#039; .. v] then<br /> row<br /> :tag(&#039;td&#039;)<br /> :wikitext(args[&#039;party&#039; .. v])<br /> end<br /> if has_votes then<br /> row:tag(&#039;td&#039;)<br /> :css(&#039;text-align&#039;, &#039;right&#039;)<br /> :wikitext(fmt(args[&#039;votes&#039; .. v]))<br /> row:tag(&#039;td&#039;)<br /> :css(&#039;text-align&#039;, &#039;right&#039;)<br /> :wikitext(pct(args[&#039;votes&#039; .. v], valid[1]))<br /> end<br /> if args[&#039;votes&#039; .. v .. &#039;_2&#039;] then<br /> row:tag(&#039;td&#039;)<br /> :css(&#039;text-align&#039;, &#039;right&#039;)<br /> :wikitext(fmt(args[&#039;votes&#039; .. v .. &#039;_2&#039;]))<br /> end<br /> if args[&#039;votes&#039; .. v .. &#039;_2&#039;] and not has_nopercentage then<br /> row:tag(&#039;td&#039;)<br /> :css(&#039;text-align&#039;, &#039;right&#039;)<br /> :wikitext(pct(args[&#039;votes&#039; .. v .. &#039;_2&#039;], valid[2]))<br /> end<br /> if args[&#039;votes&#039; .. v .. &#039;_3&#039;] then<br /> row:tag(&#039;td&#039;)<br /> :css(&#039;text-align&#039;, &#039;right&#039;)<br /> :wikitext(fmt(args[&#039;votes&#039; .. v .. &#039;_3&#039;]))<br /> end<br /> if args[&#039;votes&#039; .. v .. &#039;_3&#039;] and not has_nopercentage then<br /> row:tag(&#039;td&#039;)<br /> :css(&#039;text-align&#039;, &#039;right&#039;)<br /> :wikitext(pct(args[&#039;votes&#039; .. v .. &#039;_3&#039;], valid[3]))<br /> end<br /> if args[&#039;votes&#039; .. v .. &#039;_4&#039;] then<br /> row:tag(&#039;td&#039;)<br /> :css(&#039;text-align&#039;, &#039;right&#039;)<br /> :wikitext(fmt(args[&#039;votes&#039; .. v .. &#039;_4&#039;]))<br /> end<br /> if args[&#039;votes&#039; .. v .. &#039;_4&#039;] and not has_nopercentage then<br /> row:tag(&#039;td&#039;)<br /> :css(&#039;text-align&#039;, &#039;right&#039;)<br /> :wikitext(pct(args[&#039;votes&#039; .. v .. &#039;_4&#039;], valid[4]))<br /> end<br /> if args[&#039;votes&#039; .. v .. &#039;_5&#039;] then<br /> row:tag(&#039;td&#039;)<br /> :css(&#039;text-align&#039;, &#039;right&#039;)<br /> :wikitext(fmt(args[&#039;votes&#039; .. v .. &#039;_5&#039;]))<br /> end<br /> if args[&#039;votes&#039; .. v .. &#039;_5&#039;] and not has_nopercentage then<br /> row:tag(&#039;td&#039;)<br /> :css(&#039;text-align&#039;, &#039;right&#039;)<br /> :wikitext(pct(args[&#039;votes&#039; .. v .. &#039;_5&#039;], valid[5]))<br /> end<br /> if args[&#039;votes&#039; .. v .. &#039;_6&#039;] then<br /> row:tag(&#039;td&#039;)<br /> :css(&#039;text-align&#039;, &#039;right&#039;)<br /> :wikitext(fmt(args[&#039;votes&#039; .. v .. &#039;_6&#039;]))<br /> end<br /> if args[&#039;votes&#039; .. v .. &#039;_6&#039;] and not has_nopercentage then<br /> row:tag(&#039;td&#039;)<br /> :css(&#039;text-align&#039;, &#039;right&#039;)<br /> :wikitext(pct(args[&#039;votes&#039; .. v .. &#039;_6&#039;], valid[6]))<br /> end<br /> if args[&#039;votes&#039; .. v .. &#039;_7&#039;] then<br /> row:tag(&#039;td&#039;)<br /> :css(&#039;text-align&#039;, &#039;right&#039;)<br /> :wikitext(fmt(args[&#039;votes&#039; .. v .. &#039;_7&#039;]))<br /> end<br /> if args[&#039;votes&#039; .. v .. &#039;_7&#039;] and not has_nopercentage then<br /> row:tag(&#039;td&#039;)<br /> :css(&#039;text-align&#039;, &#039;right&#039;)<br /> :wikitext(pct(args[&#039;votes&#039; .. v .. &#039;_7&#039;], valid[7]))<br /> end<br /> if args[&#039;votes&#039; .. v .. &#039;_8&#039;] then<br /> row:tag(&#039;td&#039;)<br /> :css(&#039;text-align&#039;, &#039;right&#039;)<br /> :wikitext(fmt(args[&#039;votes&#039; .. v .. &#039;_8&#039;]))<br /> end<br /> if args[&#039;votes&#039; .. v .. &#039;_8&#039;] and not has_nopercentage then<br /> row:tag(&#039;td&#039;)<br /> :css(&#039;text-align&#039;, &#039;right&#039;)<br /> :wikitext(pct(args[&#039;votes&#039; .. v .. &#039;_8&#039;], valid[8]))<br /> end<br /> if args[&#039;votes&#039; .. v .. &#039;_9&#039;] then<br /> row:tag(&#039;td&#039;)<br /> :css(&#039;text-align&#039;, &#039;right&#039;)<br /> :wikitext(fmt(args[&#039;votes&#039; .. v .. &#039;_9&#039;]))<br /> end<br /> if args[&#039;votes&#039; .. v .. &#039;_9&#039;] and not has_nopercentage then<br /> row:tag(&#039;td&#039;)<br /> :css(&#039;text-align&#039;, &#039;right&#039;)<br /> :wikitext(pct(args[&#039;votes&#039; .. v .. &#039;_9&#039;], valid[9]))<br /> end<br /> if args[&#039;votes&#039; .. v .. &#039;_10&#039;] then<br /> row:tag(&#039;td&#039;)<br /> :css(&#039;text-align&#039;, &#039;right&#039;)<br /> :wikitext(fmt(args[&#039;votes&#039; .. v .. &#039;_10&#039;]))<br /> end<br /> if args[&#039;votes&#039; .. v .. &#039;_10&#039;] and not has_nopercentage then<br /> row:tag(&#039;td&#039;)<br /> :css(&#039;text-align&#039;, &#039;right&#039;)<br /> :wikitext(pct(args[&#039;votes&#039; .. v .. &#039;_10&#039;], valid[10]))<br /> end<br /> if args[&#039;votes&#039; .. v .. &#039;_11&#039;] then<br /> row:tag(&#039;td&#039;)<br /> :css(&#039;text-align&#039;, &#039;right&#039;)<br /> :wikitext(fmt(args[&#039;votes&#039; .. v .. &#039;_11&#039;]))<br /> end<br /> if args[&#039;votes&#039; .. v .. &#039;_11&#039;] and not has_nopercentage then<br /> row:tag(&#039;td&#039;)<br /> :css(&#039;text-align&#039;, &#039;right&#039;)<br /> :wikitext(pct(args[&#039;votes&#039; .. v .. &#039;_11&#039;], valid[11]))<br /> end<br /> if args[&#039;votes&#039; .. v .. &#039;_12&#039;] then<br /> row:tag(&#039;td&#039;)<br /> :css(&#039;text-align&#039;, &#039;right&#039;)<br /> :wikitext(fmt(args[&#039;votes&#039; .. v .. &#039;_12&#039;]))<br /> end<br /> if args[&#039;votes&#039; .. v .. &#039;_12&#039;] and not has_nopercentage then<br /> row:tag(&#039;td&#039;)<br /> :css(&#039;text-align&#039;, &#039;right&#039;)<br /> :wikitext(pct(args[&#039;votes&#039; .. v .. &#039;_12&#039;], valid[12]))<br /> end<br /> if args[&#039;votes&#039; .. v .. &#039;_13&#039;] then<br /> row:tag(&#039;td&#039;)<br /> :css(&#039;text-align&#039;, &#039;right&#039;)<br /> :wikitext(fmt(args[&#039;votes&#039; .. v .. &#039;_13&#039;]))<br /> end<br /> if args[&#039;votes&#039; .. v .. &#039;_13&#039;] and not has_nopercentage then<br /> row:tag(&#039;td&#039;)<br /> :css(&#039;text-align&#039;, &#039;right&#039;)<br /> :wikitext(pct(args[&#039;votes&#039; .. v .. &#039;_13&#039;], valid[13]))<br /> end<br /> end<br /> <br /> -- separating line<br /> if args[&#039;valid&#039;] or args[&#039;invalidblank&#039;] or args[&#039;invalid&#039;] or args[&#039;totalvotes&#039;] or args[&#039;electorate&#039;] or args[&#039;turnout&#039;] or args[&#039;source&#039;] then<br /> row = root<br /> :tag(&#039;tr&#039;)<br /> :addClass(&#039;sortbottom&#039;)<br /> row<br /> :tag(&#039;td&#039;)<br /> :css(&#039;background&#039;, &#039;#eaecf0&#039;)<br /> :attr(&#039;colspan&#039;, cols)<br /> end<br /> -- valid votes<br /> <br /> local cs = 3 - (has_party and 0 or 2)<br /> <br /> if args[&#039;invalidblank&#039;] or args[&#039;invalid&#039;] then<br /> row = root<br /> :tag(&#039;tr&#039;)<br /> :addClass(&#039;sortbottom&#039;)<br /> :css(&#039;text-align&#039;, &#039;right&#039;)<br /> row<br /> :tag(&#039;th&#039;)<br /> :wikitext(&#039;Valid votes&#039;)<br /> :attr(&#039;scope&#039;, &#039;row&#039;)<br /> :attr(&#039;colspan&#039;, cs)<br /> :css(&#039;text-align&#039;, &#039;left&#039;)<br /> :css(&#039;font-weight&#039;, &#039;normal&#039;)<br /> :css(&#039;background&#039;, &#039;inherit&#039;)<br /> :tag(&#039;td&#039;)<br /> :wikitext(fmt(ovalid[1]))<br /> :tag(&#039;td&#039;)<br /> :wikitext(pct(ovalid[1], ovalid[1] + invalidblank[1] + invalid[1] + blank[1]))<br /> end<br /> -- invalid votes<br /> if args[&#039;invalidblank&#039;] then<br /> row = root:tag(&#039;tr&#039;)<br /> :addClass(&#039;sortbottom&#039;)<br /> :css(&#039;text-align&#039;, &#039;right&#039;)<br /> row<br /> :tag(&#039;th&#039;)<br /> :wikitext(&#039;Invalid/blank votes&#039;)<br /> :wikitext(args.invalidnote)<br /> :attr(&#039;scope&#039;, &#039;row&#039;)<br /> :attr(&#039;colspan&#039;, cs)<br /> :css(&#039;text-align&#039;, &#039;left&#039;)<br /> :css(&#039;font-weight&#039;, &#039;normal&#039;)<br /> :css(&#039;background&#039;, &#039;inherit&#039;)<br /> :tag(&#039;td&#039;)<br /> :wikitext(fmt(invalidblank[1]))<br /> :tag(&#039;td&#039;)<br /> :wikitext(pct(invalidblank[1], ovalid[1] + invalidblank[1]))<br /> end<br /> if args[&#039;invalid&#039;] then<br /> row = root:tag(&#039;tr&#039;)<br /> :addClass(&#039;sortbottom&#039;)<br /> :css(&#039;text-align&#039;, &#039;right&#039;)<br /> row<br /> :tag(&#039;th&#039;)<br /> :wikitext(&#039;Invalid votes&#039;)<br /> :wikitext(args.invalidnote)<br /> :attr(&#039;scope&#039;, &#039;row&#039;)<br /> :attr(&#039;colspan&#039;, cs)<br /> :css(&#039;text-align&#039;, &#039;left&#039;)<br /> :css(&#039;font-weight&#039;, &#039;normal&#039;)<br /> :css(&#039;background&#039;, &#039;inherit&#039;)<br /> :tag(&#039;td&#039;)<br /> :wikitext(fmt(invalid[1]))<br /> :tag(&#039;td&#039;)<br /> :wikitext(pct(invalid[1], ovalid[1] + invalid[1] + blank[1]))<br /> end<br /> -- blank votes<br /> if args[&#039;blank&#039;] then<br /> row = root:tag(&#039;tr&#039;)<br /> :addClass(&#039;sortbottom&#039;)<br /> :css(&#039;text-align&#039;, &#039;right&#039;)<br /> row<br /> :tag(&#039;th&#039;)<br /> :wikitext(&#039;Blank votes&#039;)<br /> :attr(&#039;scope&#039;, &#039;row&#039;)<br /> :attr(&#039;colspan&#039;, cs)<br /> :css(&#039;text-align&#039;, &#039;left&#039;)<br /> :css(&#039;font-weight&#039;, &#039;normal&#039;)<br /> :css(&#039;background&#039;, &#039;inherit&#039;)<br /> row<br /> :tag(&#039;td&#039;)<br /> :wikitext(fmt(blank[1]))<br /> :tag(&#039;td&#039;)<br /> :wikitext(pct(blank[1], ovalid[1] + invalid[1] + blank[1]))<br /> end<br /> -- total<br /> if args[&#039;invalidblank&#039;] or args[&#039;invalid&#039;] or args[&#039;totalvotes&#039;] then<br /> row = root:tag(&#039;tr&#039;)<br /> :addClass(&#039;sortbottom&#039;)<br /> :css(&#039;font-weight&#039;, &#039;bold&#039;)<br /> :css(&#039;text-align&#039;, &#039;right&#039;)<br /> row<br /> :tag(&#039;th&#039;)<br /> :wikitext(args.tvtitle or &#039;Total votes&#039;)<br /> :attr(&#039;scope&#039;, &#039;row&#039;)<br /> :attr(&#039;colspan&#039;, cs)<br /> :css(&#039;text-align&#039;, &#039;left&#039;)<br /> :css(&#039;background&#039;, &#039;inherit&#039;)<br /> :css(&#039;color&#039;, &#039;inherit&#039;)<br /> if not args[&#039;totalvotes&#039;] and args[&#039;invalid&#039;] or not args[&#039;totalvotes&#039;] and args[&#039;invalidblank&#039;] then<br /> row<br /> :tag(&#039;td&#039;)<br /> :wikitext(fmt(ovalid[1] + invalidblank[1] + invalid[1] + blank[1]))<br /> :tag(&#039;td&#039;)<br /> :wikitext(pct(1, 1))<br /> elseif args[&#039;totalvotes&#039;] then<br /> row<br /> :tag(&#039;td&#039;)<br /> :wikitext(fmt(args.totalvotes))<br /> :tag(&#039;td&#039;)<br /> :wikitext(&#039;–&#039;)<br /> end<br /> end<br /> -- registered<br /> if args[&#039;electorate&#039;] or args[&#039;turnout&#039;] then<br /> row = root:tag(&#039;tr&#039;)<br /> :addClass(&#039;sortbottom&#039;)<br /> :css(&#039;text-align&#039;, &#039;right&#039;)<br /> row<br /> :tag(&#039;th&#039;)<br /> :wikitext(&#039;Registered voters/turnout&#039;)<br /> :attr(&#039;scope&#039;, &#039;row&#039;)<br /> :attr(&#039;colspan&#039;, cs)<br /> :css(&#039;text-align&#039;, &#039;left&#039;)<br /> :css(&#039;font-weight&#039;, &#039;normal&#039;)<br /> :css(&#039;color&#039;, &#039;inherit&#039;)<br /> :css(&#039;background&#039;, &#039;inherit&#039;)<br /> row<br /> :tag(&#039;td&#039;)<br /> :wikitext(fmt(electorate[1]))<br /> if args[&#039;invalidblank&#039;] and args[&#039;electorate&#039;] and not args[&#039;totalvotes&#039;] or args[&#039;invalid&#039;] and args[&#039;electorate&#039;] and not args[&#039;totalvotes&#039;] then<br /> row<br /> :tag(&#039;td&#039;)<br /> :wikitext(args.turnout or pct(ovalid[1] + invalidblank[1] + invalid[1] + blank[1], electorate[1]))<br /> elseif args[&#039;totalvotes&#039;] and args[&#039;electorate&#039;] then<br /> row<br /> :tag(&#039;td&#039;)<br /> :wikitext(args.turnout or pct(totalvotes[1], electorate[1]))<br /> elseif args[&#039;electorate&#039;] then<br /> row<br /> :tag(&#039;td&#039;)<br /> :wikitext(args.turnout or &#039;–&#039;)<br /> else<br /> row<br /> :tag(&#039;td&#039;)<br /> :wikitext(args.turnout)<br /> end<br /> if args[&#039;majority&#039;] then<br /> if args[&#039;invalid&#039;] or args[&#039;electorate&#039;] then<br /> row = root<br /> :tag(&#039;tr&#039;)<br /> :addClass(&#039;sortbottom&#039;)<br /> row<br /> :tag(&#039;td&#039;)<br /> :css(&#039;background&#039;, &#039;#eaecf0&#039;)<br /> :attr(&#039;colspan&#039;, cols)<br /> end<br /> row = root<br /> :tag(&#039;tr&#039;)<br /> :addClass(&#039;sortbottom&#039;)<br /> :css(&#039;text-align&#039;, &#039;right&#039;)<br /> row<br /> :tag(&#039;th&#039;)<br /> :wikitext(&#039;Majority&#039;)<br /> :attr(&#039;scope&#039;, &#039;row&#039;)<br /> :attr(&#039;colspan&#039;, cs)<br /> :css(&#039;text-align&#039;, &#039;left&#039;)<br /> :css(&#039;font-weight&#039;, &#039;normal&#039;)<br /> :css(&#039;background&#039;, &#039;inherit&#039;)<br /> :tag(&#039;td&#039;)<br /> :wikitext(fmt(majority[k]))<br /> :tag(&#039;td&#039;)<br /> :wikitext(fmt(majoritypct[k]))<br /> end<br /> end<br /> if args[&#039;result&#039;] then<br /> row = root:tag(&#039;tr&#039;)<br /> :addClass(&#039;sortbottom&#039;)<br /> -- determine the color<br /> local color = get_color(args[&#039;resultcolour&#039;] or nil, args[&#039;result&#039;])<br /> if args[&#039;resultsw&#039;] then<br /> row<br /> :tag(&#039;td&#039;)<br /> :css(&#039;background-color&#039;, color)<br /> row<br /> :tag(&#039;td&#039;)<br /> :attr(&#039;colspan&#039;, 2)<br /> :wikitext(args[&#039;result&#039;])<br /> row<br /> :tag(&#039;td&#039;)<br /> :attr(&#039;colspan&#039;, 2)<br /> :css(&#039;text-align&#039;, &#039;right&#039;)<br /> :wikitext(&#039;Swing&#039;)<br /> row<br /> :tag(&#039;td&#039;)<br /> :css(&#039;text-align&#039;, &#039;right&#039;)<br /> :wikitext(args[&#039;resultsw&#039;])<br /> else<br /> row<br /> :tag(&#039;td&#039;)<br /> :css(&#039;background-color&#039;, color)<br /> row<br /> :tag(&#039;td&#039;)<br /> :attr(&#039;colspan&#039;, cols - 1)<br /> :wikitext(args[&#039;result&#039;])<br /> end<br /> end<br /> if args[&#039;source&#039;] then<br /> row = root:tag(&#039;tr&#039;)<br /> :addClass(&#039;sortbottom&#039;)<br /> :css(&#039;text-align&#039;, &#039;right&#039;)<br /> row:tag(&#039;td&#039;)<br /> :wikitext(&#039;Source: &#039;, args.source)<br /> :attr(&#039;colspan&#039;, cols)<br /> :css(&#039;text-align&#039;, &#039;left&#039;)<br /> end<br /> if args[&#039;embedded&#039;] then<br /> root:wikitext(args[&#039;embedded&#039;])<br /> end<br /> return tostring(root) .. tracking<br /> end<br /> <br /> return p</div> Closed Limelike Curves