Jump to content

Module:AfC submission catcheck

Permanently protected module
From Wikipedia, the free encyclopedia

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