Module:Sandbox/ChaoticShadow/InfoboxBuilder: Difference between revisions
no edit summary
No edit summary |
No edit summary |
||
Line 241:
end
---
-- @param param_names { param_name, ... }
-- param_name string
-- The param name
-- @return
-- content string▼
if param_names and #param_names > 0 then
-- The processed content associated with a param▼
▲function InfoboxBuilder:getNonNilContent(param_names)
for i,v in ipairs(param_names) do▼
▲ local actual_values = {}
table.insert(actual_values, self:getContent(v))▼
▲ for i,v in ipairs(param_names) do
▲ table.insert(actual_values, self:getContent(v))
end
end
end
--- Adds a header
Line 269 ⟶ 274:
-- css {...} or nil
-- The css of the cell in table form
-- @param options { hideIfEmpty }
-- hideIfEmpty { param_name, ... }
-- The param_name that will be used to check if corresponding
-- @return self
-- The current object
function InfoboxBuilder:addHeader(arg, options)
if options then
return self
end
end
self:addSpacer()
Line 306 ⟶ 322:
--- Adds an image, or switchable images
-- @param
-- tag "artd" or "td"
-- Whether or not an it is based off a parameter
Line 313 ⟶ 329:
-- title string or nil
-- The title, if using switchable images
-- @param options { hideIfEmpty }
-- hideIfEmpty { param_name, ... }
-- param_name string
-- The param_name that will be used to check if corresponding
-- content is nil
-- @return self
-- The current object
function InfoboxBuilder:addImage(
if options then
if not self:shouldShow(options.hideIfEmpty) then
return self
end
end
local _cell = self.infobox:tag('tr'):tag('td'):css('text-align', 'center')
Line 322 ⟶ 347:
local actual_args = {}
for _,v in ipairs(
local c = v.content
if v.tag == 'argtd' then
Line 380 ⟶ 405:
function InfoboxBuilder:addRow(cols, options)
if options then
if
return self
▲ local actual_values = self:getNonNilContent(options.hideIfEmpty)
▲ if #actual_values == 0 then
▲ return self
▲ end
▲ end
end
|