Module:Ordnance Survey coordinates/sandbox: Difference between revisions

Content deleted Content added
use preview warning
try implementing our own preview warning function
Line 32:
local oscoord = {}
local getArgs = require('Module:Arguments').getArgs
local warn = require('Module:Preview warning message').main
local namespace = mw.title.getCurrentTitle().namespace;
 
Line 303 ⟶ 302:
 
local function warning(gridref,errmsg)
local frame = mw.getCurrentFrame():getParent()
local html
if gridrefframe:preprocess( "{{REVISIONID}}" ) == nil"" then
html = '<div class="hatnote" style="color:red"><strong>Warning:</strong> '
html = warn("Empty OS grid reference")
if gridref == nil then
else
html = warn(html..'Empty OS grid reference "'..gridref..'" produced error: '..errmsg)
else
html = html..'OS grid reference "'..gridref..'" produced error: '..errmsg
end
html = html..' (this message is shown only in preview)</div>'
end
if namespace == 0 then