Module:Sidebar: Difference between revisions

fix duplicated rows
allow for #invoke with args
Line 192: Line 192:
function p.sidebar(frame)
function p.sidebar(frame)
     local origArgs
     local origArgs
    -- If called via #invoke, use the args passed into the invoking template.
    -- Otherwise, assume we're being called from another module or from the debug
    -- console, and args are being passed directly in.
     if frame == mw.getCurrentFrame() then
     if frame == mw.getCurrentFrame() then
        -- We're being called via #invoke. If the invoking template passed any args, use
        -- them. Otherwise, use the args that were passed into the template.
         origArgs = frame:getParent().args
         origArgs = frame:getParent().args
        for k, v in pairs(frame.args) do
            origArgs = frame.args
            break
        end
     else
     else
        -- We're being called from another module or from the debug console, so assume
        -- the args are passed in directly.
         origArgs = frame
         origArgs = frame
     end
     end