Jump to content

Module:Preview warning

Frae Wikipedia, the free beuk o knawledge
local p = {}

--[[
main

This function returns parameter 1 as a warning if the page containing it is being previewed.

Usage:
{{#invoke:Preview warning|main|warning_text}}

]]

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

return p