Module:Infobox: Difference between revisions
make all whitespace arguments nil, rather than just empty string arguments
m>Mr. Stradivarius (disallow zero-numbered row parameters) |
m>Mr. Stradivarius (make all whitespace arguments nil, rather than just empty string arguments) |
||
Line 259: | Line 259: | ||
end | end | ||
-- ParserFunctions considers | -- ParserFunctions considers whitespace to be false, so to preserve the previous | ||
-- behavior of {{infobox}}, change any | -- behavior of {{infobox}}, change any whitespace arguments to nil, so Lua will consider | ||
-- them false too. (Except the 'italic title' param, which specifies different behavior | -- them false too. (Except the 'italic title' param, which specifies different behavior | ||
-- depending on whether it's absent or empty) | -- depending on whether it's absent or empty) | ||
args = {} | args = {} | ||
for k, v in pairs(origArgs) do | for k, v in pairs(origArgs) do | ||
if v | if mw.ustring.match(v, '%S') or k == 'italic title' then | ||
args[k] = v | args[k] = v | ||
end | end |