| Line 215: |
Line 215: |
| | if row_values ~= "break" then | | if row_values ~= "break" then |
| | if row_values == "header" then | | if row_values == "header" then |
| − | table.insert(self._rows, self._row_starter)
| + | if self._row_starter then |
| | + | table.insert(self._rows, self._row_starter) |
| | + | end |
| | if self._header then | | if self._header then |
| | table.insert(self._rows, self._header) | | table.insert(self._rows, self._header) |
| | end | | end |
| − | elseif row_values == "empty" then
| + | elseif row_values == "empty" then |
| − | table.insert(self._rows, self._row_starter)
| + | if self._row_starter then |
| | + | table.insert(self._rows, self._row_starter) |
| | + | end |
| | 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) |
| Line 226: |
Line 230: |
| | elseif type(row_values) == "table" then | | elseif type(row_values) == "table" then |
| | if row_values._row then | | if row_values._row then |
| − | table.insert(self._rows, format(self._row_starter_with_attributes, row_values._row))
| + | if self._row_starter_with_attributes then |
| | + | table.insert(self._rows, format(self._row_starter_with_attributes, row_values._row)) |
| | + | end |
| | else | | else |
| − | table.insert(self._rows, self._row_starter)
| + | if self._row_starter then |
| | + | table.insert(self._rows, self._row_starter) |
| | + | end |
| | end | | end |
| | for _, column in ipairs(self._columns) do | | for _, column in ipairs(self._columns) do |
| Line 245: |
Line 253: |
| | function BaseTable:build_rows_breaks_as_empty_rows() | | function BaseTable:build_rows_breaks_as_empty_rows() |
| | for index, row_values in ipairs(self._data_rows) do | | for index, row_values in ipairs(self._data_rows) do |
| − | table.insert(self._rows, self._row_starter)
| + | if self._row_starter then |
| | + | table.insert(self._rows, self._row_starter) |
| | + | end |
| | if row_values == "break" then | | if row_values == "break" then |
| | for _, column in ipairs(self._columns) do | | for _, column in ipairs(self._columns) do |
| Line 267: |
Line 277: |
| | if mw.ustring.sub(custom_row_key, 1, 1) == "#" then | | if mw.ustring.sub(custom_row_key, 1, 1) == "#" then |
| | local value = mw.ustring.sub(custom_row_key, 2) | | local value = mw.ustring.sub(custom_row_key, 2) |
| − | table.insert(self._rows, self._row_starter)
| + | if self._row_starter then |
| | + | table.insert(self._rows, self._row_starter) |
| | + | end |
| | table.insert(self._rows, format{ | | table.insert(self._rows, format{ |
| | self._cell, | | self._cell, |
| Line 281: |
Line 293: |
| | }, | | }, |
| | }) | | }) |
| − | table.insert(self._rows, self._row_starter)
| + | if self._row_starter then |
| | + | table.insert(self._rows, self._row_starter) |
| | + | end |
| | if self._header then | | if self._header then |
| | table.insert(self._rows, self._header) | | table.insert(self._rows, self._header) |
| Line 287: |
Line 301: |
| | elseif self._custom_rows and self._custom_rows[custom_row_key] then | | elseif self._custom_rows and self._custom_rows[custom_row_key] then |
| | if type(self._custom_rows[custom_row_key]) == "table" then | | 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 or {}))
| + | if self._row_starter_with_attributes then |
| | + | table.insert(self._rows, format(self._row_starter_with_attributes, self._custom_rows[custom_row_key].row or {})) |
| | + | end |
| | table.insert(self._rows, self._custom_rows[custom_row_key].content) | | table.insert(self._rows, self._custom_rows[custom_row_key].content) |
| | else | | else |
| − | table.insert(self._rows, self._row_starter)
| + | if self._row_starter then |
| | + | table.insert(self._rows, self._row_starter) |
| | + | end |
| | table.insert(self._rows, self._custom_rows[custom_row_key]) | | table.insert(self._rows, self._custom_rows[custom_row_key]) |
| | end | | end |
| − | else
| + | else |
| − | table.insert(self._rows, self._row_starter)
| + | if self._row_starter then |
| | + | table.insert(self._rows, self._row_starter) |
| | + | end |
| | local classes = self._args[self._custom_row_prefix .. custom_row_key .. self._classes_suffix] | | local classes = self._args[self._custom_row_prefix .. custom_row_key .. self._classes_suffix] |
| | if classes then | | if classes then |
| Line 317: |
Line 337: |
| | function BaseTable:finish_rows() | | function BaseTable:finish_rows() |
| | if not self._args.no_header_bottom then | | if not self._args.no_header_bottom then |
| − | table.insert(self._rows, self._row_starter)
| + | if self._row_starter then |
| | + | table.insert(self._rows, self._row_starter) |
| | + | end |
| | if self._header_bottom or self._header then | | if self._header_bottom or self._header then |
| | table.insert(self._rows, self._header_bottom or self._header) | | table.insert(self._rows, self._header_bottom or self._header) |