Module:Coordinates: Difference between revisions
Jump to navigation
Jump to search
Content added Content deleted
(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: | Line 580: | ||
local text = '' |
local text = '' |
||
if string.find( Display, 'inline' ) ~= nil |
|||
local valid_Display = false |
|||
or Display == 'i' |
|||
or Display == 'it' |
|||
or Display == 'ti' |
|||
then |
|||
-- Coordinates are displayed inline. |
|||
text = displayinline(contents, Notes) |
text = displayinline(contents, Notes) |
||
valid_Display = true |
|||
end |
end |
||
if string.find( Display, 'title' ) ~= nil |
if string.find( Display, 'title' ) ~= nil |
||
or Display == 't' |
|||
or Display == 'it' |
|||
or Display == 'ti' |
|||
then |
|||
-- Coordinates are displayed in the title. |
|||
text = text .. displaytitle(contents, Notes) |
text = text .. displaytitle(contents, Notes) |
||
-- Add a Wikidata category for mainspace pages. |
|||
valid_Display = true |
|||
if mw.wikibase and current_page.namespace == 0 then |
|||
⚫ | |||
local wikidata_cat |
|||
local entity = mw.wikibase.getEntity() |
|||
if valid_Display and mw.wikibase and current_page.namespace == 0 then -- add the appropriate Wikidata category for main namespace pages |
|||
if entity and entity.claims and entity.claims.p625 then |
|||
local snaktype = entity.claims.p625[0].mainsnak.snaktype |
|||
if snaktype == 'value' then |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
elseif snaktype == 'novalue' then |
|||
end |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
end |
end |
||
⚫ | |||
⚫ | |||
end |
end |
||
end |
end |
||
⚫ | |||
⚫ | |||
return text |
return text |
||
end |
end |