Module:Policy

local p = {} local u = require('Module:Util')

function p.Policy(frame) local policy = frame.args['policy'] local policyText = '' --		if u.exists(policy) then policyText = policy end local templates = frame.args['template'] if u.exists(templates) then templates = mw.text.split(templates, ',') for k,v in ipairs(templates) do			if k == 1 then policyText = policyText .. v			else policyText = policyText .. frame:expandTemplate{title = 'dot'} .. ' ' .. v			end end end local discussion = frame.args['discussion'] if u.exists(discussion) == false then discussion = '?' end local vote = frame.args['vote'] if u.exists(vote) == false then vote = '?' end local voteDate = frame.args['date'] if u.exists(voteDate) == false then voteDate = os.date end local voteResult = frame.args['result'] if u.exists(voteResult) then voteDate = voteDate .. frame:expandTemplate{ title='dot'} .. ' ' .. voteResult end local amendments = frame.args['amendments'] if u.exists(frame.args['amendments']) then amendments = mw.text.split(amendments, ';') end --}}}| Related topics 		> {{{related1}}}{{#if:{{{related2|}}}| {{dot}} {{{related2}}}}}{{#if:{{{related3|}}}| {{dot}} {{{related3}}}}}{{#if:{{{related4|}}}| {{dot}} {{{related4}}}}}{{#if:{{{related5|}}}| {{dot}} {{{related5}}}}} local related = frame.args['related'] if u.exists(related) then related = mw.text.split(related, ',') relatedString = '' if u.exists(related[1]) then for k,v in ipairs(related) do				if k == 1 then relatedString = relatedString .. v				else relatedString = relatedString .. frame:expandTemplate{ title = 'dot'} .. ' ' .. v				end end end relatedFrame = mw.html.create('tr') :tag('td') :wikitext('Related topics') :done end

local policyTable = mw.html.create('table') :addClass('va-table va-table-center') :tag('tr') :tag('th') :attr('colspan', 2) :wikitext('Policy vote forum overview') :done :done :tag('tr') :tag('td') :wikitext('Proposal discussion') :done :tag('td') :wikitext(discussion) :done :done :tag('tr') :tag('td') :wikitext('result') :done :tag('td') :wikitext(voteDate) :done :done :tag('tr') :tag('td') :wikitext('Policy & templates') :done :tag('td') :wikitext(policyText) :done :done --}}}| Amendment 1 		 {{{amendment1|}}}{{#if:{{{date1|}}}| {{dot}} {{{date1}}}}}{{#if:{{{result1|}}}| {{dot}} {{{result1}}}}}  }}		{{#if:{{{amendment2|}}}|  Amendment 2 		 {{{amendment2|}}}{{#if:{{{date2|}}}| {{dot}} {{{date2}}}}}{{#if:{{{result2|}}}| {{dot}} {{{result2}}}}}  }}		{{#if:{{{amendment3|}}}|  Amendment 3 		 {{{amendment3|}}}{{#if:{{{date3|}}}| {{dot}} {{{date3}}}}}{{#if:{{{result3|}}}| {{dot}} {{{result3}}}}}  }}		{{#if:{{{amendment4|}}}|  Amendment 4 		 {{{amendment4|}}}{{#if:{{{date4|}}}| {{dot}} {{{date4}}}}}{{#if:{{{result4|}}}| {{dot}} {{{result4}}}}}  }}		{{#if:{{{amendment5|}}}|  Amendment 5 		> {{{amendment5|}}}{{#if:{{{date5|}}}| {{dot}} {{{date5}}}}}{{#if:{{{result5|}}}| {{dot}} {{{result5}}}}}  }} for k,v in ipairs(amendments) do		amendmentRowData = mw.text.split(v, ',') col1 = 'Amendment ' .. k		col2 = '' for k2, v2 in ipairs(amendmentRowData) do			if k2 == 1 then col2 = col2 .. v2			else col2 = col2 .. frame:expandTemplate{ title = 'dot'} .. ' ' .. v2			end amendmentRow = mw.html.create('tr') :tag('td') :wikitext(col1) :done :tag('td') :wikitext(col2) :done :done end policyTable:node(amendmentRow) end policyTable:node(relatedTable) return policyTable end

return p