Module:Sandbox/ChaoticShadow/InfoboxBuilder: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 333:
 
--- Adds a row, with columns up to 30 columns spanned
-- @param should_hide boolean
-- @param ... { { tag, content, hide, attr, colspan, rowspan, css }, ... }
-- The row will be hidden if all varying columns are nil
-- @param ...cols { { tag, content, hide, attr, colspan, rowspan, css }, ... }
-- tag "th", "td", "argth", "argtd"
-- A string containing one of the above, "th" or
Line 347 ⟶ 349:
-- @return self
-- The current object
function InfoboxBuilder:addRow(should_hide, ...cols)
local argt = ...
local actual_values = {}
for i,v in ipairs(argtcols) do
if v.tag == 'argth' or v.tag == 'argtd' then
table.insert(actual_values, self:getContent(v.content))
Line 358:
end
-- if should_hide and #actual_values >== 0 then
return mw.dumpObject(argt)
-- return self
-- if should_hide and #actual_values > 0 then
-- end
-- return self
-- end
-- local _row = self.infobox:tag('tr')
-- for i,v in ipairs(argtcols) do
-- local _cell = _row:tag(tagmap[v.tag] or 'td')
-- :attr('colspan', 30 / #argtcols)
-- if v.attr then
-- _cell:attr(v.attr)
-- end
-- if v.colspan then
-- _cell:attr('colspan', v.colspan)
-- end
-- if v.rowspan then
-- _cell:attr('rowspan', v.rowspan)
-- end
-- if v.css then
-- _cell:css(v.css)
-- end
-- if v.tag == 'th' or v.tag == 'td' then
-- _cell:wikitext(v.content)
-- elseif v.tag == 'argth' or v.tag == 'argtd' then
-- _cell:wikitext(self:getContent(v.content))
-- end
-- end
-- return self
end
 
439

edits