<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://stockhub.co/index.php?action=history&amp;feed=atom&amp;title=Module%3AInterwiki_extra%2Fdata</id>
	<title>Module:Interwiki extra/data - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://stockhub.co/index.php?action=history&amp;feed=atom&amp;title=Module%3AInterwiki_extra%2Fdata"/>
	<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:Interwiki_extra/data&amp;action=history"/>
	<updated>2026-05-28T16:59:44Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://stockhub.co/index.php?title=Module:Interwiki_extra/data&amp;diff=137039&amp;oldid=prev</id>
		<title>imported&gt;Michael Bednarek: nit pick: use moved module name in documentation.</title>
		<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:Interwiki_extra/data&amp;diff=137039&amp;oldid=prev"/>
		<updated>2020-02-21T12:15:51Z</updated>

		<summary type="html">&lt;p&gt;nit pick: use moved module name in documentation.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;-- This module processes data from mw.site.interwikiMap for use with&lt;br /&gt;
-- [[Module:Interwiki extra]]. By loading the data with mw.loadData we ensure that&lt;br /&gt;
-- this is only done once per page parse.&lt;br /&gt;
&lt;br /&gt;
local prefixes, urls, hosts = {}, {}, {}&lt;br /&gt;
&lt;br /&gt;
local function makeCountedData(t, storeKey, counterKey, itemKey, item)&lt;br /&gt;
	t = t or {}&lt;br /&gt;
	t[storeKey] = t[storeKey] or {}&lt;br /&gt;
	t[storeKey][itemKey] = item&lt;br /&gt;
	t[counterKey] = t[counterKey] and t[counterKey] + 1 or 1&lt;br /&gt;
	return t&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
for prefix, data in pairs(mw.site.interwikiMap()) do&lt;br /&gt;
	local prefixData = {}&lt;br /&gt;
	for k, v in pairs(data) do&lt;br /&gt;
		prefixData[k] = v&lt;br /&gt;
	end&lt;br /&gt;
	prefixes[prefix] = prefixData&lt;br /&gt;
&lt;br /&gt;
	local urlData = makeCountedData(&lt;br /&gt;
		urls[urlText],&lt;br /&gt;
		&amp;#039;prefixes&amp;#039;,&lt;br /&gt;
		&amp;#039;nPrefixes&amp;#039;,&lt;br /&gt;
		prefix,&lt;br /&gt;
		prefixData&lt;br /&gt;
	)&lt;br /&gt;
	urlData.url = prefixData.url&lt;br /&gt;
	urls[urlData.url] = urlData&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
for url, urlData in pairs(urls) do&lt;br /&gt;
	local urlObj = mw.uri.new(url) -- We can&amp;#039;t output URI objects as they have metatables&lt;br /&gt;
	if not urlObj or not urlObj.host then&lt;br /&gt;
		error(string.format(&lt;br /&gt;
			&amp;quot;could not find a host in URL &amp;#039;%s&amp;#039;; &amp;quot; ..&lt;br /&gt;
			&amp;quot;please check your wiki&amp;#039;s interwiki data&amp;quot;,&lt;br /&gt;
			tostring(url)&lt;br /&gt;
		))&lt;br /&gt;
	end&lt;br /&gt;
	local hostData = makeCountedData(&lt;br /&gt;
		hosts[urlObj.host],&lt;br /&gt;
		&amp;#039;urls&amp;#039;,&lt;br /&gt;
		&amp;#039;nUrls&amp;#039;,&lt;br /&gt;
		url,&lt;br /&gt;
		urlData&lt;br /&gt;
	)&lt;br /&gt;
	hostData.host = urlObj.host&lt;br /&gt;
	hosts[urlObj.host] = hostData&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return {&lt;br /&gt;
	prefixes = prefixes,&lt;br /&gt;
	urls = urls,&lt;br /&gt;
	hosts = hosts&lt;br /&gt;
}&lt;/div&gt;</summary>
		<author><name>imported&gt;Michael Bednarek</name></author>
	</entry>
</feed>