Module:ReceptionTable

From JoJo's Bizarre Encyclopedia - JoJo Wiki
Revision as of 02:52, 25 February 2024 by Paisley Park (talk | contribs) (Created page with "local p = {} -- Function to create the header of the table function p.header(frame) local header = '{| class="wikitable"\n! Volume\n! Date\n! Copies Sold\n! Rank\n' return header end -- Function to create a row in the table function p.row(frame) local volume = frame.args.volume or '' local date = frame.args.date or '' local copiesSold = frame.args.copiesSold or '' local rank = frame.args.rank or '' -- The actual calculation for rowspan...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Documentation for this module may be created at Module:ReceptionTable/doc

local p = {}

-- Function to create the header of the table
function p.header(frame)
    local header = '{| class="wikitable"\n! Volume\n! Date\n! Copies Sold\n! Rank\n'
    return header
end

-- Function to create a row in the table
function p.row(frame)
    local volume = frame.args.volume or ''
    local date = frame.args.date or ''
    local copiesSold = frame.args.copiesSold or ''
    local rank = frame.args.rank or ''
    
    -- The actual calculation for rowspan would need to be dynamic based on input
    local rowspan = frame.args.rowspan or 1
    
    -- Create the row
    local row = '|-\n'
    if volume ~= '' then
        row = row .. '! rowspan="' .. rowspan .. '" | ' .. volume .. '\n'
    end
    row = row .. '| ' .. date .. '\n| ' .. copiesSold .. '\n| ' .. rank .. '\n'
    return row
end

-- Function to close the table
function p.footer(frame)
    return '|}\n'
end

return p