Line 181: |
Line 181: |
| function NodeInfo:build_rows() | | function NodeInfo:build_rows() |
| for index, row_values in ipairs(self._data_rows) do | | for index, row_values in ipairs(self._data_rows) do |
− | if row_values ~= "break" and (type(row_values) ~= "table" and not mw.ustring.find(row_values, '/')) then | + | if row_values ~= "break" then |
| table.insert(self._rows, self._row_starter) | | table.insert(self._rows, self._row_starter) |
| if row_values == "header" then | | if row_values == "header" then |
Line 190: |
Line 190: |
| table.insert(self._rows, format(self._column_cell_templates[column] or self._cell, row_values[column])) | | table.insert(self._rows, format(self._column_cell_templates[column] or self._cell, row_values[column])) |
| end | | end |
− | end
| + | end |
− | else
| + | elseif mw.ustring.find(row_values, '/') then |
− | table.insert(self._rows,
| + | local split = mw.ustring.find(row_values, '/') |
− | format{self._cell,
| + | local node = mw.ustring.sub(row_values, 1, split - 1) |
− | colspan = #self._columns, rowspan = 1,
| + | local resource = mw.ustring.sub(row_values, split + 1) |
− | text_align = self._args[self._custom_row_prefix .. row_values .. self._text_align_suffix] or self._start_align,
| + | if resource == "empty" then |
− | bg_color = self._args[self._custom_row_prefix .. row_values .. self._bg_color_suffix] or self._transparent,
| + | table.insert(self._rows, format{self._empty_node_template, { values = { node = amount } } }) |
− | values = {
| + | else |
− | value = self._args[self._custom_row_prefix .. row_values .. self._content_suffix] or "",
| + | split = mw.ustring.find(resource, '/') |
− | },
| + | local amount = mw.ustring.sub(resource, split + 1) |
− | }
| + | resource = Formatting:format_image{mw.ustring.sub(resource, 1, split - 1) .. ".png", caption = mw.ustring.sub(resource, 1, split - 1)} |
− | )
| + | table.insert(self._rows, format{self._resource_node_template, { values = { node = node, amount = amount, resource = resource } } }) |
| + | end |
| end | | end |
− | else
| |
− | table.insert(self._rows, self._row_starter)
| |
− |
| |
− | local split = mw.ustring.find(row_values, '/')
| |
− | local node = mw.ustring.sub(row_values, 1, split - 1)
| |
− | local resource = mw.ustring.sub(row_values, split + 1)
| |
− | if resource == "empty" then
| |
− | table.insert(self._rows, format{self._empty_node_template, { values = { node = amount } } })
| |
− | else
| |
− | split = mw.ustring.find(resource, '/')
| |
− | local amount = mw.ustring.sub(resource, split + 1)
| |
− | resource = Formatting:format_image{mw.ustring.sub(resource, 1, split - 1) .. ".png", caption = mw.ustring.sub(resource, 1, split - 1)}
| |
− | table.insert(self._rows, format{self._resource_node_template, { values = { node = node, amount = amount, resource = resource } } })
| |
− | end
| |
| end | | end |
| end | | end |