Module:Tableau Coupe
Apparence
La documentation pour ce module peut être créée à Module:Tableau Coupe/doc
-- essai d'amèlioration des Modèle Tableau Coupe xx (x sets)
-- Ces modèles sont lent, notemment depuis mes amèlioration demandant beacoup de calcul
-- Le nom des variables est en anglais, pour facilité une éventuelle utilisation sur d'autres wiki.
local z = {}
-- fonction abréviation, abréviation discrète
-- paramètres : 1 = abréviation, 2 = texte, 3 = langue, abrd = abréviation discrète
function z.abr (frame)
local args = frame.args or frame or { } -- appel direct ou via modèle
if args[2] == nil then
return args[1] or '' -- retoune l'abréviation ou au minimum une chaine vide s'il n'y a pas de texte
end
local wikiText = { '<abbr' }
if args.abrd then
table.insert(wikiText, ' class="abbr"')
end
table.insert(wikiText, ' title="' .. args[2])
if args[3] then
table.insert(wikiText, '" lang="' .. args[3])
end
table.insert(wikiText, '">' .. args[1] .. '</abbr>')
return table.concat (wikiText)
end
-- Pattern de détection et remplacement
local retiredPattern = '^%s*(%d*)%s*<?(s?u?p?>?)ab%.?<?/?%2%s*$' -- détection abandon
local retiredRepl = '%1<sup><abbr title="abandon">ab.</abbr></sup>' -- remplacement abandon
local disqualPattern = '^%s*(%d*)%s*<?(s?u?p?>?)dsq%.?<?/?%2%s*$' -- détection disqualification
local disqualRepl = '%1<sup><abbr title="disqualification">dsq.</abbr></sup>' -- remplacement disqualification
local tieBreackPattern = '6%s*<sup>%d' -- détection tieBreak
local woPattern = '^[wW]' -- détection WalkOver
local withdrawalPattern = '^[Ff]orfait' -- détection forfait
local wotext = ' ' -- remplacement de WalkOver
local withdrawaltext = 'forfait' -- remplacement de forfait
local emptyScorePattern = '^[%s\-\.]*$' -- détection cellule considérée vide
local emptyText = ' ' -- teste cellule vide
local replaceTab = { -- spécifique tête de série de tennis
q = z.abr {'Q', 'Qualifié(e)', abrd=true},
wc = '[[Wild card (tennis)|' .. z.abr {'WC', 'Wild card', 'en', abrd=true} ..']]',
ll = '[[Lucky loser|LL]]',
alt = '[[Lexique du tennis|' .. z.abr {'Alt', 'Alternate', 'en', abrd=true} .. ']]',
pr = '[[Lexique du tennis#PR|' .. z.abr {'PR', 'Protected Ranking', 'en', abrd=true} .. ']]',
se = '[[Lexique du tennis#SE|' .. z.abr {'SE', 'Special Exempt', 'en', abrd=true} .. ']]',
}
-- table avec les constantes utilisées pour formater les cellules de résultat de match.
local design = { {
name = 'background:#F9F9F9; border-width:1px 0 1px 1px;',
seed = 'background:#F9F9F9; border-width:1px 1px 1px 0;',
score = 'background:#EEEEEE; border-width:1px 1px 1px 0;',
scoreEnd = 'background:#EEEEEE; border-width:1px 1px 1px 0;'
},
{
name = 'background:#F9F9F9; border-width:0 0 1px 1px;',
seed = 'background:#F9F9F9; border-width:0 1px 1px 0;',
score = 'background:#EEEEEE; border-width:0 1px 1px 0;',
scoreEnd = 'background:#EEEEEE; border-width:0 1px 1px 0;'
},
order = {'name', 'seed', 'score' }
}
-- setWinner détermine le gangant d'un 'set' et retourne le numéro du gagnant et une raison détectée
-- il est possible de personnalisé la détection en fonction du sport (ex tie-break pour le tennis)
local function setWinner (score, set, sport)
if score[1][set] == nil and score[2][set] == nil then -- un score égal à nil générerait une erreur dans la suite du script
score[1][set] = ''
score[2][set] = ''
return
end
local sc1num = tonumber (score[1][set])
local sc2num = tonumber (score[2][set])
if sc1num and sc2num then
if sc1num > sc2num then
return 1, 'highestScore'
end
if sc1num < sc2num then
return 2, 'highestScore'
end
return false, equal
end
if string.match (score[2][set], retiredPattern) then
score[2][set] = string.gsub(score[2][set], retiredPattern, retiredRepl) -- insertion d'un abbréviation sur l'abandon
score[1][set] = string.gsub(score[1][set], emptyScorePattern, emptyText) -- patch ie7
return 1, 'retired'
end
if string.match (score[1][set], retiredPattern) then
score[1][set] = string.gsub(score[1][set], retiredPattern, retiredRepl)
score[2][set] = string.gsub(score[2][set], emptyScorePattern, emptyText)
return 2, 'retired'
end
if string.match (score[2][set], disqualPattern) then
score[2][set] = string.gsub(score[2][set], disqualPattern, disqualRepl) -- insertion d'un abbréviation sur la disqualification
score[1][set] = string.gsub(score[1][set], emptyScorePattern, emptyText) -- patch ie7
return 1, 'disqualified'
end
if string.match (score[1][set], disqualPattern) then
score[1][set] = string.gsub(score[1][set], disqualPattern, disqualRepl)
score[2][set] = string.gsub(score[2][set], emptyScorePattern, emptyText)
return 2, 'disqualified'
end
if sport == 'tennis' then
local winner
if sc1num == 7 and string.match (score[2][set], tieBreackPattern) then
winner = 1
elseif sc2num == 7 and string.match (score[1][set], tieBreackPattern) then
winner = 2
end
if winner then
return winner, 'tieBreack'
end
end
if string.match(score[1][set], emptyScorePattern) and string.match(score[2][set], emptyScorePattern) then
score[1][set] = emptyText
score[2][set] = emptyText
return false, 'empty cells'
end
end
-- détermination du gagnant du match. Met en gras le meilleur score de chaque set.
local function matchWinner (score, sport, nSet)
if score[1][1] and string.match (score[1][1], woPattern) or score[2][1] and string.match (score[2][1], withdrawalPattern) then
return 1, 'wo'
end
if score[2][1] and string.match (score[2][1], woPattern) or score[1][1] and string.match (score[1][1], withdrawalPattern) then
return 2, 'wo'
end
local w, r, winner, reason
for i = nSet, 1, -1 do
w, r = setWinner (score, i, sport)
if w == nil then
return 'undefined'
elseif type(w) == 'number' then
score[w][i] = '<strong>' .. score[w][i] .. '</strong>'
if winner == nil then
winner, reason = w, r
end
end
end
return winner, reason
end
-- add abbreviation to data in seed field
local function seedAbbr (seedString)
if (type (seedString) == 'string') and (seedString ~= '') then
local seed, abr = string.match (seedString, '^%s*%(?%s*(%d?%d?)%s*/?%s*(%a*)%s*%)?%s*$')
if type (seed) == 'string' and (string.len (seed) > 0 or string.len (abr) > 0) then
abr = replaceTab [string.lower (abr)] or abr
if string.len (seed) > 0 and string.len (abr) > 0 then
seedString = '(' .. seed .. '/' .. abr .. ')'
else
seedString = '(' .. seed .. abr .. ')'
end
end
end
return seedString
end
-- prépare le rendu wikiTexte du match (une ligne pour chaque 'joueur')
local function matchDisplay (score, nSet, sport, colsp, rowsp)
local winner, reason = matchWinner (score, sport, nSet)
local matchCells = { { }, { } }
local matchLine = { }
local baseDesign = '\n|rowspan="' .. (rowsp or '2') .. '" style="border-style:solid;border-color:#999999; padding:0;'
if colsp == nil then colsp = '1' end
for i=1, 2 do
if score[i].name == '' then score[i].name = emptyText -- patch ie7
end
if score[i].seed == '' then score[i].seed = emptyText -- patch ie7
end
matchCells[i].name = baseDesign .. 'padding-left:3px; text-align:left;' .. design[i].name .. '" colspan="' .. colsp .. '"|'
matchCells[i].seed = baseDesign .. design[i].seed .. '"|'
if sport == 'tennis' then
score[i].seed = seedAbbr (score[i].seed)
end
if winner == i then
matchCells[i].name = matchCells[i].name .. '<strong>' .. score[i].name .. '</strong>'
matchCells[i].seed = matchCells[i].seed .. '<strong>' .. score[i].seed .. '</strong>'
else
matchCells[i].name = matchCells[i].name .. score[i].name
matchCells[i].seed = matchCells[i].seed .. score[i].seed
end
if not winner then
matchCells[i].score = baseDesign .. design[i].scoreEnd ..'" colspan="' .. nSet.. '"|' .. emptyText
elseif winner == i and reason == 'wo' then
matchCells[i].score = baseDesign .. design[i].scoreEnd ..'" colspan="' .. nSet.. '"|' .. wotext
elseif winner == 3-i and reason == 'wo' then
matchCells[i].score = baseDesign .. design[i].scoreEnd ..'" colspan="' .. nSet.. '"|' .. withdrawaltext
else
matchCells[i].score = ''
for j = 1, nSet - 1 do
matchCells[i].score = matchCells[i].score .. baseDesign .. design[i].score .. '"|' .. score[i][j]
end
matchCells[i].score = matchCells[i].score .. baseDesign .. design[i].scoreEnd .. '"|' .. score[i][nSet]
end
matchLine[i] = matchCells[i][design.order[1]] .. matchCells[i][design.order[2]] .. matchCells[i][design.order[3]]
end
return matchLine
end
-- Préparation du score et exécution de la fonction de mise en forme du match
local function matchPrep (pargs, nSet, start, seed1, seed2, sport, colspan)
local score = {
{seed = pargs[seed1] or '', name = pargs[start] or ''},
{seed = pargs[seed2] or '', name = pargs[start + nSet + 1] or '' }
}
for i = 1, nSet do
score[1][i] = string.match( pargs[start + i ] or '', '^%s*([^\n]*)%s*$')
score[2][i] = string.match( pargs[start + i + nSet + 1] or '', '^%s*([^\n]*)%s*$')
end
return matchDisplay (score, nSet, sport, colspan)
end
-- préparation texte pour indication des date et durée du match
local function date_duration (pargs, nSet, name, colspan, dateLine)
local wikiText
local matchDate = pargs[name .. '-date']
local matchDuration = pargs[name .. '-durée']
if colspan == nil then
colspan = 2
end
local dateBorder, dateColspan = '', ''
if dateLine then
dateBorder = ' border-right: solid 1px #999999;'
dateColspan = '\n|colspan="2"|'
end
if dateLine or matchDate or matchDuration then
local lineHeight = '0;'
if matchDate or matchDuration then lineHeight = '11px;'
end
wikiText = '\n|colspan="' .. colspan .. '" rowspan="2" style="text-align:left; vertical-align:bottom; line-height:' .. lineHeight
.. dateBorder .. '"|<small>' .. (matchDate or emptyText) .. '</small>' -- emptyText = patch ie7
.. dateColspan
.. '\n|colspan="' .. nSet .. '" rowspan="2" style="vertical-align:bottom; line-height:11px;"|<small>'
.. (matchDuration or '') .. '</small>'
else
wikiText = '\n|colspan="' .. (colspan + nSet) .. '" rowspan="2"|'
end
return wikiText
end
-- calcul du nombre de set dans la (les) finale(s) en fonction du nombre de tour du tableau et du nombre de paramètre transmis
local function finalsSets (pargs, nSet, nRound)
local nArg = 0 -- nombre de paramètre si tout les matchs dont la finale se jouent en nSet.
local nSetFinal, nSetFinal2 -- nombre de set de la finale et de la petite finale
for i = 1, nRound do
nArg = nArg + 2 ^ (i) * (nSet + 1)
end
if nSet == 3 then
if pargs[nArg + 5] then -- s'il y a un paramètre nArg + 5, il y a une petite finale
if pargs[nArg + 9] then -- la finale est en 5 sets
if pargs[nArg + 13] then -- la petite finale aussi
nSetFinal = 5
nSetFinal2 = 5
else
if pargs['DF 3 sets'] == 'oui' then
nSetFinal = 3
nSetFinal2 = 5
else
nSetFinal = 5
nSetFinal2 = 3
end
end
else
nSetFinal = 3
nSetFinal2 = 3
end
else
if pargs[nArg + 1] then -- s'il y a un paramètre nArg + 1, la finale est en 5 set
nSetFinal = 5
else
nSetFinal = 3
end
end
elseif nSet == 5 then
nSetFinal = 5
if pargs[nArg + 9] then
nSetFinal2 = 5
elseif pargs[nArg + 1] then
nSetFinal2 = 3
end
end
return nSetFinal, nSetFinal2
end
-- fonction qui retourne false si l'arugment n'existe pas ou est 'vide'
local function noramalizeBlankArg (argValue)
argvalue = string.match (argValue or '', '^%s*(.-)%s*$')
return argvalue~= '' and argvalue
end
-- fonction pour tester si des joueurs ont été précisé dans les deux match suivant
local function hasPlayer (pargs, nSet, arg)
local match1 = string.match(pargs[arg] or 'x', '%S') or string.match(pargs[arg + 1 + nSet] or '', '%S')
local match2 = string.match(pargs[arg + 2 * (1 + nSet)] or 'x', '%S') or string.match(pargs[arg + 3 * (1 + nSet)] or '', '%S')
return match1, match2
end
-- fonctions pour l'assemblage du premier tour
local function fistRoundMatchs (pargs, nSet, argMatch, seedName, seedNumber, sport)
namesMatch1, namesMatch2 = hasPlayer(pargs, nSet, argMatch)
local line1, line3, line6, line7, line9, match
local lineEnd = 'border-style:solid;border-color:#999999"| ' -- fin du texte (toujours identique) des cellules générant une ligne de liason
local noMatch = '\n|colspan="' .. (2 + nSet) .. '" rowspan="2"|' -- remplace un match lorsqu'il n'y a pas de joueur
if namesMatch1 then
match = matchPrep (pargs, nSet, argMatch, seedName .. seedNumber, seedName .. (seedNumber + 1), sport)
line1 = match[1]
.. '\n|rowspan="2" style="border-width:0 0 1px 0;' .. lineEnd
.. '\n|rowspan="5" style="border-width:0 0 1px 0;' .. lineEnd
line3 = match[2]
.. '\n|rowspan="3" style="border-width:0 1px 0 0;' .. lineEnd
else
if namesMatch2 then
line1 = noMatch
.. '\n|rowspan="2"| '
.. '\n|rowspan="5" style="border-width:0 0 1px 0;' .. lineEnd
else
line1 = noMatch
.. '\n|rowspan="2"| '
.. '\n|rowspan="5"| '
end
line3 = noMatch
.. '\n|rowspan="3"| '
end
if namesMatch2 then
match = matchPrep (pargs, nSet, argMatch + 2 * (1 + nSet), seedName .. (seedNumber + 2), seedName .. (seedNumber + 3), sport)
line6 = '\n|rowspan="3" style="border-width:0 1px 1px 0;' .. lineEnd
line7 = match[1]
line9 = match[2]
else
line6 = '\n|rowspan="3"| '
line7 = noMatch
line9 = noMatch
end
return line1, line3, line6, line7, line9
end
-- Définition des hauteur de ligne (sensible sur Firefox) pour regrouper les matchs du premier tour par 2
-- Si le le premier "joueur" contient <br /> la hauteur des cellules est plus importante.
local function addCellsHeight (pargs, wikiTable, firstRoundName, compact)
local heightTable
if pargs[1] and string.match(string.lower(pargs[1]), '</?br%s?/?>') then
if compact then
heightTable = {36, 4, 1, 39, 1, 1, 39, 1, 4, 36, 4, 4}
else
heightTable = {28, 12, 6, 34, 6, 6, 34, 6, 12, 28, 12, 12}
end
else
if pargs[firstRoundName .. '1-date'] then
heightTable = {12, 8, 6, 14, 6, 6, 14, 6, 8, 12, 8, 8}
elseif compact then
heightTable = {16, 4, 1, 19, 1, 1, 19, 1, 4, 16, 4, 4}
else
heightTable = {12, 8, 3, 17, 3, 3, 17, 3, 8, 12, 8, 8}
end
end
local i = 2
local j = 12
while wikiTable[i] do
wikiTable[i] = 'height="' .. heightTable[j] .. '"|' .. wikiTable[i]
i = i + 1
j = j + 1
if j == 13 then j = 1
end
end
end
-- -------------------------------------------------
-- code principal de Modèle:Tableau Coupe 2 --
-- -------------------------------------------------
function z.Tableau2 (frame)
-- le tableau doit être ouvert en syntaxe wiki, avec une ligne définissant les largeur de cellule avant de lancer le module.
local pargs = frame:getParent().args -- paramètre du modèle
local nSet = tonumber(frame.args.nSet) -- nombre de Set (testé avec 3 et 5)
local sport = frame.args.sport -- permet d'avoir des tests spécifiques pour déterminer le gagnant de chaque match
local ligneTitre = '' -- Parti du tableau contenant les ligne de titres qui n'ont pas la même hauteur de ligne.
local wikiTable = { } -- chaque élément de cette table reprèsentera le wikiTexte d'une ligne du tableau
local wikiText = '' -- pour saisie de texte temporaire.
local match -- reçois les la table avec les deux lignes de chaque match
-- préparation des titres
local color = pargs['couleur-titre'] or '#CFCFCF' -- couleur de fond des titre du tableau
color = string.gsub (color, '^#?(%x%x%x%x%x%x)$', '#%1')
local DFtitre = noramalizeBlankArg (pargs['DF-titre']) or 'Finale'
-- assemblage de 'la' ligne de titre
ligneTitre = '|-'
.. '\n|height="23"|'
.. '\n|colspan="' .. (2 + nSet) .. '" style="background:' .. color .. ';"|<strong>' .. DFtitre .. '</strong>'
.. '\n|-'
.. '\n|height="7"|'
-- assemblage des lignes du tableau proprement dit
wikiTable[1] = date_duration (pargs, nSet, 'DF1')
wikiTable[2] = ''
-- DF 1
match = matchPrep (pargs, nSet, 1, 'DF1', 'DF2', sport)
wikiTable[3] = 'height="7"|' .. match[1]
wikiTable[4] = ''
wikiTable[5] = 'height="7"|' .. match[2]
wikiText = '\n|- \n|'
return ligneTitre .. table.concat (wikiTable, wikiText)
end
-- -------------------------------------------------
-- code principal de Modèle:Tableau Coupe 4 --
-- -------------------------------------------------
function z.Tableau4 (frame)
-- le tableau doit être ouvert en syntaxe wiki, avec une ligne définissant les largeur de cellule avant de lancer le module.
local pargs = frame:getParent().args -- paramètre du modèle
local nSet = tonumber(frame.args.nSet) -- nombre de Set (testé avec 3 et 5)
local sport = frame.args.sport -- permet d'avoir des tests spécifiques pour déterminer le gagnant de chaque match
local ligneTitre = '' -- Parti du tableau contenant les ligne de titres qui n'ont pas la même hauteur de ligne.
local wikiTable = { } -- chaque élément de cette table reprèsentera le wikiTexte d'une ligne du tableau
local wikiText = '' -- pour saisie de texte temporaire.
local match -- reçois les la table avec les deux lignes de chaque match
local nSetFinal, nSetFinal2 = finalsSets (pargs, nSet, 2)
-- nombre de set de la finale et de la petite finale
-- fontion pour connaitre le premier argument non nommé du match n°xx (dans l'ordre de saisie du modèle)
local function argMatch (xx)
if xx == 4 then
return 1 + (3 - 1) * 2 * (nSet + 1) + 2 * (nSetFinal + 1)
else
return 1 + (xx - 1) * 2 * (nSet + 1)
end
end
-- préparation des titres
local color = pargs['couleur-titre'] or '#CFCFCF' -- couleur de fond des titre du tableau
color = string.gsub (color, '^#?(%x%x%x%x%x%x)$', '#%1')
local DDtitre = noramalizeBlankArg (pargs['DD-titre']) or '1/2 finale'
local DFtitre = noramalizeBlankArg (pargs['DF-titre']) or 'Finale'
local extraCells = ''
if nSetFinal > nSet or (nSetFinal2 or 0) > nSet then
extraCells = '|width="20"| ||width="20"| \n' -- Deux cellules supplémentaire lorsque l'une des finale est en 5 sets
end
-- assemblage de 'la' ligne de titre
ligneTitre = extraCells
.. '|-'
.. '\n|height="23"|'
.. '\n|colspan="' .. (2 + nSet) .. '" style="background:' .. color .. ';"|<strong>' .. DDtitre .. '</strong>'
.. '\n|colspan="2"|'
.. '\n|colspan="' .. (2 + nSetFinal) .. '" style="background:' .. color .. ';"|<strong>' .. DFtitre .. '</strong>'
.. '\n|-'
.. '\n|height="7"|'
-- assemblage des lignes du tableau proprement dit
for i = 0, 1 do
wikiTable[1 + i * 6] = date_duration (pargs, nSet, 'DD' .. (1 + i * 2))
end
wikiTable[2] = ''
-- DD 1-4
wikiTable[3], wikiTable[5], wikiTable[8], wikiTable[9], wikiTable[11] = fistRoundMatchs (pargs, nSet, argMatch(1), 'DD', 1, sport)
wikiTable[4] = date_duration (pargs, nSet, 'DF1')
-- DF 1
match = matchPrep (pargs, nSetFinal, argMatch(3), 'DF1', 'DF2', sport)
wikiTable[6] = match[1]
wikiTable[8] = wikiTable[8] .. '\n|'
.. match[2]
wikiTable[10] = ''
wikiTable[12] = ''
if nSetFinal2 then
wikiTable[12] = '\n|colspan="2"|'
.. '\n|rowspan="2" colspan="' .. (2 + nSetFinal2) .. '" style="vertical-align:bottom;"|'
.. '<div style="position:relative;">'
.. '<div style="position:absolute; bottom:0; left:0; width:100%; padding:2px 0; background:' .. color ..';">'
.. '<strong>' .. (noramalizeBlankArg (pargs['DP-titre']) or 'Match pour la troisième place') .. '</strong>'
.. '</div></div>'
wikiTable[13] = ''
wikiTable[14] = '\n|rowspan="6" colspan="' .. (4 + nSet) .. '"|'
.. date_duration (pargs, nSetFinal2, 'DP1')
wikiTable [15] = ''
-- DP 1
match = matchPrep (pargs, nSetFinal2, argMatch(4), 'DP1', 'DP2', sport)
wikiTable[16] = match[1]
wikiTable[17] = ''
wikiTable[18] = match[2]
end
-- Définition des hauteur de ligne (sensible sur Firefox) pour regrouper les matchs du premier tour par 2
-- Si le le premier "joueur" contient <br /> la hauteur des cellules est plus importante.
local heightTable
if pargs[1] and string.match(string.lower(pargs[1]), '</?br%s?/?>') then
heightTable = {32, 8, 8}
else
heightTable = {12, 8, 8}
end
local i = 2
local j = 3
while wikiTable[i] and i < 15 do
wikiTable[i] = 'height="' .. heightTable[j] .. '"|' .. wikiTable[i]
i = i + 1
j = j + 1
if j == 4 then j = 1
end
end
wikiText = '\n|- \n|'
return ligneTitre .. table.concat (wikiTable, wikiText)
end
-- -------------------------------------------------
-- code principal de Modèle:Tableau Coupe 8 --
-- -------------------------------------------------
function z.Tableau8 (frame)
-- le tableau doit être ouvert en syntaxe wiki, avec une ligne définissant les largeur de cellule avant de lancer le module.
local pargs = frame:getParent().args -- paramètre du modèle
local nSet = tonumber(frame.args.nSet) -- nombre de Set (testé avec 3 et 5)
local sport = frame.args.sport -- permet d'avoir des tests spécifiques pour déterminer le gagnant de chaque match
local ligneTitre = '' -- Parti du tableau contenant les ligne de titres qui n'ont pas la même hauteur de ligne.
local wikiTable = { } -- chaque élément de cette table reprèsentera le wikiTexte d'une ligne du tableau
local wikiText = '' -- pour saisie de texte temporaire.
local match -- reçois les la table avec les deux lignes de chaque match
local lineEnd = 'border-style:solid;border-color:#999999"| '
-- fin du texte (toujours identique) des cellules générant une ligne de liason
local nSetFinal, nSetFinal2 = finalsSets (pargs, nSet, 3)
-- nombre de set de la finale et de la petite finale
-- fontion pour connaitre le premier argument non nommé du match n°xx (dans l'ordre de saisie du modèle)
local function argMatch (xx)
if xx == 8 then
return 1 + (7 - 1) * 2 * (nSet + 1) + 2 * (nSetFinal + 1)
else
return 1 + (xx - 1) * 2 * (nSet + 1)
end
end
-- préparation des titres
local color = pargs['couleur-titre'] or '#CFCFCF' -- couleur de fond des titre du tableau
color = string.gsub (color, '^#?(%x%x%x%x%x%x)$', '#%1')
local DQtitre = noramalizeBlankArg (pargs['DQ-titre']) or '1/4 de finale'
local DDtitre = noramalizeBlankArg (pargs['DD-titre']) or '1/2 finale'
local DFtitre = noramalizeBlankArg (pargs['DF-titre']) or 'Finale'
local extraCells = ''
if nSetFinal > nSet or (nSetFinal2 or 0) > nSet then
extraCells = '|width="20"| ||width="20"| \n' -- Deux cellules supplémentaire lorsque l'une des finale est en 5 sets
end
-- assemblage de 'la' ligne de titre
ligneTitre = extraCells
.. '|-'
.. '\n|height="23"|'
.. '\n|colspan="' .. (2 + nSet) .. '" style="background:' .. color .. ';"|<strong>' .. DQtitre .. '</strong>'
.. '\n|colspan="2"|'
.. '\n|colspan="' .. (2 + nSet) .. '" style="background:' .. color .. ';"|<strong>' .. DDtitre .. '</strong>'
.. '\n|colspan="2"|'
.. '\n|colspan="' .. (2 + nSetFinal) .. '" style="background:' .. color .. ';"|<strong>' .. DFtitre .. '</strong>'
.. '\n|-'
.. '\n|height="7"|'
-- assemblage des lignes du tableau proprement dit
for i = 0, 3 do
wikiTable[1 + i * 6] = date_duration (pargs, nSet, 'DQ' .. (1 + i * 2))
end
wikiTable[2] = ''
-- DQ 1-4
wikiTable[3], wikiTable[5], wikiTable[8], wikiTable[9], wikiTable[11] = fistRoundMatchs (pargs, nSet, argMatch(1), 'DQ', 1, sport)
wikiTable[4] = date_duration (pargs, nSet, 'DD1')
-- DD 1
match = matchPrep (pargs, nSet, argMatch(5), 'DD1', 'DD2', sport)
wikiTable[6] = match[1]
.. '\n|rowspan="2" style="border-width:0 0 1px 0;' .. lineEnd
.. '\n|rowspan="8" style="border-width:0 0 1px 0;' .. lineEnd
wikiTable[8] = wikiTable[8] .. '\n|'
.. match[2]
.. '\n|rowspan="12" style="border-width:0 1px 1px 0;' .. lineEnd
wikiTable[10] = '\n|colspan="' .. (3 + nSet) .. '" rowspan="2"|'
.. date_duration (pargs, nSetFinal, 'DF1')
-- DF 1
match = matchPrep (pargs, nSetFinal, argMatch(7), 'DF1', 'DF2', sport)
wikiTable[12] = '\n|colspan="' .. (4 + nSet) ..'" rowspan="3"|'
.. match[1]
wikiTable[14] = '\n|'
.. match[2]
-- DQ 5-8
wikiTable[15], wikiTable[17], wikiTable[20], wikiTable[21], wikiTable[23] = fistRoundMatchs (pargs, nSet, argMatch(3), 'DQ', 5, sport)
wikiTable[16] = date_duration (pargs, nSet, 'DD3')
-- DD 3
match = matchPrep (pargs, nSet, argMatch(6), 'DD3', 'DD4', sport)
wikiTable[18] = match[1]
wikiTable[20] = wikiTable[20] .. '\n|'
.. match[2]
wikiTable[22] = ''
wikiTable[24] = ''
if nSetFinal2 then
wikiTable[20] = wikiTable[20] .. '\n|colspan="2"|'
.. '\n|rowspan="2" colspan="' .. (2 + nSetFinal2) .. '" style="vertical-align:bottom;"|'
.. '<div style="position:relative;">'
.. '<div style="position:absolute; bottom:0; left:0; width:100%; padding:2px 0; background:' .. color ..';">'
.. '<strong>' .. (noramalizeBlankArg (pargs['DP-titre']) or 'Match pour la troisième place') .. '</strong>'
.. '</div></div>'
wikiTable[22] = '\n|colspan="' .. (5 + nSet) .. '"|'
.. date_duration (pargs, nSetFinal2, 'DP1')
-- DP 1
match = matchPrep (pargs, nSetFinal2, argMatch(8), 'DP1', 'DP2', sport)
wikiTable[24] = '\n|rowspan="4" colspan="' .. (6 + nSet) .. '"|'
.. match[1]
wikiTable[25] = '\n|rowspan="2" colspan="' .. (2 + nSet) .. '"|'
wikiTable[26] = match[2]
end
-- Définition des hauteur de ligne (sensible sur Firefox) pour regrouper les matchs du premier tour par 2
-- Si le le premier "joueur" contient <br /> la hauteur des cellules est plus importante.
addCellsHeight (pargs, wikiTable, 'DQ')
wikiText = '\n|- \n|'
return ligneTitre .. table.concat (wikiTable, wikiText)
end
-- -------------------------------------------------
-- code principal de Modèle:Tableau Coupe 16 --
-- -------------------------------------------------
function z.Tableau16 (frame)
-- le tableau doit être ouvert en syntaxe wiki, avec une ligne définissant les largeur de cellule avant de lancer le module.
local pargs = frame:getParent().args -- paramètre du modèle
local nSet = tonumber(frame.args.nSet) -- nombre de Set (testé avec 3 et 5)
local sport = frame.args.sport -- permet d'avoir des tests spécifiques pour déterminer le gagnant de chaque match
local compact = frame.args.compact -- permet un tableau avec moins d'espaces lorsqu'il n'y a pas de dates.
local ligneTitre = '' -- Parti du tableau contenant les ligne de titres qui n'ont pas la même hauteur de ligne.
local wikiTable = { } -- chaque élément de cette table reprèsentera le wikiTexte d'une ligne du tableau
local wikiText = '' -- pour saisie de texte temporaire.
local match -- reçois les la table avec les deux lignes de chaque match
local lineEnd = 'border-style:solid;border-color:#999999"| '
-- fin du texte (toujours identique) des cellules générant une ligne de liason
local nSetFinal, nSetFinal2 = finalsSets (pargs, nSet, 4)
-- nombre de set de la finale et de la petite finale
-- fontion pour connaitre le premier argument non nommé du match n°xx (dans l'ordre de saisie du modèle)
local function argMatch (xx)
if xx == 16 then
return 1 + (15 - 1) * 2 * (nSet + 1) + 2 * (nSetFinal + 1)
else
return 1 + (xx - 1) * 2 * (nSet + 1)
end
end
-- préparation des titres
local color = pargs['couleur-titre'] or '#CFCFCF' -- couleur de fond des titre du tableau
color = string.gsub (color, '^#?(%x%x%x%x%x%x)$', '#%1')
local premiersTours = pargs['premiers tours']
local DHtitre = noramalizeBlankArg (pargs['DH-titre'])
local DQtitre = noramalizeBlankArg (pargs['DQ-titre'])
local DDtitre = noramalizeBlankArg (pargs['DD-titre'])
local DFtitre = noramalizeBlankArg (pargs['DF-titre'])
local DFt = string.lower(DFtitre or '')
if pargs['premiers tours'] then
DHtitre = z.abr {'1<sup>er</sup>', 'Premier', abrd = true} .. ' tour'
DQtitre = z.abr {'2<sup>e</sup>', 'Deuxième', abrd = true} .. ' tour'
DDtitre = z.abr {'3<sup>e</sup>', 'Troisième', abrd = true} .. ' tour'
DFtitre = '1/8 de finale'
elseif DFt == '1/8 de finale' or DFt == 'hf' then
DHtitre = DHtitre or z.abr {'1<sup>er</sup>', 'Premier', abrd = true} .. ' tour'
DQtitre = DQtitre or z.abr {'2<sup>e</sup>', 'Deuxième', abrd = true} .. ' tour'
DDtitre = DDtitre or z.abr {'3<sup>e</sup>', 'Troisième', abrd = true} .. ' tour'
DFtitre = '1/8 de finale'
elseif DFt == '1/4 de finale' or DFt == 'qf' then
DHtitre = DHtitre or z.abr {'1<sup>er</sup>', 'Premier', abrd = true} .. ' tour'
DQtitre = DQtitre or z.abr {'2<sup>e</sup>', 'Deuxième', abrd = true} .. ' tour'
DDtitre = DDtitre or '1/8 de finale'
DFtitre = '1/4 de finale'
elseif DFt == '1/2 finale' or DFt == 'df' then
DHtitre = DHtitre or z.abr {'1<sup>er</sup>', 'Premier', abrd = true} .. ' tour'
DQtitre = DQtitre or '1/8 de finale'
DDtitre = DDtitre or '1/4 de finale'
DFtitre = '1/2 finale'
else
DHtitre = DHtitre or '1/8 de finale'
DQtitre = DQtitre or '1/4 de finale'
DDtitre = DDtitre or '1/2 finale'
DFtitre = DFtitre or 'Finale'
end
local extraCells = ''
if nSetFinal > nSet or (nSetFinal2 or 0) > nSet then
extraCells = '|width="20"| ||width="20"| \n' -- Deux cellules supplémentaire lorsque l'une des finale est en 5 sets
end
-- assemblage de 'la' ligne de titre
ligneTitre = extraCells
.. '|-'
.. '\n|height="23"|'
.. '\n|colspan="' .. (2 + nSet) .. '" style="background:' .. color .. ';"|<strong>' .. DHtitre .. '</strong>'
.. '\n|colspan="2"|'
.. '\n|colspan="' .. (2 + nSet) .. '" style="background:' .. color .. ';"|<strong>' .. DQtitre .. '</strong>'
.. '\n|colspan="2"|'
.. '\n|colspan="' .. (4 + nSet + nSetFinal)
.. '" style="background:' .. color .. ';"|<strong>' .. DFtitre .. '</strong>'
.. '\n|-'
.. '\n|height="2" colspan="25"|'
.. '\n|-'
.. '\n|'
.. '\n|colspan="' .. (5 + nSet) .. '"|'
.. '\n|colspan="' .. (4 + 2 * nSet) .. '"|'
.. '<div style="position:relative;">'
.. '<div style="position:absolute; left:0; width:100%; padding:2px 0; background:' .. color ..';">'
.. '<strong>' .. DDtitre .. '</strong>'
.. '</div></div>'
.. '\n|-'
.. '\n|height="5"|'
-- assemblage des lignes du tableau proprement dit
for i = 0, 7 do
wikiTable[i * 6 + 1] = date_duration (pargs, nSet, 'DH' .. (i * 2 + 1))
end
wikiTable[2] = ''
-- DH 1-16
for i = 0, 3 do
wikiTable[i * 12 + 3],
wikiTable[i * 12 + 5],
wikiTable[i * 12 + 8],
wikiTable[i * 12 + 9],
wikiTable[i * 12 + 11]
= fistRoundMatchs (pargs, nSet, argMatch(i * 2 + 1), 'DH', i * 4 + 1, sport)
end
wikiTable[4] = date_duration (pargs, nSet, 'DQ1')
-- DQ 1
match = matchPrep (pargs, nSet, argMatch(9), 'DQ1', 'DQ2', sport)
wikiTable[6] = match[1]
.. '\n|rowspan="2" style="border-width:0 0 1px 0;' .. lineEnd
wikiTable[8] = wikiTable[8] .. '\n|'
.. match[2]
.. '\n|rowspan="2" style="border-width:0 1px 0 0;' .. lineEnd
wikiTable[10] = '\n|colspan="2"|'
.. date_duration (pargs, nSet, 'DD1', 2 + nSet, true)
-- DD 1
match = matchPrep (pargs, nSet, argMatch(13), 'DD1', 'DD2', sport, 3 + nSet)
wikiTable[12] = '\n|colspan="3" rowspan="3"|'
.. match[1]
.. '\n|rowspan="2" style="border-width:0 0 1px 0;' .. lineEnd
wikiTable[14] = match[2]
.. '\n|rowspan="8" style="border-width:0 1px 0 0;' .. lineEnd
wikiTable[16] = date_duration (pargs, nSet, 'DQ3')
.. '\n|rowspan="4" style="border-width:0 1px 1px 0;' .. lineEnd
-- DQ 3
match = matchPrep (pargs, nSet, argMatch(10), 'DQ3', 'DQ4', sport)
wikiTable[18] = match[1]
wikiTable[20] = wikiTable[20] .. '\n|'
.. match[2]
wikiTable[22] = '\n|colspan="' .. (5 + nSet) .. '"|'
.. date_duration (pargs, nSetFinal, 'DF1', 2 + nSet, true)
-- DF 1
match = matchPrep (pargs, nSetFinal, argMatch(15), 'DF1', 'DF2', sport, 3 + nSet)
wikiTable[24] = '\n|colspan="' .. (6 + nSet) .. '" rowspan="3"|'
.. match [1]
wikiTable[26] = match [2]
wikiTable[28] = date_duration (pargs, nSet, 'DQ5')
.. '\n|colspan="' .. (3 + nSet) .. '" rowspan="2"|'
.. '\n|rowspan="10" style="border-width:0 1px 1px 0;' .. lineEnd
-- DQ 5
match = matchPrep (pargs, nSet, argMatch(11), 'DQ5', 'DQ6', sport)
wikiTable[30] = match[1]
.. '\n|rowspan="2" style="border-width:0 0 1px 0;' .. lineEnd
wikiTable[32] = wikiTable[32] .. '\n|rowspan="2"|'
.. match[2]
.. '\n|rowspan="2" style="border-width:0 1px 0 0;' .. lineEnd
wikiTable[34] = '\n|colspan="2"|'
.. date_duration (pargs, nSet, 'DD3', 2 + nSet, true)
-- DD3
match = matchPrep (pargs, nSet, argMatch(14), 'DD3', 'DD4', sport, 3 + nSet)
wikiTable[36] = '\n|colspan="3" rowspan="3"|'
.. match[1]
wikiTable[38] = match[2]
wikiTable[40] = date_duration (pargs, nSet, 'DQ7')
.. '\n|rowspan="4" style="border-width:0 1px 1px 0;' .. lineEnd
-- DQ 7
match = matchPrep (pargs, nSet, argMatch(12), 'DQ7', 'DQ8', sport)
wikiTable[42] = match[1]
wikiTable[44] = wikiTable[44] .. '\n|rowspan="2"|'
.. match[2]
wikiTable[46] = ''
wikiTable[48] = ''
if nSetFinal2 then
wikiTable[44] = wikiTable[44] .. '\n|colspan="2"|'
.. '\n|rowspan="2" colspan="' .. (4 + nSet + nSetFinal2) .. '" style="vertical-align:bottom;"|'
.. '<div style="position:relative;">'
.. '<div style="position:absolute; bottom:0; left:0; width:100%; padding:2px 0; background:' .. color ..';">'
.. '<strong>' .. (noramalizeBlankArg (pargs['DP-titre']) or 'Match pour la troisième place') .. '</strong>'
.. '</div></div>'
wikiTable[46] = '\n|colspan="' .. (5 + nSet) .. '"|'
.. date_duration (pargs, nSetFinal2, 'DP1', 4 + nSet)
-- DP1
match = matchPrep (pargs, nSetFinal2, argMatch(16), 'DP1', 'DP2', sport, 3 + nSet)
wikiTable[48] = '\n|rowspan="4" colspan="' .. (6 + nSet) .. '"|'
.. match[1]
wikiTable[49] = '\n|rowspan="2" colspan="' .. (2 + nSet) .. '"|'
wikiTable[50] = match[2]
end
-- Définition des hauteur de ligne (sensible sur Firefox) pour regrouper les matchs du premier tour par 2
-- Si le le premier "joueur" contient <br /> la hauteur des cellules est plus importante.
addCellsHeight (pargs, wikiTable, 'DH', compact)
wikiText = '\n|- \n|'
return ligneTitre .. table.concat (wikiTable, wikiText)
end
-- -------------------------------------------------
-- code principal de Modèle:Tableau Coupe 32 --
-- -------------------------------------------------
function z.Tableau32 (frame)
-- le tableau doit être ouvert en syntaxe wiki, avec une ligne définissant les largeur de cellule avant de lancer le module.
local pargs = frame:getParent().args -- paramètre du modèle
local nSet = tonumber(frame.args.nSet) -- nombre de Set (testé avec 3 sets)
local sport = frame.args.sport -- permet d'avoir des tests spécifiques pour déterminer le gagnant de chaque match
local ligneTitre = '' -- Parti du tableau contenant les ligne de titres qui n'ont pas la même hauteur de ligne.
local wikiTable = { } -- chaque élément de cette table reprèsentera le wikiTexte d'une ligne du tableau
local wikiText = '' -- pour saisie de texte temporaire.
local match -- reçois les la table avec les deux lignes de chaque match
local lineEnd = 'border-style:solid;border-color:#999999"| '
-- fin du texte (toujours identique) des cellules générant une ligne de liason
local nSetFinal, nSetFinal2 = finalsSets (pargs, nSet, 5)
-- nombre de set de la finale et de la petite finale
-- fontion pour connaitre le premier argument non nommé du match n°xx (dans l'ordre de saisie du modèle)
local function argMatch (xx)
if xx == 32 then
return 1 + (31 - 1) * 2 * (nSet + 1) + 2 * (nSetFinal + 1)
else
return 1 + (xx - 1) * 2 * (nSet + 1)
end
end
-- préparation des titres
local color = pargs['couleur-titre'] or '#CFCFCF' -- couleur de fond des titre du tableau
color = string.gsub (color, '^#?(%x%x%x%x%x%x)$', '#%1')
local premiersTours = pargs['premiers tours']
local DStitre = noramalizeBlankArg (pargs['DS-titre']) or z.abr {'1<sup>er</sup>', 'Premier', abrd = true} .. ' tour'
local DHtitre = noramalizeBlankArg (pargs['DH-titre'])
local DQtitre = noramalizeBlankArg (pargs['DQ-titre'])
local DDtitre = noramalizeBlankArg (pargs['DD-titre'])
local DFtitre = noramalizeBlankArg (pargs['DF-titre'])
local DFt = string.lower(DFtitre or '')
if pargs['premiers tours'] then
DHtitre = z.abr {'2<sup>e</sup>', 'Deuxième', abrd = true} .. ' tour'
DQtitre = z.abr {'3<sup>e</sup>', 'Troisième', abrd = true} .. ' tour'
DDtitre = z.abr {'4<sup>e</sup>', 'Quatrième', abrd = true} .. ' tour'
DFtitre = '1/4 de finale'
elseif DFt == '1/8 de finale' or DFt == 'hf' then
DHtitre = DHtitre or z.abr {'2<sup>e</sup>', 'Deuxième', abrd = true} .. ' tour'
DQtitre = DQtitre or z.abr {'3<sup>e</sup>', 'Troisième', abrd = true} .. ' tour'
DDtitre = DDtitre or z.abr {'3<sup>e</sup>', 'Quatrième', abrd = true} .. ' tour'
DFtitre = '1/8 de finale'
elseif DFt == '1/4 de finale' or DFt == 'qf' then
DHtitre = DHtitre or z.abr {'2<sup>e</sup>', 'Deuxième', abrd = true} .. ' tour'
DQtitre = DQtitre or z.abr {'3<sup>e</sup>', 'Troisième', abrd = true} .. ' tour'
DDtitre = DDtitre or '1/8 de finale'
DFtitre = '1/4 de finale'
elseif DFt == '1/2 finale' or DFt == 'df' then
DHtitre = DHtitre or z.abr {'2<sup>e</sup>', 'Deuxième', abrd = true} .. ' tour'
DQtitre = DQtitre or '1/8 de finale'
DDtitre = DDtitre or '1/4 de finale'
DFtitre = '1/2 finale'
else
DHtitre = DHtitre or '1/8 de finale'
DQtitre = DQtitre or '1/4 de finale'
DDtitre = DDtitre or '1/2 finale'
DFtitre = DFtitre or 'Finale'
end
local extraCells = ''
if nSetFinal > nSet or (nSetFinal2 or 0) > nSet then
extraCells = '|width="20"| ||width="20"| \n' -- Deux cellules supplémentaire lorsque l'une des finale est en 5 sets
end
-- assemblage de 'la' ligne de titre
ligneTitre = extraCells
.. '|-'
.. '\n|height="23"|'
.. '\n|colspan="' .. (2 + nSet) .. '" style="background:' .. color .. ';"|<strong>' .. DStitre .. '</strong>'
.. '\n|colspan="3"|'
.. '\n|colspan="' .. (6 + 2 * nSet) .. '" style="background:' .. color .. ';"|<strong>' .. DQtitre .. '</strong>'
.. '\n|'
.. '\n|colspan="' .. (6 + 2 * nSetFinal) .. '" style="background:' .. color .. ';"|<strong>' .. DFtitre .. '</strong>'
.. '\n|-'
.. '\n|height="2" colspan="34"|'
.. '\n|-'
.. '\n|'
.. '\n|colspan="' .. (4 + nSet) .. '"|'
.. '\n|colspan="' .. (3 + nSet) .. '"|'
.. '<div style="position:relative;">'
.. '<div style="position:absolute; left:0; width:100%; padding:2px 0; max-height:19px; background:' .. color ..';">'
.. '<strong>' .. DHtitre .. '</strong>'
.. '</div></div>'
.. '\n|'
.. '\n|colspan="' .. (7 + 2 * nSet) .. '"|'
.. '<div style="position:relative;">'
.. '<div style="position:absolute; left:0; width:100%; padding:2px 0; max-height:19px; background:' .. color ..';">'
.. '<strong>' .. DDtitre .. '</strong>'
.. '</div></div>'
.. '\n|-'
.. '\n|height="5"|'
-- assemblage des lignes du tableau proprement dit
for i = 0, 15 do
wikiTable[6 * i + 1] = date_duration (pargs, nSet, 'DS' .. (2 * i + 1))
end
wikiTable[2] = ''
-- DS 1-32
for i = 0, 7 do
wikiTable[i * 12 + 3],
wikiTable[i * 12 + 5],
wikiTable[i * 12 + 8],
wikiTable[i * 12 + 9],
wikiTable[i * 12 + 11]
= fistRoundMatchs (pargs, nSet, argMatch(i * 2 + 1), 'DS', i * 4 + 1, sport)
end
wikiTable[4] = date_duration (pargs, nSet, 'DH1', 3)
-- DH 1
match = matchPrep (pargs, nSet, argMatch(17), 'DH1', 'DH2', sport, 2)
wikiTable[6] = match[1]
.. '\n|colspan=2 rowspan=2 style="border-width:0 0 1px 0;' .. lineEnd
wikiTable[8] = wikiTable[8] .. '\n|'
.. match[2]
.. '\n|colspan=2 rowspan=4 style="border-width:0 1px 0 0;' .. lineEnd
wikiTable[10] = '\n|colspan="2"|'
.. date_duration (pargs, nSet, 'DQ1', 4 + nSet, true)
-- DQ 1
match = matchPrep (pargs, nSet, argMatch(25), 'DQ1', 'DQ2', sport, 5 + nSet)
wikiTable[12] = '\n|colspan=3 rowspan=3|'
.. match[1]
.. '\n|colspan=2 rowspan=2 style="border-width:0 0 1px 0;' .. lineEnd
wikiTable[13] = date_duration (pargs, nSet, 'DS5')
wikiTable[14] = match[2]
.. '\n|colspan=2 rowspan=10 style="border-width:0 1px 0 0;' .. lineEnd
wikiTable[16] = date_duration (pargs, nSet, 'DH3', 3)
.. '\n|colspan=2 rowspan=4 style="border-width:0 1px 1px 0;' .. lineEnd
-- DH 3
match = matchPrep (pargs, nSet, argMatch(18), 'DH3', 'DH4', sport, 2)
wikiTable[18] = match[1]
wikiTable[20] = wikiTable[20] ..'\n|'
.. match[2]
wikiTable[22] = '\n|colspan="' .. (5 + nSet) .. '"|'
.. date_duration (pargs, nSet, 'DD1', 5 + nSet, true)
-- DD 1
match = matchPrep (pargs, nSet, argMatch(29), 'DD1', 'DD2', sport, 6 + nSet)
wikiTable[24] = '\n|colspan="' .. (6 + nSet) .. '" rowspan="3"|'
.. match[1]
.. '\n|rowspan="2" style="border-width:0 0 1px 0;' .. lineEnd
wikiTable[26] = match[2]
.. '\n|rowspan=22 style="border-width:0 1px 0 0;' .. lineEnd
wikiTable[28] = date_duration (pargs, nSet, 'DH5', 3)
.. '\n|colspan="' .. (4 + nSet) .. '"|'
.. '\n|colspan="2" rowspan="10" style="border-width:0 1px 1px 0;' .. lineEnd
-- DH 5
match = matchPrep (pargs, nSet, argMatch(19), 'DH5', 'DH6', sport, 2)
wikiTable[30] = match[1]
.. '\n|colspan=2 rowspan=2 style="border-width:0 0 1px 0;' .. lineEnd
wikiTable[32] = wikiTable[32] .. '\n|'
.. match[2]
.. '\n|colspan=2 rowspan=4 style="border-width:0 1px 0 0;' .. lineEnd
wikiTable[34] = '\n|colspan="2"|'
.. date_duration (pargs, nSet, 'DQ3', 4 + nSet, true)
-- DQ 3
match = matchPrep (pargs, nSet, argMatch(26), 'DQ3', 'DQ4', sport, 5 + nSet)
wikiTable[36] = '\n|colspan=3 rowspan=3|'
.. match[1]
wikiTable[38] = match[2]
wikiTable[40] = date_duration (pargs, nSet, 'DH7', 3)
.. '\n|colspan="2" rowspan="4" style="border-width:0 1px 1px 0;' .. lineEnd
-- DH 7
match = matchPrep (pargs, nSet, argMatch(20), 'DH7', 'DH8', sport, 2)
wikiTable[42] = match[1]
wikiTable[44] = wikiTable[44] ..'\n|'
.. match[2]
wikiTable[46] = '\n|colspan="' .. (9 + 2 * nSet) .. '"|'
.. date_duration (pargs, nSetFinal, 'DF1', 4 + nSet, true)
-- DF 1
match = matchPrep (pargs, nSetFinal, argMatch(31), 'DF1', 'DF2', sport, 5 + nSet)
wikiTable[48] = '\n|colspan="' .. (10 + 2 * nSet) .. '" rowspan="3"|'
.. match[1]
wikiTable[50] = match[2]
wikiTable[52] = date_duration (pargs, nSet, 'DH9', 3)
.. '\n|colspan="' .. (8 + 2 * nSet) .. '"|'
.. '\n|rowspan="22" style="border-width:0 1px 1px 0;' .. lineEnd
-- DH 9
match = matchPrep (pargs, nSet, argMatch(21), 'DH9', 'DH10', sport, 2)
wikiTable[54] = match[1]
.. '\n|colspan=2 rowspan=2 style="border-width:0 0 1px 0;' .. lineEnd
wikiTable[56] = wikiTable[56] ..'\n|'
.. match[2]
.. '\n|colspan=2 rowspan=4 style="border-width:0 1px 0 0;' .. lineEnd
wikiTable[58] = '\n|colspan="2"|'
.. date_duration (pargs, nSet, 'DQ5', 4 + nSet, true)
-- DQ 5
match = matchPrep (pargs, nSet, argMatch(27), 'DQ5', 'DQ6', sport, 5 + nSet)
wikiTable[60] = '\n|colspan="3" rowspan="3"|'
.. match[1]
.. '\n|colspan="2" rowspan="2" style="border-width:0 0 1px 0;' .. lineEnd
wikiTable[62] = match[2]
.. '\n|colspan=2 rowspan=10 style="border-width:0 1px 0 0;' .. lineEnd
wikiTable[64] = date_duration (pargs, nSet, 'DH11', 3)
.. '\n|colspan="2" rowspan="4" style="border-width:0 1px 1px 0;' .. lineEnd
-- DH 11
match = matchPrep (pargs, nSet, argMatch(22), 'DH11', 'DH12', sport, 2)
wikiTable[66] = match[1]
wikiTable[68] = wikiTable[68] ..'\n|'
.. match[2]
wikiTable[70] = '\n|colspan="' .. (5 + nSet) .. '"|'
.. date_duration (pargs, nSet, 'DD1', 5 + nSet, true)
-- DD 3
match = matchPrep (pargs, nSet, argMatch(30), 'DD3', 'DD4', sport, 6 + nSet)
wikiTable[72] = '\n|colspan="' .. (6 + nSet) .. '" rowspan="3"|'
.. match[1]
wikiTable[74] = match[2]
wikiTable[76] = date_duration (pargs, nSet, 'DH13', 3)
.. '\n|colspan="' .. (4 + nSet) .. '"|'
.. '\n|colspan="2" rowspan="10" style="border-width:0 1px 1px 0;' .. lineEnd
-- DH 13
match = matchPrep (pargs, nSet, argMatch(23), 'DH13', 'DH14', sport, 2)
wikiTable[78] = match[1]
.. '\n|colspan=2 rowspan=2 style="border-width:0 0 1px 0;' .. lineEnd
wikiTable[80] = wikiTable[80] ..'\n|'
.. match[2]
.. '\n|colspan=2 rowspan=4 style="border-width:0 1px 0 0;' .. lineEnd
wikiTable[82] = '\n|colspan="2"|'
.. date_duration (pargs, nSet, 'DQ7', 4 + nSet, true)
-- DQ 7
match = matchPrep (pargs, nSet, argMatch(28), 'DQ7', 'DQ8', sport, 5 + nSet)
wikiTable[84] = '\n|colspan=3 rowspan=3|'
.. match[1]
wikiTable[86] = match[2]
wikiTable[88] = date_duration (pargs, nSet, 'DH15', 3)
.. '\n|colspan="2" rowspan="4" style="border-width:0 1px 1px 0;' .. lineEnd
-- DH 15
match = matchPrep (pargs, nSet, argMatch(24), 'DH15', 'DH16', sport, 2)
wikiTable[90] = match[1]
wikiTable[92] = wikiTable[92] ..'\n|'
.. match[2]
wikiTable[94] = ''
wikiTable[96] = ''
if nSetFinal2 then
wikiTable[92] = wikiTable[92] .. '\n|colspan="' .. (5 + nSet) .. '"|'
.. '\n|rowspan="2" colspan="' .. (6 + nSet + nSetFinal2) .. '" style="vertical-align:bottom;"|'
.. '<div style="position:relative;">'
.. '<div style="position:absolute; bottom:0; left:0; width:100%; padding:2px 0; background:' .. color ..';">'
.. '<strong>' .. (noramalizeBlankArg (pargs['DP-titre']) or 'Match pour la troisième place') .. '</strong>'
.. '</div></div>'
wikiTable[94] = '\n|colspan="' .. (9 + 2 * nSet) .. '"|'
.. date_duration (pargs, nSetFinal2, 'DP1', 6 + nSet)
-- DP1
match = matchPrep (pargs, nSetFinal2, argMatch(32), 'DP1', 'DP2', sport, 5 + nSet)
wikiTable[96] = '\n|rowspan="4" colspan="' .. (10 + 2 * nSet) .. '"|'
.. match[1]
wikiTable[97] = '\n|rowspan="2" colspan="' .. (2 + nSet) .. '"|'
wikiTable[98] = match[2]
end
-- Définition des hauteur de ligne (sensible sur Firefox) pour regrouper les matchs du premier tour par 2
-- Si le le premier "joueur" contient <br /> la hauteur des cellules est plus importante.
addCellsHeight (pargs, wikiTable, 'DS')
wikiText = '\n|- \n|'
return ligneTitre .. table.concat (wikiTable, wikiText)
end
return z