Content deleted Content added
poke |
how much did we break? |
||
Line 76:
end)
return providedReviewers, providedAggregators
end
local function renderHeadingRowWithSystems(builder, activeSystems, headingText)
builder:tag('tr')
:addClass(
:tag('th')
:attr('scope', 'col')
Line 112 ⟶ 102:
local function renderHeadingRow(builder, nameHeading)
builder:tag('tr')
:addClass(
:tag('th')
:attr('scope', 'col')
Line 137 ⟶ 127:
elseif na then
cell
:addClass(
:wikitext(data.i18n.na)
:done()
Line 147 ⟶ 137:
builder:tag('tr')
:tag('td')
:addClass(
:wikitext(name)
:done()
Line 155 ⟶ 145:
end
local function renderAggregators(div, providedAggregators, activeSystems, customAggregatorKeys, args)
local aggregatorCount = #providedAggregators + #customAggregatorKeys
if aggregatorCount == 0 then return end
builder = builder:tag('table')
:addClass(
if args.state then builder:addClass('mw-collapsible-content') end
local caption = data.i18n[aggregatorCount == 1 and 'aggregateScore' or 'aggregateScores']
builder:tag('caption')
:wikitext(caption)
:done()
if #activeSystems ~= 0 then
local na = yesno(args.na)
local showplatforms = #activeSystems ~= 1 or yesno(args.showplatforms)
if
renderHeadingRowWithSystems(builder, activeSystems, data.i18n.aggregator)
else
end
end
else
for _, v in ipairs(providedAggregators) do
end
for _, v in ipairs(customAggregatorKeys) do
end
end
end
local function renderReviews(builder, providedReviewers, activeSystems,
customReviewerKeys, args, reviewerCount, priorReviewCount)
if reviewerCount == 0 then return end
builder = builder:tag('table')
:addClass(data.i18n.class.reviews)
if args.state then builder:addClass('mw-collapsible-content') end
local caption = data.i18n[reviewerCount == 1 and 'reviewScore' or 'reviewScores']
builder:tag('caption')
:wikitext(caption)
if priorReviewCount > 0 then builder:addClass(data.i18n.class.stacked) end
builder:done()
if #activeSystems ~= 0 then
local na = yesno(args.na)
local showplatforms = #activeSystems ~= 1 or yesno(args.showplatforms)
if showplatforms then
renderHeadingRowWithSystems(builder, activeSystems, data.i18n.publication)
else
renderHeadingRow(builder, data.i18n.publication)
end
for _, v in ipairs(providedReviewers) do
renderRatingsBySystem(builder, v, data.reviewers[v].name, activeSystems, args, na)
end
for _, v in ipairs(customReviewerKeys) do
renderRatingsBySystem(builder, v, args[v], activeSystems, args, na)
end
else
renderHeadingRow(builder, data.i18n.publication)
for _, v in ipairs(providedReviewers) do
renderRating(builder, data.reviewers[v].name, args[v])
end
for _, v in ipairs(customReviewerKeys) do
renderRating(builder, args[v], args[v .. 'Score'])
end
end
end
local function renderAwards(builder, args, awardKeys,
if #awardKeys == 0 then return end
builder = builder:tag('table')
:addClass(
if args.state then builder:addClass('mw-collapsible-content') end
builder:tag('caption')
:wikitext(data.i18n[#awardKeys == 1 and 'award' or 'awards'])
if priorReviewCount > 0 then builder:addClass(data.i18n.class.stacked) end
builder:done()
builder:tag('tr')
Line 256 ⟶ 260:
builder:done()
builder:done()
end
local function renderEditOnWikidata(wikidata, updateLink, state)
if not wikidata then return end
div:tag('div')
:addClass(data.i18n.class.wikidata)
-- TODO: I think getUpdateLink can be made const in the other module.
:wikitext(data.i18n.editOnWikidata .. updateLink)
if state then div:addClass('mw-collapsible-content') end
div:done()
end
local function categorizePlatformCount(platformCount)
if #activeSystems ~= 0 then
div:wikitext(data.i18n.multiplatformCategory)
else
div:wikitext(data.i18n.singleplatformCategory)
end
end
local function renderTitles(builder, title, subtitle)
builder:tag('div')
:addClass(data.i18n.class.title)
:wikitext(title or data.i18n.reception)
:done()
if subtitle then
builder:tag('div')
:addClass(data.i18n.class.subtitle)
-- The only reason to use the subtitle is collapsible content
-- So always add the related class.
:addClass('mw-collapsible-content')
:wikitext(subtitle)
:done()
end
end
Line 261 ⟶ 303:
activeSystems, customAggregatorKeys, customReviewerKeys, args, wikidata)
local div = mw.html.create('div')
:addClass(
if args.align then
if args.align ==
div:addClass(
elseif args.align ==
div:addClass(
end
end
if #activeSystems == 0 then
div:addClass(
:css('width', args.width or nil)
end
Line 287 ⟶ 329:
end
renderTitles(div, args.title, args.subtitle)
local aggregatorCount = #providedAggregators + #customAggregatorKeys
renderAggregators(
div,
providedAggregators,
activeSystems,
customAggregatorKeys,
args,
aggregatorCount
)
local reviewerCount = #customReviewerKeys + #providedReviewers
renderReviews(
div,
providedReviewers,
activeSystems,
customReviewerKeys,
args,
reviewerCount,
aggregatorCount
)
renderAwards(
div,
args,
awardKeys,
reviewerCount + aggregatorCount
)
renderEditOnWikidata(wikidata, vgwd.getUpdateLink('nosub'), args.state)
categorizePlatformCount(activeSystems)
return div
end
Line 341 ⟶ 366:
local wikidata = false
vgwd.setDateFormat(args
vgwd.setGame(args
vgwd.setSystem(nil)
vgwd.setGenerateReferences(true)
vgwd.setShowUpdateLink(false)
vgwd.setUpdateLinkStyle("pen")
vgwd.setSystemFormat(args
-- Loop through aggregators if we have any.
|