Μετάβαση στο περιεχόμενο

Module:Τοπσταδίουομαδαςtest

Από τη Βικιπαίδεια, την ελεύθερη εγκυκλοπαίδεια
Documentation icon Τεκμηρίωση module[δημιουργία]
local p = {}

function p.main()
	local wikidata = require('Module:Wikidata')
	local id = wikidata.getCurrentId()
	local venue = wikidata.getRawValue{ id=id, property='P115', rank='valid' }
	
	if not venue then
		return nil
	end

	local location = wikidata.getRawValue{ id=venue, property='P131', rank='valid' }

	if not location then
		return nil
	end

	local sitelink = mw.wikibase.sitelink(location)
	local label = mw.wikibase.label(location)
	if sitelink and label and (sitelink ~= label) then
		return "[["..sitelink.."|"..label.."]]"
	elseif sitelink then
		return "[["..sitelink.."]]"
	elseif label then
		return "[[d:" .. location .. "|" .. label .. "]]"
	else
		return "[[d:" .. location .. "|" .. location .. "]]"
	end
	return location
end

return p