Module:Arbitration motion implementation notes/Motion/Automatic and Module:Arbitration motion implementation notes/Motion/Automatic/sandbox: Difference between pages

(Difference between pages)
Jump to navigation Jump to search
Page 1
Page 2
imported>SilverLocust
 
imported>SilverLocust
ipairs to loop over an array
 
Line 7: Line 7:
local page = args["page"] or ""
local page = args["page"] or ""
local section = args["section"] or args["anchor"] or args["name"] or "{{{name}}}"
local section = args["section"] or args["anchor"] or args["name"] or "{{{name}}}"
local pattern = args["pattern"] or "%c:?#[^:#%*].-UTC"
local pattern = args["pattern"] or "%c:?#[^#:]"
local ret = args["ret"] or ""
local ret = args["ret"] or ""
local escape = mw.ustring.gsub( section, "([%(%)%.%%%+%-%*%?%[%^%$%]])", "%%%1" )
local escape = mw.ustring.gsub( section, "([%(%)%.%%%+%-%*%?%[%^%$%]])", "%%%1" )
Line 47: Line 47:
local abstainText = mw.ustring.gsub(sectionText, ".*;Abstain", "Abstain")
local abstainText = mw.ustring.gsub(sectionText, ".*;Abstain", "Abstain")
local _, abstain = mw.ustring.gsub(abstainText, pattern, "")
local _, abstain = mw.ustring.gsub(abstainText, pattern, "")
local supportToOppose = tonumber(args["support-to-oppose"] or 0)
support = support - supportToOppose
oppose = oppose + supportToOppose
if matches ~= 1 then
if matches ~= 1 then
Line 64: Line 60:
..']] with heading<br><code>'
..']] with heading<br><code>'
..tostring(section)
..tostring(section)
..'</code>'
..'</code></span></td></tr><tr style="display:none">'
..frame:expandTemplate{title="If preview", args={"<br>If previewing a section edit, outside sections are not detected."}}
..'</span></td></tr><tr style="display:none">'
end
end