Module:Preview warning

From Timelines
Jump to: navigation, search

Documentation for this module may be created at Module:Preview warning/doc

local p = {}

local function trim(s)
	return s:match('^%s*(.-)%s*$')
end

function p.main(frame)
	local preview = frame.args[1]:match('^%s*(.-)%s*$') or ''
	if preview == '' then preview = 'Something is wrong with this template' end
	if frame:preprocess( "{{REVISIONID}}" ) == "" then return '<div class="hatnote" style="color:red"><strong>Warning:</strong> ' .. preview .. ' (this message is shown only in preview).</div>' end
end

return p