Module:High-use: Difference between revisions
Jump to navigation
Jump to search
Created page with "local p = {} local _fetch = require('Module:Transclusion_count').fetch function p.num(frame, count) if count == nil then count = _fetch(frame) end -- Build output string..."
imported>Hb1290 m (1 revision imported) |
imported>Hb1290 (Created page with "local p = {} local _fetch = require('Module:Transclusion_count').fetch function p.num(frame, count) if count == nil then count = _fetch(frame) end -- Build output string...") |
||
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 " | -- 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:// | 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 74: | Line 79: | ||
(mw.title.getCurrentTitle().namespace == 828 and "module" or "template"), | (mw.title.getCurrentTitle().namespace == 828 and "module" or "template"), | ||
title.fullText, title.fullText, | title.fullText, title.fullText, | ||
(mw.title.getCurrentTitle().namespace == 828 and "." or ", or in your own | (mw.title.getCurrentTitle().namespace == 828 and "." or ", or in your own sandbox.") | ||
) | ) | ||
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 | ||