Anonymous user
Module:Template wrapper: Difference between revisions
duplicate not
en>JJMC89 (typo) |
en>JJMC89 (duplicate not) |
||
Line 13: | Line 13: | ||
local args = {}; | local args = {}; | ||
local template; | local template; | ||
local blacklist; | local blacklist = {}; | ||
for k, v in pairs (frame.args) do -- here we get the wrapper template's 'default' parameters | for k, v in pairs (frame.args) do -- here we get the wrapper template's 'default' parameters | ||
Line 31: | Line 31: | ||
local pframe = frame:getParent(); -- here we get the wrapper template's 'live' parameters | local pframe = frame:getParent(); -- here we get the wrapper template's 'live' parameters | ||
for k, v in pairs (pframe.args) do | for k, v in pairs (pframe.args) do | ||
if 'string' == type (k) and | if 'string' == type (k) and not k:find ('^_') and not isInTable(blacklist, v) then -- do not pass along positional or blacklisted parameters | ||
if v and v ~= '' then -- pass along only those parameters that have assigned values | if v and v ~= '' then -- pass along only those parameters that have assigned values | ||
if 'unset' == v:lower() then -- special keyword to unset 'default' parameters set in the wrapper template | if 'unset' == v:lower() then -- special keyword to unset 'default' parameters set in the wrapper template |