Module:Ordnance Survey coordinates/sandbox: Difference between revisions

Content deleted Content added
sync sandbox to prev version
lop off junk characters and all following stuff
Line 304:
function oscoord.main(frame)
local args = getArgs(frame,{parentFirst=true,parentOnly=false,frameOnly=false})
local inputgridref = args[1]
if inputgridref == nil or string.len(inputgridref)==0 then
html = err({message="Missing OS grid ref",tag="span"})
if namespace == 0 then
Line 311:
end
return html
end
-- if there is a junk character (non-alphanumeric, not underscore)
-- lop off string after it (including junk character)
local junkstart = string.find(gridref,"[^%w_]")
if junkstart ~= nil then
gridref = string.sub(gridref,1,junkstart-1)
end
local linktitle = args[2]
local args = split(inputgridref,'_')
local LL
local restargs = 1
Line 354 ⟶ 360:
url = url..'_'..args[i]
end
if string.find(inputgridref,"region") == nil then
url = url..'_region:'..LL[1]
end