Module:Coordinates: Difference between revisions

From Roses, Tulips, & Liberty
Content added Content deleted
m (1 revision imported: Wikipedia)
(per request)
Line 490: Line 490:
local function makeWikidataCategories(qid)
local function makeWikidataCategories(qid)
local ret
local ret
local qid = qid or mw.wikibase.getEntityIdForCurrentPage()
if mw.wikibase and current_page.namespace == 0 then
if mw.wikibase and current_page.namespace == 0 then
local entity = qid and mw.wikibase.getEntityObject(qid) or mw.wikibase.getEntityObject()
if qid and mw.wikibase.entityExists(qid) and mw.wikibase.getBestStatements(qid, "P625") and mw.wikibase.getBestStatements(qid, "P625")[1] then
local snaktype = mw.wikibase.getBestStatements(qid, "P625")[1].mainsnak.snaktype
if entity and entity.claims and entity.claims.P625 and entity.claims.P625[1] then
local snaktype = entity.claims.P625[1].mainsnak.snaktype
if snaktype == 'value' then
if snaktype == 'value' then
-- coordinates exist both here and on Wikidata, and can be compared.
-- coordinates exist both here and on Wikidata, and can be compared.