Jump to content
Wikipedia The Free Encyclopedia

Module:Arbitration motion implementation notes/Motion/Automatic

From Wikipedia, the free encyclopedia
Module documentation[view] [edit] [history] [purge]

This module implements {{Arbitration motion implementation notes/Motion/Automatic }}.

Usage

[edit ]

{{#invoke:Arbitration motion implementation notes/Motion/Automatic|main|ret=call}}

The above documentation is transcluded from Module:Arbitration motion implementation notes/Motion/Automatic/doc. (edit | history)
Editors can experiment in this module's sandbox (edit | diff) and testcases (create) pages.
Subpages of this module.

 localgetArgs=require('Module:Arguments').getArgs

 localp={}

 functionp.main(frame)
 localargs=getArgs(frame)
 localpage=args["page"]or""
 localsection=args["section"]orargs["anchor"]orargs["name"]or"{{{name}}}"
 localpattern=args["pattern"]or"%c:?#[^:#%*].-UTC"
 localret=args["ret"]or""
 localescape=mw.ustring.gsub(section,"([%(%)%.%%%+%-%*%?%[%^%$%]])","%%%1")

 for_,pinipairs({
 "Wikipedia:Arbitration/Requests/Clarification and Amendment",
 "Wikipedia:Arbitration/Requests/Case",
 "Wikipedia:Arbitration/Requests/Motions"
 })do
 ifpage==""then
 localtext=mw.title.new(p):getContent()
 local_,sections=mw.ustring.gsub(text,".*%=%= *"..escape,"")
 ifsections~=0then
 page=p
 end
 end
 end

 ifpage=="ARM"then
 page="Wikipedia:Arbitration/Requests/Motions"
 elseifpage=="ARC"then
 page="Wikipedia:Arbitration/Requests/Case"
 elseifpage=="ARCA"orpage==""then
 page="Wikipedia:Arbitration/Requests/Clarification and Amendment"
 end

 localtext=mw.title.new(page):getContent()
 localsectionText,matches=mw.ustring.gsub(text,".*%=%= *"..escape,"")
 sectionText=mw.ustring.gsub(sectionText,";Arbitrator discussion.*","")

 localsupportText=mw.ustring.gsub(sectionText,".*;Support","Support")
 supportText=mw.ustring.gsub(supportText,";Oppose.*","")
 local_,support=mw.ustring.gsub(supportText,pattern,"")

 localopposeText=mw.ustring.gsub(sectionText,".*;Oppose","Oppose")
 opposeText=mw.ustring.gsub(opposeText,";Abstain.*","")
 local_,oppose=mw.ustring.gsub(opposeText,pattern,"")

 localabstainText=mw.ustring.gsub(sectionText,".*;Abstain","Abstain")
 local_,abstain=mw.ustring.gsub(abstainText,pattern,"")

 localsupportToOppose=tonumber(args["support-to-oppose"]or0)
 support=support-supportToOppose
 oppose=oppose+supportToOppose

 ifmatches~=1then
 support='?</td>'
 ..'<td>?</td>'
 ..'<td>?</td>'
 ..'<td style="background-color: #ededfd">[[File:Symbol question.svg|20px|link=]]</td>'
 ..'<td>?</td>'
 ..'<td style="background-color: #ededfd"><span class="error">Error: Found '
 ..tostring(matches)
 ..' sections on [['
 ..tostring(page)
 ..']] with heading<br><code>'
 ..tostring(section)
 ..'</code>'
 ..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

 ifret=="support"then
 returnsupport
 elseifret=="oppose"then
 returnoppose
 elseifret=="abstain"then
 returnabstain
 elseifret=="text"then
 returntext
 elseifret=="sectionText"then
 returnsectionText
 elseifret=="supportText"then
 returnsupportText
 elseifret=="opposeText"then
 returnopposeText
 elseifret=="abstainText"then
 returnabstainText
 elseifret=="call"then
 localtemplate="Arbitration motion implementation notes/Motion"
 localparams={}
 params["anchor"]=args["anchor"]orargs["name"]or"{{{name}}}"
 params["name"]=args["name"]or"{{{name}}}"
 params["support"]=support
 params["oppose"]=oppose
 params["abstain"]=abstain
 ifargs["notes"]then
 params["notes"]=args["notes"]
 end
 ifargs["pass"]then
 params["pass"]=args["pass"]
 end
 ifargs["active"]then
 params["active"]=args["active"]
 end
 returnframe:expandTemplate{title=template,args=params}
 else
 return""
 end
 end

 returnp

AltStyle によって変換されたページ (->オリジナル) /