Module:Ordnance Survey coordinates/sandbox: Difference between revisions

Content deleted Content added
save a call to currentTitle()
accept miscellaneous named arguments to pass to geohack
Line 321:
 
function oscoord.main(frame)
local argsframeArgs = getArgs(frame,{parentFirst=true,parentOnly=false,frameOnly=false})
local input = argsframeArgs[1]
if input == nil or string.len(input)==0 then
return warning(nil)
end
local linktitle = argsframeArgs[2]
local namearg = argsframeArgs["name"]
local args = split(input,'_')
local LL
Line 362:
html = html..warning(LL[2])
return html
end
local geohackArgs = {}
local k, v
for i = restargs,#args do
k, v = args[i].split(':')
geohackArgs[k] = v
end
for k, v in pairs(frameArgs) do
if not isnumber(k) and k ~= 'name' then
geohackArgs[k] = v
end
end
-- https://geohack.toolforge.org/geohack.php?pagename=Mount_Whitney&params=36.578580925_N_118.29199495_W_type:mountain_region:US-CA_scale:100000_source:NGS
Line 374 ⟶ 385:
url = url..LL[4]..'_E'
end
for ik, =v restargs,#argsin geohackArgs do
url = url..'_'..args[i]k..':'..v
end
if string.find(input,"not geohackArgs['region") == nil'] then
url = url..'_region:'..LL[1]
end
if namearg then