From e122d3fb3b0be511e50c729b878ac6b285556eb0 Mon Sep 17 00:00:00 2001 From: hjpalpha Date: Sat, 28 Mar 2026 15:23:50 +0100 Subject: [PATCH 1/6] fix: sparse Array usage in Array.extend --- lua/wikis/rocketleague/Infobox/Person/Player/Custom.lua | 3 ++- .../starcraft2/Infobox/UnofficialWorldChampion/Custom.lua | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lua/wikis/rocketleague/Infobox/Person/Player/Custom.lua b/lua/wikis/rocketleague/Infobox/Person/Player/Custom.lua index d35a52048b9..02370c46897 100644 --- a/lua/wikis/rocketleague/Infobox/Person/Player/Custom.lua +++ b/lua/wikis/rocketleague/Infobox/Person/Player/Custom.lua @@ -117,8 +117,9 @@ function CustomInjector:parse(id, widgets) } elseif id == 'history' then local getHistoryCells = function(key, title) + if String.isNotEmpty(args[key]) then return end return { - String.isNotEmpty(args[key]) and Title{children = title} or nil, + Title{children = title}, Center{children = {args[key]}}, } end diff --git a/lua/wikis/starcraft2/Infobox/UnofficialWorldChampion/Custom.lua b/lua/wikis/starcraft2/Infobox/UnofficialWorldChampion/Custom.lua index 3e51dbb6c53..b771ade2cfe 100644 --- a/lua/wikis/starcraft2/Infobox/UnofficialWorldChampion/Custom.lua +++ b/lua/wikis/starcraft2/Infobox/UnofficialWorldChampion/Custom.lua @@ -56,10 +56,10 @@ function CustomInjector:parse(id, widgets) Array.extendWith(widgets, - { - raceBreakdown and Title{children = 'Racial Distribution of Champions'} or nil, - raceBreakdown and Breakdown{children = raceBreakdown.display, classes = { 'infobox-center' }} or nil, - }, + raceBreakdown and { + Title{children = 'Racial Distribution of Champions'}, + Breakdown{children = raceBreakdown.display, classes = { 'infobox-center' }}, + } or nil, self.caller:_buildCellsFromBase('countries with multiple champions', 'Countries with Multiple Champions'), self.caller:_buildCellsFromBase('teams with multiple champions', 'Teams with Multiple Champions') ) From 9d4be63365130b13c978267b54c876cf379045f8 Mon Sep 17 00:00:00 2001 From: hjpalpha Date: Sat, 28 Mar 2026 15:24:25 +0100 Subject: [PATCH 2/6] shut up some anno warnings i found while looking threough extend usages --- .../ageofempires/Infobox/Person/Player/Custom.lua | 4 ++-- lua/wikis/commons/MatchGroup/Input/Util.lua | 4 ++-- lua/wikis/stormgate/Infobox/Building/Custom.lua | 14 +++++++++----- lua/wikis/stormgate/Infobox/Skill/Custom.lua | 10 +++++++--- lua/wikis/stormgate/Infobox/Unit/Custom.lua | 10 +++++++--- 5 files changed, 27 insertions(+), 15 deletions(-) diff --git a/lua/wikis/ageofempires/Infobox/Person/Player/Custom.lua b/lua/wikis/ageofempires/Infobox/Person/Player/Custom.lua index fd6876b6f69..769501b76d5 100644 --- a/lua/wikis/ageofempires/Infobox/Person/Player/Custom.lua +++ b/lua/wikis/ageofempires/Infobox/Person/Player/Custom.lua @@ -145,7 +145,7 @@ function CustomInjector:parse(id, widgets) --Elo ratings local ratingCells = {} for game, ratings in Table.iter.spairs(RATINGCONFIG) do - game = Game.raw{game = game} + local gameData = Game.raw{game = game} Array.forEach(ratings, function(rating) local children = {} local currentRating, bestRating @@ -163,7 +163,7 @@ function CustomInjector:parse(id, widgets) table.insert(children, bestRating) end if Logic.isNotEmpty(children) then - table.insert(ratingCells, Cell{name = rating.text .. ' (' .. game.abbreviation .. ')', children = children}) + table.insert(ratingCells, Cell{name = rating.text .. ' (' .. gameData.abbreviation .. ')', children = children}) end end) end diff --git a/lua/wikis/commons/MatchGroup/Input/Util.lua b/lua/wikis/commons/MatchGroup/Input/Util.lua index cc69991f6fe..15bd594f9e7 100644 --- a/lua/wikis/commons/MatchGroup/Input/Util.lua +++ b/lua/wikis/commons/MatchGroup/Input/Util.lua @@ -616,7 +616,7 @@ function MatchGroupInputUtil.getMapVeto(match, allowedVetoes) end ---@param winnerInput integer|string|nil ----@param finishedInput string? +---@param finishedInput string|boolean? ---@return boolean function MatchGroupInputUtil.isNotPlayed(winnerInput, finishedInput) return (type(winnerInput) == 'string' and MatchGroupInputUtil.isNotPlayedInput(winnerInput)) @@ -624,7 +624,7 @@ function MatchGroupInputUtil.isNotPlayed(winnerInput, finishedInput) end ---@param winnerInput integer|string|nil ----@param finishedInput string? +---@param finishedInput string|boolean? ---@param opponents MGIParsedOpponent[]? ---@return string? #Match Status function MatchGroupInputUtil.getMatchStatus(winnerInput, finishedInput, opponents) diff --git a/lua/wikis/stormgate/Infobox/Building/Custom.lua b/lua/wikis/stormgate/Infobox/Building/Custom.lua index f0cbd648802..dcc996c7182 100644 --- a/lua/wikis/stormgate/Infobox/Building/Custom.lua +++ b/lua/wikis/stormgate/Infobox/Building/Custom.lua @@ -16,14 +16,15 @@ local Faction = Lua.import('Module:Faction') local Hotkeys = Lua.import('Module:Hotkey') local Icon = Lua.import('Module:Icon') local Logic = Lua.import('Module:Logic') +local MessageBox = Lua.import('Module:Message box') local Page = Lua.import('Module:Page') local String = Lua.import('Module:StringUtils') local Table = Lua.import('Module:Table') -local MessageBox = Lua.import('Module:Message box') local Injector = Lua.import('Module:Widget/Injector') local Building = Lua.import('Module:Infobox/Building') +local HtmlWidgets = Lua.import('Module:Widget/Html/All') local Widgets = Lua.import('Module:Widget/All') local Cell = Widgets.Cell local Title = Widgets.Title @@ -59,9 +60,12 @@ function CustomBuilding.run(frame) local builtInfobox = building:createInfobox() - return mw.html.create() - :node(builtInfobox) - :node(CustomBuilding._deprecatedWarning(building.args.deprecatedDisplay)) + return HtmlWidgets.Fragment{ + children = { + builtInfobox, + CustomBuilding._deprecatedWarning(building.args.deprecatedDisplay) + } + } end ---@param id string @@ -356,7 +360,7 @@ function CustomBuilding:_processPatchFromId(key) end ---@param patch string? ----@return Html? -would need to check what warningbox actually returns ... am on phone ... +---@return Html? function CustomBuilding._deprecatedWarning(patch) if not patch then return end diff --git a/lua/wikis/stormgate/Infobox/Skill/Custom.lua b/lua/wikis/stormgate/Infobox/Skill/Custom.lua index 77777363fad..a4c9a10d8ba 100644 --- a/lua/wikis/stormgate/Infobox/Skill/Custom.lua +++ b/lua/wikis/stormgate/Infobox/Skill/Custom.lua @@ -22,6 +22,7 @@ local MessageBox = Lua.import('Module:Message box') local Injector = Lua.import('Module:Widget/Injector') local Skill = Lua.import('Module:Infobox/Skill') +local HtmlWidgets = Lua.import('Module:Widget/Html/All') local Widgets = Lua.import('Module:Widget/All') local Cell = Widgets.Cell @@ -64,9 +65,12 @@ function CustomSkill.run(frame) local builtInfobox = skill:createInfobox() - return mw.html.create() - :node(builtInfobox) - :node(CustomSkill._deprecatedWarning(skill.args.deprecatedDisplay)) + return HtmlWidgets.Fragment{ + children = { + builtInfobox, + CustomSkill._deprecatedWarning(skill.args.deprecatedDisplay) + } + } end ---@param args table diff --git a/lua/wikis/stormgate/Infobox/Unit/Custom.lua b/lua/wikis/stormgate/Infobox/Unit/Custom.lua index bb7cfdff73f..44a6caad6f6 100644 --- a/lua/wikis/stormgate/Infobox/Unit/Custom.lua +++ b/lua/wikis/stormgate/Infobox/Unit/Custom.lua @@ -23,6 +23,7 @@ local MessageBox = Lua.import('Module:Message box') local Injector = Lua.import('Module:Widget/Injector') local Unit = Lua.import('Module:Infobox/Unit') +local HtmlWidgets = Lua.import('Module:Widget/Html/All') local Widgets = Lua.import('Module:Widget/All') local Cell = Widgets.Cell @@ -60,9 +61,12 @@ function CustomUnit.run(frame) local builtInfobox = unit:createInfobox() - return mw.html.create() - :node(builtInfobox) - :node(CustomUnit._deprecatedWarning(unit.args.deprecatedDisplay)) + return HtmlWidgets.Fragment{ + children = { + builtInfobox, + CustomUnit._deprecatedWarning(unit.args.deprecatedDisplay) + } + } end ---@param id string From 82c4cb4476157a490e9f1c0d815ad13ccb2c5285 Mon Sep 17 00:00:00 2001 From: hjpalpha Date: Sat, 28 Mar 2026 15:28:40 +0100 Subject: [PATCH 3/6] inverted logic --- lua/wikis/rocketleague/Infobox/Person/Player/Custom.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/wikis/rocketleague/Infobox/Person/Player/Custom.lua b/lua/wikis/rocketleague/Infobox/Person/Player/Custom.lua index 02370c46897..e60fbc8651f 100644 --- a/lua/wikis/rocketleague/Infobox/Person/Player/Custom.lua +++ b/lua/wikis/rocketleague/Infobox/Person/Player/Custom.lua @@ -117,7 +117,7 @@ function CustomInjector:parse(id, widgets) } elseif id == 'history' then local getHistoryCells = function(key, title) - if String.isNotEmpty(args[key]) then return end + if String.isEmpty(args[key]) then return end return { Title{children = title}, Center{children = {args[key]}}, From 65a2003e2b823e398d1402453fb40e99c457bc29 Mon Sep 17 00:00:00 2001 From: hjpalpha Date: Sun, 29 Mar 2026 14:34:16 +0200 Subject: [PATCH 4/6] as per review --- lua/wikis/commons/MatchGroup/Input/Util.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/wikis/commons/MatchGroup/Input/Util.lua b/lua/wikis/commons/MatchGroup/Input/Util.lua index 15bd594f9e7..14f936f70bb 100644 --- a/lua/wikis/commons/MatchGroup/Input/Util.lua +++ b/lua/wikis/commons/MatchGroup/Input/Util.lua @@ -616,7 +616,7 @@ function MatchGroupInputUtil.getMapVeto(match, allowedVetoes) end ---@param winnerInput integer|string|nil ----@param finishedInput string|boolean? +---@param finishedInput string? ---@return boolean function MatchGroupInputUtil.isNotPlayed(winnerInput, finishedInput) return (type(winnerInput) == 'string' and MatchGroupInputUtil.isNotPlayedInput(winnerInput)) @@ -628,7 +628,7 @@ end ---@param opponents MGIParsedOpponent[]? ---@return string? #Match Status function MatchGroupInputUtil.getMatchStatus(winnerInput, finishedInput, opponents) - if MatchGroupInputUtil.isNotPlayed(winnerInput, finishedInput) then + if MatchGroupInputUtil.isNotPlayed(winnerInput, finishedInput and 'true' or nil) then return MatchGroupInputUtil.MATCH_STATUS.NOT_PLAYED elseif winnerInput or (not opponents) or MatchGroupInputUtil.hasSpecialStatus(opponents) then return From a668326199f7135f7de25f69a2f41d59d2160275 Mon Sep 17 00:00:00 2001 From: hjpalpha Date: Sun, 29 Mar 2026 15:03:38 +0200 Subject: [PATCH 5/6] like this? --- lua/wikis/commons/MatchGroup/Input/Util.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/wikis/commons/MatchGroup/Input/Util.lua b/lua/wikis/commons/MatchGroup/Input/Util.lua index 14f936f70bb..950ef209c6a 100644 --- a/lua/wikis/commons/MatchGroup/Input/Util.lua +++ b/lua/wikis/commons/MatchGroup/Input/Util.lua @@ -628,7 +628,7 @@ end ---@param opponents MGIParsedOpponent[]? ---@return string? #Match Status function MatchGroupInputUtil.getMatchStatus(winnerInput, finishedInput, opponents) - if MatchGroupInputUtil.isNotPlayed(winnerInput, finishedInput and 'true' or nil) then + if MatchGroupInputUtil.isNotPlayed(winnerInput, finishedInput and tostring(finishedInput) or nil) then return MatchGroupInputUtil.MATCH_STATUS.NOT_PLAYED elseif winnerInput or (not opponents) or MatchGroupInputUtil.hasSpecialStatus(opponents) then return From b89317fbd44f1c6a287d8efcb51a7a61f1520dbd Mon Sep 17 00:00:00 2001 From: hjpalpha Date: Sun, 29 Mar 2026 15:37:25 +0200 Subject: [PATCH 6/6] extension thinks it is bool but it is `string?` --- lua/wikis/commons/MatchGroup/Input/Util.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/wikis/commons/MatchGroup/Input/Util.lua b/lua/wikis/commons/MatchGroup/Input/Util.lua index 950ef209c6a..7a0da3912dd 100644 --- a/lua/wikis/commons/MatchGroup/Input/Util.lua +++ b/lua/wikis/commons/MatchGroup/Input/Util.lua @@ -624,11 +624,11 @@ function MatchGroupInputUtil.isNotPlayed(winnerInput, finishedInput) end ---@param winnerInput integer|string|nil ----@param finishedInput string|boolean? +---@param finishedInput string? ---@param opponents MGIParsedOpponent[]? ---@return string? #Match Status function MatchGroupInputUtil.getMatchStatus(winnerInput, finishedInput, opponents) - if MatchGroupInputUtil.isNotPlayed(winnerInput, finishedInput and tostring(finishedInput) or nil) then + if MatchGroupInputUtil.isNotPlayed(winnerInput, finishedInput) then return MatchGroupInputUtil.MATCH_STATUS.NOT_PLAYED elseif winnerInput or (not opponents) or MatchGroupInputUtil.hasSpecialStatus(opponents) then return @@ -1174,7 +1174,7 @@ function MatchGroupInputUtil.standardProcessMatch(match, Parser, FfaParser, mapP match.finished = MatchGroupInputUtil.matchIsFinished(match, games, opponents) if match.finished then - match.status = MatchGroupInputUtil.getMatchStatus(matchInput.winner, matchInput.finished, opponents) + match.status = MatchGroupInputUtil.getMatchStatus(matchInput.winner, matchInput.finished --[[@as string?]], opponents) match.winner = MatchGroupInputUtil.getWinner(match.status, matchInput.winner, opponents) Array.forEach(opponents, function(opponent, opponentIndex) opponent.placement = MatchGroupInputUtil.placementFromWinner(match.status, match.winner, opponentIndex)