en>Ahecht |
en>Ahechtbot |
Line 1: |
Line 1: |
| local p = {}
| | return { |
| | | ["H-phrases"] = 2000, |
| -- _fetch looks at the "demo" argument.
| | ["HABS"] = 2100, |
| local _fetch = require('Module:Transclusion_count').fetch
| | ["HDS"] = 4100, |
| local yesno = require('Module:Yesno')
| | ["HD_color"] = 2800, |
| | | ["HKG"] = 2700, |
| function p.num(frame, count)
| | ["HMAS"] = 6600, |
| if count == nil then
| | ["HMCS"] = 4400, |
| if yesno(frame.args['fetch']) == false then
| | ["HMM"] = 5200, |
| if (frame.args[1] or '') ~= '' then count = tonumber(frame.args[1]) end
| | ["HMNZS"] = 2000, |
| else
| | ["HMS"] = 32000, |
| count = _fetch(frame)
| | ["HOUR"] = 2300, |
| end
| | ["HRV"] = 4000, |
| end
| | ["HUN"] = 9500, |
|
| | ["Hab"] = 11000, |
| -- Build output string
| | ["Hair_space"] = 6800, |
| local return_value = ""
| | ["Hansard-contribs"] = 9300, |
| if count == nil then
| | ["Harv"] = 6300, |
| if frame.args[1] == "risk" then
| | ["Harvard_citation"] = 6900, |
| return_value = "a very large number of"
| | ["Harvard_citation_no_brackets"] = 38000, |
| else
| | ["Harvard_citation_text"] = 5300, |
| return_value = "many"
| | ["Harvid"] = 53000, |
| end
| | ["Harvnb"] = 38000, |
| else
| | ["Harvp"] = 2900, |
| -- Use 2 significant figures for smaller numbers and 3 for larger ones
| | ["Harvtxt"] = 5300, |
| local sigfig = 2
| | ["Hat"] = 10000, |
| if count >= 100000 then
| | ["Hatnote"] = 351000, |
| sigfig = 3
| | ["Hatnote_inline"] = 2800, |
| end
| | ["Hatnote_inline/invoke"] = 2800, |
|
| | ["Height"] = 106000, |
| -- Prepare to round to appropriate number of sigfigs
| | ["Help_me-helped"] = 14000, |
| local f = math.floor(math.log10(count)) - sigfig + 1
| | ["Helpbox"] = 2500, |
|
| | ["Helpme-helped"] = 2100, |
| -- Round and insert "approximately" or "+" when appropriate
| | ["Hex2dec"] = 2300, |
| if (frame.args[2] == "yes") or (mw.ustring.sub(frame.args[1],-1) == "+") then
| | ["Hidden"] = 345000, |
| -- Round down
| | ["Hidden/FC"] = 3600, |
| return_value = string.format("%s+", mw.getContentLanguage():formatNum(math.floor( (count / 10^(f)) ) * (10^(f))) )
| | ["Hidden_archive_bottom"] = 11000, |
| else
| | ["Hidden_archive_top"] = 11000, |
| -- Round to nearest
| | ["Hidden_begin"] = 380000, |
| return_value = string.format("approximately %s", mw.getContentLanguage():formatNum(math.floor( (count / 10^(f)) + 0.5) * (10^(f))) )
| | ["Hidden_category"] = 6200, |
| end
| | ["Hidden_end"] = 379000, |
|
| | ["Hidden_ping"] = 3000, |
| -- Insert percentage of pages if that is likely to be >= 1%
| | ["Hidden_sort_key"] = 16000, |
| if count and count > 250000 then
| | ["Hide_in_print"] = 76000, |
| local percent = math.floor( ( (count/frame:callParserFunction('NUMBEROFPAGES', 'R') ) * 100) + 0.5)
| | ["High-Class"] = 15000, |
| if percent >= 1 then
| | ["High-importance"] = 15000, |
| return_value = string.format("%s pages, or roughly %s%% of all", return_value, percent)
| | ["High-use"] = 3200, |
| end
| | ["Highlight"] = 4700, |
| end
| | ["Highlight/core"] = 4900, |
| end
| | ["Hilite"] = 2900, |
|
| | ["Historical"] = 24000, |
| return return_value
| | ["Historical_populations"] = 33000, |
| end
| | ["History_icon"] = 9200, |
| -- Actions if there is a large (greater than or equal to 100,000) transclusion count
| | ["History_icon2"] = 9200, |
| function p.risk(frame)
| | ["Hlist"] = 170000, |
| local return_value = ""
| | ["Hmbox"] = 22000, |
| if frame.args[1] == "risk" then
| | ["Hmmm"] = 4900, |
| return_value = "risk"
| | ["Hndis"] = 61000, |
| else
| | ["HockeyDB"] = 3900, |
| local count = _fetch(frame)
| | ["Hockeydb"] = 3700, |
| if count and count >= 100000 then return_value = "risk" end
| | ["Hong_Kong_English"] = 2800, |
| end
| | ["Horizontal_TOC"] = 4400, |
| return return_value
| | ["Horizontal_TOC/styles.css"] = 4400, |
| end
| | ["Horse_racing"] = 3300, |
| | | ["HoursElapsed"] = 41000, |
| function p.text(frame, count)
| | ["Hours_elapsed"] = 41000, |
| -- Only show the information about how this template gets updated if someone
| | ["Hover_title"] = 52000, |
| -- is actually editing the page and maybe trying to update the count.
| | ["How_to_request_photo_in"] = 2100, |
| local bot_text = (frame:preprocess("{{REVISIONID}}") == "") and "\n\n----\n'''Preview message''': Transclusion count updated automatically ([[Template:High-use/doc#Technical details|see documentation]])." or ''
| | ["Howtoreqphotoin"] = 2100, |
|
| | ["Hr"] = 4000, |
| if count == nil then
| | ["Hs"] = 16000, |
| if yesno(frame.args['fetch']) == false then
| | ["Hugman"] = 6600, |
| if (frame.args[1] or '') ~= '' then count = tonumber(frame.args[1]) end
| | ["Human_name_disambiguation"] = 64000, |
| else
| | ["Humor"] = 2100, |
| count = _fetch(frame)
| | ["Hurricane"] = 2700, |
| end
| | ["Hurricane_season_bar"] = 2300, |
| end
| | ["Hurricane_season_bar/button"] = 2300, |
| local title = mw.title.getCurrentTitle()
| | ["Hurricane_season_bar/end"] = 2300, |
| if title.subpageText == "doc" or title.subpageText == "sandbox" then
| | ["Hurricane_season_bar/start"] = 2300, |
| title = title.basePageTitle
| | ["Hurricane_status_small"] = 2300, |
| end
| | ["Module:HTMLDecode"] = 582000, |
|
| | ["Module:Hatnote"] = 1440000, |
| local systemMessages = frame.args['system']
| | ["Module:Hatnote_inline"] = 2800, |
| if frame.args['system'] == '' then
| | ["Module:Hatnote_list"] = 949000, |
| systemMessages = nil
| | ["Module:Hidden_ping"] = 3000, |
| end
| | ["Module:High-use"] = 3200, |
|
| | ["Module:Highest_archive_number"] = 102000, |
| local templateCount = ('on [https://templatecount.toolforge.org/index.php?lang=en&namespace=%s&name=%s %s pages]'):format(
| | ["Module:Historical_populations"] = 33000, |
| mw.title.getCurrentTitle().namespace, mw.uri.encode(title.text), p.num(frame, count))
| | ["Module:Hms"] = 226000, |
| 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 .. "'''"
| |
| end
| |
|
| |
|
| |
| local sandbox_text = ("%s's [[%s/sandbox|/sandbox]] or [[%s/testcases|/testcases]] subpages, or in your own [[%s]]. "):format(
| |
| (mw.title.getCurrentTitle().namespace == 828 and "module" or "template"),
| |
| title.fullText, title.fullText,
| |
| mw.title.getCurrentTitle().namespace == 828 and "Module:Sandbox|module sandbox" or "Wikipedia:User pages#SUB|user subpage"
| |
| )
| |
|
| |
| local infoArg = frame.args["info"] ~= "" and frame.args["info"]
| |
| if (systemMessages or frame.args[1] == "risk" or (count and count >= 100000) ) then
| |
| local info = systemMessages and '.<br/>Changes to it can cause immediate changes to the Wikipedia user interface.' or '.'
| |
| if infoArg then
| |
| info = info .. "<br />" .. infoArg
| |
| end
| |
| sandbox_text = info .. '<br /> To avoid major disruption' ..
| |
| (count and count >= 100000 and ' and server load' or '') ..
| |
| ', any changes should be tested in the ' .. sandbox_text ..
| |
| 'The tested changes can be added to this page in a single edit. '
| |
| else
| |
| sandbox_text = (infoArg and ('.<br />' .. infoArg .. ' C') or ' and c') ..
| |
| 'hanges may be widely noticed. Test changes in the ' .. sandbox_text
| |
| end
| |
| | |
|
| |
| local discussion_text = systemMessages and 'Please discuss changes ' or 'Consider discussing changes '
| |
| if frame.args["2"] and frame.args["2"] ~= "" and frame.args["2"] ~= "yes" then
| |
| discussion_text = string.format("%sat [[%s]]", discussion_text, frame.args["2"])
| |
| else
| |
| discussion_text = string.format("%son the [[%s|talk page]]", discussion_text, title.talkPageTitle.fullText )
| |
| end
| |
|
| |
| return used_on_text .. sandbox_text .. discussion_text .. " before implementing them." .. bot_text
| |
| end
| |
| | |
| function p.main(frame)
| |
| local count = nil
| |
| if yesno(frame.args['fetch']) == false then
| |
| if (frame.args[1] or '') ~= '' then count = tonumber(frame.args[1]) end
| |
| else
| |
| count = _fetch(frame)
| |
| end
| |
| local image = "[[File:Ambox warning yellow.svg|40px|alt=Warning|link=]]"
| |
| local type_param = "style"
| |
| local epilogue = ''
| |
| if frame.args['system'] and frame.args['system'] ~= '' then
| |
| image = "[[File:Ambox important.svg|40px|alt=Warning|link=]]"
| |
| type_param = "content"
| |
| local nocat = frame:getParent().args['nocat'] or frame.args['nocat']
| |
| local categorise = (nocat == '' or not yesno(nocat))
| |
| if categorise then
| |
| epilogue = frame:preprocess('{{Sandbox other||{{#switch:{{#invoke:Effective protection level|{{#switch:{{NAMESPACE}}|File=upload|#default=edit}}|{{FULLPAGENAME}}}}|sysop|templateeditor|interfaceadmin=|#default=[[Category:Pages used in system messages needing protection]]}}}}')
| |
| end
| |
| elseif (frame.args[1] == "risk" or (count and count >= 100000)) then
| |
| image = "[[File:Ambox warning orange.svg|40px|alt=Warning|link=]]"
| |
| type_param = "content"
| |
| end
| |
|
| |
| if frame.args["form"] == "editnotice" then
| |
| return frame:expandTemplate{
| |
| title = 'editnotice',
| |
| args = {
| |
| ["image"] = image,
| |
| ["text"] = p.text(frame, count),
| |
| ["expiry"] = (frame.args["expiry"] or "")
| |
| }
| |
| } .. epilogue
| |
| else
| |
| return require('Module:Message box').main('ombox', {
| |
| type = type_param,
| |
| image = image,
| |
| text = p.text(frame, count),
| |
| expiry = (frame.args["expiry"] or "")
| |
| }) .. epilogue
| |
| end
| |
| end
| |
| | |
| return p
| |
Documentation for this module may be created at Module:Transclusion count/data/H/doc
return {
["H-phrases"] = 2000,
["HABS"] = 2100,
["HDS"] = 4100,
["HD_color"] = 2800,
["HKG"] = 2700,
["HMAS"] = 6600,
["HMCS"] = 4400,
["HMM"] = 5200,
["HMNZS"] = 2000,
["HMS"] = 32000,
["HOUR"] = 2300,
["HRV"] = 4000,
["HUN"] = 9500,
["Hab"] = 11000,
["Hair_space"] = 6800,
["Hansard-contribs"] = 9300,
["Harv"] = 6300,
["Harvard_citation"] = 6900,
["Harvard_citation_no_brackets"] = 38000,
["Harvard_citation_text"] = 5300,
["Harvid"] = 53000,
["Harvnb"] = 38000,
["Harvp"] = 2900,
["Harvtxt"] = 5300,
["Hat"] = 10000,
["Hatnote"] = 351000,
["Hatnote_inline"] = 2800,
["Hatnote_inline/invoke"] = 2800,
["Height"] = 106000,
["Help_me-helped"] = 14000,
["Helpbox"] = 2500,
["Helpme-helped"] = 2100,
["Hex2dec"] = 2300,
["Hidden"] = 345000,
["Hidden/FC"] = 3600,
["Hidden_archive_bottom"] = 11000,
["Hidden_archive_top"] = 11000,
["Hidden_begin"] = 380000,
["Hidden_category"] = 6200,
["Hidden_end"] = 379000,
["Hidden_ping"] = 3000,
["Hidden_sort_key"] = 16000,
["Hide_in_print"] = 76000,
["High-Class"] = 15000,
["High-importance"] = 15000,
["High-use"] = 3200,
["Highlight"] = 4700,
["Highlight/core"] = 4900,
["Hilite"] = 2900,
["Historical"] = 24000,
["Historical_populations"] = 33000,
["History_icon"] = 9200,
["History_icon2"] = 9200,
["Hlist"] = 170000,
["Hmbox"] = 22000,
["Hmmm"] = 4900,
["Hndis"] = 61000,
["HockeyDB"] = 3900,
["Hockeydb"] = 3700,
["Hong_Kong_English"] = 2800,
["Horizontal_TOC"] = 4400,
["Horizontal_TOC/styles.css"] = 4400,
["Horse_racing"] = 3300,
["HoursElapsed"] = 41000,
["Hours_elapsed"] = 41000,
["Hover_title"] = 52000,
["How_to_request_photo_in"] = 2100,
["Howtoreqphotoin"] = 2100,
["Hr"] = 4000,
["Hs"] = 16000,
["Hugman"] = 6600,
["Human_name_disambiguation"] = 64000,
["Humor"] = 2100,
["Hurricane"] = 2700,
["Hurricane_season_bar"] = 2300,
["Hurricane_season_bar/button"] = 2300,
["Hurricane_season_bar/end"] = 2300,
["Hurricane_season_bar/start"] = 2300,
["Hurricane_status_small"] = 2300,
["Module:HTMLDecode"] = 582000,
["Module:Hatnote"] = 1440000,
["Module:Hatnote_inline"] = 2800,
["Module:Hatnote_list"] = 949000,
["Module:Hidden_ping"] = 3000,
["Module:High-use"] = 3200,
["Module:Highest_archive_number"] = 102000,
["Module:Historical_populations"] = 33000,
["Module:Hms"] = 226000,
}