Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Module:Sanctions/sandbox

From Wikipedia, the free encyclopedia
<Module:Sanctions
This is themodule sandbox page forModule:Sanctions (diff).
Module documentation[view] [edit] [history] [purge]
This module depends on the following other modules:

This module provides utility for thecommunity sanctions system. It should be called using one of its wrapper templates (eg{{Gs/talk notice}}).

To add, remove or modify sanctions, you only need to editModule:Sanctions/data with your changes. Be careful when saving changes; syntax errors on /data will cause every transclusion of any GS template to show an ugly red error message.

The abovedocumentation istranscluded fromModule:Sanctions/doc.(edit |history)
Editors can experiment in this module'ssandbox(edit |diff) and testcases(create) pages.
Add categories to the/doc subpage.Subpages of this module.
localp={}localgetArgs=require('Module:Arguments').getArgslocalyesno=require('Module:Yesno')localrawData=mw.loadData('Module:Sanctions/data/sandbox')localdata=rawData.sanctionslocalcommData=rawData.commlocalarbcomData=rawData.arbcomlocalmessageBox=require('Module:Message box')-- FunctionslocalfunctiontableContainsValue(needle,haystack)for_,vinpairs(haystack)doifv==needlethenreturntrueendendreturnfalseendlocalfunction_getTopicData(topicAlias)ifdata[topicAlias]thenreturndata[topicAlias]elsereturnfalseendend-- Returns an invalid topic error, with a table of acceptable topicslocalfunctionsyntaxHelp(frame)return'<span class="error">{{para|topic}} not specified. Available options:</span><div style="border-left: 5px dashed black; border-right: 5px dashed black; border-bottom: 5px dashed black; padding-left: 0.5em; padding-right: 0.5em; padding-bottom: 0.5em;">'..p.table(frame)..'</div>'end-- Topic classlocalTopic={}Topic.__index=TopicfunctionTopic.new(topicCode,args)localobj={}obj._args=argsobj._topicData=_getTopicData(topicCode)returnsetmetatable(obj,Topic)endfunctionTopic:get(arg)returnself._topicData[arg]endfunctionTopic:exists()return((self._topicData~=nil)and(self._topicData~=false))endfunctionTopic:hasGlobalRestriction(type)returnself._topicData.restrictions[type]endfunctionTopic:hasLocalRestriction(type)locallocalRestriction=self._args[type]iflocalRestrictionthenifmw.ustring.find(type,'^restriction')~=nilthenreturntrueelsereturnyesno(localRestriction)endelsereturnfalseendendfunctionTopic:hasRestriction(type)returnself:hasGlobalRestriction(type)orself:hasLocalRestriction(type)endfunctionTopic:hasRestrictions(arr)for_,vinipairs(arr)doifself:hasRestriction(v)thenreturntrueendendreturnfalseendfunctionTopic:hasAnyRevertRestrictions()returnself:hasRestrictions({'1rr','0rr','consensusrequired','brd','protection'})endfunctionTopic:hasAnyRestrictions()returnself:hasAnyRevertRestrictions()orself:hasRestrictions({'restriction1'})endfunctionTopic:getType()return(self:get('type')=='arbcom'and'[[WP:ARBCOM|Arbitration Committee]]'or(self:get('type')=="both"and'[[WP:ARBCOM|Arbitration Committee]] and community'or'community'))endfunctionTopic:getTypeUnlinked()return(self:get('type')=='arbcom'and'arbitration'or(self:get('type')=="both"and'arbitration and community'or'community'))endfunctionTopic:getCustomRestrictions()localcustomRestrictions={}localri=1localcheckArr=self._topicData.restrictionslocalbreakNext=falsewhiletruedoifcheckArr['restriction'..ri]thentable.insert(customRestrictions,checkArr['restriction'..ri])ri=ri+1elseifbreakNextthenbreakelseri=1checkArr=self._argsbreakNext=trueendendreturncustomRestrictionsend-- End classeslocalfunctionformatRestrictions(topic,you,article)localrestrictionList=mw.html.create('ul')if(you)theniftopic:hasRestriction('1rr')thenrestrictionList:tag('li'):wikitext('You are not allowed to make more than 1 revert within 24 hours on a page within this topic, subject to the [[WP:NOT3RR|usual exemptions]].')endiftopic:hasRestriction('0rr')thenrestrictionList:tag('li'):wikitext("You are not allowed to make any reverts within this topic, subject to the [[WP:NOT3RR|usual exemptions]].")endiftopic:hasRestriction('protection')thenlocalprotectionRestriction=''localshortCode=topic:get('restrictions')['protection']ifshortCode=="ecp"thenprotectionRestriction="logged in, have made 500 edits, and an account age of 30 days"elseifshortCode=="semi"thenprotectionRestriction="logged in, have made 10 edits, and an account age of 4 days"elseifshortCode=="user"thenprotectionRestriction="logged in"endrestrictionList:tag('li'):wikitext('You must be '..protectionRestriction..'.')endlocalcustomRestrictions=topic:getCustomRestrictions()for_,vinipairs(customRestrictions)dorestrictionList:tag('li'):wikitext(v)endelse-- 1RRiftopic:hasRestriction('1rr')thenrestrictionList:tag('li'):wikitext("'''Limit of one revert in 24 hours:''' This "..(articleand" article "or" topic ").." is under [[Wikipedia:Edit warring#Other revert rules|WP:1RR]] (one [[Wikipedia:Reverting|revert]] per editor per article ''per 24-hour period'').")end-- 0RRiftopic:hasRestriction('0rr')thenrestrictionList:tag('li'):wikitext("'''Reverts prohibited:''' This "..(articleand" article "or" topic ").." is under [[Wikipedia:Edit warring#Other revert rules|WP:0RR]] (no reverts permitted).")endiftopic:hasRestriction('protection')thenlocalprotectionRestriction=''localshortCode=topic:get('restrictions')['protection']ifshortCode=="ecp"thenprotectionRestriction="'''Extended confirmed requirement:''' Editors must be logged in, [[WP:ECP|have made 500 edits, and an account age of 30 days]]"elseifshortCode=="semi"thenprotectionRestriction="'''Auto confirmed requirement:''' Editors must be logged in, [[WP:SEMI|have made 10 edits, and an account age of 4 days]]"elseifshortCode=="user"thenprotectionRestriction="'''Logged in requirement:''' Editors must be logged in"endrestrictionList:tag('li'):wikitext(protectionRestriction.." in order to make edits "..(articleand" to this article"or" within this topic area")..".")end-- Text for boilerplate/predefined restrictionsiftopic:hasRestriction('consensusrequired')thenrestrictionList:tag('li'):wikitext("'''Consensus required:''' All editors must obtain [[WP:Consensus|consensus]] on the talk page of "..(articleand"this article"or"articles within this topic").." before reinstating ''any edits that have been challenged (via reversion).'' This includes making edits similar to the ones that have been challenged. If in doubt, do not make the edit.")endiftopic:hasRestriction('brd')thenrestrictionList:tag('li'):wikitext("'''24-hr [[Wikipedia:BOLD, revert, discuss cycle|BRD cycle]]:''' If a change you make to "..(articleand"this article"or"an article within this topic").." is reverted, you may not reinstate that change unless you discuss the issue on the talk page and wait 24 hours (from the time of the original edit). Partial reverts/reinstatements that reasonably address objections of other editors [[Wikipedia:BOLD, revert, discuss cycle#WP:BRR|are preferable]] to wholesale reverts.")endlocalcustomRestrictions=topic:getCustomRestrictions()for_,vinipairs(customRestrictions)dorestrictionList:tag('li'):wikitext(v)endendreturnrestrictionListend-- This function builds a talk notice-- TODO: split this up---- @param frame-- @param topic topic class instance-- @param args arguments passed to wrapper template-- @returns String representation of noticelocalfunctionbuildTalkNotice(frame,topic,args)localtype=args['type']orargs[2]or'mini'localout=mw.html.create('')localhasRestrictions=topic:hasAnyRestrictions()localhasRevertRestrictions=topic:hasAnyRevertRestrictions()ifhasRestrictionsthentype='long'-- force long displaywhere custom restrictions are applicableout:tag('span'):css('font-size','120%'):wikitext("'''WARNING: ACTIVE "..string.upper(topic:getTypeUnlinked()).." SANCTIONS'''")endifhasRestrictionsthenout:tag('p'):wikitext("The article [[:{{SUBJECTPAGENAME}}]], along with other pages relating to "..topic:get('scope')..", is designated by the "..topic:getType().." as a '''[[Wikipedia:Contentious topics|contentious topic]]'''. The current restrictions are:")elseout:tag('p'):wikitext("<strong>The use of the [[Wikipedia:Contentious topics|contentious topics procedure]] has been authorized by the "..topic:getType().." for pages related to "..topic:get('scope')..", including this page.</strong>"..(type=='mini'and' Editors who repeatedly or seriously fail to adhere to the [[Wikipedia:Five pillars|purpose of Wikipedia]], any expected [[Wikipedia:Etiquette|standards of behaviour]], or any [[Wikipedia:List of policies|normal editorial process]] may be sanctioned.'or''))endiftype~='mini'thenlocalrestrictionList=formatRestrictions(topic,false,true)ifhasRestrictionsthenout:node(restrictionList)endout:tag('p'):wikitext("Editors who repeatedly or seriously fail to adhere to the [[Wikipedia:Five pillars|purpose of Wikipedia]], any expected [[Wikipedia:Etiquette|standards of behaviour]], or any [[Wikipedia:List of policies|normal editorial process]] may be sanctioned.")-- Further info boxifhasRestrictionsthenlocalfurtherInfo=mw.html.create('')-- Enforcement proceduresfurtherInfo:tag('p'):wikitext('Enforcement procedures:'):done()localenforcementProcedures=mw.html.create('ul')ifhasRestrictionsthenenforcementProcedures:tag('li'):wikitext("Violations of any restrictions "..(hasRevertRestrictionsand"(excluding 1RR/reverting violations) "or"").."and other conduct issues should be reported to the "..(topic:get('type')=="arbcom"and"[[WP:AE|arbitration enforcement noticeboard]]"or"[[WP:ANI|administrators' incidents noticeboard]]").."."..(hasRevertRestrictionsand" Violations of revert restrictions should be reported to the [[Wikipedia:Administrators' noticeboard/Edit warring|administrators' edit warring noticeboard]]."or"")):done():tag('li'):wikitext("Editors who violate any listed restrictions may be blocked by any uninvolved administrator, even on a first offense."):done()elseenforcementProcedures:tag('li'):wikitext("Problems should be reported to the "..(topic:get('type')=="arbcom"and"[[WP:AE|arbitration enforcement noticeboard]]"or"[[WP:ANI|administrators' incidents noticeboard]]").."."):done()endenforcementProcedures:tag('li'):wikitext("An editor must be [[Wikipedia:Contentious topics#Awareness of contentious topics|aware]] before they can be sanctioned."):allDone()furtherInfo:node(enforcementProcedures)ifhasRevertRestrictionsthenfurtherInfo:tag('p'):wikitext("With respect to any reverting restrictions:"):done():tag('ul'):tag('li'):wikitext("Edits made solely to enforce any clearly established consensus are exempt from all edit-warring restrictions. In order to be considered\"clearly established\" the consensus must be proven by prior talk-page discussion."):done():tag('li'):wikitext("Edits made which remove or otherwise change any material placed by clearly established consensus, without first obtaining consensus to do so, may be treated in the same manner as clear vandalism."):done():tag('li'):wikitext("Clear vandalism of any origin may be reverted without restriction."):done():tag('li'):wikitext("Reverts of edits made by anonymous (IP) editors that are not vandalism are exempt from the 1RR but are subject to [[Wikipedia:Edit warring|the usual rules on edit warring]]. If you are in doubt, contact an administrator for assistance."):allDone():tag('p'):wikitext("If you are unsure if your edit is appropriate, discuss it here on this talk page first. <strong>Remember: When in doubt, don't revert!</strong>")endlocalcollapsed=frame:expandTemplate{title='collapse',args={tostring(furtherInfo),'<span style="color:red">Remedy instructions and exemptions</span>',['bg']='#EEE8AA'}}out:newline():node(collapsed)end-- End further info boxendlocalbox=messageBox.main('tmbox',{type='notice',image=type=='long'and'[[File:Commons-emblem-issue.svg|50px]]'or'[[File:Commons-emblem-hand-orange.svg|40px]]',text=frame:preprocess(tostring(out))})returnboxend-- Builds an intro alert notice---- @param frame-- @param topic topic class instance-- @returns String representation of noticelocalfunctionbuildFirstAlert(frame,topic,sig)localout=mw.html.create('table'):addClass('gs-alert'):cssText("border: 1px solid #AAA; background-color: #E5F8FF; padding: 0.5em; width: 100%; margin-bottom: 1em")localinsideNode=out:tag('tr'):tag('td'):cssText("vertical-align:middle; padding-left:1px; padding-right:0.5em;"):wikitext("[[File:Commons-emblem-notice.svg|50px]]"):done():tag('td')insideNode:tag('p'):wikitext("You have recently edited a page related to <b>"..topic:get('scope').."</b>, a topic designated as [[WP:CTOP|contentious]] by the "..topic:getType().."."):done():tag('p'):wikitext("A special set of rules applies to certain topic areas, which are referred to as <i>contentious topics</i>. These are specially designated topics that have been identified by the community or the Arbitration Committee to attract more persistent disruptive editing than the rest of the project. When editing a contentious topic, Wikipedia’s norms and policies are more strictly enforced, and Wikipedia administrators have special powers in order to reduce disruption to the project."):done():tag('p'):wikitext("Within contentious topics, editors should edit <strong>carefully</strong> and <strong>constructively</strong>, refrain from disrupting the encyclopedia, and:"):done():tag('ul'):tag('li'):wikitext('adhere to the [[WP:NOT|purposes of Wikipedia]];'):done():tag('li'):wikitext('comply with all applicable [[Wikipedia:Policies and guidelines|policies and guidelines]];'):done():tag('li'):wikitext('follow editorial and behavioural best practice;'):done():tag('li'):wikitext('comply with any page restrictions in force within the area of conflict; and'):done():tag('li'):wikitext('refrain from [[WP:GAME|gaming the system]].'):done():done()if(topic:hasAnyRestrictions())theninsideNode:tag('p'):wikitext("Additionally, you must comply with the following restrictions:")localrestrictionList=formatRestrictions(topic,true,false)insideNode:wikitext(tostring(restrictionList)):done()endinsideNode:tag('p'):wikitext("Editors are advised to err on the side of caution if unsure whether making a particular edit is consistent with these expectations. If you have any questions about contentious topics ''procedures'' you may ask them at the [[WT:AC/C|arbitration clerks' noticeboard]] or you may learn more about this contentious topic at [["..topic:get('wikilink').."]]. You may also choose to note which contentious topics you know about by using the {{tl|ct/aware}} template."):done()returnframe:preprocess('== Introduction to contentious topics ==\n'..tostring(out)..' <!-- Derived from Template:Contentious topics/alert --> ')end-- Builds an alert notice---- @param frame-- @param topic topic class instance-- @returns String representation of noticelocalfunctionbuildAlert(frame,topic,sig)localout=''out=out..'[[File:Commons-emblem-notice.svg|link=|25px|alt=Information icon]] You have recently made edits related to '..topic:get('scope')..'. This is a standard message to inform you that '..topic:get('scope')..' is a'..(topic:get('type')=="comm"and' community'or'n Arbitration Committee'..(topic:get('type')=="both"and' and community'or''))..' designated contentious topic. This message <em>does <strong>not</strong> imply that there are any issues with your editing</em>. 'if(topic:hasAnyRestrictions())thenout=out.."You must comply with the following restrictions within this topic area:"localrestrictionList=formatRestrictions(topic,true,false)out=out..tostring(restrictionList)..'\n\n'endout=out..'For more information about the contentious topics system, please see [[Wikipedia:Contentious topics]].'returnframe:preprocess(tostring(out)..' <!-- Derived from Template:Contentious topics/alert --> ')end-- Builds an edit noticelocalfunctionbuildEditNotice(frame,topic,args)localenHeader='This page relates to '..topic:get('scope')..', which has been designated by the '..topic:getType()..' as a [[WP:CTOP|contentious topic]].'localenText=mw.html.create('')enText:tag('p'):wikitext('While editing this topic, you must adhere to the [[WP:Five pillars|purpose of Wikipedia]], [[WP:Etiquette|expected standards of behaviour]], and [[WP:List of policies|Wikipedia\'s policies and norms]].'):done()iftopic:hasAnyRestrictions()thenlocallist=formatRestrictions(topic,true,true)enText:tag('p'):wikitext("In addition, while editing, you must follow these restrictions: "):done()enText:wikitext(tostring(list))endenText:tag('p'):wikitext("<strong>Failure to do so may result in a block or other sanctions.</strong> Please edit carefully."):done()localeditnotice=frame:expandTemplate{title='editnotice',args={expiry="indefinite",headerstyle="font-size: 120%;",style="background: ivory;",image="Commons-emblem-issue.svg",imagesize="50px",header=tostring(enHeader),text=tostring(enText)}}returneditnoticeendlocalfunctionbuildAwarenessNotice(frame,topics,args)localout='This user is aware of the designation of the following topics as [[WP:CTOP|contentious topics]]:\n'fork,vinpairs(topics)doout=out..'* '..v:get('scope')..'\n'endout=out.."They '''should ''not'' be given alerts''' for those areas."returnmessageBox.main('mbox',{type='notice',image='[[File:Commons-emblem-notice.svg|40px]]',text=frame:preprocess(out)})end-- Builds a sanction alert notice---- @param frame-- @param topic topic class instance-- @returns String representation of noticelocalfunctionbuildSanctionAlert(frame,type,topic,sanction,rationale,decision,sig)localout=mw.html.create('table'):addClass('gs-alert'):cssText("margin-bottom: 1em; border: 1px solid #AAA; background-color: ivory; padding: 0.5em; display: flex; align-items: center;")localinsideNode=out:tag('tr'):tag('td'):cssText("vertical-align:middle; padding-left:1px; padding-right:0.5em;"):wikitext("[[File:Commons-emblem-hand.svg|50px]]"):done():tag('td')insideNode:tag('p'):wikitext("The following sanction has been applied to you: "):done():wikitext(frame:expandTemplate{title="talkquote",args={["1"]=(((sanction=="ban"andtopic~=nil)and"You have been banned from making edits related to "..topic:get('scope')..", broadly construed."orsanction)or"<span class=\"error\">no sanction given</span>")}}):tag('p'):wikitext("You have been sanctioned "..(rationaleor"<span class=\"error\">no reason given</span>")):done():tag('p'):wikitext("This sanction is imposed in my capacity as an [[WP:UNINVOLVED|uninvolved administrator]] under the authority of "..(type=="comm"and"the community"or"the [[WP:ARBCOM|arbitration committee]]"..(type=="both"and" and the community"or"")).." at "..(topic~=niland"[["..topic:get("wikilink").."]]"or(decisionor"<span class=\"error\">no decision link provided</span>"))..(topic~=niland", and the [[WP:CTOP|contentious topics procedure]]."or".").." This sanction has been recorded in the log of sanctions for that topic. If the sanction includes a ban, please read the [[Wikipedia:Banning policy|banning policy]] to ensure you understand what this means. If you do not comply with this sanction, you may be [[Wikipedia:Blocking policy|blocked]] for an extended period, by way of enforcement of this sanction—and you may also be made subject to further sanctions."):done():tag('p'):wikitext("You may appeal this sanction by "..(topic~=niland"[[Wikipedia:Contentious topics#Appeals and Amendments|following the instructions here]]"or"[[WP:UNBAN|following the instructions here]]")..". Even if you appeal this sanction, you remain bound by it until you are notified by an uninvolved administrator that the appeal has been successful. You are also free to contact me on my talk page if anything of the above is unclear to you."):done()returnframe:preprocess('== You have been sanctioned ==\n'..tostring(out)..'\n <!-- Template:Ct/sanction -->')endlocalfunctionlistToText(frame,t)localnew={}localt=require('Module:TableTools').compressSparseArray(t)fori,vinipairs(t)dotable.insert(new,frame:expandTemplate{title='Contentious_topics/list',args={["scope"]=v}})endreturn'\n*'..table.concat(new,'\n*')end--/////////---- EXPORTS--/////////--functionp.detect(frame)localtitlelocalargs=getArgs(frame)ifargs.testTitlethentitle=mw.title.new(args.testTitle)elsetitle=mw.title.getCurrentTitle()endlocalcontent=title:getContent()or''localcodes=string.match(content,"{{%s-[cC]ontentious [tT]opics/[aA]ware%s-|([^}]-)}}")localshortcutCodes=string.match(content,"{{%s-[cC][tT]/[aA]ware%s-|([^}]-)}}")localdsCodes=string.match(content,"{{%s-D[sS]/[aA]ware%s-|([^}]-)}}")if(notcodes)and(notdsCodes)and(notshortcutCodes)thenreturnendlocaltextif(codes)thentext=listToText(frame,mw.text.split(codes,"|"))elseif(dsCodes)thentext=listToText(frame,mw.text.split(dsCodes,"|"))elsetext=listToText(frame,mw.text.split(shortcutCodes,"|"))endreturnframe:preprocess("<div style = 'font-weight: bold'>It is not necessary to notify this user about the following topics being contentious topics:"..text.."\n The user has indicated that they are already aware using the template <nowiki>{{Contentious topics/aware}}</nowiki> on their talk page.</div>")end-- Returns awareness noticefunctionp.awarenessNotice(frame)localargs=getArgs(frame)localtopics={}fork,vinipairs(args)dotopics[k]=Topic.new(v,args)ifnottopics[k]:exists()thenreturnframe:preprocess('<strong class="error">Invalid topic specified at argument '..k..'</strong>.\n'..p.table(frame))endendreturnbuildAwarenessNotice(frame,topics,args)end-- Returns a talk notice-- For documentation, see [[Template:Gs/talk notice]]functionp.talknotice(frame)localargs=getArgs(frame)localtopic=Topic.new(args['topic']orargs[1],args)ifnottopic:exists()thenreturnframe:preprocess(syntaxHelp(frame))endreturnbuildTalkNotice(frame,topic,args)end-- Returns an alert-- For documentation, see [[Template:Gs/alert]]functionp.alert(frame)localargs=getArgs(frame)localtopic=Topic.new(args['topic']orargs[1],args)ifnottopic:exists()thenreturnframe:preprocess(syntaxHelp(frame))elseifnottopic:hasRestriction('ds')thenreturnframe:preprocess('<span class="error">This topic area is not designated as a contentious topic. Alert is not required.</span>')endreturnbuildAlert(frame,topic,args['sig'])endfunctionp.alertFirst(frame)localargs=getArgs(frame)localtopic=Topic.new(args['topic']orargs[1],args)ifnottopic:exists()thenreturnframe:preprocess(syntaxHelp(frame))elseifnottopic:hasRestriction('ds')thenreturnframe:preprocess('<span class="error">This topic area is not designated as a contentious topic. Alert is not required.</span>')endreturnbuildFirstAlert(frame,topic,args['sig'])endfunctionp.sanction(frame)localargs=getArgs(frame)localtopic=Topic.new(args['topic']orargs[1],args)returnbuildSanctionAlert(frame,(topic:exists()andtopic:get('type')orargs['type']),(topic:exists()andtopicornil),args['sanction'],args['rationale'],args['decision'],args['sig'])end-- Returns an edit notice-- For documentation, see [[Template:Gs/editnotice]]functionp.editnotice(frame)localargs=getArgs(frame)localtopic=Topic.new(args['topic']orargs[1],args)ifnottopic:exists()thenreturnframe:preprocess(syntaxHelp(frame))endreturnbuildEditNotice(frame,topic,args)endfunctionp.generatePage(frame)localargs=getArgs(frame)localtopic=Topic.new(args['topic'],args)localout=mw.html.create('')out:wikitext(messageBox.main('ombox',{type='notice',image='[[File:Unbalanced scales.svg|50x40px|link=]]',text='This page documents and supplements decisions concerning a [[WP:CTOP|contentious topic]].'})):done()if(yesno(args['rescinded'])orfalse)thenout:tag('p'):wikitext('This topic previously had enacted remedies that applied to all editors who made edits to this topic area ("the Contentious Topic"). They have since been removed as a contentious topic.'):allDone()returntostring(out)elseifnottopic:exists()thenerror("Topic does not exist, use rescinded parameter for former contentious topics")endout:tag('p'):wikitext('The '..topic:getType()..' has [['..topic:get("decision")..'|enacted remedies]] that apply to all editors who make edits related to <b>'..topic:get("scope")..'</b> ("the Contentious Topic"). The [[WP:CTOP|contentious topic procedure]] applies to all pages and edits related to this topic.'):done()endout:tag('h2'):wikitext("Decisions"):done()out:wikitext((args['decisions']or'')):done()out:tag('h2'):wikitext("Guidance for administrators"):allDone()out:wikitext((args['guidance']or'')):done()out:tag('h2'):wikitext("Standard set of restrictions"):allDone()out:tag("p"):wikitext("Any uninvolved administrator may impose the following set of restrictions for up to one year: "):allDone()out:tag('ul'):tag("li"):wikitext("Individual restrictions"):tag("ul"):tag("li"):wikitext("sitewide and partial blocks"):done():tag("li"):wikitext("topic bans and page bans (from the entire contentious topic, a subtopic, or specified pages within the topic),"):done():tag("li"):wikitext("interaction bans,"):done():tag("li"):wikitext("revert restrictions"):done():done():done():tag("li"):wikitext("Page restrictions"):tag("ul"):tag("li"):wikitext("page protection,"):done():tag("li"):wikitext("revert restrictions,"):done():tag("li"):wikitext('the "[[Wikipedia:Contentious topics#cite note-3|consensus required]]" restriction,'):done():tag("li"):wikitext('the "[[Wikipedia:Contentious topics#cite note-4|enforced BRD]]" restriction'):done():done():done():allDone()localrestrictionList=formatRestrictions(topic,false,false)localhasRestrictions=topic:hasAnyRestrictions()localhasRevertRestrictions=topic:hasAnyRevertRestrictions()ifhasRestrictionsthenout:tag("p"):wikitext("The following restrictions apply to the whole topic area: "):done()out:node(restrictionList)endout:tag('h2'):wikitext("Templates"):allDone()out:tag("p"):wikitext("When alerting an editor who has never received an alert for any contentious topic, the following template <b>must</b> be used to alert them: "..frame:preprocess("{{tlx|Contentious topics/alert/first|"..args['topic'].."}}")):done()out:tag("p"):wikitext("In addition, the following <b>must</b> be used as an editnotice: "..frame:preprocess("{{tlx|Contentious topics/editnotice|"..args['topic'].."}}")):done()out:tag("p"):wikitext("And the following <b>must</b> be used as a talk notice: "..frame:preprocess("{{tlx|Contentious topics/talk notice|"..args['topic'].."}}")):done()returntostring(out)endfunctionp.table(frame)localargs=getArgs(frame)localtype=args['type']localtbl=mw.html.create('table'):addClass('wikitable'):addClass('sortable'):css('font-size','9pt'):css('background','transparent'):css('color','inherit')if(type~="comm"andtype~="arbcom"andtype~=nil)thenreturn'<span class="error">Invalid sanction type specified.</span>'endlocaltopRow=tbl:tag('tr')-- HeaderstopRow:tag('th'):wikitext("Topic code"):done()topRow:tag('th'):wikitext("Area of conflict"):done()if(type~="comm"andtype~="arbcom")thentopRow:tag('th'):wikitext("Designated by"):done()endtopRow:tag('th'):wikitext("Relevant information"):done()topRow:tag('th'):wikitext("Relevant decision"):allDone()-- sort alphabeticallylocalsortedTable={}iftype=="comm"thenforninpairs(commData)dotable.insert(sortedTable,n)endelseiftype=="arbcom"thenforninpairs(arbcomData)dotable.insert(sortedTable,n)endelseforninpairs(data)dotable.insert(sortedTable,n)endendtable.sort(sortedTable)localadded={}for_,vinipairs(sortedTable)dolocalsanction=data[v]localwt=(function(sanction,v)forl,winipairs(sanction.aliasesor{})doif(w==v)thenreturnnilendendlocalout="<code>"..v.."</code>"forl,winipairs(sanction.aliasesor{})doif(notadded[w])thenout=out..' '.."<code>"..w.."</code>"added[w]=trueendendreturnoutend)(sanction,v)ifwt~=nilthenif(notadded[v])thentbl:tag('tr'):tag('td'):wikitext(wt):done():tag('td'):wikitext(sanction.scope):done():tag('td'):wikitext(sanction.type=="comm"and"the community"or"the Arbitration Committee"..(sanction.type=="both"and" and the community"or"")):done():tag('td'):wikitext("[["..sanction.wikilink.."]]"):done():tag('td'):wikitext((sanction.decision~=niland"[["..sanction.decision.."|decision]]"or"")):allDone()added[v]=trueendendendreturntostring(tbl)endfunctionp.topicsHelper(frame)localargs=getArgs(frame)ifargs['sanctions scope']anddata[args['sanctions scope']]thenreturn_getTopicData(args['sanctions scope']).scopeelseifargs['sanctions link']anddata[args['sanctions link']]thenreturnmw.title.new(_getTopicData(args['sanctions link']).wikilink).redirectTargetelsereturn""-- ?endend-- Returns true if the given topic name is a valid topic areafunctionp.checkIfValidTopic(topicName)localtopic=Topic.new(topicName,nil)returntopic:exists()end-- for debuggingp._Topic=Topicreturnp
Retrieved from "https://en.wikipedia.org/w/index.php?title=Module:Sanctions/sandbox&oldid=1317011465"
Category:

[8]ページ先頭

©2009-2025 Movatter.jp