Difference between revisions of "Module:AFC submission catcheck"

From blackwiki
Jump to navigation Jump to search
blackwiki>WOSlinker
(ignore nowiki sections)
blackwiki>Courcelles
m (Changed protection level of Module:AFC submission catcheck: Per RFPP request, "mother" template only template protected now ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite)))
(No difference)

Revision as of 04:51, 20 April 2014

This module is used by Template: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.



local i = {}

function i.checkforcats(frame)
    local t = mw.title.getCurrentTitle()
    tc = t:getContent()
    if tc == nil then 
        return ""
    end
    tc = mw.ustring.gsub(tc,"%[%[Category:Articles created via the Article Wizard%]%]","")
    tc = mw.ustring.gsub(tc,"<!--.--->","")
    tc = mw.ustring.gsub(tc,"<nowiki>.-</nowiki>","")
    if mw.ustring.match(tc, "%[%[%s-[Cc]ategory:" ) == nil then
        return ""
    else
        return "[[Category:AfC submissions with categories]]"
    end
end
 
return i