• Welcome to the Kancolle Wiki!
  • If you have any questions regarding site content, account registration, etc., please visit the KanColle Wiki Discord

Changes

Jump to navigation Jump to search
Add basic row attribute support (class only)
Line 6: Line 6:  
_table_start = [[{| class="wikitable typography-xl-optout" style="width: -moz-fit-content; width: -webkit-fit-content; width: fit-content;"]],
 
_table_start = [[{| class="wikitable typography-xl-optout" style="width: -moz-fit-content; width: -webkit-fit-content; width: fit-content;"]],
 
_row_starter = "|-",
 
_row_starter = "|-",
 +
_row_starter_with_attributes = [[|- class="${classes}"]],
 
_header_template = "",
 
_header_template = "",
 
_column_header_cell_template = "! ${value}",
 
_column_header_cell_template = "! ${value}",
Line 184: Line 185:  
for index, row_values in ipairs(self._data_rows) do
 
for index, row_values in ipairs(self._data_rows) do
 
if row_values ~= "break" then
 
if row_values ~= "break" then
table.insert(self._rows, self._row_starter)
   
if row_values == "header" then
 
if row_values == "header" then
 +
table.insert(self._rows, self._row_starter)
 
table.insert(self._rows, self._header)
 
table.insert(self._rows, self._header)
 
elseif row_values == "empty" then
 
elseif row_values == "empty" then
 +
table.insert(self._rows, self._row_starter)
 
for _, column in ipairs(self._columns) do
 
for _, column in ipairs(self._columns) do
 
table.insert(self._rows, self._column_empty_cells[column] or self._empty_cell)
 
table.insert(self._rows, self._column_empty_cells[column] or self._empty_cell)
 
end
 
end
 
elseif type(row_values) == "table" then
 
elseif type(row_values) == "table" then
 +
if row_values._row then
 +
table.insert(self._rows, format(self._row_starter_with_attributes, row_values._row))
 +
else
 +
table.insert(self._rows, self._row_starter)
 +
end
 
for _, column in ipairs(self._columns) do
 
for _, column in ipairs(self._columns) do
 
if row_values[column] then
 
if row_values[column] then
Line 228: Line 235:  
function BaseTable:append_custom_row(custom_row_key)
 
function BaseTable:append_custom_row(custom_row_key)
 
if self._custom_rows and self._custom_rows[custom_row_key] then
 
if self._custom_rows and self._custom_rows[custom_row_key] then
table.insert(self._rows, self._custom_rows[custom_row_key])
+
if type(self._custom_rows[custom_row_key]) == "table" then
 +
table.insert(self._rows, format(self._row_starter_with_attributes, self._custom_rows[custom_row_key].row))
 +
table.insert(self._rows, self._custom_rows[custom_row_key].content)
 +
else
 +
table.insert(self._rows, self._row_starter)
 +
table.insert(self._rows, self._custom_rows[custom_row_key])
 +
end
 
else
 
else
 
table.insert(self._rows,  
 
table.insert(self._rows,  
Anonymous user

Navigation menu