Anonymous user
Module:Category handler: Difference between revisions
better fallback behaviour if we are over the expensive function count
(add support for "categories=no" and "category2=¬") |
(better fallback behaviour if we are over the expensive function count) |
||
Line 103:
----------------------------------------------------------------------
-- Get
-- that we will return.
local NamespaceDetect = require('Module:Namespace detect')
local p = {}
Line 116:
-- Find whether we need to return a category or not.
local function needsCategory( pageObject, args )
-- If there is no pageObject available, then that either means that we are over▼
-- the expensive function limit or that the title specified was invalid. Invalid▼
-- titles will probably only be a problem during testing, so choose the best▼
-- default for being over the expensive function limit, i.e. categorise the page.▼
if not pageObject then ▼
return true▼
end▼
▲ -- Only categorise if the relevant options are set.
if args[cfg.nocat] == cfg.nocatTrue
or args[cfg.categories] == cfg.categoriesNo
Line 129 ⟶ 122:
and args[cfg.category2] ~= cfg.category2Yes
and args[cfg.category2] ~= cfg.category2Negative )
or ( args[cfg.subpage] == cfg.subpageNo and pageObject.isSubpage )▼
return false
or ( args[cfg.subpage] == cfg.subpageOnly and not pageObject.isSubpage ) then▼
▲ end
▲ -- If there is no pageObject available, then that either means that we are over
▲ -- the expensive function limit or that the title specified was invalid. Invalid
▲ -- titles will probably only be a problem during testing, so we choose the best
▲ --
-- of the old template was to assume the page was not a subpage, so we will do
-- the same here.
return false
if args[cfg.subpage] == cfg.subpageOnly
▲
return false
▲ else
▲ return true
end
end
|