Bureaucrats, rtl-contributors, Administrators
1,619
edits
(implement fetch parameter) |
m (1 revision imported) |
||
(17 intermediate revisions by 10 users not shown) | |||
Line 18:
if count == nil then
if frame.args[1] == "risk" then
else
end
else
Line 40:
return_value = string.format("approximately %s", mw.getContentLanguage():formatNum(math.floor( (count / 10^(f)) + 0.5) * (10^(f))) )
end
-- Insert percentage of pages if that is likely to be >= 1% and when |no-percent= not set to yes
if count and count > 250000 and not yesno (frame:getParent().args['no-percent']) then
local percent = math.floor( ( (count/frame:callParserFunction('NUMBEROFPAGES', 'R') ) * 100) + 0.5)
if percent >= 1 then
Line 52:
return return_value
end
-- Actions if there is a large (greater than or equal to 100,000) transclusion count
function p.risk(frame)
if frame.args[1] == "risk" then
else
local count = _fetch(frame)
if count and count >= 100000 then
return "risk"
end
end
return
end
Line 85 ⟶ 87:
systemMessages = nil
end
-- This retrieves the project URL automatically to simplify localiation.
local templateCount = ('on [https://
mw.title.getCurrentTitle().namespace, mw.uri.encode(title.text), p.num(frame, count))▼
mw.title.getCurrentTitle():fullUrl():gsub('//(.-)/.*', '%1'),
local used_on_text = "'''This " .. (mw.title.getCurrentTitle().namespace == 828 and "Lua module" or "template") .. ' is used ';
if systemMessages then
used_on_text = used_on_text .. systemMessages ..
((count and count > 2000) and ("
else
used_on_text = used_on_text .. templateCount .. "'''"
Line 144 ⟶ 148:
local nocat = frame:getParent().args['nocat'] or frame.args['nocat']
local categorise = (nocat == '' or not yesno(nocat))
if categorise and not mw.title.getCurrentTitle().isRedirect 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]]}}}}')
end
|