Home
Random
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:Interwiki extra/data
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!
-- This module processes data from mw.site.interwikiMap for use with -- [[Module:Interwiki extra]]. By loading the data with mw.loadData we ensure that -- this is only done once per page parse. local prefixes, urls, hosts = {}, {}, {} local function makeCountedData(t, storeKey, counterKey, itemKey, item) t = t or {} t[storeKey] = t[storeKey] or {} t[storeKey][itemKey] = item t[counterKey] = t[counterKey] and t[counterKey] + 1 or 1 return t end for prefix, data in pairs(mw.site.interwikiMap()) do local prefixData = {} for k, v in pairs(data) do prefixData[k] = v end prefixes[prefix] = prefixData local urlData = makeCountedData( urls[urlText], 'prefixes', 'nPrefixes', prefix, prefixData ) urlData.url = prefixData.url urls[urlData.url] = urlData end for url, urlData in pairs(urls) do local urlObj = mw.uri.new(url) -- We can't output URI objects as they have metatables if not urlObj or not urlObj.host then error(string.format( "could not find a host in URL '%s'; " .. "please check your wiki's interwiki data", tostring(url) )) end local hostData = makeCountedData( hosts[urlObj.host], 'urls', 'nUrls', url, urlData ) hostData.host = urlObj.host hosts[urlObj.host] = hostData end return { prefixes = prefixes, urls = urls, hosts = hosts }
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:Interwiki extra/data/doc
(
edit
)