Module:High-use: Difference between revisions

implement fetch parameter
m (Tidy full stops)
(implement fetch parameter)
Line 3:
-- _fetch looks at the "demo" argument.
local _fetch = require('Module:Transclusion_count').fetch
local yesno = require('Module:Yesno')
 
function p.num(frame, count)
if count == nil then count = _fetch(frame) end
if yesno(frame.args['fetch']) == false then
if (frame.args[1] or '') ~= '' then count = tonumber(frame.args[1]) end
else
count = _fetch(frame)
end
end
-- Build output string
Line 62 ⟶ 69:
local bot_text = (frame:preprocess("{{REVISIONID}}") == "") and "\n\n----\n'''Preview message''': Transclusion count updated automatically ([[Template:High-use/doc#Technical details|see documentation]])." or ''
if count == nil then count = _fetch(frame) end
if yesno(frame.args['fetch']) == false then
if (frame.args[1] or '') ~= '' then count = tonumber(frame.args[1]) end
else
count = _fetch(frame)
end
end
local title = mw.title.getCurrentTitle()
if title.subpageText == "doc" or title.subpageText == "sandbox" then
Line 117 ⟶ 130:
 
function p.main(frame)
local count = _fetch(frame)nil
if yesno(frame.args['fetch']) == false then
if (frame.args[1] or '') ~= '' then count = tonumber(frame.args[1]) end
else
count = _fetch(frame)
end
local image = "[[File:Ambox warning yellow.svg|40px|alt=Warning|link=]]"
local type_param = "style"
Line 125 ⟶ 143:
type_param = "content"
local nocat = frame:getParent().args['nocat'] or frame.args['nocat']
local categorise = (nocat == '' or not require('Module:Yesno')yesno(nocat))
if categorise then
epilogue = frame:preprocess('{{Sandbox other||{{#switch:{{#invoke:Effective protection level|{{#switch:{{NAMESPACE}}|File=upload|#default=edit}}|{{FULLPAGENAME}}}}|sysop|templateeditor|interfaceadmin=|#default=[[Category:Pages used in system messages needing protection]]}}}}')
Anonymous user