Module:InfoboxCreator
Appearance
Technical Details
This module implements the logic for Template:Infobox Creator. It uses the Scribunto Lua engine to render a standardized, SEO-optimized infobox for content creators.
Functions
- main(frame)
- The primary entry point. Processes arguments from the template call and returns the HTML table.
Dependencies
- Requires the `infobox` and `vcard` CSS classes in MediaWiki:Common.css.
- Relies on the Scribunto extension.
local p = {}
function p.main(frame)
local args = frame:getParent().args
local res = mw.html.create('table')
res:addClass('infobox')
:css('width', '22em')
:css('font-size', '88%')
:css('line-height', '1.5em')
-- HEADER: The Creator's Name
res:tag('tr'):tag('th')
:attr('colspan', '2')
:css('text-align', 'center')
:css('font-size', '125%')
:css('font-weight', 'bold')
:css('background-color', '#cedff2') -- Professional Light Blue
:wikitext(args.name or mw.title.getCurrentTitle().text)
-- IMAGE
if args.image then
local imgRow = res:tag('tr')
imgRow:tag('td')
:attr('colspan', '2')
:css('text-align', 'center')
:wikitext('[[File:' .. args.image .. '|frameless|size=220px]]')
if args.caption then
res:tag('tr'):tag('td')
:attr('colspan', '2')
:css('text-align', 'center')
:css('font-size', '90%')
:wikitext(args.caption)
end
end
-- HELPER FUNCTION FOR ROWS
local function addRow(label, value)
if value and value ~= "" then
local row = res:tag('tr')
row:tag('th')
:attr('scope', 'row')
:css('text-align', 'left')
:css('width', '40%')
:wikitext(label)
row:tag('td')
:wikitext(value)
end
end
-- SECTION: PERSONAL DATA
addRow('Birth name', args.birth_name)
addRow('Born', args.birth_date)
addRow('Origin', args.birth_place)
addRow('Nationality', args.nationality)
addRow('Education', args.alma_mater)
-- SECTION: CREATOR DATA
addRow('Other names', args.other_names)
addRow('Occupation', args.occupation)
addRow('Years active', args.years_active)
addRow('Niche', args.niche)
addRow('Catchphrase', args.catchphrase)
-- SECTION: BUSINESS (The Giant Factor)
addRow('Net worth', args.net_worth)
addRow('Endorsements', args.endorsements)
-- SECTION: PLATFORMS
addRow('Primary Platform', args.platform)
addRow('Follower Count', args.followers)
addRow('Website', args.website)
return tostring(res)
end
return p