Module:Unsubst: Difference between revisions

Content added Content deleted
(Yay, no more hack!)
(Created page with "local p = {} local specialParams = { ['$N'] = 'template name', ['$B'] = 'template content', } p[''] = function ( frame ) if not frame:getParent() then error( '{{#invo...")
Line 1: Line 1:
local p = {}
local p = {}

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

p[''] = function ( frame )
p[''] = function ( frame )
if not frame:getParent() then
if not frame:getParent() then
Line 15: Line 15:
end
end
end
end
if mw.isSubsting() then
if mw.isSubsting() then
---- substing
---- substing
Line 31: Line 31:
args[k] = v
args[k] = v
end
end

-- Now, build an equivalent template invocation
-- Now, build an equivalent template invocation
-- First numbered args, then named
-- First numbered args, then named
Line 46: Line 46:
ret = ret .. '|' .. k .. '=' .. v
ret = ret .. '|' .. k .. '=' .. v
end
end
return ret .. '}}'
return ret .. '}}'
else
else
Line 54: Line 54:
end
end
end
end

return p
return p