Module:Coordinates: Difference between revisions
Jump to navigation
Jump to search
Content added Content deleted
(prevent blank degrees from being treated as 0) |
(import coordinates from WikiData, per discussion) |
||
Line 572: | Line 572: | ||
globalFrame = frame |
globalFrame = frame |
||
local args = frame.args |
local args = frame.args |
||
⚫ | |||
if args[1] == nil then |
if args[1] == nil then |
||
⚫ | |||
args = pFrame.args; |
args = pFrame.args; |
||
if pFrame.args[1] ~= nil then |
|||
for k,v in pairs( frame.args ) do |
|||
args[k] = v; |
args[k] = v; |
||
end |
|||
elseif pFrame.args[1] == nil and mw.wikibase.getEntityObject() ~= nil then |
|||
local entity = mw.wikibase.entity.create( mw.wikibase.getEntityObject() ) |
|||
if entity and entity.claims and entity.claims.P625 and |
|||
entity.claims.P625[1].mainsnak.snaktype == "value" then |
|||
args[1] = entity.claims.P625[1].mainsnak.datavalue.value.latitude |
|||
args[2] = entity.claims.P625[1].mainsnak.datavalue.value.longitude |
|||
end |
|||
end |
end |
||
end |
end |
||
Line 584: | Line 593: | ||
args[i] = "" |
args[i] = "" |
||
else |
else |
||
args[i] = args[i] |
args[i] = string.match(args[i], '^%s*(.-)%s*$' ); --remove whitespace |
||
end |
end |
||
end |
end |