Module:Sandbox/ChaoticShadow/InfoboxBuilder: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 17:
name = '',
headerColors = {
text = '#000',
bg = 'transparent'
},
params = {},
paramnames = {},
args = {},
infobox = mw.html.create('table'):addClass('infobox'),
finished = false
}, InfoboxBuilder)
 
Line 234 ⟶ 235:
--- Adds an image, or switchable images
-- @param ... { { tag, content, title }, ... }
-- tag "artd" or "td" TheWhether or not an it is based off a parameter
-- content string The content or the parameter name
-- title string or nil The title, if using switchable images
-- @return self
-- The current object
Line 277 ⟶ 278:
-- @param ... { { tag, content, hide, attr, colspan, rowspan, css }, ... }
-- tag "th", "td", "argth", "argtd"
-- content A string containing one of the above, "th" or
-- "td" uses content as the wikitext, "argth" or
-- attr {...} or nil
-- "argtd" uses content as the parameter name
-- colspan number or nil
-- to produce the suitable content
-- rowspan number or nil
-- csscontent string {...} Content to be used as wikitext or nila parameter
-- name
-- attr {...} or nil The attributes of the cell in table form
-- colspan number or nil The colspan of the cell
-- rowspan number or nil The rowspan of the cell
-- css {...} or nil The css of the cell in table form
-- @return self
-- The current object
Line 315 ⟶ 321:
end
 
--- Creates the 30-col layout
function InfoboxBuilder:addSpacer()
local spacer = self.infobox:tag('tr')
Line 324 ⟶ 331:
end
 
--- Adds links to the bottom of the infobox
function InfoboxBuilder:addLinks()
if not finished then
local links = {
"[[Template:%s|View]]",
"[[Template talk:%s|TalkView]]",
"[[Template talk:%s|ViewTalk]]",
}
}
self:addHeader{
content = string.format(links[1], self.name) ..
" • " ..
string.format(links[2], self.name)
}
}
end
end
 
--- Generates the infobox
-- @return string
-- The html of the infobox
function InfoboxBuilder:tostring()
if not finished then
self:addLinks()
end
}
return tostring(self.infobox)
end
439

edits