diff --git a/components/match2/commons/match_summary_base.lua b/components/match2/commons/match_summary_base.lua index 4304a97a293..e2ab758fadd 100644 --- a/components/match2/commons/match_summary_base.lua +++ b/components/match2/commons/match_summary_base.lua @@ -29,6 +29,7 @@ local OpponentLibraries = require('Module:OpponentLibraries') local Opponent = OpponentLibraries.Opponent local OpponentDisplay = OpponentLibraries.OpponentDisplay +local MATCH_LINK_PRIORITY = Lua.import('Module:Links/MatchPriorityGroups', {loadData = true}) local TBD = Abbreviation.make('TBD', 'To Be Determined') ---@class MatchSummaryHeader @@ -170,7 +171,7 @@ end ---@param links table ---@return MatchSummaryFooter function Footer:addLinks(links) - for linkType, link in pairs(links) do + local processLink = function(linkType, link) local currentLinkData = Links.getMatchIconData(linkType) if not currentLinkData then mw.log('Unknown link: ' .. linkType) @@ -184,6 +185,21 @@ function Footer:addLinks(links) end end + local processedLinks = {} + Array.forEach(MATCH_LINK_PRIORITY, function(linkType) + for linkKey, link in Table.iter.pairsByPrefix(links, linkType, {requireIndex = false}) do + processLink(linkKey, link) + processedLinks[linkKey] = true + end + end) + + for linkKey, link in Table.iter.spairs(links) do + -- Handle links not already processed via priority list + if not processedLinks[linkKey] then + processLink(linkKey, link) + end + end + return self end diff --git a/standard/links/commons/links_match_priority_groups.lua b/standard/links/commons/links_match_priority_groups.lua new file mode 100644 index 00000000000..6d8cc7a43e3 --- /dev/null +++ b/standard/links/commons/links_match_priority_groups.lua @@ -0,0 +1,22 @@ +--- +-- @Liquipedia +-- wiki=commons +-- page=Module:Links/MatchPriorityGroups +-- +-- Please see https://github.com/Liquipedia/Lua-Modules to contribute +-- + +return { + -- common + 'vod', + 'preview', + 'interview', + 'review', + 'lrthread', + 'recap', + 'headtohead', + + -- ageofempires + 'mapdraft', + 'civdraft' +}