Module:AfC submission catcheck
Appearance
This module issubject to page protection.It is ahighly visible modulein use by a very large number of pages, or issubstitutedvery frequently. Because vandalism or mistakes would affect many pages, and even trivial editing might cause substantial load on the servers, it isprotectedfrom editing. |
This module is used byTemplate:AFC submissionand 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)
ifnotstrthen
return''
end
str=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?%]%]","")
returnstr
end
functionp.checkforcats(frame)
localt=mw.title.getCurrentTitle()
tc=t:getContent()
iftc==nilthen
return""
end
tc=removeFalsePositives(tc)
ifmw.ustring.match(tc,"%[%[%s-[Cc]ategory:")==nilthen
return""
else
return"[[Category:AfC submissions with categories]]"
end
end
functionp.submitted(frame)
localtext=removeFalsePositives(mw.title.getCurrentTitle():getContent())
ifmw.ustring.find(text,'{{AfC submission||',1,true)ormw.ustring.find(text,'{{AFC submission||',1,true)then
returnframe.args[1]
else
returnframe.args[2]
end
end
returnp