Module:AFC submission catcheck

From blackwiki
Revision as of 04:51, 20 April 2014 by blackwiki>Courcelles (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)))
Jump to navigation Jump to search

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