Module:Category handler: Difference between revisions

From the Croc Wiki, the Croc encyclopedia
Jump to navigationJump to search
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 dependent[[Module:Namespace modulesdetect]] and declare the table of functions that we will
-- 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 )
-- OnlyDon't categorise if the relevant options are set.
-- 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 )
if not pageObject then then
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
-- defaultfallback for being over the expensive function limit, i.e. categoriseThe thefallback page.behaviour
-- of the old template was to assume the page was not a subpage, so we will do
-- the same here.
or (if args[cfg.subpage] == cfg.subpageNo and pageObject and pageObject.isSubpage )then
return false
elseend
if args[cfg.subpage] == cfg.subpageOnly
orand (not args[cfg.subpage]pageObject ==or cfg.subpageOnly(pageObject and not pageObject.isSubpage) ) then
return false
else
return true
end
return true
end
 
Cookies help us deliver our services. By using our services, you agree to our use of cookies.

Navigation menu