Module:Video game reviews/sandbox: Difference between revisions

Content deleted Content added
Jackmcbarn (talk | contribs)
m typo
Jackmcbarn (talk | contribs)
clean up the awards function
Line 370:
end
 
local function appendAwardRowawards(tblargs, awardnum, argsawardKeys)
if args['award1']#awardKeys ~= 0 then
tbl.tag('tr')
.tag('td')
.css('font-weight','bold')
.css('background-color','#f2f2f2')
.wikitext(args['award' .. awardnum .. 'Pub'])
.done()
.tag('td')
.css('background-color','#f2f2f2')
.wikitext(args['award' .. awardnum])
end
 
local function awards(args, awardnums, args)
if args['award1'] then
local Cell = HtmlBuilder.create('table')
.addClass('infobox wikitable')
Line 391 ⟶ 379:
.attr('cellpadding', 3)
.attr('cellspacing', 0)
Cell
.tag('tr')
.tag('th')
Line 399 ⟶ 386:
.css('border-top', 'none')
.wikitext('Awards')
Cell .done()
.done()
.tag('tr')
.tag('th')
.wikitext('Publication')
.tagdone('th').wikitext('Award')
.tag('th')
.wikitext('Award')
.done()
Cell .done()
 
for _,v in ipairs(awardnumsawardKeys) do
tbl Cell.tag('tr')
appendAwardRow(Cell, v, args)
.tag('td')
.css('font-weight','bold')
.css('background-color','#f2f2f2')
.wikitext(args['award' .. awardnumv .. 'Pub'])
.done()
.tag('td')
.css('background-color','#f2f2f2')
.wikitext(args['award' .. awardnumv])
end
return Cell
Line 411 ⟶ 412:
end
 
local function renderMainTable(halfkeysrev, halfkeysagg, awardnumsawardKeys, platforms, custome_agg, custome_rev, args)
local tbl
 
Line 476 ⟶ 477:
.tag('tr')
.tag('td')
.node(awards(args, awardnums, argsawardKeys))
else
local category = categoryHandler{
Line 560 ⟶ 561:
end
halfkeysagg = nitem
return renderMainTable(halfkeysrev, halfkeysagg, awardnumsawardKeys, platforms, custome_agg, custome_rev, args)
 
-- sorts awards by number from args.
for k, v in pairs(args) do
local awardnum = ('' .. k):match('^award(%d+)$')
if awardnum then table.insert(awardnums, tonumber(awardnum)) end
end
if awardnums then table.sort(awardnums) end
 
return renderMainTable(halfkeysrev, halfkeysagg, awardnums, platforms, custome_agg, custome_rev, args)
end