Skip to content

Commit

Permalink
shortern down the copy paste
Browse files Browse the repository at this point in the history
  • Loading branch information
Rathoz committed Aug 27, 2024
1 parent a69d871 commit 7f90ecc
Showing 1 changed file with 4 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,12 @@ function WikiCopyPaste.getMatchCode(bestof, mode, index, opponents, args)
local showScore = Logic.nilOr(Logic.readBoolOrNil, bestof == 0)

local lines = Array.extend(
'{{Match',
'|bestof=' .. (bestof ~= 0 and bestof or ''),
Logic.readBool(args.needsWinner) and INDENT .. '|winner=' or nil,
'{{Match|bestof=' .. (bestof ~= 0 and bestof or ''),
Array.map(Array.range(1, opponents), function(opponentIndex)
return INDENT .. '|opponent' .. opponentIndex .. '=' .. WikiCopyPaste.getOpponent(mode, showScore)
end),
Logic.readBool(args.hasDate) and {
INDENT .. '|date=',
INDENT .. '|finished=',
INDENT .. '|twitch=|youtube='
} or nil,
INDENT .. '|date=|finished=',
INDENT .. '|twitch=|youtube=|vod=',
Array.map(Array.range(1, bestof), WikiCopyPaste._getMapCode),
'}}'
)
Expand All @@ -45,9 +40,8 @@ end
function WikiCopyPaste._getMapCode(mapIndex)
return table.concat(Array.extend(
INDENT .. '|map' .. mapIndex .. '={{Map|length=|winner=|vod=',
INDENT .. INDENT .. '|team1side=',
INDENT .. INDENT .. '|team1side=|team2side=',
INDENT .. INDENT .. '|t1h1=|t1h2=|t1h3=|t1h4=|t1h5=|t1h6=',
INDENT .. INDENT .. '|team2side=',
INDENT .. INDENT .. '|t2h1=|t2h2=|t2h3=|t2h4=|t2h5=|t2h6=',
INDENT .. '}}'
), '\n')
Expand Down

0 comments on commit 7f90ecc

Please sign in to comment.