Anonymous user
Module:Coordinates: Difference between revisions
only add Wikidata categories if coordinates are displayed in the title
(check for nil values of entity.claims per protected edit request by User:Hydrox) |
(only add Wikidata categories if coordinates are displayed in the title) |
||
Line 580:
local text = ''
if string.find( Display, 'inline' ) ~= nil
or Display == 'ti'
then
-- Coordinates are displayed inline.
text = displayinline(contents, Notes)
end
if string.find( Display, 'title' ) ~= nil
or Display == 'it'
or Display == 'ti'
then
-- Coordinates are displayed in the title.
text = text .. displaytitle(contents, Notes)
-- Add a Wikidata category for mainspace pages.
if mw.wikibase and current_page.namespace == 0 then
end▼
local entity = mw.wikibase.getEntity()
wikidata_cat = '[[Category:Coordinates on Wikidata]]' -- coordinates exist both here and on Wikidata, and can be compared▼
if snaktype == 'value' then▼
elseif snaktype == 'somevalue' then▼
▲ wikidata_cat = '[[Category:Coordinates on Wikidata]]' -- coordinates exist both here and on Wikidata, and can be compared
wikidata_cat = '[[Category:Coordinates on Wikidata set to unknown value]]'▼
▲ elseif snaktype == 'somevalue' then
▲ wikidata_cat = '[[Category:Coordinates on Wikidata set to unknown value]]'
wikidata_cat = '[[Category:Coordinates on Wikidata set to no value]]'▼
end
▲ wikidata_cat = '[[Category:Coordinates on Wikidata set to no value]]'
else▼
wikidata_cat = '[[Category:Coordinates not on Wikidata]]' -- we have to either import the coordinates to Wikidata or remove them here▼
end
▲ else
▲ wikidata_cat = '[[Category:Coordinates not on Wikidata]]' -- we have to either import the coordinates to Wikidata or remove them here
end
end
▲ wikidata_cat = wikidata_cat or ''
▲ text = text .. wikidata_cat
return text
end
|