Module:Category handler: Difference between revisions

Ganaram inukshuk (talk | contribs)
mNo edit summary
Ganaram inukshuk (talk | contribs)
No edit summary
Line 116: Line 116:
     is_debug = yesno(is_debug, false)
     is_debug = yesno(is_debug, false)


-- Don't categorize if:
    local frame = mw.getCurrentFrame()
-- - Debug mode is on (which turns off categories)
    -- Get the page where the template/module is being used (parent frame)
-- - Page is in a suppressed namespace
    local parent_title = frame:getParent() and mw.title.new(frame:getParent():getTitle()) or mw.title.getCurrentTitle()
     if is_debug or is_suppressed_namespace(ns_override) then
    local parent_ns = parent_title.nsText
 
    -- Don't categorize if:
    -- - Debug mode is on (force suppress)
    -- - Parent page is in suppressed namespace
    -- - Parent page is NOT a content page (e.g. subpages like /doc, /sandbox)
     if is_debug
        or is_suppressed_namespace(ns_override, parent_ns)
        or not parent_title.isContentPage
    then
         return ''
         return ''
     end
     end