Module:Coordinates: Difference between revisions

Jump to navigation Jump to search
Content added Content deleted
(import coordinates from WikiData, per discussion)
(Fulfill edit request, remove superfluous function call)
Line 580: Line 580:
end
end
elseif pFrame.args[1] == nil and mw.wikibase.getEntityObject() ~= nil then
elseif pFrame.args[1] == nil and mw.wikibase.getEntityObject() ~= nil then
local entity = mw.wikibase.entity.create( mw.wikibase.getEntityObject() )
local entity = mw.wikibase.getEntityObject()
if entity and entity.claims and entity.claims.P625 and
if entity and entity.claims and entity.claims.P625 and
entity.claims.P625[1].mainsnak.snaktype == "value" then
entity.claims.P625[1].mainsnak.snaktype == "value" then
Line 624: Line 624:
if mw.wikibase and current_page.namespace == 0 then
if mw.wikibase and current_page.namespace == 0 then
local wikidata_cat
local wikidata_cat
local entity = mw.wikibase.getEntity()
local entity = mw.wikibase.getEntityObject()
if entity and entity.claims and entity.claims.p625 then
if entity and entity.claims and entity.claims.P625 then
local snaktype = entity.claims.p625[0].mainsnak.snaktype
local snaktype = entity.claims.P625[1].mainsnak.snaktype
if snaktype == 'value' then
if snaktype == 'value' then
wikidata_cat = '[[Category:Coordinates on Wikidata]]' -- coordinates exist both here and on Wikidata, and can be compared
wikidata_cat = '[[Category:Coordinates on Wikidata]]' -- coordinates exist both here and on Wikidata, and can be compared