| Thismodule is rated asready for general use. It has reached a mature state, is considered relatively stable and bug-free, and may be used wherever appropriate. It can be mentioned onhelp pages and other Wikipedia resources as an option for new users. To minimise server load and avoid disruptive output, improvements should be developed throughsandbox testing rather than repeated trial-and-error editing. |
| This module is currentlyprotected from editing. See theprotection policy andprotection log for more details. Please discuss any changes on thetalk page; you maysubmit an edit request to ask anadministrator to make an edit if it isuncontroversial or supported byconsensus. You may alsorequest that this page be unprotected. |
This module is used byTemplate:AFC submission and its subtemplates to scan the content of AFC submissions. It's used to allow finding of drafts in improper content categories as well as to suppress the message that a draft has not been submitted when in fact it has been.
localp={}localfunctionremoveFalsePositives(str)ifnotstrthenreturn''endstr=mw.ustring.gsub(str,"<!--.--->","")str=mw.ustring.gsub(str,"<nowiki>.-</nowiki>","")str=mw.ustring.gsub(str,"{{[Dd]raft [Cc]ategories[^{}]-{{[^{}]-}}[^{}]-}}","")str=mw.ustring.gsub(str,"{{[Dd]raft [Cc]ategories.-}}","")str=mw.ustring.gsub(str,"{{[Dd]raftcat[^{}]-{{[^{}]-}}[^{}]-}}","")str=mw.ustring.gsub(str,"{{[Dd]raftcat.-}}","")str=mw.ustring.gsub(str,"%[%[Category:Unsuitable for Wikipedia AfC submissions%]%]","")str=mw.ustring.gsub(str,"%[%[Category:[Dd]rafts?.-%]%]","")str=mw.ustring.gsub(str,"%[%[Category:.-drafts?%]%]","")str=mw.ustring.gsub(str,"<pre>.-</pre>","")returnstrendfunctionp.checkforcats(frame)localt=mw.title.getCurrentTitle()tc=t:getContent()iftc==nilthenreturn""endtc=removeFalsePositives(tc)ifmw.ustring.match(tc,"%[%[%s-[Cc]ategory:")==nilthenreturn""elsereturn"[[Category:AfC submissions with categories]]"endendfunctionp.submitted(frame)localtext=removeFalsePositives(mw.title.getCurrentTitle():getContent())ifmw.ustring.find(text,'{{AfC submission||',1,true)ormw.ustring.find(text,'{{AFC submission||',1,true)thenreturnframe.args[1]elsereturnframe.args[2]endendreturnp