Module:High-use: Difference between revisions

m
1 revision imported from wikipedia:Module:High-use
(+support for |article-space=yes;)
m (1 revision imported from wikipedia:Module:High-use)
 
(9 intermediate revisions by 8 users not shown)
Line 40:
return_value = string.format("approximately %s", mw.getContentLanguage():formatNum(math.floor( (count / 10^(f)) + 0.5) * (10^(f))) )
end
-- Insert percentage of pages if that is likely to be >= 1%
if count and count > 250000 then
local magic_word = yesno (frame:getParent().args['article-space']) and 'NUMBEROFARTICLES' or 'NUMBEROFPAGES';
local percent = math.floor( ( (count/frame:callParserFunction(magic_word, 'R') ) * 100) + 0.5)
 
-- Insert percentage of pages if that is likely to be >= 1% and when |no-percent= not set to yes
if count and count > 250000 and not yesno (frame:getParent().args['no-percent']) then
local percent = math.floor( ( (count/frame:callParserFunction(magic_word'NUMBEROFPAGES', 'R') ) * 100) + 0.5)
if percent >= 1 then
return_value = string.format("%s pages, or roughly %s%% of all", return_value, percent)
Line 54 ⟶ 52:
return return_value
end
 
-- Actions if there is a large (greater than or equal to 100,000) transclusion count
function p.risk(frame)
Line 87 ⟶ 86:
systemMessages = nil
end
-- This retrieves the project URL automatically to simplify localiation.
local templateCount = ('on [https://templatecountlinkcount.toolforge.org/index.php?lang=en&namespaceproject=%s&namepage=%s %s %spages]'):format(
mw.title.getCurrentTitle().namespace, mw.uri.encode(title.text), p.num(frame, count), yesno (frame:getParent().args['article-space']) and 'articles' or 'pages')
mw.title.getCurrentTitle():fullUrl():gsub('//(.-)/.*', '%1'),
mw.uri.encode(title.fullText), p.num(frame, count))
local used_on_text = "'''This " .. (mw.title.getCurrentTitle().namespace == 828 and "Lua module" or "template") .. ' is used ';
if systemMessages then
used_on_text = used_on_text .. systemMessages ..
((count and count > 2000) and (",''', and " .. templateCount) or ("'''"))
else
used_on_text = used_on_text .. templateCount .. "'''"
verified
2,497

edits