Jump to content

User:Kephir

From mediawiki.org

How to detect parsing mode

[edit]
local function get_parser_mode()
	local frame = mw.getCurrentFrame() -- or w/e
	if mw.isSubsting() then
		return 'subst/pst'
	elseif frame:preprocess "{{REVISIONID}}" ~= "" then
		return 'normal'
	elseif frame:preprocess "{{REVISIONUSER}}" ~= "" then
		return 'preview'
	elseif mw.title.getCurrentTitle().namespace == 828 then
		return 'luaconsole'
	else
		return 'echo or expandtemplates'
	end
end

See also

[edit]