From 07ace2093cb008d893cdc35c2f555be9e13f9b96 Mon Sep 17 00:00:00 2001 From: ElectricalBoy <15651807+ElectricalBoy@users.noreply.github.com> Date: Tue, 6 Jan 2026 11:36:41 +0900 Subject: [PATCH 01/12] update arg parsing --- lua/wikis/dota2/Infobox/Patch/Custom.lua | 27 +++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/lua/wikis/dota2/Infobox/Patch/Custom.lua b/lua/wikis/dota2/Infobox/Patch/Custom.lua index d78dd642ec1..703bd1e8441 100644 --- a/lua/wikis/dota2/Infobox/Patch/Custom.lua +++ b/lua/wikis/dota2/Infobox/Patch/Custom.lua @@ -7,6 +7,7 @@ local Lua = require('Module:Lua') +local Array = Lua.import('Module:Array') local Class = Lua.import('Module:Class') local Patch = Lua.import('Module:Infobox/Patch') @@ -14,7 +15,12 @@ local Injector = Lua.import('Module:Widget/Injector') local Widgets = Lua.import('Module:Widget/All') ---@class Dota2PatchInfobox: PatchInfobox +---@operator call(Frame): Dota2PatchInfobox local CustomPatch = Class.new(Patch) + +---@class Dota2PatchInfoboxWidgetInjector: WidgetInjector +---@operator call(Dota2PatchInfobox): Dota2PatchInfoboxWidgetInjector +---@field caller Dota2PatchInfobox local CustomInjector = Class.new(Injector) ---@param frame Frame @@ -26,6 +32,17 @@ function CustomPatch.run(frame) return patch:createInfobox() end +---@param frame Frame +---@return Widget +function CustomPatch.runLegacy(frame) + local patch = CustomPatch(frame) + local args = patch.args + args.release = args.dota2 + patch:setWidgetInjector(CustomInjector(patch)) + + return patch:createInfobox() +end + ---@param id string ---@param widgets Widget[] ---@return Widget[] @@ -33,11 +50,11 @@ function CustomInjector:parse(id, widgets) local args = self.caller.args if id == 'custom' then return { - Widgets.Cell{name = 'New Heroes', children = {args.new}}, - Widgets.Cell{name = 'Nerfed Heroes', children = {args.nerfed}}, - Widgets.Cell{name = 'Buffed Heroes', children = {args.buffed}}, - Widgets.Cell{name = 'Rebalanced Heroes', children = {args.rebalanced}}, - Widgets.Cell{name = 'Reworked Heroes', children = {args.reworked}}, + Widgets.Cell{name = 'New Heroes', children = Array.parseCommaSeparatedString(args.new)}, + Widgets.Cell{name = 'Nerfed Heroes', children = Array.parseCommaSeparatedString(args.nerfed)}, + Widgets.Cell{name = 'Buffed Heroes', children = Array.parseCommaSeparatedString(args.buffed)}, + Widgets.Cell{name = 'Rebalanced Heroes', children = Array.parseCommaSeparatedString(args.rebalanced)}, + Widgets.Cell{name = 'Reworked Heroes', children = Array.parseCommaSeparatedString(args.reworked)}, } end return widgets From c98f9773a5798af91d9f094b820c4b7906139340 Mon Sep 17 00:00:00 2001 From: ElectricalBoy <15651807+ElectricalBoy@users.noreply.github.com> Date: Tue, 6 Jan 2026 11:42:42 +0900 Subject: [PATCH 02/12] pre-parse highlights --- lua/wikis/dota2/Infobox/Patch/Custom.lua | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lua/wikis/dota2/Infobox/Patch/Custom.lua b/lua/wikis/dota2/Infobox/Patch/Custom.lua index 703bd1e8441..cf91e2c33b2 100644 --- a/lua/wikis/dota2/Infobox/Patch/Custom.lua +++ b/lua/wikis/dota2/Infobox/Patch/Custom.lua @@ -40,6 +40,13 @@ function CustomPatch.runLegacy(frame) args.release = args.dota2 patch:setWidgetInjector(CustomInjector(patch)) + Array.forEach( + Array.parseCommaSeparatedString(args.highlights, '\n?*'), + function (highlight, highlightIndex) + args['highlight' .. highlightIndex] = highlight + end + ) + return patch:createInfobox() end From f33590fb15f953561f3bf46b6d836636cac55805 Mon Sep 17 00:00:00 2001 From: ElectricalBoy <15651807+ElectricalBoy@users.noreply.github.com> Date: Tue, 6 Jan 2026 11:54:26 +0900 Subject: [PATCH 03/12] load character icons --- lua/wikis/dota2/Infobox/Patch/Custom.lua | 27 +++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/lua/wikis/dota2/Infobox/Patch/Custom.lua b/lua/wikis/dota2/Infobox/Patch/Custom.lua index cf91e2c33b2..4bb4352503a 100644 --- a/lua/wikis/dota2/Infobox/Patch/Custom.lua +++ b/lua/wikis/dota2/Infobox/Patch/Custom.lua @@ -9,6 +9,7 @@ local Lua = require('Module:Lua') local Array = Lua.import('Module:Array') local Class = Lua.import('Module:Class') +local CharacterIcon = Lua.import('Module:CharacterIcon') local Patch = Lua.import('Module:Infobox/Patch') local Injector = Lua.import('Module:Widget/Injector') @@ -56,12 +57,28 @@ end function CustomInjector:parse(id, widgets) local args = self.caller.args if id == 'custom' then + ---@param characterInput string + ---@return string[] + local function toCharacterList(characterInput) + return Array.map( + Array.parseCommaSeparatedString(characterInput), + function (character) + return CharacterIcon.Icon{ + character = character, + date = args.release, + size = '40px', + addTextLink = true, + } + end + ) + end + return { - Widgets.Cell{name = 'New Heroes', children = Array.parseCommaSeparatedString(args.new)}, - Widgets.Cell{name = 'Nerfed Heroes', children = Array.parseCommaSeparatedString(args.nerfed)}, - Widgets.Cell{name = 'Buffed Heroes', children = Array.parseCommaSeparatedString(args.buffed)}, - Widgets.Cell{name = 'Rebalanced Heroes', children = Array.parseCommaSeparatedString(args.rebalanced)}, - Widgets.Cell{name = 'Reworked Heroes', children = Array.parseCommaSeparatedString(args.reworked)}, + Widgets.Cell{name = 'New Heroes', children = toCharacterList(args.new)}, + Widgets.Cell{name = 'Nerfed Heroes', children = toCharacterList(args.nerfed)}, + Widgets.Cell{name = 'Buffed Heroes', children = toCharacterList(args.buffed)}, + Widgets.Cell{name = 'Rebalanced Heroes', children = toCharacterList(args.rebalanced)}, + Widgets.Cell{name = 'Reworked Heroes', children = toCharacterList(args.reworked)}, } end return widgets From 5e7f9488c1197d3d54ce73cfbdeb0fd24d338ec2 Mon Sep 17 00:00:00 2001 From: ElectricalBoy <15651807+ElectricalBoy@users.noreply.github.com> Date: Tue, 6 Jan 2026 12:12:23 +0900 Subject: [PATCH 04/12] adjust information type --- lua/wikis/dota2/Infobox/Patch/Custom.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/wikis/dota2/Infobox/Patch/Custom.lua b/lua/wikis/dota2/Infobox/Patch/Custom.lua index 4bb4352503a..9e4b1ef14cc 100644 --- a/lua/wikis/dota2/Infobox/Patch/Custom.lua +++ b/lua/wikis/dota2/Infobox/Patch/Custom.lua @@ -39,6 +39,7 @@ function CustomPatch.runLegacy(frame) local patch = CustomPatch(frame) local args = patch.args args.release = args.dota2 + args.informationType = 'version' patch:setWidgetInjector(CustomInjector(patch)) Array.forEach( From 34b7ee0132423358b9d77e4d69b601da93dce0f7 Mon Sep 17 00:00:00 2001 From: ElectricalBoy <15651807+ElectricalBoy@users.noreply.github.com> Date: Tue, 6 Jan 2026 12:14:30 +0900 Subject: [PATCH 05/12] update display config --- lua/wikis/dota2/Infobox/Patch/Custom.lua | 30 ++++++++++++++++++++---- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/lua/wikis/dota2/Infobox/Patch/Custom.lua b/lua/wikis/dota2/Infobox/Patch/Custom.lua index 9e4b1ef14cc..52db0591dd7 100644 --- a/lua/wikis/dota2/Infobox/Patch/Custom.lua +++ b/lua/wikis/dota2/Infobox/Patch/Custom.lua @@ -75,11 +75,31 @@ function CustomInjector:parse(id, widgets) end return { - Widgets.Cell{name = 'New Heroes', children = toCharacterList(args.new)}, - Widgets.Cell{name = 'Nerfed Heroes', children = toCharacterList(args.nerfed)}, - Widgets.Cell{name = 'Buffed Heroes', children = toCharacterList(args.buffed)}, - Widgets.Cell{name = 'Rebalanced Heroes', children = toCharacterList(args.rebalanced)}, - Widgets.Cell{name = 'Reworked Heroes', children = toCharacterList(args.reworked)}, + Widgets.Cell{ + name = 'New Heroes', + children = toCharacterList(args.new), + options = {columns = 3, suppressColon = true}, + }, + Widgets.Cell{ + name = 'Nerfed Heroes', + children = toCharacterList(args.nerfed), + options = {columns = 3, suppressColon = true}, + }, + Widgets.Cell{ + name = 'Buffed Heroes', + children = toCharacterList(args.buffed), + options = {columns = 3, suppressColon = true}, + }, + Widgets.Cell{ + name = 'Rebalanced Heroes', + children = toCharacterList(args.rebalanced), + options = {columns = 3, suppressColon = true}, + }, + Widgets.Cell{ + name = 'Reworked Heroes', + children = toCharacterList(args.reworked), + options = {columns = 3, suppressColon = true}, + }, } end return widgets From bed7214bc20d495da2bd591999b0ab71850564cd Mon Sep 17 00:00:00 2001 From: ElectricalBoy <15651807+ElectricalBoy@users.noreply.github.com> Date: Tue, 6 Jan 2026 12:14:39 +0900 Subject: [PATCH 06/12] rename --- lua/wikis/dota2/Infobox/Patch/Custom.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/wikis/dota2/Infobox/Patch/Custom.lua b/lua/wikis/dota2/Infobox/Patch/Custom.lua index 52db0591dd7..386d12cdafc 100644 --- a/lua/wikis/dota2/Infobox/Patch/Custom.lua +++ b/lua/wikis/dota2/Infobox/Patch/Custom.lua @@ -35,7 +35,7 @@ end ---@param frame Frame ---@return Widget -function CustomPatch.runLegacy(frame) +function CustomPatch.runVersion(frame) local patch = CustomPatch(frame) local args = patch.args args.release = args.dota2 From 5fb5017ee93d1ce1af24a82fc15d4f65af18e8aa Mon Sep 17 00:00:00 2001 From: ElectricalBoy <15651807+ElectricalBoy@users.noreply.github.com> Date: Tue, 6 Jan 2026 12:22:19 +0900 Subject: [PATCH 07/12] properly call method --- lua/wikis/dota2/Infobox/Patch/Custom.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/wikis/dota2/Infobox/Patch/Custom.lua b/lua/wikis/dota2/Infobox/Patch/Custom.lua index 386d12cdafc..89d2915f8d6 100644 --- a/lua/wikis/dota2/Infobox/Patch/Custom.lua +++ b/lua/wikis/dota2/Infobox/Patch/Custom.lua @@ -111,8 +111,8 @@ function CustomPatch:getChronologyData(args) local informationType = self:getInformationType(args):lower() local data = { - previous = CustomPatch:_getChronology('before', args.release, informationType), - next = CustomPatch:_getChronology('after', args.release, informationType), + previous = self:_getChronology('before', args.release, informationType), + next = self:_getChronology('after', args.release, informationType), } return data end From 9b99ad32e26ca8ca396ebb1fbc14cde5da8a6a79 Mon Sep 17 00:00:00 2001 From: ElectricalBoy <15651807+ElectricalBoy@users.noreply.github.com> Date: Tue, 6 Jan 2026 12:22:35 +0900 Subject: [PATCH 08/12] adjust chronology query --- lua/wikis/dota2/Infobox/Patch/Custom.lua | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/lua/wikis/dota2/Infobox/Patch/Custom.lua b/lua/wikis/dota2/Infobox/Patch/Custom.lua index 89d2915f8d6..16eb72c0077 100644 --- a/lua/wikis/dota2/Infobox/Patch/Custom.lua +++ b/lua/wikis/dota2/Infobox/Patch/Custom.lua @@ -10,14 +10,22 @@ local Lua = require('Module:Lua') local Array = Lua.import('Module:Array') local Class = Lua.import('Module:Class') local CharacterIcon = Lua.import('Module:CharacterIcon') +local Patch = Lua.import('Module:Patch') -local Patch = Lua.import('Module:Infobox/Patch') +local Condition = Lua.import('Module:Condition') +local ConditionTree = Condition.Tree +local ConditionNode = Condition.Node +local Comparator = Condition.Comparator +local BooleanOperator = Condition.BooleanOperator +local ColumnName = Condition.ColumnName + +local PatchInfobox = Lua.import('Module:Infobox/Patch') local Injector = Lua.import('Module:Widget/Injector') local Widgets = Lua.import('Module:Widget/All') ---@class Dota2PatchInfobox: PatchInfobox ---@operator call(Frame): Dota2PatchInfobox -local CustomPatch = Class.new(Patch) +local CustomPatch = Class.new(PatchInfobox) ---@class Dota2PatchInfoboxWidgetInjector: WidgetInjector ---@operator call(Dota2PatchInfobox): Dota2PatchInfoboxWidgetInjector @@ -120,14 +128,18 @@ end ---@param time 'before' | 'after' ---@param date string ---@param informationType string ----@return string +---@return string? function CustomPatch:_getChronology(time, date, informationType) local timeModifier = time == 'before' and '<' or '>' - return (mw.ext.LiquipediaDB.lpdb('datapoint', { + local data = mw.ext.LiquipediaDB.lpdb('datapoint', { conditions = '[[type::'.. informationType ..']] and [[date::'.. timeModifier .. date ..']]', order = 'date ' .. (time == 'before' and 'DESC' or 'ASC'), limit = 1, - })[1] or {}).name + })[1] + if not data then + return + end + return data.pagename .. '|' .. data.name end function CustomPatch:addToLpdb(lpdbData, args) From 1ea9142c3982992fd778a3f499feb50dc3939b50 Mon Sep 17 00:00:00 2001 From: ElectricalBoy <15651807+ElectricalBoy@users.noreply.github.com> Date: Tue, 6 Jan 2026 12:23:09 +0900 Subject: [PATCH 09/12] remove unused imports --- lua/wikis/dota2/Infobox/Patch/Custom.lua | 8 -------- 1 file changed, 8 deletions(-) diff --git a/lua/wikis/dota2/Infobox/Patch/Custom.lua b/lua/wikis/dota2/Infobox/Patch/Custom.lua index 16eb72c0077..a805e89cbbf 100644 --- a/lua/wikis/dota2/Infobox/Patch/Custom.lua +++ b/lua/wikis/dota2/Infobox/Patch/Custom.lua @@ -10,14 +10,6 @@ local Lua = require('Module:Lua') local Array = Lua.import('Module:Array') local Class = Lua.import('Module:Class') local CharacterIcon = Lua.import('Module:CharacterIcon') -local Patch = Lua.import('Module:Patch') - -local Condition = Lua.import('Module:Condition') -local ConditionTree = Condition.Tree -local ConditionNode = Condition.Node -local Comparator = Condition.Comparator -local BooleanOperator = Condition.BooleanOperator -local ColumnName = Condition.ColumnName local PatchInfobox = Lua.import('Module:Infobox/Patch') local Injector = Lua.import('Module:Widget/Injector') From d401c0a71821752bdc696731f11536a384176f76 Mon Sep 17 00:00:00 2001 From: ElectricalBoy <15651807+ElectricalBoy@users.noreply.github.com> Date: Tue, 6 Jan 2026 12:37:25 +0900 Subject: [PATCH 10/12] adjustments --- lua/wikis/dota2/Infobox/Patch/Custom.lua | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lua/wikis/dota2/Infobox/Patch/Custom.lua b/lua/wikis/dota2/Infobox/Patch/Custom.lua index a805e89cbbf..25a80785fdb 100644 --- a/lua/wikis/dota2/Infobox/Patch/Custom.lua +++ b/lua/wikis/dota2/Infobox/Patch/Custom.lua @@ -10,6 +10,7 @@ local Lua = require('Module:Lua') local Array = Lua.import('Module:Array') local Class = Lua.import('Module:Class') local CharacterIcon = Lua.import('Module:CharacterIcon') +local String = Lua.import('Module:StringUtils') local PatchInfobox = Lua.import('Module:Infobox/Patch') local Injector = Lua.import('Module:Widget/Injector') @@ -39,11 +40,11 @@ function CustomPatch.runVersion(frame) local patch = CustomPatch(frame) local args = patch.args args.release = args.dota2 - args.informationType = 'version' + args.informationType = 'Version' patch:setWidgetInjector(CustomInjector(patch)) Array.forEach( - Array.parseCommaSeparatedString(args.highlights, '\n?*'), + Array.filter(Array.parseCommaSeparatedString(args.highlights, '\n?*'), String.isNotEmpty), function (highlight, highlightIndex) args['highlight' .. highlightIndex] = highlight end @@ -138,11 +139,11 @@ function CustomPatch:addToLpdb(lpdbData, args) lpdbData.date = args.release or args.dota lpdbData.extradata.version = args.name or '' - lpdbData.extradata.new = args.new or '' - lpdbData.extradata.nerfed = args.nerfed or '' - lpdbData.extradata.buffed = args.buffed or '' - lpdbData.extradata.rebalanced = args.rebalanced or '' - lpdbData.extradata.reworked = args.reworked or '' + lpdbData.extradata.new = Array.parseCommaSeparatedString(args.new) + lpdbData.extradata.nerfed = Array.parseCommaSeparatedString(args.nerfed) + lpdbData.extradata.buffed = Array.parseCommaSeparatedString(args.buffed) + lpdbData.extradata.rebalanced = Array.parseCommaSeparatedString(args.rebalanced) + lpdbData.extradata.reworked = Array.parseCommaSeparatedString(args.reworked) lpdbData.extradata.significant = args.significant or 'no' lpdbData.extradata.dota2 = args.release or '' lpdbData.extradata.dota = args.dota or '' From 2221af06f967be03794d19c322cc2453b15f1023 Mon Sep 17 00:00:00 2001 From: ElectricalBoy <15651807+ElectricalBoy@users.noreply.github.com> Date: Tue, 6 Jan 2026 12:59:19 +0900 Subject: [PATCH 11/12] restore link to full list --- lua/wikis/dota2/Infobox/Patch/Custom.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lua/wikis/dota2/Infobox/Patch/Custom.lua b/lua/wikis/dota2/Infobox/Patch/Custom.lua index 25a80785fdb..321f687e37d 100644 --- a/lua/wikis/dota2/Infobox/Patch/Custom.lua +++ b/lua/wikis/dota2/Infobox/Patch/Custom.lua @@ -15,6 +15,7 @@ local String = Lua.import('Module:StringUtils') local PatchInfobox = Lua.import('Module:Infobox/Patch') local Injector = Lua.import('Module:Widget/Injector') local Widgets = Lua.import('Module:Widget/All') +local LinkWidget = Lua.import('Module:Widget/Basic/Link') ---@class Dota2PatchInfobox: PatchInfobox ---@operator call(Frame): Dota2PatchInfobox @@ -103,6 +104,14 @@ function CustomInjector:parse(id, widgets) }, } end + if id == 'customcontent' then + return { + Widgets.Center{children = LinkWidget{ + link = 'Game Versions', + children = 'Full list' + }} + } + end return widgets end From c9cb3c10d78deb433e12a056c6cde856019b9d3c Mon Sep 17 00:00:00 2001 From: ElectricalBoy <15651807+ElectricalBoy@users.noreply.github.com> Date: Tue, 6 Jan 2026 12:59:25 +0900 Subject: [PATCH 12/12] adjust name --- lua/wikis/dota2/Infobox/Patch/Custom.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/wikis/dota2/Infobox/Patch/Custom.lua b/lua/wikis/dota2/Infobox/Patch/Custom.lua index 321f687e37d..7f100c0f99f 100644 --- a/lua/wikis/dota2/Infobox/Patch/Custom.lua +++ b/lua/wikis/dota2/Infobox/Patch/Custom.lua @@ -40,6 +40,7 @@ end function CustomPatch.runVersion(frame) local patch = CustomPatch(frame) local args = patch.args + args.name = 'Version ' .. args.version args.release = args.dota2 args.informationType = 'Version' patch:setWidgetInjector(CustomInjector(patch))