Module:Mapframe and Module:Mapframe/sandbox: Difference between pages
Appearance
(Difference between pages)
Content deleted Content added
Better error |
sync |
||
Line 59: | Line 59: | ||
L10n.template = { |
L10n.template = { |
||
coord = { -- The coord template, as well as templates with output that contains {{coord}} |
coord = { -- The coord template, as well as templates with output that contains {{coord}} |
||
"Coord", "Coord/sandbox", |
"Coord", "Coord/sandbox", "Coordinates", "Module:Coordinates", |
||
"NRHP row", "NRHP row/sandbox", |
"NRHP row", "NRHP row/sandbox", |
||
"WikidataCoord", "WikidataCoord/sandbox", "Wikidatacoord", "Wikidata coord" |
"WikidataCoord", "WikidataCoord/sandbox", "Wikidatacoord", "Wikidata coord", "Module:WikidataCoord" |
||
} |
} |
||
} |
} |
||
Line 258: | Line 258: | ||
]]-- |
]]-- |
||
function util.isCoordTemplateOrWrapper(name) |
function util.isCoordTemplateOrWrapper(name) |
||
name = mw.text.trim(name) |
name = mw.text.split(mw.text.trim(name),":",true) |
||
local inputTitle |
local inputTitle |
||
if not name[2] then |
|||
inputTitle = mw.title.new(name[1], 'Template') |
|||
elseif mw.ustring.lower(name[1]) == "#invoke" then |
|||
inputTitle = mw.title.new(name[2], 'Module') |
|||
end |
|||
if not inputTitle then |
if not inputTitle then |
||
return false |
return false |
||
Line 380: | Line 385: | ||
local lat_d = tonumber(parts[1]) |
local lat_d = tonumber(parts[1]) |
||
assert(lat_d, "Unable to get latitude from input '"..coords.."'.") |
|||
local lat_m = tonumber(parts[2]) -- nil if coords are in decimal format |
local lat_m = tonumber(parts[2]) -- nil if coords are in decimal format |
||
local lat_s = lat_m and tonumber(parts[3]) -- nil if coords are either in decimal format or degrees and minutes only |
local lat_s = lat_m and tonumber(parts[3]) -- nil if coords are either in decimal format or degrees and minutes only |
||
Line 389: | Line 393: | ||
local long_d = tonumber(parts[1+#parts/2]) |
local long_d = tonumber(parts[1+#parts/2]) |
||
assert(long_d, "Unable to get longitude from input '"..coords.."'.") |
|||
local long_m = tonumber(parts[2+#parts/2]) -- nil if coords are in decimal format |
local long_m = tonumber(parts[2+#parts/2]) -- nil if coords are in decimal format |
||
local long_s = long_m and tonumber(parts[3+#parts/2]) -- nil if coords are either in decimal format or degrees and minutes only |
local long_s = long_m and tonumber(parts[3+#parts/2]) -- nil if coords are either in decimal format or degrees and minutes only |