Changes

Jump to navigation Jump to search
236 bytes added ,  11:40, 12 September 2020
Fix typo per talk
Line 15: Line 15:  
end
 
end
 
else
 
else
-- Use 2 sigfigs for smaller numbers and 3 for larger ones
+
-- Use 2 significant figures for smaller numbers and 3 for larger ones
 
local sigfig = 2
 
local sigfig = 2
 
if count >= 100000 then
 
if count >= 100000 then
Line 24: Line 24:  
local f = math.floor(math.log10(count)) - sigfig + 1
 
local f = math.floor(math.log10(count)) - sigfig + 1
 
 
-- Round and insert "apprxomimately" or "+" when appropriate
+
-- Round and insert "approximately" or "+" when appropriate
 
if (frame.args[2] == "yes") or (mw.ustring.sub(frame.args[1],-1) == "+") then
 
if (frame.args[2] == "yes") or (mw.ustring.sub(frame.args[1],-1) == "+") then
 
-- Round down
 
-- Round down
Line 36: Line 36:  
if frame.args["all-pages"] and frame.args["all-pages"] ~= "" then
 
if frame.args["all-pages"] and frame.args["all-pages"] ~= "" then
 
local percent = math.floor( ( (count/frame:callParserFunction('NUMBEROFPAGES', 'R') ) * 100) + 0.5)
 
local percent = math.floor( ( (count/frame:callParserFunction('NUMBEROFPAGES', 'R') ) * 100) + 0.5)
return_value = string.format("%s pages, which is ≈%s%% of all", return_value, percent)
+
return_value = string.format("%s pages, or roughly %s%% of all", return_value, percent)
 
end
 
end
 
end
 
end
Line 42: Line 42:  
return return_value
 
return return_value
 
end
 
end
 
+
-- Actions if there is a large (greater than or equal to 100,000) transclusion count
 
function p.risk(frame)
 
function p.risk(frame)
 
local return_value = ""
 
local return_value = ""
Line 55: Line 55:     
function p.text(frame, count)
 
function p.text(frame, count)
 +
local bot_text = "\n\n----\nTransclusion count updated automatically ([[Template:High-use/doc#Technical details|see documentation]])."
 +
if frame.args["nobot"] == true then
 +
bot_text = ""
 +
end
 +
 
if count == nil then count = _fetch(frame) end
 
if count == nil then count = _fetch(frame) end
 
local return_value = {}
 
local return_value = {}
Line 63: Line 68:  
end
 
end
 
 
local templatecount = string.format("https://tools.wmflabs.org/templatecount/index.php?lang=en&namespace=%s&name=%s",mw.title.getCurrentTitle().namespace,mw.uri.encode(title.text))
+
local templatecount = string.format("https://templatecount.toolforge.org/index.php?lang=en&namespace=%s&name=%s",mw.title.getCurrentTitle().namespace,mw.uri.encode(title.text))
 
 
 
local used_on_text = string.format("'''This %s is used on [%s %s pages]'''",
 
local used_on_text = string.format("'''This %s is used on [%s %s pages]'''",
Line 82: Line 87:  
info = "<br />" .. frame.args["info"]
 
info = "<br />" .. frame.args["info"]
 
end
 
end
sandbox_text = string.format(".%s<br /> To avoid large-scale disruption and unnecessary server load, any changes to it should first be tested in the %sThe tested changes can then be added to this page in a single edit.&#x20;",
+
sandbox_text = string.format(".%s<br /> To avoid major disruption and server load, any changes should be tested in the %sThe tested changes can be added to this page in a single edit.&#x20;",
 
info, sandbox_text
 
info, sandbox_text
 
)
 
)
 
else
 
else
sandbox_text = string.format(", so changes to it will be widely noticed. Please test any changes in the %s",
+
sandbox_text = string.format(" and changes may be widely noticed. Test changes in the %s",
 
sandbox_text
 
sandbox_text
 
)
 
)
 
end
 
end
 
 
local discussion_text = "Please consider discussing changes "
+
local discussion_text = "Consider discussing changes "
 
if frame.args["2"] and frame.args["2"] ~= "" and frame.args["2"] ~= "yes" then
 
if frame.args["2"] and frame.args["2"] ~= "" and frame.args["2"] ~= "yes" then
 
discussion_text = string.format("%sat [[%s]]", discussion_text, frame.args["2"])
 
discussion_text = string.format("%sat [[%s]]", discussion_text, frame.args["2"])
Line 98: Line 103:  
end
 
end
 
 
return table.concat({used_on_text, sandbox_text, discussion_text, " before implementing them."})
+
return table.concat({used_on_text, sandbox_text, discussion_text, " before implementing them.", bot_text})
 
end
 
end
  
Anonymous user

Navigation menu