Module:Ordnance Survey coordinates/sandbox: Difference between revisions

Content deleted Content added
fix up warning
simplify error message
Line 301:
end
 
local function warning(gridref,errmsg)
local frame = mw.getCurrentFrame():getParent()
local html = ""
if frame:preprocess( "{{REVISIONID}}" ) == "" then
html = '<div style="color:red"><strong>Warning:</strong> '..errmsg
if gridref == nil then
html = html..'Empty OS grid reference'
else
html = html..'OS grid reference "'..gridref..'" produced error: '..errmsg
end
html = html..' <small>(this message is shown only in preview)</small></div>'
end
Line 323 ⟶ 318:
local input = args[1]
if input == nil or string.len(input)==0 then
return warning(nil,nil"Empty OS grid ref")
end
local linktitle = args[2]
Line 358 ⟶ 353:
if LL[2] ~= nil then
html = linktitle
html = html..warning(linktitle,LL[2])
return html
end