Module:ReceptionTable: Difference between revisions
Jump to navigation
Jump to search
Content deleted Content added
Paisley Park (talk | contribs) No edit summary |
Paisley Park (talk | contribs) No edit summary |
||
Line 3: | Line 3: | ||
-- Function to create the header of the table |
-- Function to create the header of the table |
||
function p.header(frame) |
function p.header(frame) |
||
⚫ | |||
-- Retrieve the background color from the template parameter or use a default value |
|||
⚫ | |||
local part = frame.args.part or 'PB' |
|||
-- Added a style for background color to the table and set a minimum width for the date column |
-- Added a style for background color to the table and set a minimum width for the date column |
||
local header = '{| class="wikitable receptionTable"\n' |
local header = '{| class="wikitable receptionTable"\n' |
||
-- Updated to include the 'part' variable as a class for each header cell and added a color parameter for each |
|||
header = header .. '! Volume\n! style="min-width:150px;" | Date\n! Copies Sold\n! Rank\n' |
|||
header = header .. '! class="' .. part .. '" style="color:' .. frame.args.headerColor or '#ffffff' .. ';" | Volume\n' |
|||
header = header .. '! class="' .. part .. '" style="min-width:150px; color:' .. frame.args.headerColor or '#ffffff' .. ';" | Date\n' |
|||
header = header .. '! class="' .. part .. '" style="color:' .. frame.args.headerColor or '#ffffff' .. ';" | Copies Sold\n' |
|||
header = header .. '! class="' .. part .. '" style="color:' .. frame.args.headerColor or '#ffffff' .. ';" | Rank\n' |
|||
return header |
return header |
||
end |
end |
||
Line 19: | Line 21: | ||
local copiesSold = frame.args.copiesSold or '' |
local copiesSold = frame.args.copiesSold or '' |
||
local rank = frame.args.rank 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 |
local rowspan = frame.args.rowspan or 1 |
||
Line 28: | Line 28: | ||
row = row .. '! rowspan="' .. rowspan .. '" | ' .. volume .. '\n' |
row = row .. '! rowspan="' .. rowspan .. '" | ' .. volume .. '\n' |
||
end |
end |
||
-- No background color for date as per your last message |
|||
row = row .. '| ' .. date .. '\n| ' .. copiesSold .. '\n| ' .. rank .. '\n' |
row = row .. '| ' .. date .. '\n| ' .. copiesSold .. '\n| ' .. rank .. '\n' |
||
return row |
return row |
Revision as of 03:17, 25 February 2024
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 part = frame.args.part or 'PB' -- default part if none provided
-- Added a style for background color to the table and set a minimum width for the date column
local header = '{| class="wikitable receptionTable"\n'
-- Updated to include the 'part' variable as a class for each header cell and added a color parameter for each
header = header .. '! class="' .. part .. '" style="color:' .. frame.args.headerColor or '#ffffff' .. ';" | Volume\n'
header = header .. '! class="' .. part .. '" style="min-width:150px; color:' .. frame.args.headerColor or '#ffffff' .. ';" | Date\n'
header = header .. '! class="' .. part .. '" style="color:' .. frame.args.headerColor or '#ffffff' .. ';" | Copies Sold\n'
header = header .. '! class="' .. part .. '" style="color:' .. frame.args.headerColor or '#ffffff' .. ';" | 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 ''
local rowspan = frame.args.rowspan or 1
-- Create the row with the necessary cells and rowspan
local row = '|-\n'
if volume ~= '' then
row = row .. '! rowspan="' .. rowspan .. '" | ' .. volume .. '\n'
end
-- No background color for date as per your last message
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