Module:Credits
From Eli's Software Encyclopedia
Documentation for this module may be created at Module:Credits/doc
local utils = require('Module:Utils')
local p = {}
function p.semanticStore(frame)
local titleObj = mw.title.getCurrentTitle()
local args = frame:getParent().args or {}
-- Get infobox helper params
local collapsible = args['collapsible'] or 'no'
local state = args['state'] or 'autocollapse'
-- Get other properties
local title = args['title'] or titleObj.text
local Concept = args['Concept'] or ''
local Designer = args['Designer'] or ''
-- Credit
local Credit1 = args['Credit1'] or ''
local Credit2 = args['Credit2'] or ''
local Credit3 = args['Credit3'] or ''
local Credit4 = args['Credit4'] or ''
local CreditTable = {}
for _, credit in ipairs{Credit1, Credit2, Credit3, Credit4} do
if credit ~= '' then
table.insert(CreditTable, credit)
end
end
-- Graphics
local Graphics1 = args['Graphics1'] or ''
local Graphics2 = args['Graphics2'] or ''
local Graphics3 = args['Graphics3'] or ''
local Graphics4 = args['Graphics4'] or ''
local Graphics5 = args['Graphics5'] or ''
local GraphicsTable = {}
for _, graphics in ipairs{Graphics1, Graphics2, Graphics3, Graphics4, Graphics5} do
if graphics ~= '' then
table.insert(GraphicsTable, graphics)
end
end
local GameIdea = args['GameIdea'] or '' -- '''Game Idea'''
local ADesign = args['ADesign'] or '' -- '''Additional Design'''
local Producer = args['Producer'] or '' -- '''Producer'''
local Writer = args['Writer'] or '' -- '''Writer'''
local ArtDirector = args['ArtDirector'] or '' -- '''Art Director'''
local TechDirector = args['TechDirector'] or '' -- '''Technical Director'''
local AProducer = args['AProducer'] or '' -- '''Assistant Producer'''
local LProgrammer = args['LProgrammer'] or '' -- '''Lead Programmer'''
local SProgrammer = args['SProgrammer'] or '' -- '''Senior Programmer'''
local Programmer = args['Programmer'] or '' -- '''Programmer'''
local GProgrammer = args['GProgrammer'] or '' -- '''Game Programming'''
local AProgrammer = args['AProgrammer'] or '' -- '''Additional Programming'''
local LAnimator = args['LAnimator'] or '' -- '''Lead Animator'''
local Animation = args['Animation'] or '' -- '''Animation'''
local LArtist = args['LArtist'] or '' -- '''Lead Artist'''
local Artists = args['Artists'] or '' -- '''Art Team'''
local CArtist = args['CArtist'] or '' -- '''Concept Artist'''
local AArtwork = args['AArtwork'] or '' -- '''Additional Artwork'''
local TechLead = args['TechLead'] or '' -- '''Technology Lead'''
local TProgramming = args['TechLead'] or '' -- '''Technology Programming'''
local ATProgramming = args['ATProgramming'] or '' -- '''Additional Technology Programming'''
local QALead = args['QALead'] or '' -- '''QA Lead'''
local QA = args['QA'] or '' -- '''QA'''
local Music = args['Music'] or '' -- '''Music'''
local Sound = args['Sound'] or '' -- '''Sound Effects'''
local AudioEdit = args['AudioEdit'] or '' -- '''Audio Editor'''
local CDirector = args['CDirector'] or '' -- '''Casting Director'''
local LAProducer = args['LAProducer'] or '' -- '''Live Action Producer'''
local DPhoto = args['DPhoto'] or '' -- '''Director of Photography'''
local VEditor = args['VEditor'] or '' -- '''Video Editor'''
local Cast = args['Cast'] or '' -- '''Cast'''
local Manual = args['Manual'] or '' -- '''Manual'''
local ContentPub = args['ContentPub'] or '' -- '''Publisher'''
local SrEditor = args['SrEditor'] or '' -- '''Senior Editor'''
local Editor = args['Editor'] or '' -- '''Editor'''
local CoverArt = args['CoverArt'] or '' -- '''Cover Art'''
local Production = args['Production'] or '' -- '''Production'''
-- Set properties
local data = {
'Has Title=' .. title,
'Concept=' .. utils.unwrapList(utils.unwrapLink(Concept)),
'Designer=' .. utils.unwrapList(utils.unwrapLink(Designer)),
'+sep=,',
'Game Idea=' .. utils.unwrapList(utils.unwrapLink(GameIdea)),
'+sep=,',
'Additional Design=' .. utils.unwrapList(utils.unwrapLink(ADesign)),
'+sep=,',
'Producer=' .. utils.unwrapList(utils.unwrapLink(Producer)),
'+sep=,',
'Writer=' .. utils.unwrapList(utils.unwrapLink(Writer)),
'+sep=,',
'Art Director=' .. utils.unwrapList(utils.unwrapLink(ArtDirector)),
'+sep=,',
'Technical Director=' .. utils.unwrapList(utils.unwrapLink(TechDirector)),
'+sep=,',
'Assistant Producer=' .. utils.unwrapList(utils.unwrapLink(AProducer)),
'+sep=,',
'Lead Programmer=' .. utils.unwrapList(utils.unwrapLink(LProgrammer)),
'+sep=,',
'Senior Programmer=' .. utils.unwrapList(utils.unwrapLink(SProgrammer)),
'+sep=,',
'Programmer=' .. utils.unwrapList(utils.unwrapLink(Programmer)),
'+sep=,',
'Game Programming=' .. utils.unwrapList(utils.unwrapLink(GProgrammer)),
'+sep=,',
'Additional Programming=' .. utils.unwrapList(utils.unwrapLink(AProgrammer)),
'+sep=,',
'Lead Animator=' .. utils.unwrapList(utils.unwrapLink(LAnimator)),
'+sep=,',
'Animation=' .. utils.unwrapList(utils.unwrapLink(Animation)),
'+sep=,',
'Lead Artist=' .. utils.unwrapList(utils.unwrapLink(LArtist)),
'+sep=,',
'Art Team=' .. utils.unwrapList(utils.unwrapLink(Artists)),
'+sep=,',
'Concept Artist=' .. utils.unwrapList(utils.unwrapLink(CArtist)),
'+sep=,',
'Additional Artwork=' .. utils.unwrapList(utils.unwrapLink(AArtwork)),
'+sep=,',
'Technology Lead=' .. utils.unwrapList(utils.unwrapLink(TechLead)),
'+sep=,',
'Technology Programming=' .. utils.unwrapList(utils.unwrapLink(TProgramming)),
'+sep=,',
'Additional Technology Programming=' .. utils.unwrapList(utils.unwrapLink(ATProgramming)),
'+sep=,',
'QA Lead=' .. utils.unwrapList(utils.unwrapLink(QALead)),
'+sep=,',
'QA=' .. utils.unwrapList(utils.unwrapLink(QA)),
'+sep=,',
'Music=' .. utils.unwrapList(utils.unwrapLink(Music)),
'+sep=,',
'Sound Effects=' .. utils.unwrapList(utils.unwrapLink(Sound)),
'+sep=,',
'Audio Editor=' .. utils.unwrapList(utils.unwrapLink(AudioEdit)),
'+sep=,',
'Casting Director=' .. utils.unwrapList(utils.unwrapLink(CDirector)),
'+sep=,',
'Live Action Producer=' .. utils.unwrapList(utils.unwrapLink(LAProducer)),
'+sep=,',
'Director of Photography=' .. utils.unwrapList(utils.unwrapLink(DPhoto)),
'+sep=,',
'Video Editor=' .. utils.unwrapList(utils.unwrapLink(VEditor)),
'+sep=,',
'Cast=' .. utils.unwrapList(utils.unwrapLink(Cast)),
'+sep=,',
'Manual=' .. utils.unwrapList(utils.unwrapLink(Manual)),
'+sep=,',
'Publisher=' .. utils.unwrapList(utils.unwrapLink(ContentPub)),
'+sep=,',
'Senior Editor=' .. utils.unwrapList(utils.unwrapLink(SrEditor)),
'+sep=,',
'Editor=' .. utils.unwrapList(utils.unwrapLink(Editor)),
'+sep=,',
'Cover Art=' .. utils.unwrapList(utils.unwrapLink(CoverArt)),
'+sep=,',
'Production=' .. utils.unwrapList(utils.unwrapLink(Production)),
'+sep=,',
'Credit=' .. table.concat(CreditTable, ','),
'+sep=,',
'Graphics=' .. table.concat(GraphicsTable, ','),
'+sep=,'
}
mw.smw.set( data )
-- Infobox variables
local infoboxClass = 'smwtable-clean d-table w-100 d-md-flex float-none float-md-right border shadow-sm ml-md-4 mb-4 text-left'
local pad = ''
if collapsible == 'yes' then
infoboxClass = infoboxClass .. ' collapsible ' .. state
pad = frame:preprocess('{{pad|5em}}')
end
-- Build infobox
local html = mw.html.create()
local infobox = html:tag('table'):addClass(infoboxClass)
:css('font-size', '90%')
:attr('cellpadding', '0')
:attr('cellspacing', '0')
-- Header row (title + optional image)
local headerTr = mw.html.create('tr')
headerTr:tag('td'):attr('colspan', '2')
:tag('div'):addClass('summary text-center font-italic font-weight-bold')
:css('font-size', '110%')
:wikitext(pad .. title):done()
infobox:node(headerTr)
-- Print data rows
local function appendIfExists(label, value)
local tr = utils.addLabelValue(label, value)
if tr then infobox:node(tr) end
end
appendIfExists('Title', title)
appendIfExists('Concept', Concept)
appendIfExists('Designer', Designer)
appendIfExists('Credit', table.concat(CreditTable, ', '))
appendIfExists('Graphics', table.concat(GraphicsTable, ', '))
appendIfExists('Game Idea', GameIdea)
appendIfExists('Additional Design', ADesign)
appendIfExists('Producer', Producer)
appendIfExists('Writer', Writer)
appendIfExists('Art Director', ArtDirector)
appendIfExists('Technical Director', TechDirector)
appendIfExists('Assistant Producer', AProducer)
appendIfExists('Lead Programmer', LProgrammer)
appendIfExists('Senior Programmer', SProgrammer)
appendIfExists('Programmer', Programmer)
appendIfExists('Game Programming', GProgrammer)
appendIfExists('Additional Programming', AProgrammer)
appendIfExists('Lead Animator', LAnimator)
appendIfExists('Animation', Animation)
appendIfExists('Lead Artist', LArtist)
appendIfExists('Art Team', Artists)
appendIfExists('Concept Artist', CArtist)
appendIfExists('Additional Artwork', AArtwork)
appendIfExists('Technology Lead', TechLead)
appendIfExists('Technology Programming', TProgramming)
appendIfExists('Additional Technology Programming', ATProgramming)
appendIfExists('QA Lead', QALead)
appendIfExists('QA', QA)
appendIfExists('Music', Music)
appendIfExists('Sound Effects', Sound)
appendIfExists('Audio Editor', AudioEdit)
appendIfExists('Casting Director', CDirector)
appendIfExists('Live Action Producer', LAProducer)
appendIfExists('Director of Photography', DPhoto)
appendIfExists('Video Editor', VEditor)
appendIfExists('Cast', Cast)
appendIfExists('Manual', Manual)
appendIfExists('Publisher', ContentPub)
appendIfExists('Senior Editor', SrEditor)
appendIfExists('Editor', Editor)
appendIfExists('Cover Art', CoverArt)
appendIfExists('Production', Production)
return html
end
return p
