Module:Credits: Difference between revisions
From Eli's Software Encyclopedia
Created page with "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' local showImage = args['show image'] or 'no' -- Get other properties local title = args['title'] or titleObj.text local Concept = args['Conc..." |
mNo edit summary |
||
| Line 11: | Line 11: | ||
local collapsible = args['collapsible'] or 'no' | local collapsible = args['collapsible'] or 'no' | ||
local state = args['state'] or 'autocollapse' | local state = args['state'] or 'autocollapse' | ||
-- Get other properties | -- Get other properties | ||
| Line 79: | Line 78: | ||
local Production = args['Production'] or '' -- '''Production''' | local Production = args['Production'] or '' -- '''Production''' | ||
-- Set properties | -- Set properties | ||
local data = { | local data = { | ||
| Line 173: | Line 161: | ||
'+sep=,', | '+sep=,', | ||
'Graphics=' .. table.concat(GraphicsTable, ','), | 'Graphics=' .. table.concat(GraphicsTable, ','), | ||
'+sep=,' | '+sep=,' | ||
} | } | ||
mw.smw.set( data ) | mw.smw.set( data ) | ||
Revision as of 18:14, August 22, 2025
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=' .. Concept,
'Designer=' .. Designer,
'+sep=,',
'Game Idea=' .. GameIdea,
'+sep=,',
'Additional Design=' .. ADesign,
'+sep=,',
'Producer=' .. Producer,
'+sep=,',
'Writer=' .. Writer,
'+sep=,',
'Art Director=' .. ArtDirector,
'+sep=,',
'Technical Director=' .. TechDirector,
'+sep=,',
'Assistant Producer=' .. AProducer,
'+sep=,',
'Lead Programmer=' .. LProgrammer,
'+sep=,',
'Senior Programmer=' .. SProgrammer,
'+sep=,',
'Programmer=' .. Programmer,
'+sep=,',
'Game Programming=' .. GProgrammer,
'+sep=,',
'Additional Programming=' .. AProgrammer,
'+sep=,',
'Lead Animator=' .. LAnimator,
'+sep=,',
'Animation=' .. Animation,
'+sep=,',
'Lead Artist=' .. LArtist,
'+sep=,',
'Art Team=' .. Artists,
'+sep=,',
'Concept Artist=' .. CArtist,
'+sep=,',
'Additional Artwork=' .. AArtwork,
'+sep=,',
'Technology Lead=' .. TechLead,
'+sep=,',
'Technology Programming=' .. TProgramming,
'+sep=,',
'Additional Technology Programming=' .. ATProgramming,
'+sep=,',
'QA Lead=' .. QALead,
'+sep=,',
'QA=' .. QA,
'+sep=,',
'Music=' .. Music,
'+sep=,',
'Sound Effects=' .. Sound,
'+sep=,',
'Audio Editor=' .. AudioEdit,
'+sep=,',
'Casting Director=' .. CDirector,
'+sep=,',
'Live Action Producer=' .. LAProducer,
'+sep=,',
'Director of Photography=' .. DPhoto,
'+sep=,',
'Video Editor=' .. VEditor,
'+sep=,',
'Cast=' .. Cast,
'+sep=,',
'Manual=' .. Manual,
'+sep=,',
'Publisher=' .. ContentPub,
'+sep=,',
'Senior Editor=' .. SrEditor,
'+sep=,',
'Editor=' .. Editor,
'+sep=,',
'Cover Art=' .. CoverArt,
'+sep=,',
'Production=' .. Production
'+sep=,',
'Credit=' .. table.concat(CreditTable, ','),
'+sep=,',
'Graphics=' .. table.concat(GraphicsTable, ','),
'+sep=,'
}
mw.smw.set( data )
-- Infobox variables
local infoboxClass = 'chameleon-infobox smwtable-clean d-table w-100 w-md-30 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)
-- Image and caption
if image ~= '' then
local imgTr = mw.html.create('tr')
imgTr:tag('td'):attr('colspan', '2'):addClass('text-center px-0')
:wikitext(string.format('[[File:%s|class=img-fluid|%s]]',
imageFilename, imageCaption
))
infobox:node(imgTr)
if imageCaption ~= '' then
local capTr = mw.html.create('tr')
capTr:tag('td'):attr('colspan', '2'):addClass('text-center px-0')
:wikitext(imageCaption)
infobox:node(capTr)
end
end
-- 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
