Module:Coordinates: Difference between revisions

Content deleted Content added
prevent blank degrees from being treated as 0
import coordinates from WikiData, per discussion
Line 572:
globalFrame = frame
local args = frame.args
local pFrame = frame:getParent();
if args[1] == nil then
local pFrame = frame:getParent();
args = pFrame.args;
forif k,v in pairs( framepFrame.args[1] ~= )nil dothen
for k,v in pairs( frame.args ) do
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
Line 584 ⟶ 593:
args[i] = ""
else
args[i] = string.match(args[i]:match(, '^%s*(.-)%s*$' ); --remove whitespace
end
end