Module:High-use: Difference between revisions

m
no edit summary
(Please be careful not to overwrite local changes when importing)
mNo edit summary
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 51 ⟶ 55:
 
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 58 ⟶ 68:
end
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 pages'''",
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 66 ⟶ 79:
(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 90 ⟶ 103:
end
return table.concat({used_on_text, sandbox_text, discussion_text, " before implementing them.", bot_text})
end
 
function p.main(frame)
local arg1count = mw.ustring.match_fetch(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=]]"
Anonymous user