Module:Category handler: Difference between revisions
mNo edit summary |
No edit summary |
||
| Line 116: | Line 116: | ||
is_debug = yesno(is_debug, false) | is_debug = yesno(is_debug, false) | ||
local frame = mw.getCurrentFrame() | |||
-- Get the page where the template/module is being used (parent frame) | |||
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 | ||