From d862c579691cee2509a1f3afb7638d51304a0b0a Mon Sep 17 00:00:00 2001 From: ElectricalBoy <15651807+ElectricalBoy@users.noreply.github.com> Date: Mon, 27 Oct 2025 13:33:42 +0900 Subject: [PATCH 1/3] add converter --- lua/wikis/fighters/MatchMaps/Legacy.lua | 55 ++++++++++++++++++++++++- 1 file changed, 53 insertions(+), 2 deletions(-) diff --git a/lua/wikis/fighters/MatchMaps/Legacy.lua b/lua/wikis/fighters/MatchMaps/Legacy.lua index 09603ebf225..a4a52190077 100644 --- a/lua/wikis/fighters/MatchMaps/Legacy.lua +++ b/lua/wikis/fighters/MatchMaps/Legacy.lua @@ -14,6 +14,7 @@ local Array = Lua.import('Module:Array') local Logic = Lua.import('Module:Logic') local Json = Lua.import('Module:Json') local MatchGroup = Lua.import('Module:MatchGroup') +local MatchGroupLegacy = Lua.import('Module:MatchGroup/Legacy') local Opponent = Lua.import('Module:Opponent/Custom') local PageVariableNamespace = Lua.import('Module:PageVariableNamespace') local Table = Lua.import('Module:Table') @@ -175,6 +176,7 @@ end ---@return string|Html function MatchMapsLegacy.convertMatch(frame) local args = Arguments.getArgs(frame) + local generate = Logic.readBool(Table.extract(args, 'generate')) local details = Json.parseIfString(args.details or '{}') args, details = MatchMapsLegacy.handleDetails(args, details) @@ -183,7 +185,7 @@ function MatchMapsLegacy.convertMatch(frame) args = MatchMapsLegacy.setHeaderIfEmpty(args, details) args = MatchMapsLegacy.copyDetailsToArgs(args, details) - if Logic.readBool(matchlistVars:get('isOldMatchList')) then + if generate or Logic.readBool(matchlistVars:get('isOldMatchList')) then return Json.stringify(args) else Template.stashReturnValue(args, 'LegacyMatchlist') @@ -227,7 +229,7 @@ function MatchMapsLegacy.matchListEnd() isLegacy = true, id = bracketId, store = store, - noDuplicateCheck = not store, + noDuplicateCheck = not store or nil, collapsed = hide, attached = hide, title = matchlistVars:get('matchListTitle'), @@ -256,4 +258,53 @@ function MatchMapsLegacy.matchListEnd() return MatchGroup.MatchList(args) end +--- for bot conversion to proper match2 matchlists +---@param frame Frame +---@return string +function MatchMapsLegacy.generate(frame) + return MatchMapsLegacy.matchList(frame, true) +end + +--- for bot conversion to proper match2 matchlists +---@param frame Frame +---@return string +function MatchMapsLegacy.generate2(frame) + local args = Arguments.getArgs(frame) + + local store = Logic.readBoolOrNil(args.store) + + local offset = 0 + local title = args.title + if not title and not Json.parseIfTable(args[1]) then + title = args[1] + offset = 1 + end + + local parsedArgs = { + id = args.id, + title = title, + width = args.width or '300px', + collapsed = Logic.nilOr(Logic.readBoolOrNil(args.hide), true), + attached = Logic.nilOr(Logic.readBoolOrNil(args.hide), true), + store = store, + patch = args.patch, + } + + local matchsection = Logic.nilOr(args.lpdb_title, args.title) + if Logic.readBoolOrNil(matchsection) ~= false then + parsedArgs.matchsection = matchsection + end + + ---@type table[] + local matches = Array.mapIndexes(function(index) + return args[index + offset] + end) + + Array.forEach(matches, function(match, matchIndex) + parsedArgs['M' .. matchIndex] = match + end) + + return MatchGroupLegacy.generateWikiCodeForMatchList(parsedArgs) +end + return MatchMapsLegacy From 8a51cb28574e477d984edd4d99c38b61dbfa5079 Mon Sep 17 00:00:00 2001 From: ElectricalBoy <15651807+ElectricalBoy@users.noreply.github.com> Date: Mon, 27 Oct 2025 13:34:47 +0900 Subject: [PATCH 2/3] kick unused param --- lua/wikis/fighters/MatchMaps/Legacy.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/lua/wikis/fighters/MatchMaps/Legacy.lua b/lua/wikis/fighters/MatchMaps/Legacy.lua index a4a52190077..7ba46adaf0a 100644 --- a/lua/wikis/fighters/MatchMaps/Legacy.lua +++ b/lua/wikis/fighters/MatchMaps/Legacy.lua @@ -287,7 +287,6 @@ function MatchMapsLegacy.generate2(frame) collapsed = Logic.nilOr(Logic.readBoolOrNil(args.hide), true), attached = Logic.nilOr(Logic.readBoolOrNil(args.hide), true), store = store, - patch = args.patch, } local matchsection = Logic.nilOr(args.lpdb_title, args.title) From 22783fa5cdf1120553e08a8f69675adca118311b Mon Sep 17 00:00:00 2001 From: ElectricalBoy <15651807+ElectricalBoy@users.noreply.github.com> Date: Mon, 27 Oct 2025 16:42:53 +0900 Subject: [PATCH 3/3] remove unneeded entry point Co-authored-by: hjpalpha <75081997+hjpalpha@users.noreply.github.com> --- lua/wikis/fighters/MatchMaps/Legacy.lua | 7 ------- 1 file changed, 7 deletions(-) diff --git a/lua/wikis/fighters/MatchMaps/Legacy.lua b/lua/wikis/fighters/MatchMaps/Legacy.lua index 7ba46adaf0a..e71dd6a6f64 100644 --- a/lua/wikis/fighters/MatchMaps/Legacy.lua +++ b/lua/wikis/fighters/MatchMaps/Legacy.lua @@ -262,13 +262,6 @@ end ---@param frame Frame ---@return string function MatchMapsLegacy.generate(frame) - return MatchMapsLegacy.matchList(frame, true) -end - ---- for bot conversion to proper match2 matchlists ----@param frame Frame ----@return string -function MatchMapsLegacy.generate2(frame) local args = Arguments.getArgs(frame) local store = Logic.readBoolOrNil(args.store)