Module:Infobox: Difference between revisions

    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 the empty string to be false, so to preserve the previous  
         -- ParserFunctions considers whitespace to be false, so to preserve the previous  
         -- behavior of {{infobox}}, change any empty arguments to nil, so Lua will consider
         -- 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 ~= '' or k == 'italic title' then
             if mw.ustring.match(v, '%S') or k == 'italic title' then
                 args[k] = v
                 args[k] = v
             end
             end