Module:ReceptionTable/pt-br

From JoJo's Bizarre Encyclopedia - JoJo Wiki
< Module:ReceptionTable
Revision as of 10:37, 20 August 2024 by Ylkaid (talk | contribs) (Created page with "local p = {} -- Function to create the header of the table function p.header(frame) local part = frame.args.part or 'pb' local headerColor = frame.args.headerColor or '#ffffff' local width = frame.args.width or '80%' local borderColor = frame.args.borderColor or 'var(--' .. string.lower(part) .. '2)' local showVolume = frame.args.showVolume ~= 'false' local header = '{| class="wikitable receptionTable diamonds" style="border-collapse: inherit; w...")
(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/pt-br/doc

local p = {}

-- Function to create the header of the table
function p.header(frame)
    local part = frame.args.part or 'pb'
    local headerColor = frame.args.headerColor or '#ffffff'
    local width = frame.args.width or '80%'
    local borderColor = frame.args.borderColor or 'var(--' .. string.lower(part) .. '2)'
    local showVolume = frame.args.showVolume ~= 'false'

    local header = '{| class="wikitable receptionTable diamonds" style="border-collapse: inherit; width:' .. width .. '; border: 2px groove ' .. borderColor .. '\n'
    if showVolume then
    	header = header .. '! class="receptionTableHeader ' .. part .. '" style="color:' .. headerColor .. ';" | Volume\n'
    end
    header = header .. '! class="receptionTableHeader ' .. part .. '" style="min-width:150px; color:' .. headerColor .. ';" | Data\n'
    header = header .. '! class="receptionTableHeader ' .. part .. '" style="color:' .. headerColor .. ';" | Posição\n'
    header = header .. '! class="receptionTableHeader ' .. part .. '" style="color:' .. headerColor .. ';" | Cópias Físicas Vendidas\n'
    header = header .. '! class="receptionTableHeader ' .. part .. '" style="color:' .. headerColor .. ';" | Total\n'
    return header
end

-- Function to create a row in the table
function p.row(frame)
	local part = frame.args.part or 'pb'
    local volume = frame.args.volume or ''
    local date = frame.args.date or ''
    local rank = frame.args.rank or ''
    local copiesSold = frame.args.copiesSold or ''
    local total = frame.args.total or ''
    local rowspan = frame.args.rowspan or 1
    
    -- Create the row with the necessary cells and rowspan
	local row = '|-'
	if volume ~= '' then
	    row = row .. ' class="receptionTableSection"'
	    row = row .. '\n! class="receptionTableImage ' .. part .. '4 diamonds" style="width:12%; border-top: 2px solid var(--' .. string.lower(part) .. '2);" rowspan="' .. rowspan .. '" | ' .. volume
	end
	
	local borderStyle = ' style="border-top: 2px solid var(--' .. string.lower(part) .. '2);"'
	if volume ~= '' then
	    row = row .. '\n|' .. borderStyle .. ' | ' .. date
	    row = row .. '\n|' .. borderStyle .. ' | ' .. rank
	    row = row .. '\n|' .. borderStyle .. ' | ' .. copiesSold
	    row = row .. '\n|' .. borderStyle .. ' | ' .. total
	else
	    row = row .. '\n| ' .. date
	    row = row .. '\n| ' .. rank
	    row = row .. '\n| ' .. copiesSold
	    row = row .. '\n| ' .. total
	end
	
	return row
end

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

return p