Module:Sandbox/Innocent bystander

From Wikidata
Jump to navigation Jump to search
Lua
CodeDiscussionLinksLink count SubpagesDocumentationTestsResultsSandboxLive code All modules

{{#invoke:Sandbox/Innocent bystander|sitelinks}}

banwikisource:Wikisource:Pasangkepan, knwikisource:ವಿಕಿಸೋರ್ಸ್:ಅರಳಿ ಕಟ್ಟೆ, mswikisource:Wikisumber:Kedai Kopi, iswikisource:Wikiheimild:Potturinn, bnwikisource:উইকিসংকলন:লিপিশালা, napwikisource:Wikisource:Bar, itwikisource:Wikisource:Bar/Archivio/2024.08, etwikisource:Vikitekstid:Üldine arutelu, cswikisource:Wikizdroje:U pramene, bswikisource:Wikizvor:Čaršija, aswikisource:ৱিকিউৎস:কেন্দ্ৰীয় আলোচনা, trwikisource:Vikikaynak:Köy çeşmesi, mrwikisource:विकिस्रोत:चावडी, orwikisource:ଉଇକିପାଠାଗାର:ଆଲୋଚନା ସଭା, frwikisource:Wikisource:Scriptorium, hrwikisource:Wikizvor:Pisarnica, arwikisource:ويكي مصدر:الميدان, brwikisource:Wikimammenn:An davarn, suwikisource:Wikipabukon:Sawala, guwikisource:વિકિસ્રોત:સભાખંડ, huwikisource:Wikiforrás:Kocsmafal, svwikisource:Wikisource:Mötesplatsen, jvwikisource:Wikisumber:Angkringan, euwikisource:Wikiteka:Txokoa, zh_min_nanwikisource:Wiki Tô·-su-kóan:Chheh-pâng, mywikisource:ဝီကီရင်းမြစ်:လက်ဖက်ရည်ဆိုင်, cywikisource:Wicidestun:Y Sgriptoriwm, idwikisource:Wikisumber:Warung kopi, wawikisource:Wikisourd:Inte di nozôtes, sawikisource:विकिस्रोतः:समुदायद्वारम्, pawikisource:ਵਿਕੀਸਰੋਤ:ਸੱਥ, jawikisource:Wikisource:井戸端, lawikisource:Vicifons:Scriptorium, fawikisource:ویکی‌نبشته:دفترخانه, cawikisource:Viquitexts:La taverna, vecwikisource:Wikisource:Ciacole, lijwikisource:Wikivivàgna:Pòrtego da comunitæ, zhwikisource:Wikisource:写字间, thwikisource:วิกิซอร์ซ:เซ็นเตอร์พ้อยท์, tewikisource:వికీసోర్స్:రచ్చబండ, bewikisource:Вікікрыніцы:Супольнасць, dewikisource:Wikisource:Skriptorium, ruwikisource:Викитека:Форум, hewikisource:ויקיטקסט:מזנון, ukwikisource:Вікіджерела:Скрипторій, skwikisource:Wikizdroje:Portál komunity, plwikisource:Wikiźródła:Skryptorium, pmswikisource:Wikisource:Piòla, slwikisource:Wikivir:Pod lipo, enwikisource:Wikisource:Scriptorium, glwikisource:Wikisource:A Taberna, elwikisource:Βικιθήκη:Γραμματεία, mlwikisource:വിക്കിഗ്രന്ഥശാല:വിക്കി പഞ്ചായത്ത് (സാങ്കേതികം), nlwikisource:Wikisource:De kroeg, yiwikisource:װיקיביבליאָטעק:געמײנדע, viwikisource:Wikisource:Thảo luận, mkwikisource:Викиизвор:Селска чешма, hiwikisource:विकिस्रोत:चौपाल, fiwikisource:Wikiaineisto:Kahvihuone, liwikisource:Wikibrónne:Gebroekersportaol, tawikisource:விக்கிமூலம்:ஆலமரத்தடி, ptwikisource:Wikisource:Esplanada, bgwikisource:Уикиизточник:Разговори, eswikisource:Wikisource:Café, fowikisource:Wikiheimild:Undirhúsið, eowikisource:Vikifontaro:Diskutejo, kowikisource:위키문헌:사랑방, sahwikisource:Бикитиэкэ:Кэпсэтэр сир, nowikisource:Wikikilden:Kontoret, rowikisource:Wikisource:Scriptoriu, dawikisource:Wikisource:Skriptoriet, srwikisource:Викизворник:Писарница, hywikisource:Վիքիդարան:Խորհրդարան

Code

local p =   {}

p.sitelinks = function( frame )
	local s = {}
	local entity = mw.wikibase.getEntity('Q16503') 			-- Download Village Pump
	if entity and entity.sitelinks then 					-- See if entity exists, and that it has sitelinks
		for i, j in pairs(entity.sitelinks) do 				-- loop over all sitelinks
			if mw.ustring.sub( j.site, mw.ustring.len(j.site) - 9 ) == 'wikisource' then	-- See which are to Wikisource
				table.insert(s, j.site .. ':' .. j.title)	-- Create a table of sites and sitelinks
			end
		end
	end
	return table.concat(s, ', ')							-- Return as string
end

p.aliases = function( frame )
	local s = {}
	local entity = mw.wikibase.getEntity('Q39246')			-- Download Richard P. Feynman
	if entity and entity.aliases then						-- See if there is an entity and that is has aliases
		if entity.aliases['en'] then						-- See if it has English Aliases
			for i, j in pairs(entity.aliases['en']) do		-- Make a loop around the English aliases
				table.insert(s, j.value)					-- Create a table of English aliases
			end
		end
	end
	return table.concat(s, ', ')							-- Return as string
end

return p