Module:Unsubst

local p = {}

local specialParams = { ['$N'] = 'template name', ['$B'] = 'template content', }

p[''] = function ( frame ) if not frame:getParent then error( ' makes no sense without a parent frame' ) end for k, v in pairs( specialParams ) do		if not frame.args[k] then error( ' requires parameter ' .. k .. ' (' .. v .. ')' )		end end if frame:preprocess(  ) ~=  then substing -- Combine passed args with passed defaults local args = {} for k, v in pairs( frame.args ) do			if not specialParams[k] then if v == '__DATE__' then v = mw.getContentLanguage:formatDate( 'F Y' ) end args[k] = v			end end for k, v in pairs( frame:getParent.args ) do			args[k] = v		end

-- Now, build an equivalent template invocation -- First numbered args, then named local ret = '' else Not substing -- Just return the "body" return frame.args['$B'] end end

return p