Kephir
Joined 16 August 2012
How to detect parsing mode
editlocal 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