Module:High-use: Difference between revisions

Annotations
 
m 1 revision imported
 
(6 intermediate revisions by 5 users not shown)
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 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 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