Module:Unsubst: Difference between revisions
From the Croc Wiki, the Croc encyclopedia
Jump to navigationJump to search
Content added Content deleted
(add parameter list, aliases, flags; use Module:Template invocation) |
m (fix whitespace removal; remove empty parameters after handling aliases and prevent removal of two or fewer consecutive empty parameters in a sequence) |
||
Line 79: | Line 79: | ||
-- Trim parameters, if not specified otherwise |
-- Trim parameters, if not specified otherwise |
||
if not string.find( ','..(frame.args['$flags'] or '')..',', ',%s*keep%-whitespace%s*,' ) then |
if not string.find( ','..(frame.args['$flags'] or '')..',', ',%s*keep%-whitespace%s*,' ) then |
||
for k, v in pairs( args ) do args[k] = mw.ustring.match(v, '%s*(.*)%s*') or '' end |
for k, v in pairs( args ) do args[k] = mw.ustring.match(v, '^%s*(.*)%s*$') or '' end |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
end |
end |
||
Line 103: | Line 96: | ||
end |
end |
||
args[k] = nil |
args[k] = nil |
||
⚫ | |||
⚫ | |||
⚫ | |||
local tmp = 0 |
|||
for k, v in ipairs( args ) do |
|||
if v ~= '' or ( args[k+1] and args[k+1] ~= '' ) or ( args[k+2] and args[k+2] ~= '' ) then |
|||
tmp = k |
|||
else |
|||
break |
|||
end |
|||
⚫ | |||
⚫ | |||
if v == '' then |
|||
⚫ | |||
end |
|||
end |
|||
end |
end |
||