Module:Ordnance Survey coordinates/sandbox: Difference between revisions

Content deleted Content added
sync sandbox
use preview warning
Line 32:
local oscoord = {}
local getArgs = require('Module:Arguments').getArgs
local errwarn = require('Module:ErrorPreview warning message').errormain
local namespace = mw.title.getCurrentTitle().namespace;
 
Line 300:
local function alldigits(s)
return string.find(s,"%D") == nil
end
 
local function warning(gridref,errmsg)
returnlocal html
if namespacegridref == 0nil then
html = warn("Empty OS grid reference")
else
html = warn('OS grid reference "'..gridref..'" produced error: '..errmsg)
end
if namespace == 0 then
html = html.."'[[Category:Pages with malformed OS coordinates]]"'
end
return html
end
 
Line 306 ⟶ 319:
local input = args[1]
if input == nil or string.len(input)==0 then
return warning(nil,nil)
html = err({message="Missing OS grid ref",tag="span"})
if namespace == 0 then
html = html.."[[Category:Pages with malformed OS coordinates]]"
end
return html
end
local linktitle = args[2]
Line 345 ⟶ 354:
if LL[2] ~= nil then
html = linktitle
html = html..warn(input,LL[2])
if namespace == 0 then
html = html.."[[Category:Pages with malformed OS coordinates]]"
end
return html
end