Modulo:TeamBracket: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
m fix
m meglio inherit di color base
 
(27 versioni intermedie di 4 utenti non mostrate)
Riga 44:
s1 = mw.ustring.gsub(s1 or '', '^[\'%s]*([%d%.]*).-$', '%1')
s2 = mw.ustring.gsub(s2 or '', '^[\'%s]*([%d%.]*).-$', '%1')
 
if s1 ~= '' and s2 ~= '' then
s1 = tonumber(s1)
Riga 65:
end
return 0
end
 
local function unboldParenthetical(s)
if s then
s = mw.ustring.gsub(s, '(%(%[%[[^%[%]]*%]%]%))', '<span style="font-weight:normal">%1</span>')
end
return s
end
 
Line 83 ⟶ 90:
if k:find('^[R3][Dr][d1-9]b?%-[a-z][a-z]*00*') then
k = mw.ustring.gsub(k, '^([R3][Dr][d1-9]b?%-[a-z][a-z]*)00*', '%1')
if (teams < 10) then
tcats = tcats .. '[[Categoria:Errori nella compilazione di TeamBracket|P]]'
end
Line 97 ⟶ 104:
k = mw.ustring.gsub(k, '^' .. rdstr .. '(%-[a-z][a-z]*)4', '3rd%12')
elseif k:find('^Consol') then
k = mw.ustring.gsub(k, '^Consol', '3rdRD-finalina')
tcats = tcats .. '[[Categoria:Errori nella compilazione di TeamBracket|3]]'
elseif k:find('^group[0-9]') then
Line 202 ⟶ 209:
if sepwidth > 1 then topcell = true end
if seedorteam then
cell:css('border', '1px solid var(--border-color-base, #aaa)')
:css('border-top-width', topcell and '1px' or '0')
else
cell:css('border-color', 'var(--border-color-base, #aaa)')
:css('border-style', 'solid')
:css('border-top-width', topcell and '1px' or '0')
Line 219 ⟶ 226:
:attr('colspan', tonumber(hideSeeds and '1' or '2') + legs[r] + pad)
:css('text-align', 'center')
:css('border', '1px solid var(--border-color-base, #aaa)')
:css('background-color', args['RD-shade'] or 'var(--background-color-neutral, #f2f2f2)')
:css('color', 'inherit')
:wikitext(text)
:newline()
Line 254 ⟶ 262:
local value = args[argname]
if isblank(value) then
return 'var(--background-color-neutral-subtle, #f9f9f9)'
end
return value
Line 299 ⟶ 307:
elseif roundFromLast == 6 then
return "Trentaduesimi di finale"
elseif roundFromLast < 7 then
return round_names[roundFromLast]
else
return tostring(round) .. "1º turno" .. math.pow(7, roundFromLast)
end
end
Line 315 ⟶ 325:
return nil
else
local cell = addBlank(index,
{['border-width'] = '0',
['border-style'] = 'solid',
['border-color'] = 'var(--color-base, black)'}, (not compact) and 2 or 1)
if left or round < maxround and not left then
cell:css(prop, w or '2px')
Line 333 ⟶ 343:
-- seed value for the paired team
local otherteam = team % 2 == 0 and team-1 or team+1
local pairSeedArg = otherbye and ''
or getTeamArg(round, 'seed', otherteam)
-- show seed if seed is defined for either or both
Line 342 ⟶ 352:
seedCell = row:tag('td')
:css('text-align', 'center')
:css('background-color', 'var(--background-color-neutral, #f2f2f2)')
:css('color', 'inherit')
:attr('rowspan', (not compact) and '2' or nil)
:wikitext(seedArg)
Line 352 ⟶ 363:
if isblank(teamArg) then
teamArg = '&nbsp;'
elseif boldwinner ~= '' then
teamArg = unboldParenthetical(teamArg)
end
 
if not showSeed and (not hideSeeds) then
tcs = tcs + 1
Line 359 ⟶ 372:
 
local teamCell = row:tag('td')
:css('background-color', 'var(--background-color-neutral-subtle, #f9f9f9)')
:css('padding', '0 2px')
:css('color', 'inherit')
:attr('rowspan', (not compact) and '2' or nil)
:attr('colspan', (tcs > 1) and tcs or nil)
Line 375 ⟶ 389:
local fw = nil
local agg = legs[round] > 1 and s == legs[round] and true or false
local score1 = (agg and getScoreArg(round, team, 'agg') or nil) or
getScoreArg(round, team, s) or ((legs[round] == 1) and getScoreArg(round, team)) or nil
local score2 = (agg and getScoreArg(round, otherteam, 'agg') or nil) or
getScoreArg(round, otherteam, s) or ((legs[round] == 1) and getScoreArg(round, otherteam)) or nil
local showscore = true
if agg and aggregate ~= '' and score1 == nil and hassum then
score1 = (aggregate == 'score') and sumscore
or ((aggregate == 'legs' or aggregate == 'sets') and wins)
or nil
Line 390 ⟶ 404:
or nil
end
if (score1 == nil or score1 == '') and (score2 == nil or score2 == '') then
if hideomittedscores > 0 and s >= hideomittedscores then
teamcolspan = teamcolspan + 1
Line 403 ⟶ 417:
othersumscore = sumScores(othersumscore, score2)
if winner == 1 then
if boldwinner ~= '' or (agg and (aggregate == 'score' or aggregate == 'legs' or aggregate == 'sets')) then
if agg and (aggregate == 'legs' or aggregate == 'sets') and (wins <= (legs[round] - 1)/2) then
else
Line 409 ⟶ 423:
end
end
if not (agg and (aggregate == 'score' or aggregate == 'legs' or aggregate == 'sets')) then wins = wins + 1 end
elseif winner == 2 then
if not (agg and (aggregate == 'score' or aggregate == 'legs' or aggregate == 'sets')) then otherwins = otherwins + 1 end
end
scoreCells[s] = row:tag('td')
Line 417 ⟶ 431:
:css('background-color', getShadeArg(round, team, s))
:css('font-weight', fw)
:css('color', 'inherit')
:attr('rowspan', (not compact) and '2' or nil)
:wikitext(score1)
Line 503 ⟶ 518:
addHeading(rows[offset-4], r + 1, getRoundName(r+1), legs[r] - legs[r+1])
local b = addBlank(offset-4, {
['border-color'] = 'var(--color-base, black)',
['border-style']= 'solid',
['border-width']= '0'}, 2)
Line 528 ⟶ 543:
group = group + 1
end
blank = addBlank(offset,
{['border-width'] = '0',
['border-style'] = 'solid',
['border-color'] = 'var(--color-base, black)'},
height, 1)
else
blank = addBlank(offset,
{['border-width'] = '0',
['border-style'] = 'solid',
['border-color'] = 'var(--color-base, black)'},
height, tonumber(hideSeeds and '3' or '4') + legs[r] + pad)
end
Line 598 ⟶ 613:
if (round < maxround) then
addBlank(i, {
['border-color'] = 'var(--color-base, black)',
['border-style'] = 'solid',
['border-width'] = '0 ' .. w .. ' 0 0'})
else
Line 610 ⟶ 625:
if (round < maxround) then
addBlank(i+1, {
['border-color'] = 'var(--color-base, black)',
['border-style'] = 'solid',
['border-width'] = '0 ' .. w .. ' 0 0'})
else
Line 642 ⟶ 657:
end
blank = addBlank(k, rounds < 2 and {['height'] = '7px'} or nil)
addHeading(row, rounds + 1, args['3rdRD-finalina'] or 'ThirdFinale place3º posto')
if rounds < 2 then
for i = 1,(compact and 1 or 2) do
Line 697 ⟶ 712:
end
end
 
for r = 1, maxround do
local roundFromLast = rounds - r + 1
Line 734 ⟶ 749:
local blank = addBlank(i, nil, 1, tonumber(hideSeeds and '3' or '4') + legs[1])
if compact and (rounds > 2) then
blank = addBlank(i, nil, 1, tonumber(hideSeeds and '3' or '4') + legs[12])
end
end
Line 767 ⟶ 782:
local seedCell
if (not hideSeeds) then
seedCell = widthRow:tag('td'):css('width', getWidth('seed', '25px28px'))
end
local teamCell = widthRow:tag('td'):css('width', getWidth('team', '150px190px'))
local scoreCells = {}
local legsr = legs[r]
if compactFinal and r == (maxround-1) then
legsr = legs[r+1] > legs[r] and legs[r+1] or legs[r]
end
if showThird and r==maxround then
legsr = legs[r+1] > legs[r] and legs[r+1] or legs[r]
end
for s = 1, legsr do
local score_width = '30px'
scoreCells[s] = widthRow:tag('td'):css('width', getWidth('score', '25px'))
if aggregate and aggregate ~= '' and s > 1 and s == legsr then
score_width = getWidth('agg', getWidth('score', score_width))
else
score_width = getWidth('score', score_width)
end
scoreCells[s] = widthRow:tag('td'):css('width', getWidth('score', '25px')score_width)
end
titleRow:tag('td')
Line 817 ⟶ 841:
parseSeedmap(args['RD1-omit'])
parseLegs(args.sets or args.legs)
 
if autoSeeds then
-- set default seeds for round 1
Line 840 ⟶ 864:
tbl:css('white-space', 'nowrap')
end
 
if align == 'right' then
tbl:css('float', 'right')