Changes

Jump to: navigation, search

Module:Category handler

170 bytes added, 06:16, 1 July 2013
better fallback behaviour if we are over the expensive function count
----------------------------------------------------------------------
-- Get dependent modules [[Module:Namespace detect]] and declare the table of functions -- that we will-- return.
local NamespaceDetect = require('Module:Namespace detect')
local p = {}
-- 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 Don't categorise if the relevant options are set.
if args[cfg.nocat] == cfg.nocatTrue
or args[cfg.categories] == cfg.categoriesNo
and args[cfg.category2] ~= cfg.category2Yes
and args[cfg.category2] ~= cfg.category2Negative )
then return false 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 -- fallback for being over the expensive function limit. The fallback behaviour -- of the old template was to assume the page was not a subpage, so we will do -- the same here. if args[cfg.subpage] == cfg.subpageNo and pageObject and pageObject.isSubpage )then or ( return false end if args[cfg.subpage] == cfg.subpageOnly and (not pageObject or (pageObject and not pageObject.isSubpage ) ) then
return false
else
return true
end
return true
end
Anonymous user

Navigation menu