Munurin millum rættingarnar hjá "Module:Cycling race"
Content deleted Content added
copy from wikidata Merki: Reverted |
Merkir: Undo Reverted |
||
Linja 13:
local wikilang = contentLanguage:getCode()
local wikibase = mw.wikibase
local localframe -- Value may be given by functions which use frame functions like getReference
local arwiki_totemplate = mw.getCurrentFrame():getParent().args["totemplate"] or mw.getCurrentFrame().args["totemplate"]
arwiki_totemplate = (wiki == "ar" and arwiki_totemplate and arwiki_totemplate ~= "") or false
-- == Structure of the code ==
-- I) Constant
Line 48 ⟶ 50:
--== I) Classes declared as global ==
--dictionnaries
local teamCats=data.teamCats
local class_sort=data.class_sort
local class_dic=data.class_dic
local UCI_Circuits=data.UCI_Circuits
local stages=data.stages
local bg_color_table = data.bg_color_table
local NationalRoadCyclingChampionships=data.NationalRoadCyclingChampionships
local NationalITTCyclingChampionships=data.NationalITTCyclingChampionships
local womenNcRoadtable=data.womenNcRoadtable
local womenNcITTtable=data.womenNcITTtable
local menNcRoadtable=data.menNcRoadtable
local menNcITTtable=data.menNcITTtable
local amateurcat=data.amateurcat
local nationalcat=data.nationalcat
local available, translations = pcall(require, "Module:Cycling race/lang")
local available_list = available and type(translations.list) == "function"
local available_lang_priority = available == true and type(translations.lang_priority) == "table"
local textalign = "left"
local floattable = "left"
Line 61 ⟶ 84:
local standardtablecss=data.standardtablecss_part1..textalign..data.standardtablecss_part2
local no_country_calendar={'ru','ar'}
local no_country_victories={'ru','ar
local no_country_classification={'es','da','no','ru','ar'}
local no_roll_startlist={'fr','da','no','ar','ru','de'}
local display_language_in_riderinfobox={'ru'}
Line 99 ⟶ 93:
local display_noweight_in_riderinfobox={'fr','pl'}
local display_noage_in_riderinfobox={'pl'}
local silver_theme_countries={'da
local backgroundColor="#FFDF80"
Line 119 ⟶ 111:
--== II) Translation ==
local function translate(func_name_short, index,
if index == nil then index=1 end -- for prologue
if index==1000 then --code for some custom function
return title
Line 125 ⟶ 118:
if func_name_short then
local func_name
if
func_name=func_name_short.."_women_translate"
if l10n[func_name] and l10n[func_name][index] then
Line 137 ⟶ 130:
return "translation for "..func_name.." index ".. tostring(index).." not found"
else
return "error
end
end
end
local plural=false --latin language
local gen_singular=false --for slavic language
Line 168 ⟶ 161:
end
local black_list=l10n.black_list
--[[ List of Wikipedia articles with the same lemma as the non existing rider article. Those lemmas are printed
Line 176 ⟶ 169:
end
local function stageLink(x, a, b) -- x= 10a: a = 10, b = a. x = 5: a = 5, b = ""
local l10nDef = {["fr"]="étape", ["en"]="stage", ["ar"]="المرحلة", ["br"]="Tennad", ["ca"]="etapa", ["cs"]="etapa", ["de"]="Etappe", ["da"]="etape", ["eo"]="Etapo",
["es"]="etapa", ["eu"]="Etapa", ["fi"]="Etappi", ["fo"]="teinur", ["hu"]="szakasz", ["it"]="Tappa", ["ja"]="ステージ", ["la"]="Statio", ["lb"]="Etapp",
["lv"]="Posms", ["mk"]="Етапа", ["nl"]="Etappe", ["no"]="etappe", ["pl"]="Etap", ["pt"]="Etapa", ["ro"]="Etapa", ["ru"]="Этап", ["sk"]="Etapa",
["sv"]="Etapp", ["ast"]="etapa" }
local word1, word2
word2=l10nDef[wiki]
if word2 == nil then word2=l10nDef["en"] end -- if no translation, show en translation
local word = word2
if wiki=="ar" then return word2 .. " " .. ( a or "" ) , "#" .. word2 .. " " .. ( a or "" ) end
Line 232 ⟶ 224:
-- plain, hilly, inter, ... must be "" or "any text"
-- l10nDef[""] = {plain = "", hilly="", inter='', mount='', time_prologue='', time_team='', time_indiv='', uphill='', rest=''}
local l10nDef = {
["ar"] = {plain = "مرحلة مستوية", hilly="مرحلة التلال", inter='مرحلة متوسطة', mount='مرحلة جبلية', time_prologue='مرحلة سباق زمني', time_team='مرحلة سباق الزمن للفرق', time_indiv='مرحلة سباق الزمن فردي', uphill='مرحلة تسلق الجبل زمني', rest='يوم راحة'},
["ast"] = {plain = "etapa llana", hilly="etapa escarpada", inter='etapa de mediu monte', mount='etapa de monte', time_prologue='prólogu', time_team='contrarreló per equipos', time_indiv='contrarreló individual', uphill='cronoescalada', rest='xornada de descansu'},
["fr"] = {plain = "étape de plaine", hilly="étape vallonnée", inter='étape de moyenne montagne', mount='étape de montagne', time_prologue='prologue', time_team='contre-la-montre par équipes', time_indiv='contre-la-montre individuel', uphill='contre-la-montre en côte', rest='étape de repos'},
["en"] = {plain = "plain stage", hilly="hilly stage", inter='intermediate stage', mount='mountain stage', time_prologue='time trial stage', time_team='team time trial stage', time_indiv='individual time trial stage', uphill='uphill time trial stage', rest='rest day'},
["br"] = {plain = "tennad plaen", hilly="tennad digompez", inter='tennad damveneziek', mount='tennad meneziek', time_prologue='prolog', time_team='ABEU a-skipailhoù', time_indiv='ABEU', uphill='', rest='devezh diskuizh'},
["ca"] = {plain = "etapa plana", hilly="etapa accidentada", inter='etapa de mitja muntanya', mount='etapa de muntanya', time_prologue='pròleg', time_team='contrarellotge per equips', time_indiv='contrarellotge individual', uphill='', rest='etapa de descans'},
["cs"] = {plain = "rovinatá etapa", hilly="", inter='kopcovitá etapa', mount='horská etapa', time_prologue='prolog', time_team='týmová časovka', time_indiv='individuální časovka', uphill='', rest=''},
["da"] = {plain = "flad etape", hilly="kuperet etape", inter='middel bjergetape', mount='bjergetape', time_prologue='prolog', time_team='holdtidskørsel', time_indiv='enkeltstart', uphill='bjergenkeltstart', rest='hviledag'},
["de"] = {plain = "Flachetappe", hilly="Hügelige Etappe", inter='Mittelschwere Etappe', mount='Hochgebirgsetappe', time_prologue='Prolog', time_team='Teamzeitfahren', time_indiv='Einzelzeitfahren', uphill='Bergzeitfahren', rest='Ruhetag'},
["eo"] = {plain = "ebena etapo", hilly="malebena etapo", inter='mezgranda montaro etapo', mount='montara etapo', time_prologue='prologo', time_team='teama kontraux-la-kronometro', time_indiv='individua kontraux-la-kronometro', uphill='malebena kontraux-la-kronometro', rest='ripoza etapo'},
["es"] = {plain = "etapa llana", hilly="etapa escarpada", inter='etapa de media montaña', mount='etapa de montaña', time_prologue='prólogo', time_team='contrarreloj por equipos', time_indiv='contrarreloj individual', uphill='cronoescalada', rest='jornada de descanso'},
["eu"] = {plain = "etapa laua", hilly="etapa gorabeheratsua", inter='bitarteko etapa', mount='mendiko etapa', time_prologue='aitzinetapa', time_team='taldekako erlojupekoa', time_indiv='banakako erlojupekoa', uphill='erlojupeko igoera', rest='atseden eguna'},
["fi"] = {plain = "Tasamaaetappi", hilly="Mäkietappi", inter='Keskivaikea vuorietappi', mount='Vuorietappi', time_prologue='', time_team='Joukkueaika-ajo', time_indiv='Henkilökohtainen aika-ajo', uphill='mäkiaika-ajo', rest='välipäivä'},
["fo"] = {plain = "Slætt", hilly="Slætt við brúgvasteinum", inter='Óslætt', mount='Fjallateinur', time_prologue='Forteinur', time_team='Liðsúkkling', time_indiv='Einkultstartur', uphill='', rest='Hvílidagur'},
["hu"] = {plain = "sík szakasz", hilly="dombos szakasz", inter='közepes hegyi szakasz', mount='hegyi szakasz', time_prologue='prolog', time_team='csapat időfutam', time_indiv='egyéni időfutam', uphill='hegyi időfutam', rest=''},
["ja"] = {plain = "平坦ステージ", hilly="丘陵ステージ", inter='中間ステージ', mount='山岳ステージ', time_prologue='タイムトライアルステージ', time_team='チームタイムトライアルステージ', time_indiv='個人タイムトライアルステージ', uphill='アップヒルタイムトライアルステージ', rest='休養日'},
["lb"] = {plain = "Flaach Etapp", hilly="Hiwweleg Etapp", inter='Mëttelschwéier Etapp', mount='Biergetapp', time_prologue='Prolog', time_team='Contre-la-montre (Ekipp)', time_indiv='Contre-la-montre (Eenzel)', uphill='Biergcourse', rest='Roudag'},
["lv"] = {plain = "līdzenuma posms", hilly="paugurains posms", inter='vidēju kalnu posms', mount='kalnu posms', time_prologue='individuālais brauciens', time_team='komandu brauciens', time_indiv='individuālais brauciens', uphill='individuālais brauciens kalnā', rest='atpūtas diena'},
["mk"] = {plain = "рамна етапа", hilly="ридеста етапа", inter='среднопланинска етапа', mount='планинска етапа', time_prologue='пролог', time_team='екипен хронометар', time_indiv='индивидуален хронометар', uphill='', rest='ден за одмор'},
["nl"] = {plain = "vlakke rit", hilly="heuvelrit", inter='heuvelrit', mount='bergrit', time_prologue='proloog', time_team='ploegentijdrit', time_indiv='individuele tijdrit', uphill='klimtijdrit', rest='rustdag'},
["no"] = {plain = "flat etappe", hilly="kupert etappe", inter='middels klatreetappe', mount='klatreetappe', time_prologue='prolog', time_team='lagtempo', time_indiv='temporitt', uphill='klatretempoetappe', rest='hviledag'},
["pl"] = {plain = "płaski", hilly="pagórkowaty", inter='górzysty', mount='górski', time_prologue='prolog', time_team='jazda drużynowa na czas', time_indiv='jazda indywidualna na czas', uphill='jazda indywidualna na czas pod górę', rest='dzień przerwy'},
["pt"] = {plain = "etapa plana", hilly="etapa escarpada", inter='média montanha', mount='alta montanha', time_prologue='prólogo', time_team='contrarrelógio por equipes', time_indiv='contrarrelógio individual', uphill='cronoescalada', rest='jornada de descanso'},
["ro"] = {plain = "etapă de plat", hilly="etapă valonată", inter='etapă intermediară', mount='etapă de munte', time_prologue='prolog', time_team='contratimp pe echipe', time_indiv='contratimp individual', uphill='', rest='zi de repaus'},
["ru"] = {plain = "равнинный", hilly="холмистый", inter='среднегорный', mount='горный', time_prologue='пролог', time_team='командная разделка', time_indiv='индивидуальная разделка', uphill='горная разделка', rest='день отдыха'},
["sv"] = {plain = "Flack etapp", hilly="", inter='Kuperat', mount='Bergsetapp', time_prologue='Prolog', time_team='Lagtempoetapp', time_indiv='Tempoetapp', uphill='', rest='Vilodag'},
}
local l10n = l10nDef[wiki]
if not l10n then l10n = l10nDef["en"] end -- default
local border
Line 249 ⟶ 270:
if x=='time trial stage' then
if noborder then border="" else border="|right" end
if typ=="Q2348250" then return "[[File:Team Time Trial Stage.svg"..border.."|20px|"..l10n.time_team.."]]" end
end
end
local function typeofstagelogo(stageID, noborder)
local sType
p = mw.wikibase.getBestStatements(stageID, 'P31') -- P31 is 'instance of'
for _,t in pairs(p) do
if t.mainsnak.snaktype == 'value' then
local iOf = t.mainsnak.datavalue.value.id
if iOf == "Q20646667" then sType = typeofstage('plain stage', nil, noborder) break end
if iOf == "Q20680270" then sType = typeofstage('intermediate stage', nil,noborder) break end
if iOf == "Q20646668" then sType = typeofstage('mountain stage',nil, noborder) break end
if iOf == "Q485321" then sType = typeofstage('time trial stage', "Q485321", noborder) break end -- prologue
if iOf == "Q2266066" then sType = typeofstage('time trial stage', "Q2266066", noborder) break end -- individual time trial
if iOf == "Q2348250" then sType = typeofstage('time trial stage', "Q2348250", noborder) break end -- team time trial
if iOf == "Q20679712" then sType = typeofstage('uphill time trial stage', nil, noborder) break end
end
end
Line 309 ⟶ 319:
local function getLabelFallback(itemID, fallback)
local label
for _, lang in ipairs(fallback) do
label = mw.wikibase.getLabelByLang(itemID, lang)
Line 328 ⟶ 335:
end
return nil
end
Line 431 ⟶ 418:
--[[ Get a Wikidata statement for an entity and property valid at the given timevalue ]]
local function checktime(s,q, time)
local start, startPrecision, END, endPrecision
if not q
return s
end
if q.P580 and q.P580[1] and q.P580[1].snaktype == 'value' then -- P580 is start time
start = q.P580[1].datavalue.value.time
startPrecision = q.P580[1].datavalue.value.precision
if startPrecision ==
start = string.sub(start, 1, 5) -- Cut of everything after year
elseif startPrecision == 10 then -- precision is months
Line 456 ⟶ 439:
return s
end
if endPrecision ==
END = string.sub(END, 1, 6) .. '13' -- Set month to 13
elseif endPrecision == 10 then -- precision 10 is 'months'
Line 490 ⟶ 473:
local starttime, endtime
local month_pl = {"stycznia", "lutego", "marca", "kwietnia", "maja", "czerwca", "lipca", "sierpnia",
"września", "października", "listopada", "grudnia"}
--local format = formats[wiki] or formats['']
if mode==nil then mode='long' end
Line 497 ⟶ 482:
if m=='00' then --manage the 30 November issue
if mode=='long'
starttime =lang:formatDate( "Y", sTime )
else
Line 504 ⟶ 489:
else
if y ~= y2 then
if mode=='long'
starttime = lang:formatDate( "j F Y", sTime )
else
Line 510 ⟶ 495:
end
elseif m ~= m2 then
if mode=='long'
starttime = lang:formatDate( "j F", sTime )
else
Line 572 ⟶ 557:
end
elseif wiki == "pl" then
if y ~= y2 then starttime = lang:formatDate( "j
elseif m ~= m2 then starttime = lang:formatDate( "j
else starttime = lang:formatDate( "j", sTime )
end
Line 580 ⟶ 565:
if m2=='00' then --manage the 30 November issue
if mode=='long'
endtime= lang:formatDate( "Y", eTime )
else
Line 586 ⟶ 571:
end
else
if
endtime = lang:formatDate("j F Y", eTime)
elseif y ~= y2 then --small
Line 596 ⟶ 581:
end
if wiki == "ar" then
if mode=='long'
elseif m ~= m2 then endtime = lang:formatDate( "d F Y", eTime )
else endtime = lang:formatDate( "d F Y", eTime )
Line 602 ⟶ 587:
elseif wiki == "br" then endtime = lang:formatDate( "j", eTime ) .." a viz ".. lang:formatDate( "F Y", eTime )
elseif wiki == "ca" or wiki == "es" or wiki == "ast" then
if mode=='long'
endtime = lang:formatDate( "j", eTime ) .." de "..
lang:formatDate( "F", eTime ) .." de ".. lang:formatDate( "Y", eTime )
Line 611 ⟶ 596:
elseif wiki == "cs" then endtime = lang:formatDate( "j. xg Y", eTime )
elseif wiki == "de" or wiki == "da" or wiki == "fi" or wiki == "fo" or wiki == "lb" or wiki == "no" then
if mode=='long'
endtime = lang:formatDate( "j. F Y", eTime )
else
Line 635 ⟶ 620:
else endtime = lang:formatDate( "j. F", eTime )
end
elseif wiki == "pl" then
endtime = lang:formatDate( "j ", eTime ) .. month_pl[tonumber(lang:formatDate( "n", eTime ))] ..
lang:formatDate( " Y", eTime )
end
end
Line 650 ⟶ 637:
local lang = contentLanguage
local month_pl = {"stycznia", "lutego", "marca", "kwietnia", "maja", "czerwca", "lipca", "sierpnia",
"września", "października", "listopada", "grudnia"}
--handle problems with lack of precision
local
local monthcorrect=true
if string.sub(date,
if string.sub(date,7,8)=='00' then monthcorrect=false end
return string.sub(date,2,5) --only year, note: contentLanguage:formatDate("Y", date) returns the wrong year
end
if daycorrect and monthcorrect then
if wiki=="pl" then-- overcome declination issue
return lang:formatDate( "j ", date ) .. month_pl[tonumber(lang:formatDate( "n", date ))] ..
lang:formatDate( " Y", date )
else
return contentLanguage:formatDate(format[mode], date)
end
else
if daycorrect or (monthcorrect==false and daycorrect==false) then --no month
if mode
return string.sub(date,2,5) --only year, note: contentLanguage:formatDate("Y", date) returns the wrong year
else --otherwise we don't know
end
else --month correct, but day incorrect
if mode=='onlyday' then
return '-'
else
local newdate=string.sub(date,1,9).."01"..string.sub(date,12)
if wiki=="pl" then
return month_pl[tonumber(lang:formatDate( "n", date ))] ..lang:formatDate( " Y", date )
else
return string.sub(contentLanguage:formatDate(format[mode], newdate), 3) --cut the day
end
end
end
end
end
Line 685 ⟶ 690:
end
local cancelled=""
local disqualified=false
Line 710 ⟶ 715:
local cyrillic = {mk = true, ru = true}
local strictLangBool= strictLang[wiki] or strict
local correcttime, best, name, nametemp
local wantedLanguages = {}
if available_lang_priority then
for i, lang in ipairs(translations.lang_priority) do --from Module:Cycling_race/lang
wantedLanguages[lang] = i
end
end
--case one, one official name / period overloaded with other languages as qualifier
--for instance https://www.wikidata.org/wiki/Q195833
for _, p1448 in statements(teamID, 'P1448') do
correcttime=true
Line 725 ⟶ 731:
end
if correcttime then
if available_lang_priority and p1448.qualifiers and p1448.qualifiers.P1448 then
local q = p1448.qualifiers.P1448
best = 999
Line 742 ⟶ 748:
lang=p1448.mainsnak.datavalue.value.language
best = 999
if available_lang_priority and wantedLanguages[lang] and wantedLanguages[lang] < best then
best = wantedLanguages[lang]
name = p1448.mainsnak.datavalue.value.text
elseif strictLangBool then
if wiki==lang then
name = p1448.mainsnak.datavalue.value.text
end
else
if cyrillic[lang]==nil then --don't display cyrillic for latin wiki
Line 758 ⟶ 765:
if name then
return name, true
elseif not strictLangBool
return nametemp, false
end
Line 780 ⟶ 787:
end
-- RiderID --> RiderLink
local function getRiderLink(riderID, startOfSeason) --startOfSeason optional
Linja 848:
if sitelink and officialname then --if there is an official name, then use it
return
else
if officialname then return officialname end
Linja 859:
local c = p27[1].mainsnak.datavalue.value.id
if c=="Q159" or c=="Q184" or c=="Q212" or c=="Q232" then -- Q159, Q184, Q212, Q232 is Russia, Belarus, Ukraine, Kazakhstan
return
end
end
Linja 865:
end
if wiki == 'ru' then
local label = revertfirstlast(mw.text.trim(string.gsub(sitelink, "%b()", "")
return
else
return
end
end
Linja 902:
link = make_IllWD2_link(riderID)
else
link = getLabelFallback(riderID, {'en', 'de', 'fr','es'})
if link then
link = string.gsub(link, "%b()", "")
Linja 911:
return link, correctlanguage
end
end
--[[ Get the name of a country ]]
local function getCountryName(countryID)
local name =
if
name = translations.list(countryID)
end
if name == '' then
local label, lang = wikibase.getLabelWithLang(countryID)
--[[ Uses standard language fallback. Should not return nil, nil, as all countries have English labels. ]]
Line 939 ⟶ 928:
end
end
return name
end
Line 957 ⟶ 946:
--[[ Get sitelink, categoryID and maybe country for a team.
Returns sitelink, team category ID, countryID (only countryID if country arg is true ]]
local function getTeamLinkCat(teamID, timeOfRace, country,
local name, sitelink,
local national_team_boolean=false
-- Find team category
--Hypothesis, it is a season, look in P2094
for _, p2094 in statements(teamID, 'P2094') do
if checktime(p2094, p2094.qualifiers, timeOfRace) then
if teamCats[natureID] then
break
end
end
end
-- Fallback with P31 (deprecated)
if checktime(p31, p31.qualifiers, timeOfRace) then
if teamCats[natureID] then
catID = natureID
break
end
Line 983 ⟶ 973:
end
--look by the parent, then P31 is used
if
parentID = getParentID(teamID)
if parentID then
local p31 = getStatementForTime(
if p31 then catID = p31.mainsnak.datavalue.value.id end
end
catID = catID or 'Q53534649'
end
-- Find country if needed
local countryID
if country or catID == 'Q23726798' or catID == 'Q20738667' or catID == 'Q54555994' then
local stm = getStatementForTime(teamID, 'P1532', timeOfRace) -- P1532 is country for sport
if stm == nil then
stm = getStatementForTime(teamID, 'P17', timeOfRace) -- P17 is country
end
if stm then countryID = stm.mainsnak.datavalue.value.id end
end
if countryID and
or catID == 'Q54660600' or catID == 'Q54555994' or catID == 'Q99658502') then
-- It is a national cycling team
national_team_boolean=true
if countryID=='Q145' then
name = getCountryName('Q23666')
Line 1.002 ⟶ 1.000:
name = getCountryName(countryID)
end
if catID == 'Q20738667' then -- national cycling team U23
local s
if wiki == 'fr' then s = ' espoirs'
elseif wiki == 'mk' then s = ' под 23 години'
elseif wiki == 'ar' then s = ' تحت 23'
elseif wiki == 'es' then s = ' sub-23'
else s = ' U23'
end
name = name .. s
elseif catID == 'Q54555994' then -- national cycling team U19
local s
if wiki == 'fr' then s = ' juniors'
elseif wiki == 'mk' then s = ' под 19 години'
elseif wiki == 'ar' then s = ' تحت 19'
elseif wiki == 'es' then s = ' sub-19'
else s = ' U19'
end
name = name .. s
elseif catID == 'Q99658502' then -- national cycling team "B"
local s
if wiki == 'fr' then s = ' "B"'
elseif wiki == 'mk' then s = ' "B"'
elseif wiki == 'ar' then s = ' "ب"'
elseif wiki == 'es' then s = ' "B"'
else s = ' "B"'
end
name = name .. s
end
sitelink = getRawTeamLink(teamID)
else
-- It is not a national cycling team
local isLocal
if season and
sitelink = wikibase.getSitelink(teamID)
name, isLocal = getOfficialName(teamID, timeOfRace,true)
if not sitelink
parentID = getParentID(teamID)
if parentID then sitelink = wikibase.getSitelink(parentID) end
end
else
parentID = getParentID(teamID)
if parentID then -- try parent team first
sitelink = wikibase.getSitelink(parentID)
Line 1.026 ⟶ 1.050:
end
if not name or (not isLocal and
local partName, partIsLocal = getOfficialName(teamID, timeOfRace)
if partName and (not name or partIsLocal) then
Line 1.053 ⟶ 1.077:
end
end
return sitelink, catID, countryID, national_team_boolean
end
Line 1.074 ⟶ 1.098:
end
local function getReference(
local function formatRefDate(date, precision)
if precision == 9 then -- Precision is year
Line 1.159 ⟶ 1.183:
refargs.name = refText
end
return
end
end
end
Line 1.242 ⟶ 1.248:
local function getPlaceLink(placeID,timeOfRace)
local sitelink = wikibase.getSitelink(placeID)
local name
if available_list then
name = translations.list(placeID) --return '' if nothing
end
if name==nil or name=='' then
name=getOfficialName(placeID, timeOfRace,nil,true) --name should be in the right language
end
Line 1.264 ⟶ 1.274:
-- ClassID --> ClassLink
-- some WPs use a unique article for this case
local function classLinkFn(
local link, label
if wiki~="fr" then --not used
Line 1.272 ⟶ 1.282:
end
if
if wiki=="fr" then
label="JO"
Line 1.279 ⟶ 1.289:
end
else
label = getLabelFallback(
end
Line 1.292 ⟶ 1.302:
end
if wiki == "ar" then-- right now Q22348500 has no link in "ar"
link = make_IllWD2_link(
end
return link
Line 1.298 ⟶ 1.308:
--[[ Get local content to a infoboxe from template args ]]
local function getLocalContent(contents, args)
for _, content in pairs(contents) do
local name = content.name
if not name then error('translation missing in Module:Cycling race/l10n of your wikipedia') end
local nameNoShy = string.gsub(name, '­', '') -- filter soft hyphen out
local nameNoShyLow, name_pluralNoShyLow
Line 1.342 ⟶ 1.353:
end
local function checkDis(q)
dis="road"
if q and q.P642 and q.P642[1] and q.P642[1].snaktype == 'value' then
onlyRoad=false
dis="mountainBike"
elseif
onlyRoad=false
dis="cycloCross"
elseif
onlyRoad=false
dis="track"
Line 1.372 ⟶ 1.376:
if q and q.P54 and q.P54[1].snaktype == 'value' then -- P54 is member of sports team
teamID = q.P54[1].datavalue.value.id
link, catID, countryID, national_team_boolean = getTeamLinkCat(teamID, timeOfRace)
else
for _, s in statements(riderID, 'P54') do
Line 1.381 ⟶ 1.385:
if dis=='road' then --by default
teamID = p54.mainsnak.datavalue.value.id
link, catID, countryID, national_team_boolean = getTeamLinkCat(teamID, timeOfRace)
end
end
Line 1.387 ⟶ 1.391:
end
end
return link, teamID, catID, countryID, national_team_boolean
end
Line 1.431 ⟶ 1.435:
local link=''
local Sitelink = wikibase.getSitelink(Qnumber) -- link to WParticle
local Label = getLabelFallback(Qnumber, {wikilang, 'en', 'fr', 'de'}) or ''
if Sitelink ~= nil then link = "[[" .. Sitelink .. "|" .. mw.text.trim(string.gsub(Sitelink, "%b()", "")..' ') .. "]]"
Line 1.447 ⟶ 1.451:
local function getCountryBool(no_country_list)
local country = true
for _, value in pairs(no_country_list) do -- get data if country should be printed in this wiki
end
return country
end
local function
local error_message = ''
if
if s.error_message == 1 then
error_message = func_error_message( 1)
error_message = mw.ustring.gsub(error_message, "<1>", s.property)
Line 1.464 ⟶ 1.467:
error_message = ' [[File:Exclam icon.svg|12px|'.. error_message .. ']]'
end
local table = mw.html.create('table')
:addClass('sortable')
:attr('cellpadding', '0')
Line 1.477 ⟶ 1.475:
:css('padding', '3px')
local title =translate(s.header_function,s.header_1, s.
if s.header_1 == 19 and wiki == "ar" then title = title .. " " .. s.year end
local wd_link = mw.html.create('span'):cssText('float:left; margin: 0 5px'):wikitext(wdLink(s.item..'#'..s.property))
if arwiki_totemplate then wd_link = wdLink(s.item..'#'..s.property) end
local caption =
:cssText('padding:2px; text-align:center; line-height: 1.8em;')
:css('background-color',backgroundColor)
Line 1.489 ⟶ 1.487:
local country=getCountryBool(s.no_country)
local header =
for i,k in ipairs(s.header_2) do
if i == s.country_column then
if available_list and country == true then
header:tag('th')
:cssText('text-align:center;padding:2px 20px 2px 2px;white-space:nowrap')
:wikitext(translate(s.header_function,k,s.
end
end
Line 1.501 ⟶ 1.499:
local column = header:tag('th')
:cssText('text-align:center;padding:2px 20px 2px 2px;white-space:nowrap')
:wikitext(translate(s.header_function,k,s.
if s.data_sort_type[i] == 'unsortable' then
column:addClass('unsortable')
Line 1.508 ⟶ 1.506:
end
return
end
local function tableB(s) --for startlist
local error_message =
if wiki == "ar" and s.item == "" or not s.item then return "" end
if s.error_message == 1 then
error_message = func_error_message( 1)
error_message = mw.ustring.gsub(error_message, "<1>", s.property)
error_message = mw.ustring.gsub(error_message, "<2>", mw.wikibase.label( s.item ))
error_message = mw.ustring.gsub(error_message, "<3>", s.item)
error_message = ' [[File:Exclam icon.svg|12px|'.. error_message .. ']]'
end
local roll = true
for _, value in pairs(s.no_roll_startlist) do -- get data if country should be printed in this wiki
Line 1.536 ⟶ 1.541:
local tSpan=tDiv:wikitext(tostring(wdlink_span))
tDiv:wikitext(translate("startlist",1
tDiv = rollTable1:tag('div'):addClass("NavContent"):cssText("margin:0; background:white; display:block; text-align:left;")
Line 1.558 ⟶ 1.563:
:attr('colspan','3'):attr('align','center')
tCell:node(wdlink_span)
tCell:wikitext(translate("startlist",1,s.
local tRow=tCell:tag('tr')
Line 1.572 ⟶ 1.577:
{'Flag of Japan (1870–1999).svg', '+1870-02-27', '+1999-08-12'}},
Q20 = {'NOR', {'Flag of Norway.svg', '+1821-07-13'}},
Q27 = {'IRL', {'Flag of Ireland.svg', '+
Q28 = {'HUN', {'Flag of Hungary.svg', '+1957-05-23'}},
Q29 = {'ESP', {'Flag of Spain.svg', '+1981-12-06'},
Line 1.583 ⟶ 1.586:
{'Flag of Spain (1785–1873, 1875–1931).svg', '+1874', '+1931-04-13'}},
Q30 = {'USA', {'Flag of the United States.svg', '+1960-07-04'}},
Q31 = {'BEL', {'Flag of Belgium (civil).svg'
Q32 = {'LUX', {'Flag of Luxembourg.svg'}},
Q33 = {'FIN', {'Flag of Finland.svg', '+1918-05-29'}},
Q34 = {'SWE', {'Flag of Sweden.svg'}},
Q35 = {'DEN', {'Flag of Denmark.svg'
Q36 = {'POL', {'Flag of Poland.svg'}},
Q37 = {'LTU', {'Flag of Lithuania.svg', '+2004-09-01'},
{'Flag of Lithuania (1988-2004).svg', '+1990-03-11', '+2004-09-01'}},
Q38 = {'ITA', {'Flag of Italy.svg', '+
{'Flag of Italy (1861–1946).svg', '+1861', '+1946-06-19'}},
Q39 = {'SUI', {'Flag of Switzerland.svg', '+
{'
Q40 = {'AUT', {'Flag of Austria.svg', '+1945-05-01'},
{'Flag of Austria.svg', '+1919-10-21', '+1938-03-13'}},
Line 1.607 ⟶ 1.603:
Q43 = {'TUR', {'Flag of Turkey.svg'}},
Q45 = {'POR', {'Flag of Portugal.svg', '+1911-06-30'}},
Q55 = {'NED', {'Flag of the Netherlands.svg', '+
Q77 = {'URU', {'Flag of Uruguay.svg'}},
Q96 = {'MEX', {'Flag of Mexico.svg', '+1968-09-16'},
Line 1.616 ⟶ 1.610:
Q115 = {'ETH', {'Flag of Ethiopia.svg', '+1996-10-31'}},
Q117 = {'GHA', {'Flag of Ghana.svg', '+1966-02-28'}},
Q148 = {'CHN', {"Flag of the People's Republic of China.svg", '+1985'}},
Q155 = {'BRA', {'Flag of Brazil.svg', '+1992-05-11'},
Line 1.662 ⟶ 1.651:
Q232 = {'KAZ', {'Flag of Kazakhstan.svg'}},
Q235 = {'MON', {'Flag of Monaco.svg'}},
Q238 = {'SMR', {'Flag of San Marino.svg'
Q241 = {'CUB', {'Flag of Cuba.svg'}},
Q244 = {'BAR', {'Flag of Barbados.svg'}},
Line 1.675 ⟶ 1.662:
Q334 = {'SGP', {'Flag of Singapore.svg'}},
Q347 = {'LIE', {'Flag of Liechtenstein.svg'}},
Q398 = {'BRN
Q403 = {'SRB', {'Flag of Serbia.svg', '+2004-08-18'},
{'Flag of Serbia (1992–2004).svg', '+1992-04-27', '+2004-08-17'}},
Q408 = {'AUS', {'Flag of Australia.svg'
Q414 = {'ARG', {'Flag of Argentina.svg'}},
Q419 = {'PER', {'Flag of Peru.svg', '+1950'},
Line 1.697 ⟶ 1.681:
Q750 = {'BOL', {'Flag of Bolivia.svg', '+1851-10-31'}},
Q754 = {'TTO', {'Flag of Trinidad and Tobago.svg'}},
Q774 = {'GUA', {'Flag of Guatemala.svg'}},
Q778 = {'BAH', {'Flag of the Bahamas.svg'}, '+1973-07-10'},
Line 1.718 ⟶ 1.701:
Q881 = {'VIE', {'Flag of Vietnam.svg', '+1976-02-07'}},
Q884 = {'KOR', {'Flag of South Korea.svg', '+1997-10'}},
Q916 = {'ANG', {'Flag of Angola.svg', '+1975-11-11'}},
Q921 = {'BRU', {'Flag of Brunei.svg', '+1959-09-29'}},
Q928 = {'PHI', {'Flag of the Philippines.svg', '+1998'}},
Line 1.767 ⟶ 1.730:
Q8646 = {'HKG', {'Flag of Hong Kong.svg'}},
Q25228 = {'AIA', {'Flag of Anguilla.svg'}},
Q29999 = {'NED', {'Flag of the Netherlands.svg', '+
Q33946 = {'TCH', {'Flag of the Czech Republic.svg', '+1920'}}, -- Czechoslovakia (1918–1992)
Q36704 = {'YUG', {'Flag of Yugoslavia (1992–2003).svg', '+1992-04-27', '+2003-02-04'}, --Yugoslavia
{'Flag of Yugoslavia (1943–1992).svg', '+1946', '+1992-04-27'}},
Q41304 = {'GER', {'Flag of Germany (3-2 aspect ratio).svg', '+1918-11-09'}}, -- Weimar Republic
Q83286 = {'YUG', {'Flag of Yugoslavia (1943–1992).svg'}}, --Socialist Federal Republic of Yugoslavia
Q172579 = {'ITA', {'Flag of Italy (1861–1946).svg'}}, --Kingdom of Italy (1861-1946)
Line 1.826 ⟶ 1.786:
end
elseif not date then
local p41 =
if p41[1] and p41[1].mainsnak.snaktype == 'value' then
result = '[[File:' .. p41[1].mainsnak.datavalue.value .. '|border|' .. flagpxSize ..'|(Wikidata:' .. countryID .. ')]]'
if arwiki_totemplate then
result = '{{flagicon image|' .. p41[1].mainsnak.datavalue.value .. '}}'
end
end
Line 1.840 ⟶ 1.800:
if arwiki_totemplate then
result = '{{flagicon image|' .. p41.mainsnak.datavalue.value .. '}}'
end
end
end
return result .. trackingCategory
Line 1.857 ⟶ 1.817:
--get link, assumed for a country the label is equal to the link, where not correct in the blacklist
--if the black list becomes too long, we could create a second list for the sitelinks
if available_list then
if
countryName = translations.list(countryID)
end
end
if countryName == nil or countryName=='' or blacklist[countryID] then
countryName = mw.wikibase.getSitelink(countryID)
end
Line 1.878 ⟶ 1.842:
-- 6. item of the Wikipedia article of that jersey
local data = {
{'Q33881', 'montagne', '+1975', '+2500', 'Q25265958', 'Q927157'}, -- Tour de France
{'Q33881', 'leader', '+1919', '+2500', 'Q24257871', 'Q738903'},
{'Q33881', 'points', '+1953', '+1967', 'Q24645209', 'Q175399'}, -- Jersey green.svg
{'Q33881', 'points', '+1968', '+1968', 'Q26919974', 'Q175399'}, -- Jersey red.svg
{'Q33881', 'points', '+1969', '+2500', 'Q24645209', 'Q175399'}, -- Jersey green.svg
{'Q33881', 'jeune', '+1975', '+2500', 'Q640430', 'Q2254180'}, -- Jersey white.svg
{'Q33881', 'winner_fighting', '+2003', '+2500', 'Q27644113', 'Q2094179'}, -- Jersey red number.svg
{'Q33881', 'winner_fighting2', '+2003', '+2500', 'Q27644113', 'Q2094179'}, -- Jersey red number.svg
{'Q33881', 'equipe', '+2006', '+2500', 'Q27644112', 'Q1436680'}, -- Jersey yellow number.svg
{'Q33861', 'leader', '+1931', '+2500', 'Q24257763', 'Q1164275'}, -- Giro d'Italia, Jersey pink.svg
{'Q33861', 'points', '+1967', '+1968', 'Q26919974', 'Q641083'}, -- Jersey red.svg
{'Q33861', 'points', '+1969', '+2009', 'Q26945272', 'Q641083'}, -- Jersey violet.svg
{'Q33861', 'points', '+2010', '+2016', 'Q26919974', 'Q641083'}, -- Jersey red.svg
{'Q33861', 'points', '+2017', '+2500', 'Q26945272', 'Q641083'}, -- Jersey violet.svg
{'Q33861', 'montagne', '+1974', '+2011', 'Q24645209', 'Q641060'}, -- Jersey green.svg
{'Q33861', 'montagne', '+2012', '+2500', 'Q24687409', 'Q641060'}, -- Jersey blue.svg
{'Q33861', 'jeune', '+1976', '+2500', 'Q640430', 'Q641662'}, -- Jersey white.svg
{'Q33937', 'leader', '+1935', '+1936', 'Q24258056', 'Q3278226'}, -- Vuelta a España, Jersey orange.svg
{'Q33937', 'leader', '+1941', '+1941', 'Q26696171', 'Q640430'}, -- Jersey white.svg
{'Q33937', 'leader', '+1942', '+1942', 'Q24258056', 'Q3278226'}, -- Jersey orange.svg
{'Q33937', 'leader', '+1945', '+1945', 'Q24257872', 'Q2534046'}, -- Jersey red.svg
{'Q33937', 'leader', '+1946', '+1950', 'Q26696171', 'Q640430'}, -- Jersey white.svg
{'Q33937', 'leader', '+1955', '+1976', 'Q24257871', 'Q738903'}, -- Jersey yellow.svg
{'Q33937', 'leader', '+1977', '+1977', 'Q24258056', 'Q3278226'}, -- Jersey orange.svg
{'Q33937', 'leader', '+1978', '+1998', 'Q24257871', 'Q738903'}, -- Jersey yellow.svg
{'Q33937', 'leader', '+1999', '+2009', 'Q24257991', 'Q27665179'}, -- Jersey gold.svg
{'Q33937', 'leader', '+2010', '+2500', 'Q24257872', 'Q2534046'}, -- Jersey red.svg
{'Q33937', 'points', '+1945', '+1986', 'Q24687409', 'Q2746711'}, -- Jersey blue.svg
{'Q33937', 'points', '+1987', '+1989', 'Q24645209', 'Q11638007'}, -- Jersey green.svg
{'Q33937', 'points', '+1990', '+2009', 'Q24687409', 'Q2746711'}, -- Jersey blue.svg
{'Q33937', 'points', '+2010', '+2500', 'Q24645209', 'Q11638007'}, -- Jersey green.svg
{'Q33937', 'montagne', '+1935', '+1985', 'Q27670182', 'Q11638007'}, -- Jersey green.svg
{'Q33937', 'montagne', '+1986', '+1986', 'Q27670174', 'Q3278226'}, -- Jersey orange.svg
{'Q33937', 'montagne', '+1987', '+1987', 'Q27670178', 'Q2534046'}, -- Jersey red.svg
{'Q33937', 'montagne', '+1988', '+1989', 'Q27670105', 'Q27670115'}, -- Jersey blackdots.png
{'Q33937', 'montagne', '+1990', '+2005', 'Q27670182', 'Q11638007'}, -- Jersey green.svg
{'Q33937', 'montagne', '+2006', '+2008', 'Q27670174', 'Q3278226'}, -- Jersey orange.svg
{'Q33937', 'montagne', '+2009', '+2009', 'Q27670126', 'Q27670163'}, -- Jersey granate.svg
{'Q33937', 'montagne', '+2010', '+2500', 'Q25265959', 'Q27670167'}, -- Jersey bluedots.svg
{'Q33937', 'jeune', '+2019', '+2500', 'Q640430', 'Q60233927'}, -- Jersey white.svg
{'Q2091354', 'leader', '+2011', '+2500', 'Q24257871'}, -- Tour of Norway, Jersey yellow.svg
{'Q2091354', 'sprints', '+2011', '+2011', 'Q26806427'}, -- Jersey green.svg
{'Q2091354', 'points', '+2012', '+2017', 'Q24645209'}, -- Jersey green.svg
{'Q2091354', 'points', '+2018', '+2018', 'Q28820618'}, -- MaillotCyan.PNG
{'Q2091354', 'points', '+2019', '+2500', 'Q47945989'}, -- Jersey dark blue.svg
{'Q2091354', 'montagne', '+2011', '+2015', 'Q25265958'}, -- Jersey polkadot.svg
{'Q2091354', 'montagne', '+2016', '+2017', 'Q27670174'}, -- Jersey orange.svg
{'Q2091354', 'montagne', '+2018', '+2500', 'Q25265958'}, -- Jersey polkadot.svg
{'Q2091354', 'jeune', '+2011', '+2500', 'Q640430'}, -- Jersey white.svg
{'Q2091354', 'winner_fighting', '+2017', '+2017', 'Q29957114'}, -- MaillotCyan.PNG
{'Q128713', 'leader', '+2013', '+2017', 'Q24257871'}, -- Tour des Fjords, Jersey yellow.svg
{'Q128713', 'leader', '+2018', '+2018', 'Q29594434'}, -- MaillotCyan.PNG
{'Q128713', 'points', '+2013', '+2014', 'Q24645209'}, -- Jersey green.svg
{'Q128713', 'points', '+2015', '+2017', 'Q24687409'}, -- Jersey blue.svg
{'Q128713', 'points', '+2018', '+2018', 'Q25265938'}, -- Jersey violet.svg
{'Q128713', 'montagne', '+2013', '+2018', 'Q25265958'}, -- Jersey polkadot.svg
{'Q128713', 'jeune', '+2013', '+2018', 'Q640430'}, -- Jersey white.svg
{'Q128713', 'winner_fighting', '+2015', '+2015', 'Q30035038'}, -- Jersey green.svg
{'Q128713', 'winner_fighting', '+2016', '+2017', 'Q30035039'}, -- Jersey orange.svg
{'Q128961', 'leader', '+2013', '+2500', 'Q24687408'}, -- Arctic Race of Norway, Jersey blue.svg
{'Q128961', 'points', '+2013', '+2500', 'Q24645209'}, -- Jersey green.svg
{'Q128961', 'montagne', '+2013', '+2014', 'Q27670178'}, -- Jersey red.svg
{'Q128961', 'montagne', '+2015', '+2500', 'Q27670174'}, -- Jersey orange.svg
{'Q128961', 'jeune', '+2013', '+2500', 'Q640430'}, -- Jersey white.svg
{'Q128961', 'winner_fighting', '+2014', '+2500', 'Q27644113'}, -- Jersey red number.svg
{'Q17619325', 'leader', '+2014', '+2014', 'Q24257871'}, -- Ladies Tour of Norway, Jersey yellow.svg
{'Q17619325', 'leader', '+2015', '+2016', 'Q26945272'}, -- Jersey violet.svg
{'Q17619325', 'leader', '+2017', '+2500', 'Q24257871'}, -- Jersey yellow.svg
{'Q17619325', 'points', '+2014', '+2500', 'Q24645209'}, -- Jersey green.svg
{'Q17619325', 'montagne', '+2014', '+2500', 'Q25265958'}, -- Jersey polkadot.svg
{'Q17619325', 'jeune', '+2014', '+2500', 'Q640430'}, -- Jersey white.svg
{'Q17619325', 'winner_fighting', '+2016', '+2500', 'Q30035039'}, -- Jersey orange.svg
}
--timeOfRace = '+1968-07-01T00:00:00Z'
timeOfRace = string.match(timeOfRace, "+%d%d%d%d") or ''
for _, v in pairs(item) do
for _, value in pairs(data
if v == value[1] then
if winner_classification == value[2] then
Line 1.947 ⟶ 1.988:
if p18[1] and p18[1].mainsnak.snaktype == 'value' then
jersey_string = jersey_string .. '[[File:' .. p18[1].mainsnak.datavalue.value .. '|20px'
jersey_name = getLabelFallback(v, {wikilang, 'en', 'fr'})
if jersey_name then
jersey_string = jersey_string .. '|' .. jersey_name
Line 1.959 ⟶ 2.000:
end -- function end
--=== E) Other (winner, getkm) ===
local function isHuman(riderId)
local isHuman = false
Line 1.974 ⟶ 2.015:
end
local function isCountry(
local isCountry = false
if
local p31 = wikibase.getBestStatements(
for _, iOf in pairs (p31) do
-- exception Hong-Kong and Taiwan
Line 1.989 ⟶ 2.030:
end
for _, p2094 in statements(raceID, 'P2094') do
if p2094.mainsnak.datavalue.value.id == "Q1451845" then
return true
end
end
return false
Line 2.025 ⟶ 2.054:
end
end
end
end
Line 2.061 ⟶ 2.083:
end
local function winner(
local p1346 = wikibase.getAllStatements(raceID, 'P1346') -- P1346 is 'winner'
for _, winner in pairs(p1346) do
Line 2.069 ⟶ 2.091:
if q then
local _, disqualified =isdisqualified(winner,q)
if
for _,
wOf =
if not wOf then
-- Try P1346 (winner) instead
Line 2.093 ⟶ 2.107:
if winners[wOf] then
if wID then
local reference = ref and getReference(
local _, countryID
if isHuman(wID) then
Line 2.124 ⟶ 2.138:
countryID = getNationality(wID, timeOfRace,q)
else
if p17 then
countryID = p17.mainsnak.datavalue.value.id
end
end
end
Line 2.166 ⟶ 2.183:
local function sortAndConcat(t_Body, resultTable)
table.sort(t_Body, function(a, b) return a[
for _, m in ipairs(t_Body) do resultTable:node(m[
return resultTable
end
--------- Definition sub-functions for calendar and victory ------
local function getTimeOfRace(raceID
local timeOfRace = firstValue(raceID, 'P580',
if timeOfRace==nil then
timeOfRace = firstValue(raceID, 'P585', 'time') -- P585 is 'point in time'
if timeOfRace==nil then
timeOfRace = firstValue(raceID, 'P582', 'time')
if timeOfRace==nil then
local link = getSitelinkFallback(raceID, {'en', 'fr', 'de'})
if link then
local year = string.match(link, '%d%d%d%d')
if year then
timeOfRace = year .. '-01-01T00:00:00Z'
end
end
end
end
end
if timeOfRace == nil and wiki == "ar" then
end
return timeOfRace, '> Wikidata is missing data about start time (P580) or point in time (P582)'
end
local function
local tempdate, timeOfRace, sortkey, sortkeyDate
local outTable={}
local sTime = firstValue(entityID, 'P580', 'time') -- P580 is 'start time'
local eTime = firstValue(entityID, 'P582', 'time') -- P582 is 'end time'
if sTime and eTime then
local startTime, endTime = getStartEndTime(sTime, eTime,
if functionName==nil
tempdate
sortkeyDate = sTime
else --victory, general classification
tempdate =endTime
sortkeyDate =eTime
end
timeOfRace = eTime
else
-- This function give a format to dates when P585 (date) is used in a single day race
local pTime = firstValue(entityID, 'P585', 'time') -- P585 is 'point in time'
if pTime then
timeOfRace = pTime
sortkeyDate = pTime
end
end
local _, _, y, m, d = string.find(sortkeyDate or "", "(%d+)-(%d+)-(%d+)")
if y~= nil and m~= nil and d~=nil then
sortkey = y..m..d
elseif y~= nil and m~= nil then
sortkey = y..m
elseif y~= nil then
sortkey = y
end
local tCell = mw.html.create('td'):attr('data-sort-value',sortkey)
:cssText("style=text-align:right;padding:0 0.5em")
:wikitext(tempdate)
outTable["timeOfRace"]=timeOfRace
outTable["tCell"]=tostring(tCell)
outTable["sortkey"]=sortkey
return outTable
end
local function fn_country(entityID, timeOfRace,
-- This function gives countries where the race take place
-- parentID taken from fn_race, optional
local country, countryname, outTable= {}, {}, {}
local countryID
local cssCell="text-align:" .. textalign .. ";padding:0 0.5em"
local tCell= mw.html.create('td'):cssText(cssCell)
local listOfProperty={'P1532','P17'} -- P1512 is 'country for sport' to handle problems with Hong Kong etc.
local listOfID = {entityID, parentID}
for _, thisID in ipairs(listOfID) do
if
for _, prop in ipairs(listOfProperty) do
if
for _, p1532 in statements(thisID, prop) do
countryID = p1532.mainsnak.datavalue.value.id
countryname[#countryname + 1] = getCountryName(countryID)
if countrybool==false or not countryname[#countryname] then
country[#country + 1]=flag(countryID, timeOfRace)
else
country[#country + 1]=flag(countryID, timeOfRace).." "..countryname[#countryname]
end
outTable["flag"]=flag(countryID, timeOfRace)
end
end
end
end
end
if countryID == nil then outTable["flag"]="no flag" end
if countryname[1] then tCell:attr('data-sort-value',countryname[1]) end
if countrybool==false then
tCell:wikitext((country[1] or '').." "..(raceCell or ''))
outTable["countryname"]=''
else
if
outTable["countryname"]=countryname[1]
if country[1] then tCell:wikitext(country[1]) end
else
outTable["countryname"]=''
end
end
outTable["tCell"]=tCell
return outTable
end
Line 2.368 ⟶ 2.395:
prefix=''; postfix='' --general classification
listOfProperty={'P2561','P1448'}
--system with P3450 and P2094
--else use P31
if instanceOf==nil then
for _, p31 in statements(entityID, 'P31') do
instanceOfTemp = p31.mainsnak.datavalue.value.id
if instanceOfTemp ~= "Q27020041" and class_dic[instanceOfTemp]==nil then --we don't want the class, but the main race
instanceOf=instanceOfTemp
end
end
end
--get information from the parent
if instanceOf then
Line 2.402 ⟶ 2.433:
if label==nil then
label=wikibase.label(instanceOf)
if wiki == 'ar' then arlabel = mw.wikibase.getLabelByLang(instanceOf, 'ar') end
if not label then
label = getLabelFallback(entityID,
end
end
Line 2.439 ⟶ 2.471:
--affect the label
if label==nil then
label=
if wiki == 'ar' then arlabel = mw.wikibase.getLabelByLang(entityID, 'ar') end
if not label then
label = getLabelFallback(entityID, {'en', 'fr', 'de'}) or ''
end
end
--look for link to the race if nothing
Line 2.486 ⟶ 2.522:
for _, p31 in statements(circuitID, 'P31') do --is it a UCI circuit?
parentCircuitID = p31.mainsnak.datavalue.value.id
if
displayedCircuitID=circuitID
end
Line 2.493 ⟶ 2.529:
else --for instance Flèche wallonne
if q then
if q.
displayedCircuitID =
end
end
Line 2.530 ⟶ 2.564:
end
local function getPeriodSub(sTime, eTime, brackets)
local startTime, endTime, y, m, y2, m2
Line 2.572 ⟶ 2.584:
end
end
local period
if sTime and eTime then
if startTime
period=startTime --only (1990)
else
period=startTime .. '-'..endTime
end
elseif sTime then
period=startTime .. '-'
elseif eTime then
period='-'..endTime
else
period=""
end
if brackets and period~="" then
period="("..period..")"
end
return period, sTime
end
-- for display period with only year, for instance (2020-2021)
local function getPeriod(q, brackets
local sTime, eTime = getStartEndfromQuali(q)
return getPeriodSub(sTime, eTime, brackets)
end
local function getClassCalendar_sub(entityID)
local classID=firstValue(entityID, 'P279', 'id')
if classID==nil then
for _, p31 in statements(entityID, 'P31') do
if class_dic[p31.mainsnak.datavalue.value.id]~=nil then
classID=p31.mainsnak.datavalue.value.id
break
end
end
end
return classID
end
Line 2.605 ⟶ 2.635:
local classID = p279.mainsnak.datavalue.value.id
if
circuitID=classToCircuit(classID, entityID, false, p279.qualifiers)
classLink=classLinkFn(classID,circuitID)
if circuitID
table.insert(classTable, {sTime, classStr, circuitID})
end
Line 2.622 ⟶ 2.652:
if not str then str='' else str=str..'<br>' end
str=str..class[2]
end
return str, circuitLink, #classTable
Line 2.631 ⟶ 2.659:
local function fn_race(entityID,displayed_class,display_class,timeOfRace, functionName,country)--return link to the race and class
--first function read from victory main
local Sitelink, entity_type, classID, stageID
local outTable={}
for _, p31 in statements(entityID, 'P31') do
if
entity_type = 'stage' --then the class is one stage above!
local parentID = getParentID(entityID)
classID=
outTable["parentID"] = parentID --as we read it here, no need to read it afterwards
stageID= entityID --everything slide from one rank
entityID = parentID
end
end
if classID==nil then
classID=getClassCalendar_sub(entityID)
end
--Now we have the class and know the type of race it is
Line 2.646 ⟶ 2.681:
Sitelink=getMainRaceLink(entityID,entity_type,stageID, functionName,timeOfRace)
else
Sitelink=getMainRaceLink(entityID,class_dic[classID],nil, functionName,timeOfRace)
end
if country~=false then
local tCell=mw.html.create('td'):cssText("text-align:".. textalign ..";padding:0 2.3em"):wikitext(Sitelink)
else
end
Line 2.661 ⟶ 2.695:
local classLink=classLinkFn(classID,circuitID) --return '' worst case
:attr('data-sort-value',
:cssText("text-align:center;padding:0 0.5em")
:wikitext(classLink)
outTable["classCell"]=tCell
end
return outTable
end
local function fn_rider(
local winners, countrytemp, result
local WDlink_on = (wiki == "mk" or wiki == "ja")
Line 2.682 ⟶ 2.718:
end
if country==nil then countrytemp=false else countrytemp=country end
winner(
local tCell=mw.html.create('td'):css("text-align:".. textalign ..";padding:0 0.5em")
Line 2.743 ⟶ 2.779:
local function calculateAge(birthDate, endDate) --test future
local eYear, eMonth, eDay
if birthDate then
if not endDate then
Line 2.778 ⟶ 2.813:
if alreadyThisYear then
return eYear-tYear, tYear, eYear+
else
return eYear-tYear-1, tYear, eYear+
end
else
return 0, tYear, eYear+
end
end
Line 2.824 ⟶ 2.859:
end
local function listOfWinners(itemID,t, team
local winners = { Q20882667 = '',}-- Q20882667 is 'overall winner general classification'
local winnersId={ Q20882667 = '',}--to detect disqualification
local WDlink_on, sitelink
-- WDlink_on is used to decide if a Wikidata flag will be shown
if wiki == "mk" or wiki == "ja" or wiki == "ru" then WDlink_on = true else WDlink_on = false end
Line 2.856 ⟶ 2.892:
winners.Q20882667=''
winnersId.Q20882667=''
winner(
if t.race[num]['future']==false then --in the past
if winnersId.Q20882667~="Q30108381
numberOfEditions=numberOfEditions+1
lastRunEdition=num
Line 2.867 ⟶ 2.903:
winnerId=winnersId.Q20882667
if winnerId~=nil and winnerId~='' and winnerId~='Q666' and winnerId~='Q30108381'
if not t.vainqueur[winnerId] then
t.vainqueur[winnerId]={}
Line 2.876 ⟶ 2.912:
end
end
else --for team
numberOfEditions=num
lastRunEdition=num
lastEditionDate=t.race[num]['raceDate']
end
local monthId=firstValue(itemID, 'P2922','id')
if monthId then
t.lastEditionMonth=getLabelFallback(monthId, {wikilang, 'en', 'fr', 'de'}) or ''
else
t.lastEditionMonth=contentLanguage:formatDate("M", lastEditionDate)
end
t.numberOfEditions=numberOfEditions
if not team then evaluateWinnerMax(t) end
Line 2.910 ⟶ 2.932:
if lastRunEdition then
t.lastWinner=lastWinner or '' --t.vainqueur[lastRunEdition]['link']
if sitelink ~= nil then
t.lastLink = "[[" .. sitelink .. "]]"
Line 2.920 ⟶ 2.941:
if nextEdition then
if sitelink ~= nil then
t.nextLink = "[[" .. sitelink .. "]]"
Line 2.930 ⟶ 2.950:
end
local p = wikibase.getBestStatements(itemID, 'P2257')
if p[1] and p[1].mainsnak.snaktype == 'value' then
Line 2.960 ⟶ 2.980:
end
local function getFormerNames(itemID, PID
local listOfNames={}
local langFallback, officialname,language
if wiki=="mk" then
langFallback= {wiki} --only exact language
else
langFallback= {wiki, 'en','fr', 'de', 'es', 'nl', 'it'} --all languages, but tested one at a time
end
local kk=1
while #listOfNames == 0 and kk<=#
lang=
kk=kk+1
for _, prop in ipairs({PID}) do
Line 2.973 ⟶ 2.999:
officialname = p1813.mainsnak.datavalue.value.text
if lang==language then --only exact language
local period, sTime=getPeriod(p1813.qualifiers
if not sTime then sTime="+1900-01-01T00:00:00Z" end --first
table.insert(listOfNames,{sTime, period, officialname, language})
Line 2.985 ⟶ 3.011:
local function officialSite(itemID)
local
if p856[1] and p856[1].mainsnak.snaktype == 'value' then
local url = p856[1].mainsnak.datavalue.value
return '['..url.." "..translate("raceinfobox",3)..']'
end
return nil
end
local function getKm(wiki)
local km
if wiki == "ar" then km = 'كم'
elseif wiki == "mk" then km = 'км'
elseif wiki == "ru" then km = 'км'
elseif wiki == "ja" then km = 'キロメートル'
else km = 'km' end
return km
end
local function getm(wiki)
local m
if wiki == "ar" then m = 'م'
elseif wiki == "mk" then m = 'м'
elseif wiki == "ru" then m = 'м'
elseif wiki == "ja" then m = ''
else m = 'm' end
return m
end
local function getKg(wiki)
local kg
if wiki == "ar" then kg = 'كجم'
elseif wiki == "mk" then kg = 'кг'
elseif wiki == "ru" then kg = 'кг'
elseif wiki == "ja" then kg = ''
else kg = 'kg' end
return kg
end
Line 3.004 ⟶ 3.061:
end
local function checkm(p
local m, unit
if p[1] and p[1].mainsnak.snaktype == 'value' then
m = tonumber(p[1].mainsnak.datavalue.value.amount)
unit = p[1].mainsnak.datavalue.value.unit
if unit == 'http://www.wikidata.org/entity/Q11573' then
elseif unit=='http://www.wikidata.org/entity/Q174728' then --cm
end
end
Line 3.047 ⟶ 3.087:
end
local function
local m
local text
local lang = contentLanguage
local p = mw.wikibase.getBestStatements(entityID, 'P2048')
m= checkm(p)
if m then
text = lang:formatNum(m)
if wiki == 'fo' then
text = string.gsub(text, "%.", ",")
end
text = text .. ' ' .. getm(wiki)
end
return text
end
local function getWeight(entityID)
local kg
local text
local lang = contentLanguage
local p = mw.wikibase.getBestStatements(entityID, 'P2067')
if kg then
text = lang:formatNum(kg)
if wiki == 'fo' then
text = string.gsub(text, "%.", ",")
end
text = text .. ' ' .. getKg(wiki)
end
return text
end
local function getDistance(raceID, addUnit)
local km
local p = mw.wikibase.getBestStatements(raceID, 'P3157') -- P3157 is 'event distance'
if not km then --for stage race we can sum the distances from each stage
local stagep, tempkm
for _, p527 in statements(raceID,'P527') do
stagep=mw.wikibase.getBestStatements(stageID, 'P3157')
tempkm=checkkm(stagep)
if tempkm then
if not km then
km=
else
km=km+tempkm
end
end
end
end
local text
local lang = contentLanguage
if km then
-- The unit should always be km. Skip if it isn't.
text = lang:formatNum(km)
if wiki == 'fo' then
text = string.gsub(text, "%.", ",")
end
if addUnit then
text = text .. ' ' .. getKm(wiki)
end
end
return text, km
end
local function getKmh(wiki)
local kmh
if wiki == "ar" then kmh = 'كم/س'
elseif wiki == "da" then kmh = 'km/t'
elseif wiki == "fo" then kmh = 'km/t'
elseif wiki == "nl" then kmh = 'km/u'
elseif wiki == "no" then kmh = 'km/t'
elseif wiki == "mk" then kmh = 'км/ч'
elseif wiki == "ru" then kmh = 'км/ч'
elseif wiki == "ja" then kmh = 'キロメートル毎時'
else kmh = 'km/h' end
return kmh
end
local function getElevation(raceID)
local l10nDef = {
["en"] = " m",
["ar"] = " م",
}
local l10n = l10nDef[wiki] or l10nDef["en"]
local temp = mw.wikibase.getBestStatements(raceID, 'P7297')
if temp[1] and temp[1].mainsnak.snaktype == 'value' then
local unit = temp[1].mainsnak.datavalue.value.unit
if unit == 'http://www.wikidata.org/entity/Q11573' then
return tonumber(temp[1].mainsnak.datavalue.value.amount) .. l10n
end
end
return nil
end
local function getSpeed(raceID, addUnit,kmdistance, property)
local p = mw.wikibase.getBestStatements(raceID, 'P2052') -- P2052 is 'speed'
local kmh
local lang = contentLanguage
if p[1] and p[1].mainsnak.snaktype == 'value' then
kmh = tonumber(p[1].mainsnak.datavalue.value.amount)
unit = p[1].mainsnak.datavalue.value.unit
if unit == 'http://www.wikidata.org/entity/Q180154' then -- Q180154 is 'kilometre per hour'
found=true
end
end
if not found and kmdistance then --calculate speed
local p2321= wikibase.getBestStatements(raceID, property) --winner supposed to be first of overall classification
if p2321 and p2321[1] and p2321[1].mainsnak.snaktype == 'value' then
Line 3.122 ⟶ 3.211:
if timeOfRace then
found=true
kmh=math.modf(1000*kmdistance/(timeOfRace/3600))/1000
end
end
end
if found then
-- The unit should always be km/h. Skip if it isn't.
text = lang:formatNum(kmh)
if wiki == 'fo' then
text = string.gsub(text, "%.", ",")
end
if addUnit then
text = text .. ' ' .. getKmh(wiki)
end
end
return text
end
local function getGenderCode(riderID, default)
local gender
local
if p21[1] and p21[1].mainsnak.snaktype == 'value' then
local g = p21[1].mainsnak.datavalue.value.id
elseif g == 'Q6581072' then gender = 'f' -- Female
elseif g == 'Q1052281' then gender = 't' -- Transgenre
end
end
return gender or default -- default is for teams, n or f
end
Line 3.196 ⟶ 3.299:
end
local l10nDef = {
["en"] = {'Property <1> is missing in item "<2>" (<3>)'},
["ar"] = {'الخاصية <1> غير موجودة في العنصر "<2>" (<3>)'},
Line 3.209 ⟶ 3.311:
local function getMissingLabelTrackingCategory()
local l10nDef = {
["//cs.wikipedia.org"] = '[[Kategorie:Údržba:Doplnit štítek na Wikidatech]]',
["//lv.wikipedia.org"] = '[[Category:Vikidatos trūkst nosaukuma latviešu valodā]]',
["//he.wikipedia.org"] = '[[קטגוריה:ויקינתונים:ערכים חסרי תווית בעברית: קבוצת אופניים]]',
}
local l10n = l10nDef[
if not l10n then
l10n = ''
Line 3.230 ⟶ 3.332:
end
if inp == "0" then
this_label = translate("func_prologue"
else
this_label = stageLink(inp, a, b)
Line 3.312 ⟶ 3.414:
--== Functions for infobox
-- functions for infoboxs
local function infoGetOthers(others, entityID)
if not others[1].content then --picture
Line 3.403 ⟶ 3.494:
if width==nil then width= '320px' end
local tab = mw.html.create('table
if wiki == "eo" then
tab:cssText(standardtablecss):css('width','23em')
:addClass('infobox')
else
cellpadding=tostring(cellpadding or 4)
Line 3.490 ⟶ 3.582:
local function wdDoc(tab, s, translation, ID)
local tCell=tab:tag('tr'):tag('td')
local tC
local commons_cat=firstValue(ID, 'P373', 'id')
Line 3.496 ⟶ 3.588:
commons_cat=string.gsub(commons_cat, '%s', '_')
local icon="[[File:Commons-logo.svg|12px|link=https://commons.wikimedia.org/wiki/Category:"..commons_cat.."]]"
tC=tCell:cssText('text-align:left; border-top:3px solid '..backgroundColor..'; font-size:
:wikitext(icon):tag('td')
else
tC=tCell:attr('colspan','2')
end
local wd_link = wdLink(ID)
local link = "[[" .. s .. "|" .. translation .. "]] "..wd_link
if wiki == "ar" then
link =
end
tC:cssText('text-align:right; border-top:3px solid '..backgroundColor..'; font-size:
:wikitext(link)
end
Line 3.531 ⟶ 3.623:
--Display in a chronological order fields in a table
local function listWPlinkChrono(details, index, entityID, listOfProperty, option, initialYear, display_flag, comma
local period, sTime, value, ID, temp
local list={}
Line 3.544 ⟶ 3.636:
ID=p.mainsnak.datavalue.value.id
if p.qualifiers then
period, sTime=getPeriod( p.qualifiers, true
end
if not sTime then sTime="+"..initialYear.."-01-01T00:00:00Z" end --first
Line 3.551 ⟶ 3.643:
value=wikibase.getLabelByLang(ID, wiki)
elseif option == 'country' then
if display_flag then
value= flag(ID, sTime).." "..
value=getCountryName(ID)
end
elseif option=='officialname' then
value=getOfficialName(ID, sTime,false) --official name is necessary because of continental team change in ProTeam
Line 3.601 ⟶ 3.694:
-- == Functions for team roster
local function getReason(riderReason, riderRef, p527,timeOfRace,riderEnd
local listofproperty={'P1642','P1643','P1534'}
local outTable={}
Line 3.621 ⟶ 3.714:
end
if riderReason then
local label = string.gsub(
riderRef = getReference(
riderReason = ', ' .. label
end
Line 3.634 ⟶ 3.727:
for _, q in qualifiers(v, 'P39') do
stagiaire = q.value.id
local label = string.gsub(
Sitelink = wikibase.getSitelink('Q2328847')
if Sitelink then
Line 3.706 ⟶ 3.799:
end
if not done then
names =
done = true
end
Line 3.734 ⟶ 3.827:
if wikiIsSlavic and correctlanguage then
local label = wikibase.getLabelByLang(riderID, wiki)
if not label then
label = getLabelFallback(riderID, {'en', 'fr', 'de', 'es'})
return findLastName(label,wiki)
else
local nametable = mw.text.split(label, ",")
if nametable[2] then --there is a coma so the lastname is first
Line 3.742 ⟶ 3.838:
end
end
else
local label = getLabelFallback(riderID, {'en', 'fr', 'de', 'es'})
return findLastName(label,wiki)
end
end
--== V) Main functions ==
--=== A) Function race reference ===
local function race_reference(raceID
-- Allow to display the reference below the classifications --
local bases={
Line 3.756 ⟶ 3.852:
{"Cycling Quotient", "P2648", "http://www.cqranking.com/men/asp/gen/race.asp?raceid="},
{"Cycling Archives", "P2330", "http://www.cyclingarchives.com/ritfiche.php?ritid="},
{"Cycling Quotient", "P2708", "http://www.cqranking.com/women/asp/gen/race.asp?raceid="}
}
local links = {}
Line 3.768 ⟶ 3.860:
if p[1] and p[1].mainsnak.snaktype == 'value' then
if base[2]=="P2648" and p[1].mainsnak.datavalue.value=="1" then --code for general reference of results
ref=getReference(
if ref then table.insert(links, ref) end
else
Line 3.787 ⟶ 3.879:
function p.calendarcustom(frame)
local headers={2} --date
if wiki == "ar" and string.match(frame:getParent():getTitle(), '%P+') == mw.site.namespaces.Template.name
then frame = frame:getParent() end
if frame.args[1] ~= nil then calendarID = string.gsub(frame.args[1], "%c", "") end
local display_numbering=false --default
local country_column=2
if istrue(
display_numbering=true
table.insert(headers, 3)
Line 3.798 ⟶ 3.894:
--no_country modify the way the country is displayed
local no_country={}
if istrue(
no_country={wiki}
end
Line 3.807 ⟶ 3.903:
local display_class=false
if istrue(
display_class=true
table.insert(headers, 6)
Line 3.814 ⟶ 3.910:
table.insert(headers, 7) --winner
local only_winner=1
if istrue(
only_winner =0
table.insert(headers, 8) --second
Line 3.821 ⟶ 3.917:
local display_leader=false
if istrue(
display_leader=true
table.insert(headers, 10)
end
local display_team =false
if istrue(
display_team =true
end
Line 3.835 ⟶ 3.931:
end
local
local s = {
header_function = "calendar", -- translations are in function Calendar
Line 3.848 ⟶ 3.944:
only_winner = only_winner,
display_numbering = display_numbering,
error_message = 0,
displayed_class =nil,
display_team=display_team,
display_class=display_class,
display_leader= display_leader,
womenrace_bool=womenrace_bool
}
return calendar_main(s, tableA(s))
Line 3.862 ⟶ 3.959:
----- based on WWTcalendar function -----
----- author: Mr. Ibrahem -----
local calendarID
local UCI = data.UCIYearToQ
Line 3.870 ⟶ 3.967:
local header_1_number = 12
local tempdic
local tempdic1 = {
header_2 = {2, 3,5, 4, 7, 8, 9, 10},
Line 3.889 ⟶ 3.986:
for key, v in pairs(UCI) do
if not calendarID and frame.args[key] then
local year = frame.args[key]
year = string.gsub(year , "%c", "")
if v[year] then
calendarID = v[year]
header_1_number = header_1_tab[key]
display_code = display_code_tab[key]
end
end
Line 3.911 ⟶ 4.007:
if display_code == 1 then
tempdic=tempdic1
else
tempdic=tempdic2
end
if istrue(
tempdic.display_numbering=true
elseif
tempdic.display_numbering=false
end
local
local s = {
header_function = "calendar", -- translations are in function Calendar
Line 3.936 ⟶ 4.028:
only_winner = tempdic.only_winner,
display_numbering = tempdic.display_numbering,
error_message = 0,
displayed_class = nil, --all
display_team=tempdic.display_team,
display_class=tempdic.display_class,
display_leader=tempdic.display_leader,
womenrace_bool=womenrace_bool
}
return calendar_main(s, tableA(s))
Line 3.947 ⟶ 4.040:
function calendar_main(s, resultTable)--Display the UCI women calendar of one year
localframe=s.frame
local calendarID=s.item
local fn_racetable,fn_datetable, fn_countrytable
local t_Body ={}
local
local temp=firstValue(calendarID, s.property)
if not temp
local country=getCountryBool(s.no_country)
if available_list==false then country=false end --otherwise the display put no "country" column...
----- Begin of the main part of the code
Line 3.963 ⟶ 4.056:
local RaceID = p527.mainsnak.datavalue.value.id
---- Create a row ----
if
fn_countrytable=fn_country(RaceID,
fn_datetable["timeOfRace"],
country,
fn_racetable["raceCell"],
fn_racetable["parentID"]
)
local tRow = mw.html.create('tr'):cssText( "line-height: 1.8em; padding: 5px;")
tRow:node(fn_datetable["tCell"])
if s.display_numbering == true then
tRow:tag('td'):cssText("text-align:center;padding:0 0.5em"):wikitext(tostring(kk))
end
if
tRow:node(fn_racetable["raceCell"])
end
if fn_racetable["classCell"] then tRow:node(fn_racetable["classCell"]) end --class
local tCell, _ =fn_rider(RaceID,fn_datetable["timeOfRace"],s.display_team,s.only_winner)
tRow:node(tCell)
if s.display_leader==true then
end
---- Add the row to the table
end
end
return sortAndConcat(t_Body, resultTable)
end
Line 3.992 ⟶ 4.094:
function p.nationalchampionships(frame)
local calendarroadID, calendarITTID, year
if wiki == "ar" then
frame = frame:getParent()
end
local listOfCalendar={NationalRoadCyclingChampionships,NationalITTCyclingChampionships}
for ii, thisCalendar in pairs(listOfCalendar) do --road/ITT
for key, v in pairs(thisCalendar) do --look for the key of the dictionnary, here women/men
if ((ii==1 and calendarroadID==nil) or (ii==2 and calendarITTID ==nil)) and frame.args[key] then
year = frame.args[key]
year = string.gsub( year , "%c", "")
if v[year] then
if ii==1 then
Line 4.010 ⟶ 4.115:
end
local
local s = {
header_function = "calendar", -- translations are in function Calendar
Line 4.023 ⟶ 4.128:
year = year,
no_country = {}, --no sense here to hide the country
error_message = 0,
display_team = true,
display_countrylink =
womenrace_bool=womenrace_bool
}
return nationalchampionships_main(s,tableA(s))
Line 4.032 ⟶ 4.138:
function nationalchampionships_main(s, resultTable)--Display the list of national champions for one year
localframe=s.frame
local tableChamp, fn_countrytable, t_Body = {}, {}, {}
local timeOfRace ='+'..tostring(s.year).."-01-01T00:00:00Z"
local
local temp=firstValue(s.calendarroadID, s.property)
if
local listOfCalendarID={s.calendarroadID, s.calendarITTID}
Line 4.051 ⟶ 4.153:
for _, p527 in statements(thisCalendarID, 'P527') do
thisID = p527.mainsnak.datavalue.value.id
sortkey=string.gsub(fn_countrytable["countryname"], 'É', 'E') --case États Unis
--create the table
if tableChamp[sortkey]==nil then
tableChamp[sortkey]={}
tableChamp[sortkey]['countryname']=
tableChamp[sortkey]['roadwinner']='<td></td>'
tableChamp[sortkey]['ITTwinner']='<td></td>'
Line 4.070 ⟶ 4.172:
end
tableChamp[sortkey]['sitelink']=sitelink
tableChamp[sortkey]['flag']=
end
--fill the table
if tableChamp[sortkey]['thereisawinner']~=true then --all other cases
tableChamp[sortkey]['thereisawinner']=thereisawinner
Line 4.080 ⟶ 4.182:
if ii==1 then
tableChamp[sortkey]['roadwinner']=
else
tableChamp[sortkey]['ITTwinner']=
end
end
Line 4.099 ⟶ 4.201:
tRow:node(thisRow['roadwinner'])
tRow:node(thisRow['ITTwinner'])
end --no winner
end --end list of key
Line 4.108 ⟶ 4.210:
--=== C) Victory ===
function p.victories(frame)
local
local
local s = {
Line 4.119 ⟶ 4.221:
country_column = 3,
data_sort_type = {'', 'unsortable', '', '', ''}, -- see https://meta.wikimedia.org/wiki/Help:Sorting
item =
property = 'P2522',
no_country = no_country_victories,
error_message = 0,
frame=frame,
womenrace_bool=womenrace_bool
}
return victory_main(s ,tableA(s))
Line 4.129 ⟶ 4.232:
function victory_main(s, resultTable)
localframe=s.frame
local _
_, _, s.item = string.find(s.item, "(%w+)")
local temp=firstValue(s.item, s.property,'id')
if
local country=getCountryBool(s.no_country)
if available_list==false then country=false end
local sortkey
local t_Body = {}
Line 4.146 ⟶ 4.249:
local tRow = mw.html.create('tr'):cssText( "line-height: 1.8em; padding: 5px;")
if
fn_datetable["timeOfRace"],
country,
fn_racetable["raceCell"],
fn_racetable["parentID"]
)
tRow:node(fn_datetable["tCell"])
if country==true then
tRow:node(
end
tRow:node(
tRow:node(
t_Body[#t_Body + 1] = {fn_datetable["sortkey"], tRow}
end --no winner
end --end list of key
Line 4.169 ⟶ 4.276:
--== D) Stage infobox
function p.stageinfobox(frame)
local
if type(entityID) ~= 'string' then error('parameter must be a string') end
if not entityID:match('Q%d+') then error('parameter must be a valid Wikidata item (ex: Q42)') end
local womenrace_bool=isWomenrace(entityID)
local details = {
{ name = translate("stageinfobox",2,
{ name = translate("stageinfobox",2,
{ name = translate("stageinfobox",3,
{ name = translate("stageinfobox",4,
{ name = translate("stageinfobox",6,
{ name = translate("stageinfobox",7,
{ name = translate("stageinfobox",9,
{ name = translate("stageinfobox",10,
{ name = translate("stageinfobox",11,
{ name = translate("stageinfobox",12,
{ name = translate("stageinfobox",13,
{ name = translate("stageinfobox",44,
{ name = translate("infobox",32,
{ name = translate("infobox",33,
}
local others = {
{ name = translate("infobox",29,womenrace_bool)}, -- picture
{ name = translate("infobox",30,womenrace_bool)}, -- caption
{ name = translate("infobox",31,womenrace_bool)}, -- map
{ name = 'sectional'}, -- sectional
{ name = translate("infobox",30,womenrace_bool)}, -- caption map
{ name = translate("infobox",30,womenrace_bool)}, -- caption sectional
}
--begin of the function
local
Q20882747={'results', 'first'},
Q20882748={'results', 'second'},
Line 4.229 ⟶ 4.346:
}
local localframe
if string.match(frame:getParent():getTitle(), '%P+') == mw.site.namespaces.Template.name then
localframe = frame:getParent()
else
localframe = frame
end
getLocalContent(details, localframe.args)
getLocalContent(others, localframe.args)
local timeOfRace
local temp = firstValue(
icon = ''
if temp and temp ~= 'Q18131152' then
Line 4.241 ⟶ 4.365:
icon = " [[File:Cycling (road) pictogram.svg|35px]]"
end
details[3].content = typeofstagelogo(
end
local name = getLabelFallback(
if wiki == 'fr' and name ~= nil then
name= mw.ustring.gsub(name, "^(%d+)([re]+)", "%1<sup>%2</sup> ")
Line 4.250 ⟶ 4.374:
name= mw.ustring.gsub(name, "^(%a)",function (x) return mw.ustring.upper(x) end)
infoGetOthers(others,
--name
if course==nil then
temp = firstValue(
if temp then
details[2].content =getStageLabel(temp)
raceId = firstValue(entityID, 'P361','id')
if raceId then
details[2].content = (details[2].content or '') .. '، '.. WPlinkpure(raceId)
for k, p31 in statements(raceId, 'P31') do
if race==nil then race={} end
race[k] = p31.mainsnak.datavalue.value.id --for the jersey
end
Line 4.270 ⟶ 4.393:
-- This function give a format to dates when P585 (date) is used in a single day race
local pTime = firstValue(
if pTime then
details[4].content = funcDate(pTime, 'long')
Line 4.277 ⟶ 4.400:
local kmdistance
if not details[5].content then details[5].content, kmdistance = getDistance(
infoGetCountry(details,6,
infoGetStartEnd(details,7,
infoGetParticipants(details,9,
if not details[11].content then details[11].content = getSpeed(
if not details[12].content then
local elevation=getElevation(
if elevation ~= nil then details[12].content =elevation else details[12].content = nil end
end --Elevation
Line 4.329 ⟶ 4.452:
--Winner
for _, p1346 in statements(
local id_speed, id_time, id_time_gap, id_points_a, id_points_b, type_ofclas, name_ofclas
local q = p1346.qualifiers
Line 4.343 ⟶ 4.466:
local riderLink,riderTeam = subwinner(riderId, timeOfRace, q) --sub function to avoid code in double
-- looks into race item if the winner has a P642 statement for showing the type of winner(points, mountain, ..)
if q.P642 and q.P642[1].snaktype == 'value' then
for _, vv in pairs(q.P642) do
local qual = vv.datavalue.value.id
if qual~=nil and deprecated~='deprecated' and
if qual=="Q21686770" and t_s['results']['winner_fighting'][1] ~= "" then
end
type_ofclas=
name_ofclas=
local v=t_s[type_ofclas][name_ofclas]
Line 4.382 ⟶ 4.498:
end
local rank, deprecated, prop, order, thisorder
local listoftable = {'results','gen'}
-- look into P2417, stage classification, then p2321 gen classification
for ii, thistable in ipairs(
if ii==1 then
prop='P2417'
Line 4.393 ⟶ 4.510:
end
for _, p2417 in statements(
local q = p2417.qualifiers
if q.P1352 and q.P1352[1].snaktype == 'value' then
Line 4.419 ⟶ 4.536:
end
for _, thistable in ipairs(listoftable) do
for _, v in ipairs(thistable.order) do --order is the list of all classification names
if thistable[v]['link'] then
Line 4.432 ⟶ 4.551:
if t_s.annex.show == true and (wiki == 'no' or wiki == '..') then width= '340px' end
tab= infoInitTab(width, name, icon)
infoFillOthersDetails(tab, others, details,translate("stageinfobox",1,
-- ranking table, general and stage
Line 4.442 ⟶ 4.561:
tTab=tCell:tag('table'):attr('cellpadding','0'):attr('cellspacing','0'):css('width','100%')
tCell=tTab:tag('tr'):tag('td'):attr('colspan','3')
:cssText('border-bottom:5px solid
:css('font-weight','bold')
:wikitext(translate("stageinfobox",thistable.header,
for key, value in ipairs(thistable.order) do --value is the name of the class
Line 4.457 ⟶ 4.576:
else
local lang = mw.language.getContentLanguage()
v['speed'] = '('.. lang:formatNum(v['speed'])..translate("unit",5,
end
end
if v['points'] then
if v['points'] > 1 then
temp=translate("unit",7,
else
temp=translate("unit",6,
end
v['points'] = v['points']..temp
end
local title, k = string.gsub(translate("stageinfobox",v['translation'],
if k > 0 then title = string.gsub(title, " ", "<br>", 1) end -- 
Line 4.478 ⟶ 4.597:
tCell:attr('rowspan','2')
end
tCell:cssText("width:1%;background-color:
textalign .. ";padding:0 2px 0 2px;white-space:nowrap")
Line 4.484 ⟶ 4.603:
if v['jersey'] == nil then
if (value_order=='results') and (value=='winner_fighting' or value=='winner_fighting2' or value=='cima_coppi' or value=='cima_pantanii') then
tCell:wikitext(translate("stageinfobox",v['translation'],
else
tCell:wikitext(number(v['genre'], key, wiki))
end
else
else
temp="|link="..jerseyWPID
end
Line 4.547 ⟶ 4.667:
infoFillOthersMap(tab, others)
tab:node(getPreviousNextLine(
wdDoc(tab, "d:Wikidata:WikiProject Cycling/Documentation/stageinfobox", translate("stageinfobox",39,
return tab
end
Line 4.554 ⟶ 4.674:
--== E) List of teams
function p.listofteams(frame)
local raceID
local teams = {} -- values will be {teamLink, teamCat, sortkey, index}
local WDlink_on = (wiki == "mk" or wiki == "ja")
local timeOfRace, errorMessage = getTimeOfRace(raceID
if not timeOfRace then return errorMessage end
local womenrace_bool=isWomenrace(raceID)
local teamCats = { -- {c,d,e} c = singular team type, d = plural team type, e = print order of the team types
["Q6154783"]
["
["
["
["
["
["
["
["
["Q20653566"] = {24,25,10}, -- Groupe Sportif III
["
["
["
["
["
["Q28492441"] = {12,13,16}, -- national cycling team with sponsor name
["
["
["
["
}
Line 4.614 ⟶ 4.711:
if v.mainsnak.snaktype == 'value' then
no = no + 1
local teamLink, teamCat, countryID = getTeamLinkCat(v.mainsnak.datavalue.value.id, timeOfRace, true, true)
local flagImage = countryID and flag(countryID, timeOfRace) or ''
teams[#teams + 1] = {flagImage .. ' ' .. teamLink, teamCat,
end
end
table.sort(teams, function(a,b)
if a[3] < b[3] then return true end -- First sort key: Order from table
if a[3] > b[3] then return false end
return a[4] < b[4] -- Second key is the index to ensure stable sorting
Line 4.629 ⟶ 4.726:
local function getHeader(CatID, count)
local header, sitelink
if
local done=false
if CatID=="Q2466826" then --name changed after 2020
Line 4.635 ⟶ 4.732:
if year and year>2019 then
if count == 1 then
header_label = translate("headoftableIII",32,
else
header_label = translate("headoftableIII",33,
end
done=true
Line 4.645 ⟶ 4.742:
if done==false then
if count == 1 then
header_label = translate("headoftableIII",
else
header_label = translate("headoftableIII",
end
end
Line 4.666 ⟶ 4.763:
if not header then
-- Unknown team category. Get the label for the entity to display if possible
header = (CatID and getLabelFallback(CatID, {wikilang, 'en', 'fr', 'de'})) or 'Unknown team category'
tHeader:css('text-transform','capitalize')
end
Line 4.728 ⟶ 4.825:
--== F) Classifications
function p.UCIclassification(frame)
local s = {
header_function = "headoftableII", -- translations are in function headoftableII
header_1 = 19, -- translation 10 in function headoftableII is printed in the upper part of the table header
header_2 = {1, 2, 7}, -- translations 1, 2, 3, 7 in function headoftableII are printed in this order in the lower part of the table header
item = string.gsub(frame.args[1] or frame:getParent().args[1], "%c", ""),
property = 'P3494', -- property to use for this table
team_classification = false, -- it is not a team classification table, its a rider classification table
background = 'color', -- there is a background color for the first row
display_team=false,
max_rank_displayed=
}
return new_classification(
end
function p.pointsclassification(frame)
local s = {
header_function = "headoftableII", -- translations are in function headoftableII
header_1 = 10, -- translation 10 in function headoftableII is printed in the upper part of the table header
header_2 = {1, 2, 3, 7}, -- translations 1, 2, 3, 7 in function headoftableII are printed in this order in the lower part of the table header
item = string.gsub(frame.args[1] or frame:getParent().args[1], "%c", ""),
property = 'P3494', -- property to use for this table
team_classification = false, -- it is not a team classification table, its a rider classification table
background = 'color', -- there is a background color for the first row
max_rank_displayed=10
}
return new_classification(
end
function p.teamsclassificationbytime(frame)
local s = {
header_function = "headoftableII", -- translations are in function headoftableII
header_1 = 14, -- translation 10 in function headoftableII is printed in the upper part of the table header
header_2 = {3, 2, 4}, -- translations 3, 2, 4 in function headoftableII are printed in this order in the lower part of the table header
item =
property = 'P3497', -- property to use for this table
team_classification = true, -- it is a team classification table, its not a rider classification table
background = 'strong', -- there is no background color for the first row, but the first row is formated strong
max_rank_displayed=10
}
return new_classification(
end
function p.teamsclassificationbypoints(frame)
local s = {
header_function = "headoftableII", -- translations are in function headoftableII
header_1 = 15, -- translation 10 in function headoftableII is printed in the upper part of the table header
header_2 = {3, 2, 7}, -- translations 3, 2, 7 in function headoftableII are printed in this order in the lower part of the table header
item =
property = 'P3496', -- property to use for this table
team_classification = true, -- it is a team classification table, its not a rider classification table
background = 'strong', -- there is no background color for the first row, but the first row is formated strong
max_rank_displayed=10
}
return new_classification(
end
function p.stageclassification(frame)
local s = {
header_function = "headoftableII", -- translations are in function headoftableII
header_1 = 8, -- translation 10 in function headoftableII is printed in the upper part of the table header
header_2 = {1, 2, 3, 4}, -- translations 1, 2, 3, 4 in function headoftableII are printed in this order in the lower part of the table header
item =
property = 'P2417', -- property to use for this table
team_classification = false, -- it is not a team classification table, its a rider classification table
background = false, -- there is no background color for the first row
display_ref =
max_rank_displayed=10
}
return new_classification(
end
function p.generalclassification(frame)
local s = {
header_function = "headoftableII", -- translations are in function headoftableII
header_1 = 9, -- translation 10 in function headoftableII is printed in the upper part of the table header
header_2 = {1, 2, 3, 4}, -- translations 1, 2, 3, 4 in function headoftableII are printed in this order in the lower part of the table header
item =
property = 'P2321', -- property to use for this table
team_classification = false, -- it is not a team classification table, its a rider classification table
background = 'color', -- there is a background color for the first row
display_ref =
max_rank_displayed=25,
}
return new_classification(
end
function p.generalclassificationpoint(frame)
local s = {
header_function = "headoftableII", -- translations are in function headoftableII
header_1 = 9, -- translation 10 in function headoftableII is printed in the upper part of the table header
header_2 = {1, 2, 3, 7}, -- translations 1, 2, 3, 7 in function headoftableII are printed in this order in the lower part of the table header
item =
property = 'P2321', -- property to use for this table
team_classification = false, -- it is not a team classification table, its a rider classification table
background = 'color', -- there is a background color for the first row
display_ref =
max_rank_displayed=25
}
return new_classification(
end
function p.generalclassificationforttt(frame)
local s = {
header_function = "headoftableII", -- translations are in function headoftableII
header_1 = 9, -- translation 10 in function headoftableII is printed in the upper part of the table header
header_2 = {3, 2, 4, 5, 6}, -- translations 3, 2, 4, 5, 6 in function headoftableII are printed in this order in the lower part of the table header
item =
property = 'P2321', -- property to use for this table
team_classification = true, -- it is a team classification table, its not a rider classification table
background = false, -- there is no background color for the first row
display_ref =
max_rank_displayed=
}
return new_classification(
end
function p.teamtimetrialclassification(frame)
local s = {
header_function = "headoftableII", -- translations are in function headoftableII
header_1 = 8, -- translation 10 in function headoftableII is printed in the upper part of the table header
header_2 = {3, 2, 4, 5, 6}, -- translations 3, 2, 4, 5, 6 in function headoftableII are printed in this order in the lower part of the table header
item =
property = 'P2417', -- property to use for this table
team_classification = true, -- it is a team classification table, its not a rider classification table
background = false, -- there is no background color for the first row
display_ref =
max_rank_displayed=25
}
return new_classification(
end
function p.mountainsclassification(frame)
local s = {
header_function = "headoftableII", -- translations are in function headoftableII
header_1 = 11, -- translation 10 in function headoftableII is printed in the upper part of the table header
header_2 = {1, 2, 3, 7}, -- translations 1, 2, 3, 7 in function headoftableII are printed in this order in the lower part of the table header
item = string.gsub(frame.args[1] or frame:getParent().args[1], "%c", ""),
property = 'P4320', -- property to use for this table
team_classification = false, -- it is not a team classification table, its a rider classification table
background = 'color', -- there is a background color for the first row
max_rank_displayed=10
}
return new_classification(
end
function p.sprintsclassification(frame)
local s = {
header_function = "headoftableII", -- translations are in function headoftableII
header_1 = 12, -- translation 10 in function headoftableII is printed in the upper part of the table header
header_2 = {1, 2, 3, 7}, -- translations 1, 2, 3, 7 in function headoftableII are printed in this order in the lower part of the table header
item = string.gsub(frame.args[1] or frame:getParent().args[1], "%c", ""),
property = 'P4322', -- property to use for this table
team_classification = false, -- it is not a team classification table, its a rider classification table
background = 'color', -- there is a background color for the first row
max_rank_displayed=10
}
return new_classification(
end
function p.bestyoungclassificationbypoints(frame)
local s = {
header_function = "headoftableII", -- translations are in function headoftableII
header_1 = 13, -- translation 10 in function headoftableII is printed in the upper part of the table header
header_2 = {1, 2, 3, 7}, -- translations 1, 2, 3, 7 in function headoftableII are printed in this order in the lower part of the table header
item = string.gsub(frame.args[1] or frame:getParent().args[1], "%c", ""),
property = 'P4323', -- property to use for this table
team_classification = false, -- it is not a team classification table, its a rider classification table
background = 'color', -- there is a background color for the first row
max_rank_displayed=10
}
return new_classification(
end
function p.bestyoungclassification(frame)
local s = {
header_function = "headoftableII", -- translations are in function headoftableII
header_1 = 13, -- translation 10 in function headoftableII is printed in the upper part of the table header
header_2 = {1, 2, 3, 4}, -- translations 1, 2, 3, 7 in function headoftableII are printed in this order in the lower part of the table header
item = string.gsub(frame.args[1] or frame:getParent().args[1], "%c", ""),
property = 'P4323', -- property to use for this table
team_classification = false, -- it is not a team classification table, its a rider classification table
background = 'color', -- there is a background color for the first row
max_rank_displayed=10
}
return new_classification(
end
function p.u23classification(frame)
local s = {
header_function = "headoftableII", -- translations are in function headoftableII
header_1 = 18, -- translation 10 in function headoftableII is printed in the upper part of the table header
header_2 = {1, 2, 3, 4}, -- translations 1, 2, 3, 7 in function headoftableII are printed in this order in the lower part of the table header
item = string.gsub(frame.args[1] or frame:getParent().args[1], "%c", ""),
property = 'P4323', -- property to use for this table (same as best young classification)
team_classification = false, -- it is not a team classification table, its a rider classification table
background = 'color', -- there is a background color for the first row
max_rank_displayed=10
}
return new_classification(
end
function p.combinationclassification(frame)
local s = {
header_function = "headoftableII", -- translations are in function headoftableII
header_1 = 16, -- translation 10 in function headoftableII is printed in the upper part of the table header
header_2 = {1, 2, 3, 7}, -- translations 1, 2, 3, 7 in function headoftableII are printed in this order in the lower part of the table header
item = string.gsub(frame.args[1] or frame:getParent().args[1], "%c", ""),
property = 'P4324', -- property to use for this table
team_classification = false, -- it is not a team classification table, its a rider classification table
background = 'color', -- there is a background color for the first row
max_rank_displayed=10
}
return new_classification(
end
function p.combativeclassification(frame)
local s = {
header_function = "headoftableII", -- translations are in function headoftableII
header_1 = 17, -- translation 10 in function headoftableII is printed in the upper part of the table header
header_2 = {1, 2, 3, 7}, -- translations 1, 2, 3, 7 in function headoftableII are printed in this order in the lower part of the table header
item = string.gsub(frame.args[1] or frame:getParent().args[1], "%c", ""),
property = 'P4321', -- property to use for this table
team_classification = false, -- it is not a team classification table, its a rider classification table
background = 'color', -- there is a background color for the first row
max_rank_displayed=10
}
return new_classification(
end
function p.custompointsclassification(frame)
local team_title
if frame.args[4] and string.find(frame.args[4],"{{{")==nil then team_title=string.gsub(frame.args[4], "%c", "") end
local s = {
header_function = "headoftableII", -- translations are in function headoftableII
header_2 = {1, 2, 3, 7}, -- translations 1, 2, 3, 7 in function headoftableII are printed in this order in the lower part of the table header
header_1_text=
item = string.gsub(frame.args[1] or frame:getParent().args[1], "%c", ""),
property =
team_title=team_title, --for old races where there was no team, only bike brands
team_classification = false, -- it is not a team classification table, its a rider classification table
background = 'color', -- there is a background color for the first row
max_rank_displayed=10
}
return new_classification(
end
function p.customtimeclassification(frame)
local team_title
if frame.args[4] and string.find(frame.args[4],"{{{")==nil then team_title=string.gsub(frame.args[4], "%c", "") end
local s = {
header_function = "headoftableII", -- translations are in function headoftableII
header_2 = {1, 2, 3, 4}, -- translations 1, 2, 3, 7 in function headoftableII are printed in this order in the lower part of the table header
header_1_text=
item = string.gsub(frame.args[1] or frame:getParent().args[1], "%c", ""),
property =
team_title=team_title, --for old races where there was no team, only bike brands
team_classification = false, -- it is not a team classification table, its a rider classification table
background = 'color', -- there is a background color for the first row
max_rank_displayed=10
}
return new_classification(
end
function new_classification(frame, s)
local country = true
for _, value in pairs(no_country_classification) do -- get data if country should be printed in this wiki
if value == wiki then country = false end
end
local raceID = s.item
local
--[=[ It is possible to give the classification tables in the article commands to change the standard behaviour. They could look like this:
Line 5.124 ⟶ 5.114:
]=]
local timeOfRace, errorMessage = getTimeOfRace(raceID
if not timeOfRace then return errorMessage end
local plus = ''
if string.match(frame:getParent():getTitle(), '%P+') == mw.site.namespaces.Template.name
then localframe = frame:getParent() else localframe = frame end
if localframe.args[1] ~= nil then localframe.args[1] = string.gsub(localframe.args[1], "%c", "") end
if
if
if
end
local tableHeader2_size = #s.header_2
local max_rank_displayed=s.max_rank_displayed
if localframe.args['max_rank_displayed'] and localframe.args['max_rank_displayed'] ~= '' then
max_rank_displayed=tonumber(localframe.args['max_rank_displayed'])
end
if s.header_1_text ==nil then s.header_1_text=translate(s.header_function,s.header_1,
local team_translation_index=3
if s.team_title == nil then s.team_title=translate(s.header_function,team_translation_index,
local tableBody = mw.html.create('table')
Line 5.168 ⟶ 5.156:
header= tableBody:tag('tr'):cssText("text-align:center;padding:2px 2px;white-space:nowrap")
for i, k in ipairs(s.header_2) do
if i ~= 2 or (country and available_list) then
local header_text
if k == team_translation_index then --for team
header_text=s.team_title
else
header_text=translate(s.header_function,k,
end
local head =header:tag('th'):wikitext(header_text)
Line 5.204 ⟶ 5.192:
if q.P1534 and q.P1534[1].snaktype == 'value' then
local dnf=q.P1534[1].datavalue.value.id
if dnf=='Q1210380' then riderDNF =translate("startlist",6,
elseif dnf=='Q54881674' or dnf=='Q7113430' then riderDNF =translate("startlist",7,
elseif dnf=='Q1210382' then riderDNF =translate("startlist",8,
elseif dnf=='Q1229261' then riderDNF =translate("startlist",9,
else riderDNF=''
end
Line 5.240 ⟶ 5.228:
teamLink, _, countryID = getTeamLinkCat(riderID, timeOfRace, true)
else
riderLink = getRiderLink(riderID,timeOfRace)..(getReference(
teamLink = getTeam(riderID, timeOfRace, q)
countryID = getNationality(riderID, timeOfRace,q)
Line 5.246 ⟶ 5.234:
if countryID then
flagLink = flag(countryID, timeOfRace)
if available_list and country then
if type(translations.list) == "function" then
countryName = translations.list(countryID)
end
if countryName == '' then
local label, lang = mw.wikibase.getLabelWithLang(countryID)
--[[ Uses standard language fallback. Should not be nil, as all countries have English labels. ]]
if lang == wikilang then
countryName = label
else
countryName = label .. ' (' .. lang .. ')'
end
end
end
end
Line 5.256 ⟶ 5.255:
if h.jersey[1] then
for _, jersey in pairs(h.jersey) do
if
bg_color =
break
end
Line 5.281 ⟶ 5.280:
if not s.team_classification then
if
if not available_list then
if s.display_team~=false then
tBody:tag('td'):wikitext(teamLink)
end
else
if country == true then
tCell:wikitext(riderLink .. jersey(h.jersey) )
tBody:tag('td'):wikitext( flagLink ..' '.. countryName)
else
tCell:wikitext(
end
if s.display_team~=false then
tBody:tag('td'):cssText("text-align:".. textalign ..";padding:0 0.2em 0 0.2em")
:wikitext(teamLink)
end
end
else --team
if available_list==true and country then
tCell:wikitext(teamLink .. jersey(h.jersey))
tBody:tag('td'):wikitext(flagLink .. ' ' .. countryName)
Line 5.300 ⟶ 5.307:
end
if s.header_2[4] == 4 then -- for table stageclassification, generalclassification, adds time and time gap
if riderDNF=='' then
if rank == 1 and h.value[2] then
Line 5.323 ⟶ 5.330:
if type(h.value[1]) == "number" then
if h.value[1] > 1 then
temp2=translate("unit",7,
else
temp2=translate("unit",6,
end
tCell:tag('span'):cssText("font-size:80%"):wikitext(temp2)
Line 5.356 ⟶ 5.363:
if type(h.value[1]) == "number" then
if h.value[1] > 1 then
temp2=translate("unit",7,
else
temp2=translate("unit",6,
end
tCell:tag('span'):cssText("font-size:80%"):wikitext(temp2)
Line 5.373 ⟶ 5.380:
if type(h.value[4]) == "number" then
tCell:wikitext(mw.ustring.format('%.3f', h.value[4]))
:tag('span'):cssText("font-size:80%"):wikitext(translate("unit",5,
end
end
Line 5.379 ⟶ 5.386:
if rank~='' and rank<=max_rank_displayed then --else no display
if riderDNF=='' then
else --disqualified should be higher than not disqualified if the ranking was revided
end
end
Line 5.398 ⟶ 5.405:
:cssText("text-align:right")
tCell:tag('small')
:wikitext(race_reference(raceID
end
--general table style and last line
local tableStyle, tableNewline
if
tableStyle = "float:" .. floattable .. "; margin-right:0.5em; border:1px solid rgb(200,200,200)"
tableNewline = ''
end
if
tableStyle = "border:1px solid rgb(200,200,200)"
tableNewline = '<br style="clear:left;">'
end
if
if s.property == 'P2417' then --stageclassification
tableStyle = "float:"..floattable.."; margin-right:0.5em; border:1px solid rgb(200,200,200)"
Line 5.433 ⟶ 5.440:
--=== G) Infobox ===
function p.infobox(frame)
return infobox_main(frame,0)
end
function p.
return infobox_main(frame,1)
end
function p.
return infobox_main(frame,2)
end
function infobox_main(frame, selector)
localframe = frame
-- If true, winners will have Wikidata logos with link to Wikidata
local WDlink_on = (wiki == "mk" or wiki == "ja")
-- If true, winners will the team of the cyclist
local team = true
local details, others, winners
local entityID
if type(entityID) ~= 'string' then error('parameter must be a string') end
if not entityID:match('Q%d+') then error ('parameter must be a valid Wikidata item (ex: Q42)') end
local womenrace_bool=isWomenrace(entityID)
if selector==0 then --
details = {
{ name = translate("infobox",2,
{ name = translate("infobox",3,
{ name = translate("infobox",5,
{ name = translate("infobox",6,
{ name = translate("infobox",8,
{ name = translate("infobox",9,
{ name = translate("infobox",11,
{ name = translate("infobox",12,
{ name = translate("infobox",13,
{ name = translate("infobox",14,
{ name = translate("infobox",15,
{ name = translate("infobox",16,
{ name = translate("infobox",43,
{ name = translate("infobox",17,
{ name = translate("infobox",32,
{ name = translate("infobox",33,
}
elseif selector==1 then --
details = {
{ name = translate("infobox",46,
{ name = translate("infobox",3,
{ name = translate("infobox",6,
{ name = translate("infobox",45,
{ name = translate("infobox",47,
{ name = translate("infobox",49,
{ name = translate("infobox",63,
{ name = translate("infobox",32,
{ name = translate("infobox",33,
}
else --
details = {
{ name = translate("infobox",46,
{ name = translate("infobox",6,
{ name = translate("infobox",9,
{ name = translate("infobox",67,
{ name = translate("infobox",61,
{ name = translate("infobox",60,
{ name = translate("infobox",13,
{ name = translate("infobox",49,
{ name = translate("infobox",32,
{ name = translate("infobox",33,
}
end
others = { --same for 3 infobox
{ name = translate("infobox",29,womenrace_bool)}, -- picture
{ name = translate("infobox",30,womenrace_bool)}, -- caption
{ name = translate("infobox",31,womenrace_bool)}, -- map
{ name = 'sectional'}, -- sectional
{ name = translate("infobox",30,womenrace_bool)}, -- caption map
{ name = translate("infobox",30,womenrace_bool)}, -- caption sectional
}
if selector==0 then
winners = {
{ name = translate("infobox",19,
{ name = translate("infobox",20,
{ name = translate("infobox",21,
{ name = translate("infobox",22,
{ name = translate("infobox",23,
{ name = translate("infobox",24,
{ name = translate("infobox",25,
{ name = translate("infobox",26,
{ name = translate("infobox",26,
{ name = translate("infobox",35,
{ name = translate("infobox",36,
{ name = translate("infobox",27,
{ name = translate("infobox",38,
{ name = translate("infobox",39,
{ name = translate("infobox",40,
{ name = translate("infobox",28,
{ name = translate("infobox",37,
{ name = translate("infobox",41,
{ name = translate("infobox",42,
}
elseif selector==1 then
winners = {
{ name = translate("infobox",52,
{ name = translate("infobox",53,
{ name = translate("infobox",54,
{ name = translate("infobox",55,
{ name = translate("infobox",56,
{ name = translate("infobox",57,
{ name = translate("infobox",58,
{ name = translate("infobox",59,
}
end --
local localframe
if string.match(frame:getParent():getTitle(), '%P+') == mw.site.namespaces.Template.name then
localframe = frame:getParent()
else
localframe = frame
end
getLocalContent(details, localframe.args)
getLocalContent(others, localframe.args)
if selector==0 or selector==1 then
getLocalContent(winners,
end
Line 5.551 ⟶ 5.573:
' [[File:Cycling (road) pictogram.svg|35px]]' or ''
local name = getLabelFallback(entityID, {wikilang, 'en', 'fr', 'de'}) or ''
infoGetOthers(others, entityID)
Line 5.576 ⟶ 5.598:
for _, p31 in statements(entityID, 'P31') do -- P31 is 'instance of'
local instanceOf = p31.mainsnak.datavalue.value.id
if instanceOf ~= "Q27020041" and
class = classLinkFn(instanceOf)
break
Line 5.587 ⟶ 5.609:
is_a = raceLink(season)
else
for _, p31 in statements(entityID, 'P31') do -- P31 is 'instance of'
local instanceOf = p31.mainsnak.datavalue.value.id
if instanceOf ~= 'Q27968055' and instanceOf ~= 'Q27020041' and class_dic[instanceOf] == nil then -- Q27020041 is 'sports season'
is_a = raceLink(instanceOf)
break
Line 5.630 ⟶ 5.651:
end
end
local index_date
if selector==0 then
index_date=4
elseif selector==1 then
index_date=3
else
index_date=2
end
if not details[index_date].content then -- date
local sTime = firstValue(entityID, 'P580', 'time') -- P580 is 'start time'
local eTime = firstValue(entityID, 'P582', 'time') -- P582 is 'end time'
if sTime and eTime then
local startTime, endTime = getStartEndTime(sTime, eTime)
details[index_date].content = startTime .. ' – ' .. endTime
details[index_date].name = details[index_date].name_plural
timeOfRace = eTime
else
-- This function give a format to dates when P585 (date) is used in a single day race
local pTime = firstValue(entityID, 'P585', 'time') -- P585 is 'point in time'
if pTime then
details[index_date].content = funcDate(pTime, 'long')
timeOfRace = pTime
end
end
end
--from this point the functions differ fundamentally
Line 5.704 ⟶ 5.733:
if stages > 0 then
details[4].content = stages
end
end
Line 5.713 ⟶ 5.739:
end
if not details[6].content then -- organizer sitelink
listWPlink(details, 6, entityID,'
end
if not details[7].content then -- organizer sitelink
Line 5.739 ⟶ 5.765:
end
if not details[8].content then -- organizer sitelink
listWPlink(details, 8, entityID,'
end
end
tab = infoInitTab("300px", name, icon)
infoFillOthersDetails(tab, others, details,translate("infobox",1,womenrace_bool))
if selector==0 or selector==1 then --no winners for champ
Line 5.766 ⟶ 5.780:
end
end
winner(
for _, v in pairs(winners) do
if not v.content then
Line 5.784 ⟶ 5.798:
:cssText('border-bottom:5px solid white; background-color:'..backgroundColor..'; text-align:center')
:css('font-weight','bold')
:wikitext(translate("infobox",18,
tab:wikitext(winRows)
end
Line 5.799 ⟶ 5.813:
tab:node(getPreviousNextLine(entityID))
wdDoc(tab, "d:Wikidata:WikiProject Cycling/Documentation/infobox", translate("infobox",34,
return tab
end
Line 5.805 ⟶ 5.819:
--=== H) race infobox
function p.raceinfobox(frame)
localframe = frame
local lang = contentLanguage
-- If true, winners will have Wikidata logos with link to Wikidata
local WDlink_on = (wiki == "mk" or wiki == "ja")
Line 5.814 ⟶ 5.830:
},
vainqueur= {},
lastEditionMonth,
lastEditionYear,
numberOfEditions,
lastLink,
nextLink,
lastWinner,
maxWinner,
}
local entityID
if type(entityID) ~= 'string' then error('parameter must be a string') end
if not entityID:match('Q%d+') then error('parameter must be a valid Wikidata item (ex: Q42)') end
local womenrace_bool=isWomenrace(entityID)
local details = {
{ name = translate("raceinfobox",4,
{ name = translate("raceinfobox",5,
{ name = translate("raceinfobox",6,
{ name = translate("raceinfobox",7,
{ name = translate("raceinfobox",8,
{ name = translate("raceinfobox",9,
{ name = translate("raceinfobox",33,
{ name = translate("raceinfobox",10,
{ name = translate("raceinfobox",12,
{ name = translate("raceinfobox",27,
{ name = translate("raceinfobox",
{ name = translate("raceinfobox",
{ name = translate("raceinfobox",
}
local others = {
{ name = translate("infobox",29,womenrace_bool)}, -- picture
{ name = translate("infobox",30,womenrace_bool)}, -- caption
{ name = translate("infobox",31,womenrace_bool)}, -- map
{ name = 'sectional'}, -- sectional
{ name = translate("infobox",30,womenrace_bool)}, -- caption map
{ name = translate("infobox",30,womenrace_bool)}, -- caption sectional
}
local name = getLabelFallback(entityID, {wikilang, 'en', 'fr', 'de'}) or ''
infoGetOthers(others, entityID)
local localframe
if string.match(frame:getParent():getTitle(), '%P+') == mw.site.namespaces.Template.name then
localframe = frame:getParent()
else
localframe = frame
end
getLocalContent(details, localframe.args)
getLocalContent(others, localframe.args)
local timeOfRace, class
Line 5.857 ⟶ 5.897:
local creation=firstValue(entityID, 'P571', 'time')
if not details[2].content and creation then
details[2].content = funcDate(creation, "
end
Line 5.863 ⟶ 5.903:
local disparition=firstValue(entityID, 'P576', 'time')
if not details[3].content and disparition then
details[3].content = funcDate(disparition,"
end
--populate tRace
listOfWinners(entityID, tRace
--number of editions
if not details[4].content and tRace.numberOfEditions and tRace.lastEditionYear then
details[4].content = tostring(tRace.numberOfEditions).." (" .. translate("raceinfobox",31,
end
--periodicity
Line 5.886 ⟶ 5.926:
end
if not details[8].content then
infoGetPlace(details,
end
Line 5.897 ⟶ 5.937:
end
if not details[11].content then
details[11].content = officialSite(entityID)
end
--Class and circuit
local classContent, circuitLink, numberClass= getClass(entityID)
if not details[
details[
if numberClass >1 then
details[
end
end
if not details[
details[
end
--Build the table
Line 5.924 ⟶ 5.963:
end
--picture at the top
infoFillOthersDetails(tab, others, nil,translate("raceinfobox",19,
if not listOfNamesAtBottom then
if listOfNames and #listOfNames>1 then
tab:node(addATitle(translate("raceinfobox",18,
for _, v in pairs(listOfNames) do
tab:node(addARow(v[2],v[3])) --period, name
Line 5.934 ⟶ 5.973:
end
infoFillOthersDetails(tab, nil, details,translate("raceinfobox",19,
if listOfNamesAtBottom then
if listOfNames and #listOfNames>0 then -- except for the ru-wiki, no one uses the display of official names at the bottom anyway
tab:node(addATitle(translate("raceinfobox",18,
for _, v in pairs(listOfNames) do
tab:node(addARow(v[2],v[3])) --period, name
Line 5.947 ⟶ 5.986:
if (tRace.lastWinner and tRace.lastWinner~='') or
(tRace.maxWinner and tRace.maxWinner~='') then
tab:node(addATitle(translate("raceinfobox",20,
if (tRace.lastWinner and tRace.lastWinner~='') then
tab:node(addARow(translate("raceinfobox",21,
end
if (tRace.maxWinner and tRace.maxWinner~='') then
tab:node(addARow(translate("raceinfobox",22,
end
end
if tRace.nextLink or tRace.lastLink then
tab:node(addATitle(translate("raceinfobox",23,
local outTable
Line 5.964 ⟶ 6.003:
local tCell=outTable:tag('td'):attr('colspan','2'):css('text-align','center')
local lastText="[[File:Crystal Clear app kworldclock.png|left|37px]]"..
translate("raceinfobox",24,
":<br>'''"..
tRace.lastLink.."'''"
Line 5.975 ⟶ 6.014:
local tCell=outTable:tag('td'):attr('colspan','2'):css('text-align','center')
local nextText = "[[File:Crystal Clear app kworldclock.png|left|37px]]"..
translate("raceinfobox",25,
":<br>'''"..
tRace.nextLink.."'''"
Line 5.982 ⟶ 6.021:
end
end
wdDoc(tab, "d:Wikidata:WikiProject Cycling/Documentation/raceinfobox", translate("raceinfobox",26,
return tab
end
--=== I) Team roster
function p.
localframe=frame
local squadID
if frame.args[1] then squadID = string.gsub(frame.args[1], "%c", "") end
local flags, pays = {}, {}
local riderName, riderBirthday,riderTeam, timeTeam, correctlanguage,riderStart, riderEnd
local riderPosition, riderReason, riderRef, errortext
local riderReasonTable, riderTablecorrect, riderTablenotcorrect, riderTable = {}, {}, {}, {}
local labelMissing = false
local teamID, startOfSeason, stagiaire
local
local wikiIsSlavic = slavicWikis[wiki]
local WDlink_on = wiki == "mk" or wiki == "ja" or wiki == "ru" or wiki == "he"
local tableEndText = ''
local sort
--[[
Line 6.031 ⟶ 6.051:
change that in the code. In lv mkWiki and ruWiki sorting is standard, there is no need to switch sorting on in the article
]]
if string.match(frame:getParent():getTitle(), '%P+') == mw.site.namespaces.Template.name
then localframe = frame:getParent() else localframe = frame end
if localframe.args[2] ~= nil then
if mw.ustring.find(mw.ustring.lower(localframe.args[2]), "sort") then sort = true else sort = false end
end
if wiki == "lv" or wiki == "mk" or wiki == "ru" then sort = true end
local womenrace_bool=isWomenrace(squadID)
local
if temp then teamID = temp end
temp = firstValue(squadID, 'P580', 'time')
if temp then
startOfSeason = temp
else
local Sitelink=getSitelinkFallback(squadID,{'en', 'fr', 'de'})
if Sitelink == nil then return '> Wikidata is missing data about the start time (P580) and end time (P582) of the season'
else startOfSeason = '+'..string.match(Sitelink, '%d%d%d%d' ) ..'-01-01T00:00:00Z'
end
end
for _, p527 in statements(
--re-init
riderName, riderBirthday, correctlanguage=nil, nil, nil
Line 6.108 ⟶ 6.099:
end
riderPosition=getPosition(riderPosition,p527)
riderReason, riderRef=getReason(riderReason,riderRef,p527, timeOfRace,enddate
local beginYear, beginMonth, beginDay, endYear, endMonth, endDay, beginDate, endDate, endDatefound, endDatetemp
Line 6.128 ⟶ 6.119:
if not endDate then endDatefound=false end
endDate, endYear, endMonth, endDay, _ = parseDate(endDate, beginYear, '12', '31', errortext,'')
riderReason, riderRef=getReason(riderReason,riderRef,v,timeOfRace,endDate
if (beginYear == startOfSeasonYear or endYear == startOfSeasonYear) and ((beginYear == startOfSeasonYear and (beginMonth ~= '01' or beginDay ~= '01')) or (endYear == startOfSeasonYear and (endMonth ~= '12' or endDay ~= '31'))) then
Line 6.206 ⟶ 6.197:
-- sorting names
if sort == true and #riderTablecorrect==0 and #riderTablenotcorrect==0 then -- replaced with this to display the team roster in the ru-wiki
table.sort(riderTablenotcorrect, function(a,b) return a[1]<b[1] end)
end
--merge
for _, v in pairs (riderTablecorrect) do
Line 6.222 ⟶ 6.209:
table.insert(riderTable, v)
end
local wd_link = mw.html.create('span'):css('float','left'):wikitext(wdLink(
if arwiki_totemplate then wd_link = wdLink(
local outTable = mw.html.create('table')
:addClass('sortable')
Line 6.232 ⟶ 6.219:
local th_colspan = 4
if wiki == "ar" then th_colspan = 5 end
:css('background-color',backgroundColor)
:tag('th'):attr('colspan', th_colspan):cssText('text-align:center;white-space:nowrap')
:wikitext(tostring(wd_link))
:wikitext(translate("getSquadTableColumn",7,womenrace_bool))
local header = outTable:tag('tr')
header:tag('th'):cssText('text-align:center;padding:2px 20px 2px 2px;white-space:nowrap'):wikitext(translate("getSquadTableColumn",1,
local textalign = 'center'
if wiki=='ar' then textalign = 'right' end
header:tag('th'):cssText('text-align:'..textalign..';padding:2px 20px 2px 2px;white-space:nowrap'):wikitext(translate("getSquadTableColumn",2,
if
header:tag('th'):cssText('text-align:center;padding:2px 20px 2px 2px;white-space:nowrap'):wikitext(translate("getSquadTableColumn",6,
end
if wiki == "ar" then
header:tag('th'):attr('colspan', 2):cssText('text-align:center;padding:2px 20px 2px 2px;white-space:nowrap'):wikitext(translate("getSquadTableColumn",3,
else
header:tag('th'):cssText('text-align:center;padding:2px 20px 2px 2px;white-space:nowrap'):wikitext(translate("getSquadTableColumn",3,
end
local temp
Line 6.260 ⟶ 6.243:
local tCell= tRow:tag('td'):cssText("padding:0 1em 0 0;white-space:nowrap")
if not
tCell:wikitext(temp..v['riderName']):attr('data-sort-value',v['sortkey'])
Line 6.267 ⟶ 6.250:
local note=''
if v['riderReason'] ~= nil then
note = ', [[#tr_'..i..
if wiki == "ar" then note = '، [[#tr_'..i..
end
tCell:wikitext(' ('..(v['riderStart'] or '')..'–'..(v['riderEnd'] or '')
Line 6.274 ⟶ 6.257:
elseif v['riderReason'] then
tCell:tag('span'):cssText("font-size:80%; color:#686868")
:wikitext('([[#tr_'..i..
end
tCell=tRow:tag('td'):cssText("text-align:right;white-space:nowrap")
Line 6.280 ⟶ 6.263:
local _, _, beginYear, beginMonth, beginDay = string.find(startOfSeason,"(%d+)-(%d+)-0*(%d+)")
local _, _, endYear, endMonth, endDay = string.find(v['riderBirthday'] or '',"(%d+)-(%d+)-0*(%d+)")
tCell:wikitext(
else
tCell:wikitext(funcDate(v['riderBirthday'] or '', 'long'))
if available_list then
tRow:tag('td'):wikitext(v['flags'].. ' '..v['pays'])
end
Line 6.296 ⟶ 6.279:
tCell=tRow:tag('td'):cssText("padding:0 0.5em; text-align:left")
end
else
if wiki == "ar" then
tCell=tRow:tag('td'):cssText("padding:0 0.5em")
else
tCell=tRow:tag('td'):cssText("padding:0 0.5em; text-align:left")
end
end
if v['riderTeam'] then
Line 6.314 ⟶ 6.299:
local temp=(v['riderReason'] or '')..(v['errortext'] or '')
if iii == 1 then
tableEndText = tableEndText.. translate("getSquadTableColumn",5,
else
tableEndText = tableEndText.. '<span style="color:white">'.. translate("getSquadTableColumn",5,
end
iii = iii + 1
if riderRef ~= nil then tableEndText = tableEndText..
tableEndText = tableEndText.. '<br>'
end
Line 6.326 ⟶ 6.311:
if labelMissing then outTable:wikitext(getMissingLabelTrackingCategory()) end
local UCIlink
if
UCIlink="https://www.uci.org/fr/route/%C3%A9quipe"
else
end
Line 6.345 ⟶ 6.326:
:attr('data-sort-value','zzz')
:cssText("text-align:right")
:tag('small'):wikitext(
return tostring(outTable)..tableEndText
Line 6.352 ⟶ 6.333:
--== J) List of winners ==
function p.listofwinners(frame)
local winnersProperty = {'Q20882667','Q20882668','Q20882669'}
local display_team = false -- display of a rider without a team
if tonumber(frame.args[5]) ==1 then display_team = true end -- display of the rider with the team
local s = {
countryflag=true,
beginyear=tonumber(frame.args[2]),
display_team=display_team,
winnersProperty=winnersProperty,
custom=false
}
return listofwinners_main(frame, s)
end
function p.listofwinnersyoung(frame)
local winnersProperty = {'Q20883139','Q72099969','Q72099972'}
local display_team = false -- display of a rider without a team
if tonumber(frame.args[4]) ==1 then display_team = true end -- display of the rider with the team
local s = {
countryflag=true,
beginyear=tonumber(frame.args[2]),
display_team=tonumber(frame.args[5]), -- since the answer is "args[4]"
winnersProperty=winnersProperty,
custom=false
}
return listofwinners_main(frame, s)
end
function p.listofwinnersChamp(frame)
local winnersProperty = {'Q20882667','Q20882668','Q20882669'}
local s = {
countryflag=false,
beginyear=tonumber(frame.args[2]),
winnersProperty=winnersProperty,
display_team = false,
custom=false
}
return listofwinners_main(frame, s)
end
--listofwinnerssecondpart and so on can be coded with p.listofwinners
function p.listofwinnersnowiki(frame)
local winnersProperty = {'Q20882667','Q20882668','Q20882669'}
local display_team = false -- display of a rider without a team
if tonumber(frame.args[5]) ==1 then display_team = true end -- display of the rider with the team
local s = {
countryflag=true,
beginyear=tonumber(frame.args[2]),
display_team=display_team, -- since the answer is "args[4]"
winnersProperty=winnersProperty,
custom=false
}
return frame:extensionTag{ name = 'nowiki', content = listofwinners_main(frame, s)}
end
function p.listofwinnersteamofpoint(frame)
local winnersProperty = {'Q27104269','Q72065970','Q72065977'}
local display_team = false -- display of a rider without a team
if tonumber(frame.args[5]) ==1 then display_team = true end -- display of the rider with the team
local s = {
countryflag=true,
beginyear=tonumber(frame.args[2]),
display_team=display_team, -- since the answer is "args[4]"
winnersProperty=winnersProperty,
custom=false
}
return listofwinners_main(frame, s)
end
function p.listofwinnersGSI(frame)
local winnersProperty = {'Q98959152','Q98959192','Q98959196'}
local display_team = false -- display of a rider without a team
if tonumber(frame.args[5]) ==1 then display_team = true end -- display of the rider with the team
local s = {
countryflag=true,
beginyear=tonumber(frame.args[2]),
display_team=display_team, -- since the answer is "args[4]"
winnersProperty=winnersProperty,
custom=false
}
return listofwinners_main(frame, s)
end
function p.listofwinnersGSII(frame)
local winnersProperty = {'Q98959153','Q98959194','Q98959197'}
local display_team = false -- display of a rider without a team
if tonumber(frame.args[5]) ==1 then display_team = true end -- display of the rider with the team
local s = {
countryflag=true,
beginyear=tonumber(frame.args[2]),
display_team=display_team, -- since the answer is "args[4]"
winnersProperty=winnersProperty,
custom=false
}
return listofwinners_main(frame, s)
end
function p.listofwinnersGSIII(frame)
local winnersProperty = {'Q98959155','Q98959195','Q98959198'}
local display_team = false -- display of a rider without a team
if tonumber(frame.args[5]) ==1 then display_team = true end -- display of the rider with the team
local s = {
countryflag=true,
beginyear=tonumber(frame.args[2]),
display_team=display_team, -- since the answer is "args[4]"
winnersProperty=winnersProperty,
custom=false
}
return listofwinners_main(frame, s)
end
function p.listofwinnerscountry(frame)
local winnersProperty = {'Q72068715','Q72068718','Q72068721'}
local display_team = false -- display of a rider without a team
if tonumber(frame.args[5]) ==1 then display_team = true end -- display of the rider with the team
local s = {
countryflag=true,
beginyear=tonumber(frame.args[2]),
display_team=display_team, -- since the answer is "args[4]"
winnersProperty=winnersProperty,
custom=false
}
return listofwinners_main(frame, s)
end
function p.listofwinnerscountryU23(frame)
local winnersProperty = {'Q72068724','Q72068725','Q72068729'}
local display_team = false -- display of a rider without a team
if tonumber(frame.args[5]) ==1 then display_team = true end -- display of the rider with the team
local s = {
countryflag=true,
beginyear=tonumber(frame.args[2]),
display_team=display_team, -- since the answer is "args[4]"
winnersProperty=winnersProperty,
custom=false
}
return listofwinners_main(frame, s)
end
function p.listofwinnerscustom(frame)
local winnersProperty ={}
--general
if
--podium
if frame.args[6] ~= nil and tonumber(frame.args[6]) ==1 then
table.insert( winnersProperty,'Q20882668')
table.insert( winnersProperty,'Q20882669')
end
--points
if
--mounstain
if
-- sprints
if
-- youth
if
-- supercombativity
if
-- combativity
if
-- volante
if
-- regularity
if
-- combination
if frame.args[14] ~= nil and tonumber(frame.args[14]) ==1 then table.insert( winnersProperty, 'Q20893979' ) end
-- breakaway
if frame.args[15] ~= nil and tonumber(frame.args[15]) ==1 then table.insert( winnersProperty, 'Q27907715' ) end
-- azzurri
if frame.args[16] ~= nil and tonumber(frame.args[16]) ==1 then table.insert( winnersProperty, 'Q27907747' ) end
-- rookie
if frame.args[17] ~= nil and tonumber(frame.args[17]) ==1 then table.insert( winnersProperty, 'Q28092831' ) end
-- teams
if frame.args[18] ~= nil and tonumber(frame.args[18]) ==1 then table.insert( winnersProperty, 'Q20882921' ) end
-- teamspoints
if frame.args[19] ~= nil and tonumber(frame.args[19]) ==1 then table.insert( winnersProperty, 'Q27104269' ) end
-- amateur
if frame.args[20] ~= nil and tonumber(frame.args[20]) ==1 then table.insert( winnersProperty, 'Q61976850' ) end
--nationality
if frame.args[21] ~= nil and tonumber(frame.args[21]) ==1 then table.insert( winnersProperty, 'Q61976872' ) end
-- country
if frame.args[22] ~= nil and tonumber(frame.args[22]) ==1 then table.insert( winnersProperty, 'Q72068715' ) end
-- country U-23
if frame.args[23] ~= nil and tonumber(frame.args[23]) ==1 then table.insert( winnersProperty, 'Q72068724' ) end
local s = {
countryflag=true,
beginyear=tonumber(frame.args[2]),
display_team = false,
winnersProperty=winnersProperty,
custom=true
}
return listofwinners_main(frame, s)
end
function listofwinners_main(frame, s)
local rows = {}
frame.args[1] = string.gsub(frame.args[1], "%c", "")
local raceID = frame.args[1]
local WDlink_on = (wiki == "mk") or (wiki == "ja") or (wiki == "ru")
-- WDlink_on is used to decide if a Wikidata logo will be shown
local WPcontent = {
row ={},
Line 6.579 ⟶ 6.563:
local titletable
local
if s.custom then
titletable={
[ 'Q20882667' ]=translate("listofwinners",2,
[ 'Q20882668' ]=translate("listofwinners",3,
[ 'Q20882669' ]=translate("listofwinners",4,
[ 'Q20883007' ]=translate("listofwinners",5,
[ 'Q20883212' ]=translate("listofwinners",6,
[ 'Q20883328' ]=translate("listofwinners",7,
[ 'Q20883139' ]=translate("listofwinners",8,
[ 'Q101246973' ]=translate("listofwinners",9,
[ 'Q20893983' ]=translate("listofwinners",9,
[ 'Q20893979' ]=translate("listofwinners",10,
[ 'Q20882921' ]=translate("listofwinners",11,
[ 'Q27067359' ]=translate("listofwinners",12,
[ 'Q27067170' ]=translate("listofwinners",13,
[ 'Q27104269' ]=translate("listofwinners",14,
[ 'Q27907715' ]=translate("listofwinners",15,
[ 'Q27907747' ]=translate("listofwinners",16,
[ 'Q28092831' ]=translate("listofwinners",17,
[ 'Q61976850' ]=translate("listofwinners",18,
[ 'Q61976872' ]=translate("listofwinners",19,
[ 'Q72068715' ]=translate("listofwinners",23,
[ 'Q72068724' ]=translate("listofwinners",24,
}
else --main
titletable={
-- winner:
[ 'Q20882667' ]=translate("listofwinners",2,
[ 'Q20883007' ]=translate("listofwinners",2,
[ 'Q20883212' ]=translate("listofwinners",2,
[ 'Q20883328' ]=translate("listofwinners",2,
[ 'Q20883139' ]=translate("listofwinners",2,
[ 'Q101246973' ]=translate("listofwinners",2,
[ 'Q20893983' ]=translate("listofwinners",2,
[ 'Q20893979' ]=translate("listofwinners",2,
[ 'Q20882921' ]=translate("listofwinners",2,
[ 'Q27067359' ]=translate("listofwinners",2,
[ 'Q27067170' ]=translate("listofwinners",2,
[ 'Q27104269' ]=translate("listofwinners",2,
[ 'Q27907715' ]=translate("listofwinners",2,
[ 'Q27907747' ]=translate("listofwinners",2,
[ 'Q28092831' ]=translate("listofwinners",2,
[ 'Q61976850' ]=translate("listofwinners",2,
[ 'Q61976872' ]=translate("listofwinners",2,
[ 'Q72068715' ]=translate("listofwinners",2,
[ 'Q72068724' ]=translate("listofwinners",2,
[ 'Q98959152' ]=translate("listofwinners",2,
[ 'Q98959153' ]=translate("listofwinners",2,
[ 'Q98959155' ]=translate("listofwinners",2,
-- 2 place:
[ 'Q20882668' ]=translate("listofwinners",3,
[ 'Q72065970' ]=translate("listofwinners",3,
[ 'Q72099969' ]=translate("listofwinners",3,
[ 'Q72068718' ]=translate("listofwinners",3,
[ 'Q72068725' ]=translate("listofwinners",3,
[ 'Q98959192' ]=translate("listofwinners",3,
[ 'Q98959194' ]=translate("listofwinners",3,
[ 'Q98959195' ]=translate("listofwinners",3,
-- 3 place:
[ 'Q20882669' ]=translate("listofwinners",4,
[ 'Q72065977' ]=translate("listofwinners",4,
[ 'Q72099972' ]=translate("listofwinners",4,
[ 'Q72068721' ]=translate("listofwinners",4,
[ 'Q72068729' ]=translate("listofwinners",4,
[ 'Q98959196' ]=translate("listofwinners",4,
[ 'Q98959197' ]=translate("listofwinners",4,
[ 'Q98959198' ]=translate("listofwinners",4,
}
end
--localframe defined as global for references
if string.match(frame:getParent():getTitle(), '%P+') == mw.site.namespaces.Template.name then
localframe = frame:getParent()
else
localframe = frame
end
if localframe.args[1] then
localframe.args[1] = string.gsub(localframe.args[1], "%c", "")
end
--[=[
It is possible to give the table listofwinners in the article commands. It could look like this:
Line 6.658 ⟶ 6.651:
"above row x" inserts a new row above row x into the table. Content is what is behind the ":".
]=]
if
for num, _ in pairs(
if num > 1 and mw.ustring.find(mw.ustring.lower(
local _, _, kebeginYear, val = mw.ustring.find(
local _, _, key01, kebeginYear1, kebeginYear2 = mw.ustring.find(kebeginYear, "(%a+)%s*(%a+)%s*(%d+)")
kebeginYear2 = tonumber(kebeginYear2) kebeginYear1 = mw.ustring.lower(key01..kebeginYear1)
Line 6.675 ⟶ 6.668:
if part.rank ~= 'deprecated' and part.mainsnak.snaktype == 'value' then
local partID = part.mainsnak.datavalue.value.id
local timeOfRace=getTimeOfRace(partID
local year = timeOfRace and string.sub(timeOfRace, 2, 5) or '?'
local month = timeOfRace and string.sub(timeOfRace, 7, 8) or '01'
Line 6.698 ⟶ 6.691:
local temp=firstValue(partID, 'P1346','id')
if temp and temp=='Q30108381
local cancelledlabel = getLabelFallback(
tCell=mw.html.create('td'):attr('colspan','4')
:cssText('text-align:center; font-style: italic')
Line 6.705 ⟶ 6.698:
tCellstr=tostring(tCell)
else
winner(
for _, property in ipairs(s.winnersProperty) do
tCell=mw.html.create('td'):wikitext(winners[property])
Line 6.739 ⟶ 6.732:
tCell:wikitext(tostring(wd_link))
end
tCell:wikitext(translate("listofwinners",1,
for _, pp in ipairs(s.winnersProperty) do
tTitleRow:tag('th'):wikitext(titletable[pp])
Line 6.791 ⟶ 6.784:
--== K) List of stages
function p.listofstages(frame)
-- WDlink_on is used to decide if a Wikidata logo will be shown
local WDlink_on = wiki == "mk" or wiki == "ja"
local WPcontent = {}
local raceID
local thereiselevation=false
local result, tableBody
local localframe
if string.match(frame:getParent():getTitle(), '%P+') == mw.site.namespaces.Template.name then
localframe = frame:getParent()
else
localframe = frame
end
if localframe.args[1] then
localframe.args[1] = string.gsub(localframe.args[1], "%c", "")
end
local womenrace_bool=isWomenrace(raceID)
--[=[ It is possible to give the table listofstages in the article commands which overwrites data from Wikidata.
It could look like this:
Line 6.843 ⟶ 6.820:
end location are the same. The file data for the icon looks this way: [[File:Stage rest day.svg|any text]]
]=]
if
local WProw, WPnew_row, WPcourse, WPtext, WPdate, WPwinner, WPicon, WPdistance
= 'row', 'afterrow', 'location', 'text', 'date', 'winner', 'icon', 'distance'
Line 6.849 ⟶ 6.826:
local key01, kebeginYear1, kebeginYear2
local key21, key22
for num, var in pairs(
if num > 1 and mw.ustring.find(mw.ustring.lower(var), WProw) then
_, _, kebeginYear, key2, val = mw.ustring.find(var, "([^:]+)%s*:?%s*([^:]*)%s*:%s*(%C+)")
Line 6.909 ⟶ 6.886:
local WDLink = WDlink_on and wdLink(stageID) or ''
local sitelink = mw.wikibase.getSitelink(stageID)
local timeOfRace =getTimeOfRace(stageID) or ''
local sPointID = firstValue(stageID, 'P1427', 'id')
local sPoint = (sPointID and getPlaceLink(sPointID, timeOfRace)) or ''
if sPointID and not onecountry and
local
if startcountry then
local startcountryID = startcountry.mainsnak.datavalue.value.id
if firstcountryID ~= startcountryID then
local sflag = flag(startcountryID, timeOfRace)
sPoint = sflag.." "..sPoint
end
end
end
Line 6.928 ⟶ 6.905:
local dPoint = (dPointID and getPlaceLink(dPointID, timeOfRace)) or ''
if dPointID and not onecountry and timeOfRace then
local dcountry= getStatementForTime(dPointID, 'P17',timeOfRace)
if dcountry then
local dcountryID = dcountry.mainsnak.datavalue.value.id
if firstcountryID ~= dcountryID then
local dflag = flag(dcountryID, timeOfRace)
dPoint = dflag.." "..dPoint
end
end
end
Line 6.949 ⟶ 6.925:
Q20882667 = '', -- Q20882667 is 'overall winner' not supposed to be used
}
winner(
-- find the type of stage
Line 6.955 ⟶ 6.931:
local label, section_title
if sOrdinal == "0" then
label, section_title = translate("func_prologue"
else
label, section_title = stageLink(sOrdinal, sNumber, sLetter)
Line 6.967 ⟶ 6.943:
if winners['Q20882763']~='' then tempoverall=winners['Q20882763'] else tempoverall=winners['Q20882667'] end
rows[#rows + 1] = {
sLink, sDate, WDLink, sPoint, dPoint, sType, sDistance, sElevation, winners['Q20882747'], tempoverall -- Content
}
end
Line 6.984 ⟶ 6.950:
table.sort(rows, function(a, b)
if a[
return a[
end)
local Id = ((not WDlink_on and wdLink(string.gsub(raceID, '%s', '') .. "#P527")) or "")
Line 6.997 ⟶ 6.963:
:css('text-align','center')
tRow:tag('th'):css('white-space','nowrap')
:wikitext(Id..translate("headoftable",1,
tRow:tag('th'):wikitext(translate("headoftable",2,
tRow:tag('th'):wikitext(translate("headoftable",3,
tRow:tag('th'):css('color',backgroundColor):wikitext("type")
tRow:tag('th'):wikitext(translate("headoftable",4,
if thereiselevation then
tRow:tag('th'):wikitext(translate("headoftable",7,
end
tRow:tag('th'):wikitext(translate("headoftable",5,
tRow:tag('th'):wikitext(translate("headoftable",6,
local header = tostring(tRow)
for num, row in pairs(rows) do
local sLink, sDate, WDLink, sPoint, dPoint, sType, sDistance, sElevation, sSWin, sGWin
= row[3], row[4], row[5], row[6], row[7], row[8], row[9], row[10], row[11], row[12]
local WPc = WPcontent[num]
if WPc then
Line 7.024 ⟶ 6.988:
local tRow = tab:tag('tr')
local tCell= tRow:tag('td'):cssText('text-align:center; white-space:nowrap'):wikitext(
tCell:tag('span'):css('white-space','nowrap'):wikitext(" "..
tRow:tag('td'):css('white-space','nowrap'):cssText("text-align:right; padding-right:0px")
:wikitext(
tCell=tRow:tag('td'):cssText("padding-right:0px"):wikitext( sPoint)
if dPoint ~= '' then
Line 7.035 ⟶ 6.999:
tRow:tag('td'):css('text-align','center'):wikitext( sDistance)
if thereiselevation then
tRow:tag('td'):css('text-align','center'):wikitext(
end
Line 7.041 ⟶ 7.005:
tRow:tag('td'):css('text-align',textalign):wikitext( WPc['stage winner'])
else
tRow:tag('td'):wikitext(
end
if WPc and WPc['general winner'] then
tRow:tag('td'):css('text-align',textalign):wikitext( WPc['general winner'])
else
tRow:tag('td'):wikitext(
end
if WPc and (WPc['date'] or WPc['text'] or WPc['icon (new row)']) then
Line 7.074 ⟶ 7.038:
function p.stagetitle(frame)
-- WDlink_on is used to decide if a Wikidata logo will be shown
local stageID = frame.args[1]
-- from to
local
local sPointID = p[1] and p[1].mainsnak.snaktype == 'value' and p[1].mainsnak.datavalue.value.id
local sPoint = sPointID and getPlaceLink(sPointID) or ''
p = mw.wikibase.getBestStatements(stageID, 'P1444') -- P1444 is 'destination point'
local dPointID =
local dPoint =
local sDistance = getDistance(stageID, true) or ''
local sType = typeofstagelogo(stageID)
tab=mw.html.create('table')
Line 7.095 ⟶ 7.062:
local road, ITT, result
local hcountry, hnotcountry = {},{}
local
--the jersey for a stage race and the jersey from national championship should be differentiated
Line 7.104 ⟶ 7.071:
roadtemp=false
ITTtemp=false
if
road = true
roadtemp=true
elseif
ITT = true
ITTtemp=true
Line 7.147 ⟶ 7.114:
end
--avoid double display of jersey
result = "<small>("..translate("startlist",10,
elseif road then
result = "<small>("..translate("startlist",10,
elseif ITT then
result = "<small>("..translate("startlist",11,
else
result = ""
Line 7.166 ⟶ 7.133:
local q = winner.qualifiers
if q then
if q.
wOf = q.P642[1].datavalue.value.id -- P642 is 'of'
end
if q.P2912 and q.P2912[1].snaktype == 'value' then
thisjersey=q.P2912[1].datavalue.value.id
if
bg_color =
end
end
Line 7.193 ⟶ 7.158:
local displaytypeofstage = true
local stageinfotable = {}
local raceID
local
local sType
local localframe
if string.match(frame:getParent():getTitle(), '%P+') == mw.site.namespaces.Template.name then
localframe = frame:getParent()
else
localframe = frame
end
if localframe.args[1] then
localframe.args[1] = string.gsub(localframe.args[1], "%c", "")
end
--link for Grand Tour
local GTid={['Q33881']=true,['Q33861']=true,['Q33937
local thisGT
Line 7.207 ⟶ 7.181:
local Sitelink,overallname, pointsname, mountainname, youngname, teamname, combativityname, supercombativityname, combinedname
if thisGT then
if thisGT=='Q33881' then
Sitelink = wikibase.getSitelink('Q2267539')
if Sitelink then overallname="[["..Sitelink .."|"..translate("headoftableII",9,
Sitelink = wikibase.getSitelink('Q175399')
if Sitelink then pointsname="[["..Sitelink .."|"..translate("infobox",22,
Sitelink = wikibase.getSitelink('Q927157')
if Sitelink then mountainname="[["..Sitelink .."|"..translate("infobox",23,
Sitelink = wikibase.getSitelink('
if Sitelink then youngname="[["..Sitelink .."|"..translate("infobox",25,
Sitelink = wikibase.getSitelink('Q1436680')
if Sitelink then teamname="[["..Sitelink .."|"..translate("infobox",28,
Sitelink = wikibase.getSitelink('Q2094179')
if Sitelink then combativityname="[["..Sitelink .."|"..translate("infobox",26,womenrace_bool).."]]" end
Sitelink = wikibase.getSitelink('Q2094179')
if Sitelink then supercombativityname="[["..Sitelink .."|"..translate("infobox",26,womenrace_bool).."]]" end
Sitelink = wikibase.getSitelink('
if Sitelink then
elseif thisGT=='Q33861' then
Sitelink = wikibase.getSitelink('Q1164275')
if Sitelink then overallname="[["..Sitelink .."|"..translate("headoftableII",9,womenrace_bool).."]]" end
Sitelink = wikibase.getSitelink('Q641083')
if Sitelink then pointsname="[["..Sitelink .."|"..translate("infobox",22,womenrace_bool).."]]" end
Sitelink = wikibase.getSitelink('Q641060')
if Sitelink then mountainname="[["..Sitelink .."|"..translate("infobox",23,womenrace_bool).."]]" end
Sitelink = wikibase.getSitelink('Q641662')
if Sitelink then youngname="[["..Sitelink .."|"..translate("infobox",25,womenrace_bool).."]]" end
else
Sitelink = wikibase.getSitelink('Q2532554')
if Sitelink then overallname="[["..Sitelink .."|"..translate("headoftableII",9,womenrace_bool).."]]" end
Sitelink = wikibase.getSitelink('Q2241695')
if Sitelink then pointsname="[["..Sitelink .."|"..translate("infobox",22,womenrace_bool).."]]" end
Sitelink = wikibase.getSitelink('Q1118296')
if Sitelink then mountainname="[["..Sitelink .."|"..translate("infobox",23,womenrace_bool).."]]" end
Sitelink = wikibase.getSitelink('Q2330008')
if Sitelink then combinedname="[["..Sitelink .."|"..translate("infobox",27,womenrace_bool).."]]" end
end
end
local winners = {
{ name = translate("infobox",19,
{ name = overallname or translate("headoftableII",9,
{ name = pointsname or translate("infobox",22,
{ name = mountainname or translate("infobox",23,
{ name = translate("infobox",24,
{ name = youngname or translate("infobox",25,
{ name = combativityname or translate("infobox",26,
{ name = supercombativityname or translate("infobox",26,
{ name = translate("infobox",35,
{ name = translate("infobox",36,
{ name = combinedname or translate("infobox",27,
{ name = translate("infobox",38,
{ name = translate("infobox",39,
{ name = translate("infobox",40,
{ name = teamname or translate("infobox",28,
{ name = translate("infobox",37,
{ name = translate("infobox",41,
{ name = translate("infobox",42,
}
Line 7.371 ⟶ 7.331:
local label, section_title
if sOrdinal == "0" then
label, section_title = translate("func_prologue"
else
label, section_title = stageLink(sOrdinal, sNumber, sLetter)
Line 7.386 ⟶ 7.346:
if ii==1 then jerseytable[v.QID]='' end
end
winner(
if ii
jerseytable, bgcolortable=winnerjersey(stageID, jerseytable)
end
Line 7.408 ⟶ 7.368:
end
columntable[v.QID].used=true
if ii
end
end
Line 7.431 ⟶ 7.389:
somewinner = false
jerseytable, bgcolortable=winnerjersey(raceID, jerseytable)
winner(
for _, v in pairs(winnersgen) do
if win[v.QID] and win[v.QID] ~= '' then
Line 7.463 ⟶ 7.421:
end
end
table.insert(stageinfotable,{sLink=translate("listofstagesclassification",2,
--build the table
Line 7.474 ⟶ 7.432:
tRow:tag('th'):css('white-space','nowrap')
:wikitext(((not WDlink_on and wdLink(string.gsub(raceID, '%s', '') .. "#P527")) or "")..
translate("headoftable",1,
if displaytypeofstage==true then tRow:tag('th') end
Line 7.522 ⟶ 7.480:
tCell=tRow:tag('td')
if ii~=#stageinfotable and v.somewinner==true then
tCell:wikitext(translate("listofstagesclassification",1,
elseif ii~=#stageinfotable then
--empty
elseif v.somewinner==true then --general row
tCell:cssText('border-top: 2px black solid')
:wikitext(translate("listofstagesclassification",1,
else
tCell:cssText('border-top: 2px black solid') --empty
Line 7.540 ⟶ 7.498:
--M) Start list
function p.startlist(frame)
local IDtemp
if frame.args[1] ~= nil then
IDtemp=string.gsub(frame.args[1], "%c", "")
end
local womenrace_bool=isWomenrace(IDtemp)
local s = {
header_function = "startlist",
header_1 = 1, -- translation 1 in function victories is printed in the upper part of the table header
header_2 = {2, 3,4,5},
item=
title="Start list",
data_sort_type={'unsortable', 'unsortable', 'unsortable'},
property ='P710',
no_roll_startlist=no_roll_startlist,
womenrace_bool=womenrace_bool
}
Line 7.560 ⟶ 7.520:
function p.startlisttable(frame)
local IDtemp
if frame.args[1] ~= nil then
IDtemp=string.gsub(frame.args[1], "%c", "")
end
local womenrace_bool=isWomenrace(IDtemp)
local s = {
Line 7.567 ⟶ 7.530:
header_1 = 1, -- translation 1 in function victories is printed in the upper part of the table header
header_2 = {2, 3,4,5},-- translations 2, 3, 4, 5, 6 in function victories are printed in this order
item=
title="Start list", -- in the lower part of the table header. The second value 3 in {4, 3} tells where the icon will go.
no_country ={'fr'},
Line 7.573 ⟶ 7.536:
property ='P710',
no_roll_startlist=no_roll_startlist,
womenrace_bool=womenrace_bool
}
return startlisttable_main(s, tableA(s))
end
local function startlist_sub(p710, timeOfRace, WDlink_on, istable,
local h, resultTable= {}, {}
local tBody = '' --row in our case
local riderID, riderTeamLink, riderTeamID, riderDossard, riderLink, riderRank
Line 7.604 ⟶ 7.565:
if q and q.P1534 and q.P1534[1].snaktype == 'value' then
local dnf=q.P1534[1].datavalue.value.id
if dnf=='Q1210380' then riderDNF =translate("startlist",6,
elseif dnf=='Q54881674' or dnf=='Q7113430' then riderDNF =translate("startlist",7,
elseif dnf=='Q1210382' then riderDNF =translate("startlist",8,
elseif dnf=='Q1229261' then riderDNF =translate("startlist",9,
else riderDNF=''
end
Line 7.652 ⟶ 7.613:
end
riderTeamLink, riderTeamID, catID, countryID, national_team_boolean = getTeam(riderID, timeOfRace, q)
riderTeamID=seasonToTeamID(riderTeamID)
riderTeamCode= getTeamCode(riderID, timeOfRace, q)
--Custom display for national selection
if
if riderTeamCode and wikibase.getSitelink(countryID) then --for the refugee case
riderTeamCode='[['..wikibase.getSitelink(countryID)..'|'..riderTeamCode..']]'
Line 7.667 ⟶ 7.628:
riderLink =riderLink..jerseytemp
if riderTeamLink == nil then riderTeamLink ="" end
local sortkey = riderDossard == "" and 0 or tonumber(riderDossard)
Line 7.676 ⟶ 7.638:
if wiki == "ar" then td_css = "text-align:right;padding:0 0.5em" end
if istable then
tBody:tag('td'):cssText(td_css):wikitext(riderTeamLink
end
tBody:tag('td'):cssText('text-align:'..textalign.. ';padding:0 0.5em;'..DSQ):wikitext(number(gender,riderRank,wiki)..riderDNF)
table.insert(resultTable, {sortkey=sortkey, riderTeamLink=riderTeamLink,riderTeamID=riderTeamID,riderTeamCode=riderTeamCode, tBody=tBody})
return resultTable
end
Line 7.690 ⟶ 7.652:
local timeOfRace=getTimeOfRace(s.item)
local
for _,p286 in statements(s.item, 'P286') do--look for DS
DSID = p286.mainsnak.datavalue.value.id
DSLink= getRiderLink(DSID, timeOfRace)
q= p286.qualifiers
if q.
DSteamID=q.P642[1].datavalue.value.id
DSteamID=seasonToTeamID(DSteamID)
end
table.insert(DStable, {DSLink=DSLink, DSteamID=DSteamID})
end
for _, p710 in statements(s.item, 'P710') do -- P710 is participants
ridertable[#ridertable + 1] = {
subtable[1].sortkey,
riderTeamLink=subtable[1].riderTeamLink,
riderTeamID=subtable[1].riderTeamID,
riderTeamCode=subtable[1].riderTeamCode,
tBody=subtable[1].tBody
}
end
--sort
table.sort(ridertable, function(a,
local thisTableRow, thisTeamTable, thisDS, insideTable, test
local tSubtitle, tTitle
Line 7.723 ⟶ 7.686:
tSubtitle:tag('td'):attr('width','30px')
:css("align:right;text-align:right")
:wikitext(translate("startlist",2,
tSubtitle:tag('td'):attr('width','200px')
:css("align:right;text-align:right")
:wikitext(translate("startlist",3,
tSubtitle:tag('td'):attr('width','85px')
:css("align:right;text-align:right")
:wikitext(translate("startlist",4,
else
tSubtitle=mw.html.create('tr')
tSubtitle:tag('td'):attr('width','30px'):wikitext(translate("startlist",2,
tSubtitle:tag('td'):attr('width','250px'):wikitext(translate("startlist",3,
tSubtitle:tag('td'):attr('width','35px'):wikitext(translate("startlist",4,
end
Line 7.745 ⟶ 7.708:
else
for ii=1,#ridertable do
if ridertable[ii].riderTeamLink==nil then ridertable[ii].riderTeamLink=translate("startlist",13,womenrace_bool) end
if
--new team
if test==1 or ii==1 then
if thisDS and ii~=1 then
tDS=insideTable:tag('tr')
tDS:tag('td'):attr('colspan','3'):attr('align','center')
:wikitext(translate("startlist",5,
thisDS=nil
end
Line 7.776 ⟶ 7.741:
:attr('align','center')
local tCell=tTitle:tag('th'):attr('colspan','3')
tCell:tag('big'):wikitext
insideTable:node(tTitle)
Line 7.793 ⟶ 7.758:
end
end
insideTable:node(ridertable[ii].tBody)
end
--last DS
Line 7.800 ⟶ 7.764:
tDS=insideTable:tag('tr')
tDS:tag('td'):attr('colspan','3'):attr('align','center')
:wikitext(translate("startlist",5,
end
tag:node(thisTableRow)
Line 7.807 ⟶ 7.771:
end
end
function startlisttable_main(s, resultTable)
Line 7.834 ⟶ 7.779:
for _, p710 in statements(s.item, 'P710') do -- P710 is participants
t_Body[#t_Body + 1] = {subtable[1].sortkey, tostring(subtable[1].tBody)}
end
return sortAndConcat(t_Body, resultTable)
end
Line 7.852 ⟶ 7.797:
function p.riderranking(frame)
local s = {
item = string.gsub(frame.args[1] or frame:getParent().args[1], "%c", ""),
}
return riderranking_main(frame, s)
end
function riderranking_main(frame,s)
local thisCompetition, rank, thisyear, sitelink, q, gender, DSQ
local resultTable, listofcalendar, UCImaster, UCImasterlimist={},{},{},{}
local minmaxyear= {
minimum = 0, -- lots of jerseyID
maximum = 0 -- points, time, time_gap, speed
}
local calendarlistpresent={
["UCIwomen"]=false,
["UCImen"]=false
}
local UCI = {}
--inverse the table
for k,v in pairs(data.UCIYearToQ) do
for kk, vv in pairs(v) do
end
end
local UCImaster=data.UCImaster
local gender=getGenderCode(s.item, 'm')
local
if gender=="f" then
UCImastername={
["women"]= translate("riderranking",2,womenrace_bool),
['WWT']= translate("riderranking",3,womenrace_bool),
['WWC']= translate("riderranking",4,womenrace_bool),
["UWT"]= translate("riderranking",5,womenrace_bool),
["europe"]= translate("riderranking",6,womenrace_bool),
["asia"]= translate("riderranking",7,womenrace_bool),
["oceania"]=translate("riderranking",8,womenrace_bool),
["america"]=translate("riderranking",9,womenrace_bool) ,
["africa"]= translate("riderranking",10,womenrace_bool),
["WR"]= translate("riderranking",11,womenrace_bool),
["WC"]= translate("riderranking",12,womenrace_bool),
["UPT"]= translate("riderranking",13,womenrace_bool), --WC is world calendar here
["UCImen"]= translate("riderranking",14,womenrace_bool),
["WCmen"]= translate("riderranking",15,womenrace_bool), --UCImen = UCI ranking 1984-2004, WC= World cup men
["Pernod"]= translate("riderranking",16,womenrace_bool),
["Desgrange"]=translate("riderranking",17,womenrace_bool),
}
UCImasterlimit={
["women"]= {b=1989, e=0}, --women=Calendrier international féminin UCI, begin/end 0 = no end
["WWT"]= {b=2016, e=0},
["WWC"]= {b=1998, e=2015},
["UWT"]= {b=2011, e=2018},
["europe"]= {b=2005, e=0},
["asia"]= {b=2005, e=0},
["oceania"]={b=2005, e=0},
["america"]={b=2005, e=0},
["africa"]= {b=2005, e=0},
["WR"]= {b=2016, e=0},
["WC"]= {b=2009, e=2010},
["UPT"]= {b=2005, e=2008},
["UCImen"]= {b=1984, e=2004},
["WCmen"]= {b=1989, e=2004},
["Pernod"]= {b=1959, e=1987},
["Desgrange"]= {b=1948, e=1958},
}
local listofwomencalendar={"women","WWC", "WWT"} --"women" is in fact UCIwomen
local listofmencalendar={"Desgrange","Pernod","UCImen","WCmen","UPT",
"WC","UWT","WR","europe","asia","america","oceania","africa","Pro"}
if gender=="f" then
listofcalendar=listofwomencalendar
else
listofcalendar=listofmencalendar
end
--init table
for ii=1900,2100,1 do
resultTable[tostring(ii)]={}
for _, calendar in pairs(listofcalendar) do
resultTable[tostring(ii)][calendar]={
rank=nil,
sitelink=nil
}
end
end
Line 7.928 ⟶ 7.892:
for _, p1344 in statements(s.item, 'P1344') do
thisCompetition = p1344.mainsnak.datavalue.value.id
for _, calendar in pairs(listofcalendar) do
if
thisyear=
minmaxyear=checkminmaxyear(minmaxyear,thisyear)
q = p1344.qualifiers
if q and q.P1352 and q.P1352[1].snaktype == 'value' then --rank
else
rank= nil
end
if rank then
resultTable[thisyear][calendar]["rank"]=tostring(rank)
resultTable[thisyear][calendar]["DSQ"]=DSQ or ""
calendarlistpresent[calendar]=true
sitelink=mw.wikibase.getSitelink(thisCompetition)
Line 7.952 ⟶ 7.923:
local tRow= finalTable:tag('tr'):tag('th')
:css("background-color",backgroundColor)
:wikitext(wdLin..' '..translate("riderranking",1,
for ii=minmaxyear.minimum,minmaxyear.maximum,1 do
Line 7.964 ⟶ 7.935:
for _, calendar in pairs(listofcalendar) do
if calendarlistpresent[calendar] then
sitelink=mw.wikibase.getSitelink(
local tRow=finalTable:tag('tr')
local tCell = tRow:tag('th'):cssText("text-align:" .. textalign .. ";") -- left
if sitelink then
tCell:wikitext('[['..sitelink..'|'..
else
tCell:wikitext(
end
Line 7.977 ⟶ 7.947:
thisyear=tostring(yy)
color="white"
if resultTable[ thisyear][calendar]["rank"] then
if resultTable[thisyear][calendar]["rank"]=="1" then
color="gold"
elseif (2<=tonumber(resultTable[thisyear][calendar]["rank"])) and (tonumber(resultTable[thisyear][calendar]["rank"])<=3) then
color="YellowGreen"
elseif (4<=tonumber(resultTable[thisyear][calendar]["rank"])) and (tonumber(resultTable[thisyear][calendar]["rank"])<=10) then
end
local rank=tonumber(resultTable[thisyear][calendar]["rank"])
rank=number(gender,rank,wiki)
if resultTable[thisyear][calendar]["sitelink"] then
tCell:wikitext('[['..resultTable[thisyear][calendar]["sitelink"]..'|'..rank..']]')
else
tCell:wikitext(rank)
end
--this ranking exist for this year, but the rider is not ranked
elseif yy>=
(
if wiki=="fr" then
tRow:tag('td'):wikitext(' nc ')
Line 8.038 ⟶ 7.979:
end
end
local UCIlink, legend
if wiki=="fr" then
UCIlink="https://www.uci.org/fr/route/classements"
legend= " Légende : nc = non classé"
else
UCIlink="https://www.uci.org/road/rankings"
legend=""
end
local tableyearsize=minmaxyear.maximum-minmaxyear.minimum+2
finalTable:tag('tr'):tag('td'):addClass("navigation-only")
Line 8.052 ⟶ 8.001:
:wikitext(legend)
tCell:tag('span'):css("float","right")
:wikitext(translate("race_reference", 1,
return finalTable
end
end
Line 8.259 ⟶ 8.050:
local riderteam={}
local stagiaire
for ii, p54 in statements(itemID, PID) do --itemID loaded in presentTeam
Line 8.317 ⟶ 8.071:
end
end
return riderteam
end
Line 8.353 ⟶ 8.107:
if managedTeam then
cat=
else
cat=
end
Line 8.582 ⟶ 8.336:
local function listOfManagedTeamTable(itemID, initialYear,finalYear)
local managedTeamRider
if not managedTeamRider then
return nil, nil
Line 8.595 ⟶ 8.349:
local function listOfTeamTable(itemID, initialYear,finalYear)
local teamRider
if not teamRider then
return nil, nil
Line 8.611 ⟶ 8.365:
end
local birthDate=firstValue(entityID, 'P569', 'time')
local deathDate=firstValue(entityID, 'P570', 'time')
Line 8.617 ⟶ 8.371:
local gender=getGenderCode(entityID, 'm')
local
if gender=="f" then
if birthDate then
Line 8.630 ⟶ 8.384:
local ans
if gen_singular then
ans=translate("riderinfobox",48,
elseif gen_plural then
ans=translate("riderinfobox",49,
else
ans=translate("riderinfobox",50,
end
Line 8.658 ⟶ 8.412:
local ans
if gen_singular then
ans=translate("riderinfobox",48,
elseif gen_plural then
ans=translate("riderinfobox",49,
else
ans=translate("riderinfobox",50,
end
if display_age==false then
Line 8.699 ⟶ 8.453:
teamLinkRoad=teamLink
elseif dis=='mountainBike' then
row=teamLink..' (
elseif dis=='cycloCross' then
row=teamLink..' (
else
row=teamLink..' (
end
if row then
Line 8.746 ⟶ 8.500:
--for wikidata input
if teamAmateur and #teamAmateur>0 then
if #teamAmateur==1 then
Line 8.761 ⟶ 8.515:
end
if v['stagiaire'] then
local stagiaire = string.gsub(
nametemp=nametemp..' ('..stagiaire..')'
end
Line 8.770 ⟶ 8.524:
--for local data
if names then
names = mw.text.split(names, '<br />')
Line 8.787 ⟶ 8.541:
function p.riderinfobox(frame)
local frame = frame
local lang = contentLanguage
-- If true, winners will have Wikidata logos with link to Wikidata
local WDlink_on = (wiki == "mk" or wiki == "ja")
local localframe
if string.match(frame:getParent():getTitle(), '%P+') == mw.site.namespaces.Template.name then
localframe = frame:getParent()
else
localframe = frame
end
local entityID = mw.text.trim(frame.args[1])
if type(entityID) ~= 'string' then error('parameter must be a string') end
if not entityID:match('Q%d+') then error('parameter must be a valid Wikidata item (ex: Q42)') end
local gender=getGenderCode(entityID, 'm')
local
if gender=="f" then
local details = {
{ name = translate("riderinfobox",1,
{ name = translate("riderinfobox",3,
{ name = translate("riderinfobox",5,
{ name = translate("riderinfobox",7,
{ name = translate("riderinfobox",9,
{ name = translate("riderinfobox",10,
{ name = translate("riderinfobox",11,
{ name = translate("riderinfobox",13,
{ name = translate("riderinfobox",15,
{ name = translate("riderinfobox",17,
{ name = translate("riderinfobox",18,
{ name = translate("riderinfobox",19,
{ name = translate("riderinfobox",20,
{ name = translate("riderinfobox",21,
}
local teams = {
{ name = translate("riderinfobox",23,
{ name = translate("riderinfobox",25,
{ name = translate("riderinfobox",26,
{ name = translate("riderinfobox",28,
{ name = translate("riderinfobox",29,
{ name = translate("riderinfobox",31,
{ name = translate("riderinfobox",32,
{ name = translate("riderinfobox",34,
{ name = translate("riderinfobox",35,
{ name = translate("riderinfobox",37,
{ name = translate("riderinfobox",52,
{ name = translate("riderinfobox",54,
}
--separated to have a title
local subtitle = {
{ name = translate("riderinfobox",51,
}
--separated to have a title
local victories = {
{ name = translate("riderinfobox",38,
}
--separated to have a title
local medals = {
{ name = translate("riderinfobox",47,
}
local
{ name = translate("infobox",29,womenrace_bool)}, -- picture
{ name = translate("infobox",30,womenrace_bool)}, -- caption
{ name = translate("infobox",31,womenrace_bool)}, -- map
{ name = 'sectional'}, -- sectional
{ name = translate("infobox",30,womenrace_bool)}, -- caption map
{ name = translate("infobox",30,womenrace_bool)}, -- caption sectional
}
local name = getLabelFallback(entityID, {wikilang, 'en', 'fr', 'de'}) or ''
local display_birthnameastitle=false
Line 8.848 ⟶ 8.624:
if value == wiki then display_birthnameastitle=true end
end
getLocalContent(subtitle,
if not subtitle[1].content and display_birthnameastitle then
Line 8.867 ⟶ 8.643:
infoGetOthers(others, entityID)
getLocalContent(details,
getLocalContent(teams,
getLocalContent(others,
getLocalContent(victories,
getLocalContent(medals,
local listOfBirthNames, listOfNickNames, listOfOfficialNames, listOfShortNames
Line 8.886 ⟶ 8.662:
if value == wiki then display_age=false end
end
-- getSomeNames(details, entityID, 'P1477', 1, display_language) --birthname
--less prio than P1477
getSomeNames(details, entityID, 'P1559', 1, display_language) --birthname, bis
getSomeNames(details, entityID, 'P1448', 3, display_language) --official name
getSomeNames(details, entityID, 'P1813', 4, display_language) --short name
local birth, death, initialYear, finalYear=getBirthDeathDate(entityID, display_age)
Line 8.944 ⟶ 8.705:
--height
if not details[12].content then
details[12].content=getHeight(entityID
end
Line 8.966 ⟶ 8.727:
local proWD=true
local managedWD=true
local teamAmateur,teamPro, teamMountainBike, teamCycloCross, teamTrack=listOfTeamTable(entityID, initialYear, finalYear)
local nationalTeam, managedTeam=listOfManagedTeamTable(entityID, initialYear, finalYear)
Line 9.018 ⟶ 8.778:
end
infoFillOthersDetails(tab, others, details,translate("riderinfobox",55,
if amateurWD then
teamTable(tab, teamAmateur, translate("riderinfobox",26,
else
localTeamTable(tab,amateurTeam_names, amateurTeam_periods, translate("riderinfobox",26,
localTeamTable(tab,nonUCITeam_names, nonUCITeam_periods, translate("riderinfobox",29,
end
if proWD then
teamTable(tab, teamPro, translate("riderinfobox",45,
teamTable(tab, teamMountainBike, translate("riderinfobox",39,
teamTable(tab, teamCycloCross, translate("riderinfobox",41,
teamTable(tab, teamTrack, translate("riderinfobox",43,
else
localTeamTable(tab,proTeam_names, proTeam_periods,translate("riderinfobox",45,
localTeamTable(tab,UCITeam_names, UCITeam_periods, translate("riderinfobox",35,
end
--managed teams
if managedWD then
teamTable(tab, nationalTeam, translate("riderinfobox",52,
teamTable(tab, managedTeam, translate("riderinfobox",23,
else
localTeamTable(tab,managedTeam_names, managedTeam_periods,translate("riderinfobox",23,
end
if victories[1].content then
tab:node(addATitle(translate("riderinfobox",38,
tab:tag('tr'):tag('td')
:css('vertical-align','top'):attr('colspan','2')
Line 9.052 ⟶ 8.812:
if medals[1].content then
tab:node(addATitle(translate("riderinfobox",47,
tab:tag('tr'):tag('td')
:css('vertical-align','top'):attr('colspan','2')
:wikitext(medals[1].content)
end
wdDoc(tab, "d:Wikidata:WikiProject Cycling/Documentation/riderinfobox", translate("raceinfobox",26,
return tab
end
--=== P) Team infobox
function p.teaminfobox(frame)
localframe = frame
local lang = contentLanguage
-- If true, winners will have Wikidata logos with link to Wikidata
local WDlink_on = (wiki == "mk" or wiki == "ja")
local entityID
if type(entityID) ~= 'string' then error('parameter must be a string') end
if not entityID:match('Q%d+') then error('parameter must be a valid Wikidata item (ex: Q42)') end
local womenrace_bool=isWomenrace(entityID)
local tRace = {race={
Line 9.263 ⟶ 8.838:
future,
},
lastEditionMonth,
lastEditionYear,
numberOfEditions,
lastLink,
nextLink,
}
local details = {
{ name = translate("teaminfobox",2,
{ name = translate("teaminfobox",3,
{ name = translate("teaminfobox",5,
{ name = translate("teaminfobox",7,
{ name = translate("teaminfobox",9,
{ name = translate("teaminfobox",10,
{ name = translate("teaminfobox",11,
{ name = translate("teaminfobox",13,
{ name = translate("teaminfobox",
{ name = translate("teaminfobox",
}
local others =
{ name = translate("infobox",29,womenrace_bool)}, -- picture
{ name = translate("
{ name = translate("
{ name = 'sectional'}, -- sectional
{ name = translate("infobox",30,womenrace_bool)}, -- caption map
{ name = translate("infobox",30,womenrace_bool)}, -- caption sectional
}
local
{ name = translate("teaminfobox",14,
{ name = translate("teaminfobox",16,
}
local name = getLabelFallback(entityID, {wikilang,
infoGetOthers(others, entityID)
local localframe
if string.match(frame:getParent():getTitle(), '%P+') == mw.site.namespaces.Template.name then
localframe = frame:getParent()
else
localframe = frame
end
getLocalContent(details, localframe.args)
getLocalContent(others, localframe.args)
getLocalContent(managers, localframe.args)
local listOfNames=getFormerNames(entityID, 'P1448')
Line 9.328 ⟶ 8.911:
--creation date
if not details[5].content and creation then
details[5].content = funcDate(creation, "
end
Line 9.334 ⟶ 8.917:
local disparition=firstValue(entityID, 'P576', 'time')
if not details[6].content and disparition then
details[6].content = funcDate(disparition,"
end
--populate tRace
listOfWinners(entityID, tRace,true
-- number of season
if not details[7].content and tRace.numberOfEditions and tRace.lastEditionYear then
details[7].content = tostring(tRace.numberOfEditions).." (" .. translate("teaminfobox",12,
end
Line 9.350 ⟶ 8.933:
end
--9 is
--10 budget
listWPlinkChrono(details, 10, entityID, {'P2769'}, 'money', initialYear)
-- manager
Line 9.374 ⟶ 8.953:
end
--picture at the top
infoFillOthersDetails(tab, others, details, translate("teaminfobox",1,
if managers[1].content or managers[2].content then
tab:node(addATitle(translate("teaminfobox",18,
for _, row in ipairs(managers) do
tab:node(addARow(row.name, row.content)) --node check itself if nil
Line 9.384 ⟶ 8.963:
if listOfNames and #listOfNames>0 then --Always display a list of names
tab:node(addATitle(translate("teaminfobox",19,
for _, v in pairs(listOfNames) do
tab:node(addARow(v[2],v[3])) --period, name
Line 9.391 ⟶ 8.970:
-- an empty line with a title under the form in the form of an image or third-party template
if
tab:node(addATitle(translate("teaminfobox",20,
local outTable = mw.html.create('tr')
local tCell=outTable:tag('td'):attr('colspan','3'):css('text-align','center')
tCell:wikitext(
tab:node(outTable)
end
-- adding a link to articles about the last and current seasons (the same as for the race)
if tRace.
tab:node(addATitle(translate("teaminfobox",21,womenrace_bool)))
local outTable
if tRace.lastLink then
outTable = mw.html.create('tr')
local tCell=outTable:tag('td'):attr('colspan','2'):css('text-align','center')
local lastText="[[File:Crystal Clear app kworldclock.png|left|37px]]"..
translate("teaminfobox",22,
":<br>'''"..
tRace.lastLink.."'''"
Line 9.433 ⟶ 8.998:
local tCell=outTable:tag('td'):attr('colspan','2'):css('text-align','center')
local nextText = "[[File:Crystal Clear app kworldclock.png|left|37px]]"..
translate("teaminfobox",23,
":<br>'''"..
tRace.nextLink.."'''"
Line 9.441 ⟶ 9.006:
end
wdDoc(tab, "d:Wikidata:WikiProject Cycling/Documentation/raceinfobox", translate("raceinfobox",26,
return tab
end
Line 9.634 ⟶ 9.055:
end
elseif function_name=='getTeamLinkCat' then
temp=getTeamLinkCat(argu[2],argu[3],toboolean(argu[4]),toboolean(argu[5]))
if temp then return temp else return 'nil' end
elseif function_name=='getPlaceLink' then
if argu[3]=="nil" then arg3=nil else arg3=argu[3] end
Line 9.677 ⟶ 9.095:
elseif function_name=='isWomenrace' then
return tostring(isWomenrace(argu[2]))
elseif function_name=='commaStage' then
temp =commaStage(argu[2],argu[3])
Line 9.765 ⟶ 9.181:
elseif function_name=='getNationality' then
return getNationality(argu[2], argu[3])
elseif function_name=='
return
end
end
Line 9.788 ⟶ 9.192:
if function_name=='class_dic' then
return tostring(
elseif function_name=="class_sort" then
return tostring(
elseif function_name=='bg_color_table' then
local temp =
temp=string.gsub(temp,'#',"")
return temp
|