<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://www.vigyanwiki.in/index.php?action=history&amp;feed=atom&amp;title=Module%3AInterwiki_extra</id>
	<title>Module:Interwiki extra - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.vigyanwiki.in/index.php?action=history&amp;feed=atom&amp;title=Module%3AInterwiki_extra"/>
	<link rel="alternate" type="text/html" href="https://www.vigyanwiki.in/index.php?title=Module:Interwiki_extra&amp;action=history"/>
	<updated>2026-04-29T03:42:03Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://www.vigyanwiki.in/index.php?title=Module:Interwiki_extra&amp;diff=147955&amp;oldid=prev</id>
		<title>Indicwiki: 1 revision imported from :alpha:Module:Interwiki_extra</title>
		<link rel="alternate" type="text/html" href="https://www.vigyanwiki.in/index.php?title=Module:Interwiki_extra&amp;diff=147955&amp;oldid=prev"/>
		<updated>2023-05-03T03:52:37Z</updated>

		<summary type="html">&lt;p&gt;1 revision imported from &lt;a href=&quot;https://alpha.indicwiki.in/index.php?title=Module:Interwiki_extra&quot; class=&quot;extiw&quot; title=&quot;alpha:Module:Interwiki extra&quot;&gt;alpha:Module:Interwiki_extra&lt;/a&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en-GB&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 09:22, 3 May 2023&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en-GB&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Indicwiki</name></author>
	</entry>
	<entry>
		<id>https://www.vigyanwiki.in/index.php?title=Module:Interwiki_extra&amp;diff=21430&amp;oldid=prev</id>
		<title>Admin: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="https://www.vigyanwiki.in/index.php?title=Module:Interwiki_extra&amp;diff=21430&amp;oldid=prev"/>
		<updated>2022-11-01T04:38:36Z</updated>

		<summary type="html">&lt;p&gt;1 revision imported&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en-GB&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 10:08, 1 November 2022&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en-GB&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Admin</name></author>
	</entry>
	<entry>
		<id>https://www.vigyanwiki.in/index.php?title=Module:Interwiki_extra&amp;diff=147954&amp;oldid=prev</id>
		<title>alpha&gt;Sarika: Created page with &quot;-- This module provides functions and objects for dealing with interwiki links.  local checkType = require('libraryUtil').checkType local interwikiData = mw.loadData('Module:I...&quot;</title>
		<link rel="alternate" type="text/html" href="https://www.vigyanwiki.in/index.php?title=Module:Interwiki_extra&amp;diff=147954&amp;oldid=prev"/>
		<updated>2022-05-23T09:40:20Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;-- This module provides functions and objects for dealing with interwiki links.  local checkType = require(&amp;#039;libraryUtil&amp;#039;).checkType local interwikiData = mw.loadData(&amp;#039;Module:I...&amp;quot;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en-GB&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 15:10, 23 May 2022&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en-GB&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>alpha&gt;Sarika</name></author>
	</entry>
	<entry>
		<id>https://www.vigyanwiki.in/index.php?title=Module:Interwiki_extra&amp;diff=21429&amp;oldid=prev</id>
		<title>wikipedia&gt;Tamzin: add support for numbered arg. checked with search of ```hastemplate:&quot;Interwiki extra&quot; insource:/\{\{[Ii]nterwiki[_ ]extra\s*\|[^=|]+\}\}/```, will not break anything, and indeed will save one page where someone used a numbered arg</title>
		<link rel="alternate" type="text/html" href="https://www.vigyanwiki.in/index.php?title=Module:Interwiki_extra&amp;diff=21429&amp;oldid=prev"/>
		<updated>2022-03-19T17:05:10Z</updated>

		<summary type="html">&lt;p&gt;add support for numbered arg. checked with search of ```hastemplate:&amp;quot;Interwiki extra&amp;quot; insource:/\{\{[Ii]nterwiki[_ ]extra\s*\|[^=|]+\}\}/```, will not break anything, and indeed will save one page where someone used a numbered arg&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;-- This module provides functions and objects for dealing with interwiki links.&lt;br /&gt;
&lt;br /&gt;
local checkType = require('libraryUtil').checkType&lt;br /&gt;
local interwikiData = mw.loadData('Module:Interwiki extra/data')&lt;br /&gt;
&lt;br /&gt;
--------------------------------------------------------------------------------&lt;br /&gt;
-- Prefix class&lt;br /&gt;
--------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
local Prefix = {}&lt;br /&gt;
Prefix.__index = Prefix&lt;br /&gt;
&lt;br /&gt;
function Prefix.new(code)&lt;br /&gt;
	checkType('Prefix.new', 1, code, 'string')&lt;br /&gt;
	local obj = setmetatable({}, Prefix)&lt;br /&gt;
	local data = interwikiData.prefixes[code]&lt;br /&gt;
	if not data then&lt;br /&gt;
		return nil&lt;br /&gt;
	end&lt;br /&gt;
	for k, v in pairs(data) do&lt;br /&gt;
		obj[k] = v&lt;br /&gt;
	end&lt;br /&gt;
	return obj&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function Prefix:makeUrl(page)&lt;br /&gt;
	checkType('makeUrl', 1, page, 'string')&lt;br /&gt;
	-- In MediaWiki, interlanguage links are wiki-encoded (spaces are encoded&lt;br /&gt;
	-- as underscores), even if the site is not a wiki and underscores don't&lt;br /&gt;
	-- make sense. So we do the same here.&lt;br /&gt;
	page = mw.uri.encode(page, 'WIKI')&lt;br /&gt;
	return mw.message.newRawMessage(self.url, page):plain()&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function Prefix:isValidUrl(url)&lt;br /&gt;
	checkType('isValidUrl', 1, url, 'string')&lt;br /&gt;
	local obj1 = mw.uri.new(self.url)&lt;br /&gt;
	local obj2 = mw.uri.new(url)&lt;br /&gt;
	if not obj2 then&lt;br /&gt;
		return false&lt;br /&gt;
	elseif obj1.protocol and obj1.protocol ~= obj2.protocol then&lt;br /&gt;
		-- Protocols only have to match if the prefix URL isn't protocol-relative&lt;br /&gt;
		return false&lt;br /&gt;
	elseif obj1.host ~= obj2.host then&lt;br /&gt;
		return false&lt;br /&gt;
	end&lt;br /&gt;
	local function makePathQuery(obj)&lt;br /&gt;
		return obj.path .. (obj.queryString or '')&lt;br /&gt;
	end&lt;br /&gt;
	local pathQuery1 = makePathQuery(obj1)&lt;br /&gt;
	local pathQuery2 = makePathQuery(obj2)&lt;br /&gt;
	-- Turn pathQuery1 into a string pattern by escaping all punctuation, then&lt;br /&gt;
	-- replacing the &amp;quot;$1&amp;quot; parameter (which will have become &amp;quot;%$1&amp;quot;) with &amp;quot;.*&amp;quot;&lt;br /&gt;
	local pattern = pathQuery1:gsub('%p', '%%%0'):gsub('%%$1', '.*')&lt;br /&gt;
	pattern = '^' .. pattern .. '$'&lt;br /&gt;
	return pathQuery2:find(pattern) ~= nil&lt;br /&gt;
end&lt;br /&gt;
local langcode = {&lt;br /&gt;
	['bat_smg']      = 'bat-smg',&lt;br /&gt;
	['be_x_old']     = 'be-x-old',&lt;br /&gt;
	['cbk_zam']      = 'cbk-zam',&lt;br /&gt;
	['fiu_vro']      = 'fiu-vro',&lt;br /&gt;
	['map_bms']      = 'map-bms',&lt;br /&gt;
	['nds_nl']       = 'nds-nl',&lt;br /&gt;
	['roa_rup']      = 'roa-rup',&lt;br /&gt;
	['roa_tara']     = 'roa-tara',&lt;br /&gt;
	['zh_classical'] = 'zh-classical',&lt;br /&gt;
	['zh_min_nan']   = 'zh-min-nan', -- a comma have to be added when new lines are added&lt;br /&gt;
	['zh_yue']       = 'zh-yue'&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
local siteexcludes = {&lt;br /&gt;
	['metawiki'] = true,&lt;br /&gt;
	['mediawikiwiki'] = true,&lt;br /&gt;
	['commonswiki'] = true,&lt;br /&gt;
	['wikidatawiki'] = true,&lt;br /&gt;
	['specieswiki'] = true,&lt;br /&gt;
	['enwiki'] = true&lt;br /&gt;
}&lt;br /&gt;
function Prefix.interwiki(frame)&lt;br /&gt;
	local s = setmetatable({}, {__index = table})&lt;br /&gt;
	local entity = mw.wikibase.getEntity()&lt;br /&gt;
	-- use qid parameter if provided, otherwise follow P460&lt;br /&gt;
	local qid = frame.args.qid or frame:getParent().args.qid or frame.args[1] or frame:getParent().args[1] or ''&lt;br /&gt;
	if not mw.wikibase.isValidEntityId(qid) then&lt;br /&gt;
		qid = nil&lt;br /&gt;
		-- access the first valid value of P460&lt;br /&gt;
		for i, statement in pairs(entity:getBestStatements[[P460]]) do&lt;br /&gt;
			if statement.mainsnak.snaktype == 'value' then&lt;br /&gt;
				qid = statement.mainsnak.datavalue.value['id']&lt;br /&gt;
				break&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	if qid then&lt;br /&gt;
		local entity2 = mw.wikibase.getEntity(qid)&lt;br /&gt;
		if entity2 and entity2.sitelinks then&lt;br /&gt;
			for i, j in pairs(entity2.sitelinks) do&lt;br /&gt;
				-- exclude the own wiki and some wikiprojects that are not Wikipedia, even if their code ends with 'wiki'&lt;br /&gt;
				if not siteexcludes[j.site] then&lt;br /&gt;
					-- exclude Wikisource, Wikiquote, Wikivoyage etc&lt;br /&gt;
					if mw.ustring.sub( j.site, mw.ustring.len(j.site) - 3 ) == 'wiki' then&lt;br /&gt;
						local lang = langcode[mw.ustring.sub( j.site, 1, mw.ustring.len(j.site) - 4 )] or mw.ustring.sub( j.site, 1, mw.ustring.len(j.site) - 4 )&lt;br /&gt;
						-- exclude interwiki to projects that already have sitelinks in the present page&lt;br /&gt;
						if (entity and not entity.sitelinks[j.site]) or not entity then&lt;br /&gt;
							-- put together a interwiki-link to other projects&lt;br /&gt;
							s:insert( '[[' .. lang .. ':' .. j.title .. ']]' )&lt;br /&gt;
						end&lt;br /&gt;
					end&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	if #s &amp;gt; 0 then &lt;br /&gt;
		s:insert(&amp;quot;[[Category:Module:Interwiki extra: additional interwiki links]]&amp;quot;)&lt;br /&gt;
	end&lt;br /&gt;
	return s:concat('')&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return Prefix&lt;/div&gt;</summary>
		<author><name>wikipedia&gt;Tamzin</name></author>
	</entry>
</feed>