Module:Sandbox/CAS222222221: Difference between revisions

Content deleted Content added
No edit summary
Line 4:
local p = {}
 
local function won(frametext, args, istyle)
return ' style="vertical-align: middle; text-align: center; background-color: #9F9;' .. (style or '') .. '" |' .. text
local cont = args['won' .. i] or 0
return frame:expandTemplate{ title = 'won', args = { cont } }
end
 
local function nom(frametext, args, istyle)
return ' style="vertical-align: middle; text-align: center; background-color: #FDD;' .. (style or '') .. '" |' .. text
local cont = args['nom' .. i] or 0
return frame:expandTemplate{ title = 'nom', args = { cont } }
end
 
local function core(frame, args, i)
if args['award' .. i] == nil then return end
local ret
Line 21 ⟶ 19:
'|- style="background-color: #ddddff;"' .. '\n' ..
'| style="text-align: center; font-weight: bold;" | ' .. args['award' .. i] .. '\n' ..
'|' .. won(frame, args,['won' .. i]) .. '\n' ..
'|' .. nom(frame, args,['nom' .. i]) .. '\n'
return ret
Line 29 ⟶ 27:
function p.main(frame)
local args = getArgs(frame)
args.frame = frame
return p._main(args)
end
Line 35 ⟶ 32:
function p._main(args)
-- Main module code goes here.
local frame = args.frame
local ret, temp = '', ''
local winTotal, nomTotal = 0, 0
 
ret =
'{| class="infobox" style="width: 20em; text-align: left; font-size: 90%; vertical-align: middle;"\n' ..
'|+ style="font-size: 9pt; font-weight: bold;" | List of accolades<i>' .. (args.title and (' received by' .. args.title) or '') .. '</i>\n'
if args.image then
ret = ret .. '|-\n'
ret = ret .. '| colspan="3" style="text-align: center;" | ' .. args.image .. '\n' .. (args.caption and ('<brdiv style="display: block;"/>' .. args.caption) or '') .. '\n'
end
for i = 1, 99 do
if args['award' .. i] then
temp = temp .. core(frame, args, i)
winTotal = winTotal + args['won' .. i]
nomTotal = nomTotal + args['nom' .. i]
Line 57 ⟶ 53:
if temp ~= '' then
ret = ret ..
'|-\n' ..
'{| colspan="3" |\n' ..
'{| class="collapsible collapsed" style="width: 100%;" |\n' ..
'! colspan=3 style="background-color: #D9E8FF; text-align: center;" | Accolades\n' ..
'|-\n' ..
'|- style="background-color: #D9E8FF; font-weight: bold;"\n' ..
'| style="text-align:center;" | Award\n' ..
'| style="text-align:center; background: #cceecc; text-size:0.9em; width: 5.8em; | Won\n' ..
'| style="text-align:center; background: #ffccdd; text-size:0.9em; width: 5.8em;"| Nominated\n' ..
temp ..
'|}\n'
Line 66 ⟶ 68:
if args.totals ~= 'no' then
local win_win = args.totalwin or winTotal
local nom_nom = args.totalnom or nomTotal
if win_win == 0 and nom_nom == 0 then
else
ret = ret ..
Line 74 ⟶ 76:
'|-style="background:#d9e8ff;"\n' ..
'| style="text-align:center;" colspan="3"| <b>Total number of awards and nominations</b>\n' ..
'|- style="font-weight: bold;"\n' ..
'|' .. frame:expandTemplate{ title = 'won(', args = { '<b>Totals</b>' } } ).. '\n' ..
'|' .. frame:expandTemplate{ title = 'won'(tostring(_win), args = { '<b>' .. win ..width: 6em;'</b>' } }) .. '\n' ..
'|' .. frame:expandTemplate{ title = 'nom'(tostring(_nom), args = { '<b>' .. nom ..width: 6em;'</b>' } }) .. '\n'
end
end
Line 84 ⟶ 86:
ret = ret ..
'|- style="background:#d9e8ff;"\n' ..
'| colspan="3" style="font-size: smaller; text-align:center;"| [[#References|Footnotes]]\n' ..
'|}'
end