Module:Infobox/Cycliste
Outils
Général
Imprimer / exporter
Dans d’autres projets
Cette page définit un module d'infobox. Pour les conseils sur l'usage de ce module, voyezModèle:Infobox Cycliste.
Ladocumentation de cemodule est générée par le modèle{{Documentation module}}.
Elle estincluse depuis la pageModèle:Documentation module d'infobox. Veuillez placer les catégories sur cette page-là.
Les éditeurs peuvent travailler dans le bac à sable (créer).
Voir lesstatistiques d'appel depuis le wikicode sur l'outilwstat et lesappels depuis d'autres modules.
localperson=require"Module:Infobox/Fonctions/Personne"localWikidata=require"Module:Wikidata"localwikibase=mw.wikibaselocalComplexedate=require"Module:Date complexe"localwikidataON=truelocalwikidataManagedON=truelocalfinalYear=2030localinitialYear=1900localonlyRoad=truelocalpresentTeamLabellocalavailable,translations=pcall(require,"Module:Cycling race/lang")localavailable_lang_priority=available==trueandtype(translations.lang_priority)=="table"localwiki="fr"-- lazy-filled by listofTeamTable(), on first call of amateurTeamTable() or proTeamTable()localteamAmateur,teamPro,teamMountainBike,teamCycloCross,teamTrack,teamTriathlon,teamGravel,nationalTeam,managedTeamlocalitemID-- ##### Functions from Cycling race module copied #####--[[ Iterator to get all statements for an entity and property which are not deprecated and have a value]]localfunctionnextStatement(state,i)localsrepeati=i+1locals=state[i]ifsands.rank~='deprecated'ands.mainsnak.snaktype=='value'thenreturni,senduntils==nilendlocalfunctionstatements(QID,PID)returnnextStatement,wikibase.getAllStatements(QID,PID),0end--[[ Get any value for a property which is not deprecated ]]localfunctionfirstValue(QID,PID,field)localss=wikibase.getAllStatements(QID,PID)for_,sinpairs(ss)doifs.rank~='deprecated'ands.mainsnak.snaktype=='value'thenreturnfieldands.mainsnak.datavalue.value[field]ors.mainsnak.datavalue.valueendendend--[[ Go from season of a team to the team ]]localfunctiongetParentID(teamID)returnfirstValue(teamID,'P361','id')-- P361 is 'part of'orfirstValue(teamID,'P5138','id')-- P5138 is 'season of club or team'end--[[ Get sitelink with no wiki no formating ]]localfunctiongetRawTeamLink(teamID)localsitelinklocalparentID=getParentID(teamID)ifparentIDthen-- try parent team firstsitelink=mw.wikibase.getSitelink(parentID)endifnotsitelinkthensitelink=mw.wikibase.getSitelink(teamID)endreturnsitelinkend--[[ Get a Wikidata statement for an entity and property valid at the given timevalue ]]localfunctioncheckTime(s,time)localstart,startPrecision,END,endPrecisionlocalq=s.qualifiersifqthenifq.P580andq.P580[1]andq.P580[1].snaktype=='value'then-- P580 is start timestart=q.P580[1].datavalue.value.timestartPrecision=q.P580[1].datavalue.value.precisionifstartPrecision==9then-- precision is yearsstart=string.sub(start,1,5)-- Cut of everything after yearelseifstartPrecision==10then-- precision is monthsstart=string.sub(start,1,8)-- Cut of everything after monthendendifq.P582andq.P582[1]andq.P582[1].snaktype=='value'then-- P582 is end timeEND=q.P582[1].datavalue.value.timeendPrecision=q.P582[1].datavalue.value.precisionendendifnotstartorstart<=timethenifnotENDthenreturnsendifendPrecision==9then-- precision 9 is 'years'END=string.sub(END,1,6)..'13'-- Set month to 13elseifendPrecision==10then-- precision 10 is 'months'END=string.sub(END,1,9)..'32'-- Set day to 32endifEND>=timethenreturnsendendreturnnilendlocalfunctiongetStatementForTime(ID,property,time)localtempfor_,sinstatements(ID,property)dotemp=checkTime(s,time)iftempthenreturntempendendreturnnilendlocalfunctiongetOfficialName(teamID,timeOfRace,season,strict)-- for team--return officialName, isLocallocalstrictLang={mk=true}localcyrillic={mk=true,ru=true}localstrictLangBool=strictLang[wiki]orstrictlocalcorrecttime,best,name,nametemplocalwantedLanguages={}ifavailable_lang_prioritythenfori,langinipairs(translations.lang_priority)do--from Module:Cycling_race/langwantedLanguages[lang]=iendend--case one, one official name / period overloaded with other languages as qualifier--for instance https://www.wikidata.org/wiki/Q195833for_,p1448instatements(teamID,'P1448')docorrecttime=trueiftimeOfRacethencorrecttime=checkTime(p1448,timeOfRace)endifcorrecttimethenifavailable_lang_priorityandp1448.qualifiersandp1448.qualifiers.P1448thenlocalq=p1448.qualifiers.P1448best=999for_,linpairs(q)doifl.snaktype=='value'thenlocallang=l.datavalue.value.languageifwantedLanguages[lang]andwantedLanguages[lang]<bestthenbest=wantedLanguages[lang]name=l.datavalue.value.textendendendifnamethenreturnname,trueendend--p1448 and correct time, look in the not qualifier partlang=p1448.mainsnak.datavalue.value.languagebest=999ifavailable_lang_priorityandnotstrictLangBoolandwantedLanguages[lang]andwantedLanguages[lang]<bestthenbest=wantedLanguages[lang]name=p1448.mainsnak.datavalue.value.textelseifstrictLangBoolthenifwiki==langthenname=p1448.mainsnak.datavalue.value.textendelseifcyrillic[lang]==nilthen--don't display cyrillic for latin wikinametemp=p1448.mainsnak.datavalue.value.textendendendendifnamethenreturnname,trueelseifnotstrictLangBoolthenreturnnametemp,falseend--no official name, get labellocallabel=wikibase.getLabel(teamID)ifseasonandseason==truetheniflabelthenreturnstring.sub(label,1,label:len()-5),trueend--elsereturnlabel,true-- No official name, try labelendendlocalfunctiongetCountryName(countryID)localname=''localavailable,translations=pcall(require,"Module:Cycling race/lang")localavailable_list=availableandtype(translations.list)=="function"ifavailable_listthenname=translations.list(countryID)endifname==''thenlocallabel,lang=wikibase.getLabelWithLang(countryID)--[[ Uses standard language fallback. Should not return nil, nil, as all countries have English labels. ]]iflang==wikilangthenname=labelelseiflangthenname=label..' ('..lang..')'endendreturnnameend--[[ Get sitelink, categoryID and maybe country for a team.Returns sitelink, team category ID, countryID (only countryID if country arg is true ]]localfunctiongetTeamLinkCat(teamID,timeOfRace,country)--countryID is not used in this modulelocalname,sitelink,parentID,catID-- Find team categorylocalteamCats={Q6154783=true,Q20638319=true,Q382927=true,Q1756006=true,Q23726798=true,Q20738667=true,Q28492441=true,Q20639848=true,Q20639847=true,Q20652655=true,Q20653563=true,Q20653564=true,Q20653566=true,Q2466826=true,Q26849121=true,Q78464255=true,Q80425135=true}for_,p31instatements(teamID,'P31')doifcheckTime(p31,timeOfRace)thenlocalnatureID=p31.mainsnak.datavalue.value.idifteamCats[natureID]thencatID=natureIDbreakendendend--main team-- Find country if neededlocalcountryIDifcountryorcatID=='Q23726798'orcatID=='Q20738667'thencountryID=firstValue(teamID,'P1532','id')-- P17 is country for sportifcountryID==nilthencountryID=firstValue(teamID,'P17','id')-- P17 is countryendendifcountryIDand(catID=='Q23726798'orcatID=='Q20738667')then-- It is a national cycling teamname=getCountryName(countryID)ifcatID=='Q20738667'then-- national cycling team U23localsifwiki=='fr'thens=' espoirs'endname=name..sendsitelink=getRawTeamLink(teamID)else-- It is not a national cycling teamlocalisLocalparentID=getParentID(teamID)ifparentIDthen-- try parent team firstsitelink=wikibase.getSitelink(parentID)name,isLocal=getOfficialName(parentID,timeOfRace)endifnotsitelinkthensitelink=wikibase.getSitelink(teamID)endifnotnameor(notisLocalandavailable_lang_priority)thenlocalpartName,partIsLocal=getOfficialName(teamID,timeOfRace)ifpartNameand(notnameorpartIsLocal)thenname=partNameendendendifsitelinkthenifnamethensitelink='[['..sitelink..'|'..name..']]'elsesitelink='[['..sitelink..']]'endelseifnamethensitelink=nameelsesitelink=(parentIDandwikibase.getLabel(parentID))orwikibase.getLabel(teamID)or'No name'endendreturnsitelink,catIDend-- ##### Functions for the Infobox #####--For the case with direct input of the parameterslocalfunctionteamValue(teamParam,dateParam)returnfunction(localdata)localnames,periods=localdata[teamParam],localdata[dateParam]ifnotnamesthenreturnnilendifnamesthennames=mw.text.split(names,'<br />')periods=mw.text.split(periodsor'','<br />')endlocaltab=mw.html.create('table')fori,nameinpairs(names)dolocalrow=mw.html.create('tr'):tag('td'):wikitext(periods[i]or''):done():tag('td'):wikitext(name):done()tab:node(row):done()endtab:done()returntostring(tab)endendlocalfunctioncheckDis(q)dis="road"ifqandq.P641andq.P641[1]andq.P641[1].snaktype=='value'thenifq.P641[1].datavalue.value.id=='Q520611'orq.P641[1].datavalue.value.id=='Q1031445'thenonlyRoad=falsedis="mountainBike"elseifq.P641[1].datavalue.value.id=='Q335638'thenonlyRoad=falsedis="cycloCross"elseifq.P641[1].datavalue.value.id=='Q221635'thenonlyRoad=falsedis="track"elseifq.P641[1].datavalue.value.id=='Q10980'thenonlyRoad=falsedis="triathlon"elseifq.P641[1].datavalue.value.id=='Q111721834'thenonlyRoad=falsedis="gravel"endendreturndisendlocalfunctionpresentTeam(item)localtToday=os.date("*t")localteamId,result,teamLink,teamLinkRoad,rowlocalplural=falseifmw.ustring.len(tToday["month"])==1thentToday["month"]='0'..tToday["month"]endifmw.ustring.len(tToday["day"])==1thentToday["day"]='0'..tToday["day"]endlocaltoday='+'..tToday["year"].."-"..tToday["month"].."-"..tToday["day"].."T00:00:00Z"finalYear=tonumber(tToday["year"])+10--globalitemID=itemlocaltemp=firstValue(itemID,'P569','time')iftempthen_,_,initialYear,_,_=string.find(temp,"(%d+)-(%d+)-(%d+)")endfor_,sinstatements(itemID,'P54')dop54=checkTime(s,today)--present Teamifp54thenteamId=p54.mainsnak.datavalue.value.idteamLink=getTeamLinkCat(teamId,today)dis=checkDis(p54.qualifiers)row=nilifdis=='road'thenteamLinkRoad=teamLinkelseifdis=='mountainBike'thenrow=teamLink..' (VTT)'elseifdis=='cycloCross'thenrow=teamLink..' (cyclo-cross)'elseifdis=='gravel'thenrow=teamLink..' (gravel)'elseifdis=='triathlon'thenrow=teamLink..' (triathlon)'elserow=teamLink..' (piste)'endifrowthenifnotresultthenresult=rowelseresult=result..'<br/>'..rowplural=trueendendendendifteamLinkRoadandresultthen--put road firstresult=teamLinkRoad..' (route)<br/>'..resultplural=trueelseifteamLinkRoadthenresult=teamLinkRoadendifpluralthenpresentTeamLabel="Équipes actuelles"elsepresentTeamLabel="Équipe actuelle"endreturnresultendlocalfunctionconvertDate(date1,beginOrEnd)ifdate1==0thenifbeginOrEnd==0then--beginy1=tostring(initialYear)m1="01"d1="01"elsey1=tostring(finalYear)m1="12"d1="31"endelse_,_,y1,m1,d1=string.find(date1,"(%d+)-(%d+)-(%d+)")ifm1==nilorm1=="00"thenifbeginOrEnd==0then--beginm1="01"d1="01"else--endm1="12"d1="31"endendendreturn'+'..y1.."-"..m1.."-"..d1.."T00:00:00Z"endlocalfunctiongetStartendTime(q)-- look for start and end time of team by the riderslocalstartTime,endTime,stagiaire,disifqthenifq.P580andq.P580[1]andq.P580[1].snaktype=='value'then-- P580 is start timestartTime=q.P580[1].datavalue.value.timeelseifq.P585andq.P585[1]andq.P585[1].snaktype=='value'thenstartTime=q.P585[1].datavalue.value.timeelsestartTime=0endstartTime=convertDate(startTime,0)ifq.P582andq.P582[1]andq.P582[1].snaktype=='value'thenendTime=q.P582[1].datavalue.value.timeelseifq.P585andq.P585[1]andq.P585[1].snaktype=='value'thenendTime=q.P585[1].datavalue.value.timeelseendTime=0endendTime=convertDate(endTime,1)ifq.P39andq.P39[1]andq.P39[1].snaktype=='value'thenstagiaire=q.P39[1].datavalue.valueelsestagiaire=nilenddis=checkDis(q)endreturnstartTime,endTime,stagiaire,disendlocalfunctionlistofTeam(item,PID)--first we have to read P54 of the riderlocalriderteam={}ifnotitemIDthenitemID=itemendforii,p54instatements(itemID,PID)do--itemID loaded in presentTeamifp54thenteamId=p54.mainsnak.datavalue.value.idelseteamId=nilendlocalq=p54.qualifiersifqthenlocalstartTime,endTime,stagiaire,dis=getStartendTime(q)table.insert(riderteam,{teamId=teamId,startTime=startTime,endTime=endTime,stagiaire=stagiaire,dis=dis})endendreturnriderteamendlocalfunctionformatDate(thisDate)ifthisDate==''thenreturn''elselocalmonth=math.ceil(thisDate['month']/2)ifmonth==12ormonth==1thenreturnthisDate['year']elselocaldate1='+'..thisDate['year'].."-"..month.."-".."01".."T00:00:00Z"localnewobj=Complexedate.splitDate(date1)ifnewobj.month==0ornewobj.month==nilthenreturnnewobj.yearelsereturnnewobj.month..'.'..newobj.yearendendendendlocalfunctiongetTeamInfo(teamId,mm,yy,dd,managedTeam)--get the nature and name of the team for the date mm,yymm=tostring(mm)yy=tostring(yy)dd=tostring(dd)ifmw.ustring.len(mm)==1thenmm='0'..mmendifmw.ustring.len(dd)==1thendd='0'..ddendthistime='+'..yy.."-"..mm.."-"..dd.."T00:00:00Z"localsitelink,teamNature=getTeamLinkCat(teamId,thistime,false)localcat,booleanlocalamateurcat={Q20639848=true,Q20652655=true,Q26849121=true}localnationalcat={Q23726798=true,Q20738667=true,Q54660600=true,Q54555994=true,Q99658502=true}ifmanagedTeamthencat=nationalcatelsecat=amateurcatendifcat[teamNature]then--clubboolean=true--amateur / national selectionelseboolean=false--pro / not national selectionendreturnboolean,sitelinkend--for managed team, the table should be splat, as we can be national trainer and team trainer at the same timelocalfunctionanalyzeManagedTeam(teamRider)localnatTeamOut,managedTeamOut={},{}localdis="road"localmanagedTeam=truefori=1,24do--init tablenatTeamOut[i]={}managedTeamOut[i]={}forj=initialYear,finalYeardonatTeamOut[i][j]={amateurTeam,link,stagiaire=nil}managedTeamOut[i][j]={amateurTeam,link,stagiaire=nil}endendlocalteamId,natTeam,sitelinklocalsYear,sMonth,eYear,eMonth,sDay,eDayifteamRider==nilthenreturnnilendfor_,vinpairs(teamRider)do--for each team where was the riderifv['dis']==disthen--exception managed at the reading_,_,sYear,sMonth,sDay=string.find(v['startTime'],"(%d+)-(%d+)-(%d+)")_,_,eYear,eMonth,eDay=string.find(v['endTime'],"(%d+)-(%d+)-(%d+)")sYear=tonumber(sYear)sMonth=tonumber(sMonth)eYear=tonumber(eYear)eMonth=tonumber(eMonth)ifsYear<=eYearthen--test of congruenceforyy=sYear,eYeardoformm=1,12dolocalmmindex=(mm-1)*2+1--avoid reading info where the team is not the one of the ridergetinfo=trueif(yy==sYearandmm<sMonth)or(yy==eYearandmm>eMonth)thengetinfo=falseendifgetinfothenif(yy==sYear)and(mm==sMonth)and(sDay~='01'andsDay~='00'andsDay~=nil)thennatTeam,sitelink=getTeamInfo(v['teamId'],mm,yy,sDay,managedTeam)ifnatTeamthennatTeamOut[mmindex+1][yy]['amateurTeam']=truenatTeamOut[mmindex+1][yy]['link']=sitelinkelsemanagedTeamOut[mmindex+1][yy]['amateurTeam']=falsemanagedTeamOut[mmindex+1][yy]['link']=sitelinkendelsenatTeam,sitelink=getTeamInfo(v['teamId'],mm,yy,'01',managedTeam)ifnatTeamthennatTeamOut[mmindex][yy]['amateurTeam']=truenatTeamOut[mmindex][yy]['link']=sitelinkifnatTeamOut[mmindex+1][yy]['amateurTeam']==nilorv['stagiaire']then--to avoid problem with team name change during the monthnatTeam,sitelink=getTeamInfo(v['teamId'],mm,yy,'28',managedTeam)natTeamOut[mmindex+1][yy]['amateurTeam']=true--a nat team stays a nat teamnatTeamOut[mmindex+1][yy]['link']=sitelinkendelsemanagedTeamOut[mmindex][yy]['amateurTeam']=falsemanagedTeamOut[mmindex][yy]['link']=sitelinkifmanagedTeamOut[mmindex+1][yy]['amateurTeam']==nilorv['stagiaire']then--to avoid problem with team name change during the monthnatTeam,sitelink=getTeamInfo(v['teamId'],mm,yy,'28',managedTeam)managedTeamOut[mmindex+1][yy]['amateurTeam']=false--a nat team stays a nat teammanagedTeamOut[mmindex+1][yy]['link']=sitelinkendendendendendendendendendreturnnatTeamOut,managedTeamOut--a filled matrix with the link and nature of the teamsendlocalfunctionanalyzeTeam(teamRider,dis)localteamOut={}--as there can be a suppositionfori=1,24do--init tableteamOut[i]={}forj=initialYear,finalYeardoteamOut[i][j]={amateurTeam,link,stagiaire,dis}endendlocalmanagedTeam=falselocalteamId,amateurTeam,sitelinklocalsYear,sMonth,eYear,eMonth,sDay,eDayifteamRider==nilthenreturnnilendfor_,vinpairs(teamRider)do--for each team where was the riderifv['dis']==disthen--exception managed at the reading_,_,sYear,sMonth,sDay=string.find(v['startTime'],"(%d+)-(%d+)-(%d+)")_,_,eYear,eMonth,eDay=string.find(v['endTime'],"(%d+)-(%d+)-(%d+)")sYear=tonumber(sYear)sMonth=tonumber(sMonth)eYear=tonumber(eYear)eMonth=tonumber(eMonth)ifsYear<=eYearthen--test of congruenceforyy=sYear,eYeardoformm=1,12dolocalmmindex=(mm-1)*2+1--avoid reading info where the team is not the one of the ridergetinfo=trueif(yy==sYearandmm<sMonth)or(yy==eYearandmm>eMonth)thengetinfo=falseendifgetinfothenif(yy==sYear)and(mm==sMonth)and(sDay~='01'andsDay~='00'andsDay~=nil)thenamateurTeam,sitelink=getTeamInfo(v['teamId'],mm,yy,sDay,managedTeam)teamOut[mmindex+1][yy]['amateurTeam']=amateurTeamteamOut[mmindex+1][yy]['link']=sitelinkteamOut[mmindex+1][yy]['stagiaire']=v['stagiaire']teamOut[mmindex+1][yy]['dis']=v['dis']elseamateurTeam,sitelink=getTeamInfo(v['teamId'],mm,yy,'01',managedTeam)teamOut[mmindex][yy]['amateurTeam']=amateurTeamteamOut[mmindex][yy]['link']=sitelinkteamOut[mmindex][yy]['stagiaire']=v['stagiaire']teamOut[mmindex][yy]['dis']=v['dis']ifteamOut[mmindex+1][yy]['amateurTeam']==nilorv['stagiaire']then--to avoid problem with team name change during the monthamateurTeam,sitelink=getTeamInfo(v['teamId'],mm,yy,'28',managedTeam)teamOut[mmindex+1][yy]['amateurTeam']=amateurTeamteamOut[mmindex+1][yy]['link']=sitelinkteamOut[mmindex+1][yy]['stagiaire']=v['stagiaire']teamOut[mmindex+1][yy]['dis']=v['dis']endendendendendendendendreturnteamOut--a filled matrix with the link and nature of the teamsend--local function insertTeam(teamAmateur,teamPro,teamMountainBike, teamCycloCross, teamTrack, sDate,eDate,v)localfunctioninsertTeam(teamAmateur,teamPro,sDate,eDate,v)localsDate2=formatDate(sDate)localeDate2=formatDate(eDate)localins={link=v['link'],sDate=sDate2,eDate=eDate2,stagiaire=v['stagiaire']}ifv['amateurTeam']thentable.insert(teamAmateur,ins)elsetable.insert(teamPro,ins)endreturnteamAmateur,teamProendlocalfunctionsynthetizeTable(analyzedTeam)localteamPro,teamAmateur,tempTeam,tempsDate,tempeDate={},{},{},{},{}localempty=truelocalactive=falseforyy=initialYear,finalYeardoformm=1,24dolocalv=analyzedTeam[mm][yy]ifv['amateurTeam']~=nilthenifemptythen--first lineactive=trueempty=falsetempTeam=vtempsDate['month']=mmtempsDate['year']=yyelseiftempTeam['amateurTeam']==v['amateurTeam']andtempTeam['link']==v['link']andtempTeam['stagiaire']==v['stagiaire']then--no change, the case of same team but different disciplines is not consideredifyy==finalYearandmm==24then--present teamteamAmateur,teamPro=insertTeam(teamAmateur,teamPro,tempsDate,'',tempTeam)endelse--change--save the oldifactivethen--if active false then it was already savedifmm==1thentempeDate['year']=yy-1tempeDate['month']=24elsetempeDate['year']=yytempeDate['month']=mm-1endteamAmateur,teamPro=insertTeam(teamAmateur,teamPro,tempsDate,tempeDate,tempTeam)end--save the newactive=truetempTeam=vtempsDate['month']=mmtempsDate['year']=yyend--changeend--first lineelseifactivethen--there was a team and now there is an empty periodactive=false--save the oldifmm==1thentempeDate['year']=yy-1tempeDate['month']=24elsetempeDate['year']=yytempeDate['month']=mm-1endteamAmateur,teamPro=insertTeam(teamAmateur,teamPro,tempsDate,tempeDate,tempTeam)tempTeam['link']=nil--avoid problem if the rider comes back in the same teamendend-- for mmend--for yyreturnteamAmateur,teamProendlocalfunctionlistOfManagedTeamTable(itemID)localmanagedTeamRider=listofTeam(itemID,'P6087')--raw list of teamifnotmanagedTeamRiderthenreturnnil,nilendlocalnatTeamOut,managedTeamOut=analyzeManagedTeam(managedTeamRider)--table with links and nature of teams--globalnationalTeam,_=synthetizeTable(natTeamOut)_,managedTeam=synthetizeTable(managedTeamOut)endlocalfunctionlistofTeamTable(item)localteamRider=listofTeam(item,'P54')--raw list of teamifnotteamRiderthenreturnnilendlocalanalyzedTeam1=analyzeTeam(teamRider,"road")--table with links and nature of teamsteamAmateur,teamPro=synthetizeTable(analyzedTeam1)--table formated, globallocalanalyzedTeam2=analyzeTeam(teamRider,"mountainBike")_,teamMountainBike=synthetizeTable(analyzedTeam2)localanalyzedTeam3=analyzeTeam(teamRider,"cycloCross")_,teamCycloCross=synthetizeTable(analyzedTeam3)localanalyzedTeam4=analyzeTeam(teamRider,"track")_,teamTrack=synthetizeTable(analyzedTeam4)localanalyzedTeam5=analyzeTeam(teamRider,"triathlon")_,teamTriathlon=synthetizeTable(analyzedTeam5)localanalyzedTeam6=analyzeTeam(teamRider,"gravel")_,teamGravel=synthetizeTable(analyzedTeam6)endlocalfunctionTeamTable(teamRider,titlesing,titleplural)localtemprows=nillocaltitle=titlepluralifteamRiderand#teamRider~=0thenlocalnametemp,periodtemplocalrows=mw.html.create('table')for_,vinpairs(teamRider)donametemp=v['link']ifv['sDate']==v['eDate']thenperiodtemp=v['sDate']elseperiodtemp=v['sDate']..'-'..v['eDate']endifv['stagiaire']thennametemp=nametemp..' (stagiaire)'endlocalrow=rows:tag('tr')row:tag('td'):wikitext(periodtempor'')row:tag('td'):wikitext(nametemp)endtemprows=tostring(rows)if#teamRider==1thentitle=titlesingendelsetemprows=nilendreturn{type='table',title=title,rows={{type='row',value=function()returntemprowsend}}}endlocalfunctionmanagedTeamTable(localdata)localteamManagednames=localdata['équipes dirigées']localteamManagedperiods=localdata['années direction']ifteamManagednamesthenwikidataManagedON=falseendifwikidataManagedONthenifmanagedTeam==nilandlocaldata.itemthenlistOfManagedTeamTable(localdata.item)endreturnTeamTable(managedTeam,'Équipe dirigée','Équipes dirigées')elsereturn{type='table',title='Équipes dirigées',rows={{type='row',value=teamValue('équipes dirigées','années direction')}}}endendlocalfunctionnationalTeamTable(localdata)ifwikidataManagedONthen--only with wikidataifnationalTeam==nilandlocaldata.itemthenlistOfManagedTeamTable(localdata.item)endreturnTeamTable(nationalTeam,'Sélection nationale dirigée','Sélections nationales dirigées')elsereturn{type='table',title=nil,rows={{type='row',value=nil}}}endendlocalfunctionamateurTeamTable(localdata)-- teamAmateur called beforelocalNotUCInames=localdata['équipes non-UCI']localAmateurNames=localdata['équipes amateur']localsuffix=''ifNotUCInamesorAmateurNamesorlocaldata['équipes UCI']orlocaldata['équipes pro']thenwikidataON=falseendifwikidataONthenifteamAmateur==nilandlocaldata.itemthenlistofTeamTable(localdata.item)endifnotonlyRoadthensuffix=' en cyclisme sur route'endreturnTeamTable(teamAmateur,'Équipe non-UCI'..suffix,'Équipes non-UCI'..suffix)elseifNotUCInamesthenreturn{type='table',title='Équipes non-UCI',rows={{type='row',value=teamValue('équipes non-UCI','années non-UCI')}}}elsereturn{type='table',title='Équipes amateurs',rows={{type='row',value=teamValue('équipes amateur','années amateur')}}}endendendlocalfunctionproTeamTable(localdata)localUCInames=localdata['équipes UCI']localProNames=localdata['équipes pro']localsuffix=''ifwikidataONthenifteamPro==nilandlocaldata.itemthenlistofTeamTable(localdata.item)endifnotonlyRoadthensuffix=' en cyclisme sur route'endreturnTeamTable(teamPro,'Équipe UCI'..suffix,'Équipes UCI'..suffix)elseifUCInamesthenreturn{type='table',title='Équipes UCI',rows={{type='row',value=teamValue('équipes UCI','années UCI')}}}elsereturn{type='table',title='Équipes professionnelles',rows={{type='row',value=teamValue('équipes pro','années pro')}}}endendendlocalfunctionmountainBikeTeamTable(localdata)--amateur or pro Team Table were already calledifwikidataONandteamMountainBike~=nilthenreturnTeamTable(teamMountainBike,'Équipe VTT','Équipes VTT')elsereturn{type='table',title=nil,rows={{type='row',value=nil}}}endendlocalfunctioncycloCrossTeamTable(localdata)--amateur or pro Team Table were already calledifwikidataONandteamCycloCross~=nilthenreturnTeamTable(teamCycloCross,'Équipe cyclo-cross','Équipes cyclo-cross')elsereturn{type='table',title=nil,rows={{type='row',value=nil}}}endendlocalfunctiongravelTeamTable(localdata)--amateur or pro Team Table were already calledifwikidataONandteamGravel~=nilthenreturnTeamTable(teamGravel,'Équipe gravel','Équipes gravel')elsereturn{type='table',title=nil,rows={{type='row',value=nil}}}endendlocalfunctiontrackTeamTable(localdata)--amateur or pro Team Table were already calledifwikidataONandteamTrack~=nilthenreturnTeamTable(teamTrack,'Équipe piste','Équipes piste')elsereturn{type='table',title=nil,rows={{type='row',value=nil}}}endendlocalfunctiontriathlonTeamTable(localdata)--amateur or pro Team Table were already calledifwikidataONandteamTriathlon~=nilthenreturnTeamTable(teamTriathlon,'Équipe triathlon','Équipes triathlon')elsereturn{type='table',title=nil,rows={{type='row',value=nil}}}endendreturn{maincolor='#FFDF80',parts={person.title('cyclisme'),person.mainimage('Article à illustrer Cycliste'),{type='table',title='Informations',rows={person.othernames(),person.birth(),person.death(),person.placeofburial(),person.nationality(),{type='row',label=function(item)returnpresentTeamLabelor'Équipe actuelle'--plural or not, or not calledend,value='équipe',wikidata=function(item)returnpresentTeam(item)end,},{type='row',label='Spécialité',singularlabel='Spécialité',plurallabel='Spécialités',value='type coureur',property='P413'},{type='row',label='Latéralisation',property='P552'},--person.appearance(),{type='row',label='Groupe sanguin',property='P1853'},--person.family(),person.awards(),},},amateurTeamTable,proTeamTable,mountainBikeTeamTable,cycloCrossTeamTable,trackTeamTable,triathlonTeamTable,gravelTeamTable,managedTeamTable,nationalTeamTable,{type='table',title='Principales victoires',rows={{type='row',value='victoires principales'},}},person.signature(),person.plaque(),person.tombe(),}}