FANDOM


local p = {}
 
local sites = { -- interwiki prefix, parameter, label and site id (for Wikidata)
	{ 'w', 'wikipedia', 'Wikipedia article', 'enwiki' },
	{ 'commons', 'commons', 'Commons gallery', 'commonswiki' },
	{ 'commons:Category', 'commonscat', 'Commons category', '' },
	{ 'q', 'wikiquote', 'quotes', 'enwikiquote' },
	{ 'n', 'wikinews', 'news', 'enwikinews' },
	{ 'wikt', 'wiktionary', 'definition', 'enwiktionary' },
	{ 'b', 'wikibooks', 'textbook', 'enwikibooks' },
	{ 'v', 'wikiversity', 'course', 'enwikiversity' },
	{ 'wikispecies', 'wikispecies', 'taxonomy', 'wikispecieswiki' },
	{ 'voy', 'wikivoyage', 'travel guide', 'enwikivoyage' },
	{ 'd', 'wikidata', 'Data item', 'wikidatawiki' },
	{ 'wikilivres', 'wikilivres', 'wikilivres', '' },
	{ 'm', 'meta', 'Meta', 'metawiki' }
}
 
function p.interprojetPart( frame )
	local frame = frame:getParent()
	local item = mw.wikibase.getEntityObject()
	local links = {}
 
	for _, site in pairs( sites ) do
		local val = ''
		if val == '' and frame.args[site[2]] ~= nil then
			val = frame.args[site[2]]
		end
		if val == '' and site[4] ~= '' and item ~= nil then
			if site[4] == 'wikidatawiki' then
				val = item.id or ''
			else
				val = item:getSitelink( site[4] ) or ''
			end
		end
 
		if val ~= '' then
			table.insert( links, '[[' .. site[1] .. ':' .. val .. '|' .. site[3] .. ']]' )
		end
	end
 
	if next( links ) == nil then
		return ''
	end
 
	return '<li class="sisitem">'
		.. '<span class="sisicon" style="padding-right:1ex;">[[Image:Wikimedia-logo.svg|frameless|18px|link=Special:sitematrix|alt=Sister Projects.]]</span>'
		.. '[[Special:sitematrix|sister projects]]:&#32;' .. table.concat( links, ',&#32;' )
		.. '.</li>'
end
 
return p

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.