Module:High-use: Difference between revisions

470 bytes removed ,  3 years ago
Please be careful not to overwrite local changes when importing
(added bot comment sandbox changes based on talk page discussion)
(Please be careful not to overwrite local changes when importing)
Line 1:
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
local return_value = ""
Line 55 ⟶ 51:
 
function p.text(frame, count)
local bot_text = "\n\n----\nTransclusion count updated by [[User:Ahechtbot|Ahechtbot]]."
if frame.args["nobot"] == true then
bot_text = ""
end
if count == nil then count = _fetch(frame) end
local return_value = {}
Line 68 ⟶ 58:
end
local used_on_text = string.format("'''This %s is used on [%s %s pages]'''",
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]'''",
(mw.title.getCurrentTitle().namespace == 828 and "Lua module" or "template"),
templatecount,
p.num(frame, count)
)
Line 79 ⟶ 66:
(mw.title.getCurrentTitle().namespace == 828 and "module" or "template"),
title.fullText, title.fullText,
(mw.title.getCurrentTitle().namespace == 828 and "." or ", or in your own [[Wikipedia:Subpages#How to create user subpages|user subpage]].")
)
Line 103 ⟶ 90:
end
return table.concat({used_on_text, sandbox_text, discussion_text, " before implementing them.", bot_text})
end
 
function p.main(frame)
local countarg1 = _fetchmw.ustring.match(frame.args[1], '[%d,]+')
local count = tonumber(frame:callParserFunction('formatnum', arg1, 'R'))
local return_value = ""
local image = "[[File:Ambox warning yellow.svg|40px|alt=Warning|link=]]"
0

edits