Open main menu
Home
Random
Donate
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:NUMBEROF/other
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
-- Return a table of statistics to be accessed once per page using mw.loadData. -- For each sister project, the table ranks each site by its number of articles. local projects = { 'wikibooks', 'wikinews', 'wikiquote', 'wikisource', 'wikiversity', 'wikivoyage', 'wiktionary', } local function getData(statistics) local iSite, iArticles for i, v in ipairs(statistics.schema.fields) do if v.name == 'site' then iSite = i elseif v.name == 'articles' then iArticles = i end end local rankBySite, rankByIndex = {}, {} for _, v in ipairs(statistics.data) do rankBySite[v[iSite]] = v[iArticles] -- rank of site from number of articles rankByIndex[v[iArticles]] = v[iSite] -- inverse end return { rankByIndex = rankByIndex, -- rankByIndex[1] == 'en' rankBySite = rankBySite, -- rankBySite['en'] == 1 } end local function makeData() -- For example, data to rank each language for sister project wikipedia is at -- https://commons.wikimedia.org/wiki/Data:Wikipedia_statistics/rank/wikipedia.tab local result = {} for _, project in ipairs(projects) do result[project] = getData(mw.ext.data.get('Wikipedia statistics/rank/' .. project .. '.tab')) end return result end return makeData()
Summary:
Please note that all contributions to Stockhub may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Stockhub:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Template used on this page:
Module:NUMBEROF/other/doc
(
edit
)