Modul:Cycling race: Forskelle mellem versioner

Content deleted Content added
function new_classification: No country header in table if not shown.
No edit summary
Linje 4:
wiki = "fr"
end
 
local contentLanguage = mw.getContentLanguage()
local wikilang = contentLanguage:getCode()
Line 357 ⟶ 358:
local y, m = string.match(sTime, "(%d+)-(%d+)-%d+")
local y2, m2 = string.match(eTime, "(%d+)-(%d+)-%d+")
if y ~= y2 then
if modem=='long00' then --manage the 30 November issue
if mode=='long' then
starttime = lang:formatDate( "j F Y", sTime )
starttime =lang:formatDate( "Y", sTime )
else
starttime = lang:formatDate( "j M Y", sTime )'-'
end
elseif m ~= m2 then
if mode=='long' then
starttime = lang:formatDate( "j F", sTime )
else
starttime = lang:formatDate( "j M", sTime )
end
else
starttime = lang:formatDate( "j", sTime )
end
 
if wiki == "ar" then
if y ~= y2 then starttime = lang:formatDate( "d F Y", sTime )
elseif m ~= m2 then starttime = lang:formatDate( "d F", sTime )
else starttime = lang:formatDate( "d ", sTime ) end
elseif wiki == "br" then
if y ~= y2 then starttime = lang:formatDate( "j", sTime ) .." a viz ".. lang:formatDate( "F Y", sTime )
elseif m ~= m2 then starttime = lang:formatDate( "j", sTime ) .." a viz ".. lang:formatDate( "F", sTime )
else starttime = lang:formatDate( "j", sTime ) .." "
end
elseif wiki == "ca" or wiki == "es" or wiki == "ast" then
if y ~= y2 then
if mode=='long' then
starttime = lang:formatDate( "j", sTime ) .." de ".. lang:formatDate( "F", sTime ) .." de ".. lang:formatDate( "Y", sTime )
starttime = lang:formatDate( "j F Y", sTime )
else
starttime = lang:formatDate( "j M Y", sTime )
end
elseif m ~= m2 then
if mode=='long' then
starttime = lang:formatDate( "j", sTime ) .." de ".. lang:formatDate( "F", sTime )
else starttime = lang:formatDate( "j F", sTime ) .." "
else
starttime = lang:formatDate( "j M", sTime )
end
else
starttime = lang:formatDate( "j", sTime )
end
elseif wiki == "cs" then
if wiki == "ar" then
if y ~= y2 then starttime = lang:formatDate( "j.d xgF Y", sTime )
elseif m ~= m2 then starttime = lang:formatDate( "j.d xgF", sTime )
else starttime = lang:formatDate( "jd ", sTime ) end
elseif wiki == "br" then
end
if y ~= y2 then starttime = lang:formatDate( "j", sTime ) .." a viz ".. lang:formatDate( "F Y", sTime )
elseif wiki == "de" or wiki == "da" or wiki == "fo" or wiki == "no" then
if elseif ym ~= y2m2 then starttime = lang:formatDate( "j", sTime ) .." Fa Yviz ".. lang:formatDate( "F", sTime )
elseif m ~= m2 then else starttime = lang:formatDate( "j. F", sTime ) .." "
end
else starttime = lang:formatDate( "j.", sTime )
elseif wiki == "ca" or wiki == "es" or wiki == "ast" then
end
elseif if wikiy =~= "fi"y2 then
if y ~= y2 then starttime = lang:formatDate( '"j", sTime ) .." de ".. lang:formatDate( "F"ta, sTime ) .." de ".. lang:formatDate( "Y'", sTime )
elseif m ~= m2 then starttime = lang:formatDate( 'j. F"ta"', sTime )
else starttime = lang:formatDate( "j", sTime ) .." de ".. lang:formatDate( "F", sTime )
else starttime = lang:formatDate( "j", sTime ) .." "
end
end
elseif wiki == "eo" then
elseif wiki == "cs" then
if y ~= y2 then starttime = lang:formatDate( "j", sTime ) .."-a de ".. lang:formatDate( "F Y", sTime )
elseif if my ~= m2y2 then starttime = lang:formatDate( "j. xg Y", sTime )
elseif .."-am de~= "..m2 then starttime = lang:formatDate( "Fj. xg", sTime )
else starttime = lang:formatDate( "j", sTime ) .."-a "
end
elseif wiki == "eude" or wiki == "da" or wiki == "fo" or wiki == "no" then
if y ~= y2 then starttime = lang:formatDate( "j. F Y", sTime )
elseif ..".ekom "..~= m2 then starttime = lang:formatDate( "j. F", sTime )
else .."kstarttime "..= lang:formatDate( "j.", sTime )
end
elseif m ~= m2 then starttime = lang:formatDate( "F", sTime ) .."k ".. lang:formatDate( "j", sTime )
elseif wiki == "fi" then
else starttime = lang:formatDate( "F", sTime ) .."k ".. lang:formatDate( "j", sTime )
if y ~= y2 then starttime = lang:formatDate( 'j. F"ta" Y', sTime )
end
elseif m ~= m2 then starttime = lang:formatDate( 'j. F"ta"', sTime )
elseif wiki == "hu" then
else starttime = lang:formatDate( "Y. F j.", sTime )
end
elseif wiki == "ja" then
elseif wiki == "eo" then
if y ~= y2 then starttime = lang:formatDate( "Y年m月d日", sTime )
elseif if my ~= m2y2 then starttime = lang:formatDate( "j", sTime ) .."-a de ".. lang:formatDate( "F Y年m月d日", sTime )
else elseif m ~= m2 then starttime = lang:formatDate( "Y年m月d日j", sTime ) .."-a de ".. lang:formatDate( "F", sTime )
else starttime = lang:formatDate( "j", sTime ) .."-a "
end
end
elseif wiki == "lv" then
elseif wiki == "eu" then
if m ~= m2 then starttime = lang:formatDate( "Y. \\g\\a\\d\\a j. F", sTime )
else if y ~= y2 then starttime = lang:formatDate( "Y", sTime ) ..".eko \\g\\a\\d\\a".. lang:formatDate( "F", sTime ) j.."k ".. lang:formatDate( "j", sTime )
elseif m ~= m2 then starttime = lang:formatDate( "F", sTime ) .."k ".. lang:formatDate( "j", sTime )
end
else starttime = lang:formatDate( "F", sTime ) .."k ".. lang:formatDate( "j", sTime )
elseif wiki == "pl" then
end
local date_pl = {"stycznia", "lutego", "marca", "kwietnia", "maja", "czerwca", "lipca", "sierpnia", "września", "października", "listopada", "grudnia"}
elseif wiki == "hu" then
if y ~= y2 then starttime = lang:formatDate( "j ", sTime ) .. date_pl[tonumber(lang:formatDate( "n", sTime ))] .. lang:formatDate( " Y", sTime )
elseif m ~= m2 then starttime = lang:formatDate( "jY. ", sTime )F j.. date_pl[tonumber(lang:formatDate( "n", sTime ))]
elseif wiki == "ja" then
else starttime = lang:formatDate( "j", sTime )
if y ~= y2 then starttime = lang:formatDate( "Y年m月d日", sTime )
elseif m ~= m2 then starttime = lang:formatDate( "Y年m月d日", sTime )
else starttime = lang:formatDate( "Y年m月d日", sTime )
end
elseif wiki == "lv" then
if m ~= m2 then starttime = lang:formatDate( "Y. \\g\\a\\d\\a j. F", sTime )
else starttime = lang:formatDate( "Y. \\g\\a\\d\\a j.", sTime )
end
elseif wiki == "pl" then
local date_pl = {"stycznia", "lutego", "marca", "kwietnia", "maja", "czerwca", "lipca", "sierpnia", "września", "października", "listopada", "grudnia"}
if y ~= y2 then starttime = lang:formatDate( "j ", sTime ) .. date_pl[tonumber(lang:formatDate( "n", sTime ))] .. lang:formatDate( " Y", sTime )
elseif m ~= m2 then starttime = lang:formatDate( "j ", sTime ) .. date_pl[tonumber(lang:formatDate( "n", sTime ))]
else starttime = lang:formatDate( "j", sTime )
end
end
end
 
if modem2=='long00' orthen y--manage ~=the y230 thenNovember issue
if mode=='long' then
endtime = lang:formatDate("j F Y", eTime)
endtime= lang:formatDate( "Y", eTime )
else
endtime = lang:formatDate("j M", eTime)
end
if wiki == "ar" then
if mode=='long' or y ~= y2 then endtime = lang:formatDate( "d F Y", eTime )
elseif m ~= m2 then endtime = lang:formatDate( "d F Y", eTime )
else endtime = lang:formatDate( "d F Y", eTime )
end
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' or y ~= y2 then
endtime = lang:formatDate( "j", eTime ) .." de "..
lang:formatDate( "F", eTime ) .." de ".. lang:formatDate( "Y", eTime )
else
endtime = lang:formatDate( "j", eTime ) .." de "..'-'
lang:formatDate( "F", eTime )
end
else
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 == "no" then
if mode=='long' or y ~= y2 then
endtime = lang:formatDate( "j. F Y", eTime )
else
endtime = lang:formatDate( "j. M", eTime )
end
if wiki == "ar" then
elseif wiki == "eo" then endtime = lang:formatDate( "j", eTime ) .."-a de ".. lang:formatDate( "F Y", eTime )
elseif wiki if mode=='long' "eu"or y ~= y2 then endtime = lang:formatDate( "Y",d eTimeF ) ..".eko ".. lang:formatDate( "FY", eTime ) .."k "..
elseif m ~= m2 then endtime = lang:formatDate( "jd F Y", eTime )
elseif wiki == "fi" then else endtime = lang:formatDate('j F"ta"d F Y'", eTime )
end
elseif wiki == "hu" then
ifelseif ywiki ~== y2"br" then endtime = lang:formatDate( "Yj", eTime ) .." Fa jviz ".. lang:formatDate( "F Y", eTime )
elseif mwiki ~== m2"ca" thenor endtimewiki = lang:formatDate(= "F j.es", eTimeor )wiki == "ast" then
if mode=='long' or y ~= y2 then
else endtime = lang:formatDate( "j.", eTime )
endtime = lang:formatDate( "j", eTime ) .." de "..
end
--endtime = lang:formatDate( "YF", eTime ) ..". de ".. lang:formatDate( "F jY", eTime ) .."."
else
elseif wiki == "ja" then
if y ~= y2 then endtime = lang:formatDate( "Y年m月d日j", eTime ) .." de "..
elseif m ~= m2 then endtime = lang:formatDate( "m月d日F", eTime )
end
else endtime = lang:formatDate( "d日", eTime )
elseif wiki == "cs" then endtime = lang:formatDate( "j. xg Y", eTime )
end
elseif wiki == "lvde" or wiki == "da" or wiki == "fi" or wiki == "fo" or wiki == "no" then
if mode=='long' or y ~= y2 then
if y ~= y2 then endtime = lang:formatDate( "Y. \\g\\a\\d\\a j. F", eTime )
else endtime = lang:formatDate( "j. F Y", eTime )
else
endtime = lang:formatDate( "j. M", eTime )
end
elseif wiki == "eo" then endtime = lang:formatDate( "j", eTime ) .."-a de ".. lang:formatDate( "F Y", eTime )
elseif wiki == "eu" then endtime = lang:formatDate( "Y", eTime ) ..".eko ".. lang:formatDate( "F", eTime ) .."k "..
lang:formatDate( "j", eTime )
elseif wiki == "fi" then endtime = lang:formatDate('j F"ta" Y', eTime)
elseif wiki == "hu" then
if y ~= y2 then endtime = lang:formatDate( "Y. F j.", eTime )
elseif m ~= m2 then endtime = lang:formatDate( "F j.", eTime )
else endtime = lang:formatDate( "j.", eTime )
end
--endtime = lang:formatDate( "Y", eTime ) ..". ".. lang:formatDate( "F j", eTime ) .."."
elseif wiki == "ja" then
if y ~= y2 then endtime = lang:formatDate( "Y年m月d日", eTime )
elseif m ~= m2 then endtime = lang:formatDate( "m月d日", eTime )
else endtime = lang:formatDate( "d日", eTime )
end
elseif wiki == "lv" then
if y ~= y2 then endtime = lang:formatDate( "Y. \\g\\a\\d\\a j. F", eTime )
else endtime = lang:formatDate( "j. F", eTime )
end
elseif wiki == "pl" then
local date_pl = {"stycznia", "lutego", "marca", "kwietnia", "maja", "czerwca", "lipca", "sierpnia",
"września", "października", "listopada", "grudnia"}
endtime = lang:formatDate( "j ", eTime ) .. date_pl[tonumber(lang:formatDate( "n", eTime ))] ..
lang:formatDate( " Y", eTime )
end
elseif wiki == "pl" then
local date_pl = {"stycznia", "lutego", "marca", "kwietnia", "maja", "czerwca", "lipca", "sierpnia",
"września", "października", "listopada", "grudnia"}
endtime = lang:formatDate( "j ", eTime ) .. date_pl[tonumber(lang:formatDate( "n", eTime ))] ..
lang:formatDate( " Y", eTime )
end
return starttime, endtime
Line 508 ⟶ 527:
no = { long = 'j. F Y', small = 'j. M', onlyday = 'j.' }, -- copy of de
}
 
local function func_date(date, mode)
-- local date = '+2016-05-20'
-- local mode = 'small'
local format = formats[wiki] or formats['']
if string.sub(date,7,8)=='00' then --manage the 30 November issue
return contentLanguage:formatDate(format[mode], date)
if mode=='long' then
return lang:formatDate( "Y", date )
else
return '-'
end
else
return contentLanguage:formatDate(format[mode], date)
end
end
 
Line 1.372 ⟶ 1.400:
the flag table will be placed in a tracking category. You can use this to find more flags
to add to the table. ]]
-- trackingCategory = '[[Category:Missing flag in Module:Cycling race]]'
 
Line 1.950 ⟶ 1.978:
Sitelink=wikibase.getSitelink(entityID)
prefix=''; postfix='' --general classification
listOfProperty={'P2561','P1448'}
 
Line 3.867 ⟶ 3.895:
end
local tCell=tab:tag('tr'):tag('td'):attr('colspan','2')
:cssText('border-bottom:5px solid white; font-size:175%; background:#FFE7A0FFDF80; text-align:center')
local topTable = tCell:tag('table')
:cssText('width:100%')
Line 5.281 ⟶ 5.309:
 
local function findlastname(label,wiki)
if not label then label = '' end
local _, count = string.gsub(label, " ", " ")
local names
Line 5.327 ⟶ 5.356:
end
end
return names or ''
end
 
Line 5.335 ⟶ 5.364:
local label = wikibase.getLabelByLang(riderID, wiki)
if not label then
label = getLabelFallback(riderID, {'en', 'fr', 'de', 'es'})
return findlastname(label,wiki)
else
Line 5.342 ⟶ 5.371:
return nametable[1]..nametable[2]
else --no coma
return findlastname(label,wiki)
end
end
else
local label = getLabelFallback(riderID, {'en', 'fr', 'de', 'es'})
return findlastname(label,wiki)
end
Line 5.546 ⟶ 5.575:
local i = 1
for _, v in pairs (riderTable) do
sortkey=v[1]
riderName=v[2]
riderBirthday=v[3]
Line 5.564 ⟶ 5.594:
 
if not available_list or wiki == 'lv' then temp=flags..' ' else temp='' end
tCell:wikitext(temp..riderName):attr('data-sort-value',sortkey)
 
if riderStart~=nil or riderEnd~=nil then
tCell:tag('span'):cssText("font-size:80%; color:#686868")
Line 5.572 ⟶ 5.603:
if wiki == "ar" then note = '، [[#tr_'..i..frame.args[1]..'|'..getSquadTableColumn(4)..']]' end
end
tCell:wikitext( ' ('..riderStart..'–'..riderEnd.. (riderPosition or '')..note..')')
elseif riderReason then
tCell:tag('span'):cssText("font-size:80%; color:#686868")
Line 5.627 ⟶ 5.658:
end
if labelMissing then outputTable:wikitext(getMissingLabelTrackingCategory()) end
local UCIlink
if wiki=="fr" then
UCIlink="https://www.uci.org/fr/route/%C3%A9quipe"
else
UCIlink="https://www.uci.org/road/teams"
end
 
outputTable:tag('tr'):tag('td'):addClass("navigation-only")
:attr('data-sort-value','zz')
:attr('colspan',4)
:cssText("border-top: 2px #FFDF80 solid; font-size: 80%;")
:tag('tr')
:tag('td'):attr('colspan',4)
:attr('data-sort-value','zzz')
:cssText("text-align:right")
:tag('small'):wikitext(race_reference_translate(wiki, 1).."["..UCIlink..' UCI]')
return outputTable
Line 5.962 ⟶ 6.010:
local winners = {}
for _, property in ipairs(s.winnersProperty) do winners[property]='' end
local tCell
 
local tRowtCellstr=mw.html.create('tr')
tRow:tag('td'):css('text-align','left'):wikitext(sitelink)
local temp=firstValue(partID, 'P1346','id')
if temp and temp=='Q30108381' then --race cancelled
local cancelledlabel = getLabelFallback('Q30108381', {wikilang, 'en', 'fr', 'de'})
tRow:tagtCell=mw.html.create('td'):attr('colspan','4')
:cssText('text-align:center; font-style: italic')
:wikitext(cancelledlabel)
tCellstr=tostring(tCell)
else
winner(partID, winners, timeOfRace, not s.countryflag, WDlink_on,s.displayteam,true)
for _, property in ipairs(s.winnersProperty) do
tRow:tagtCell=mw.html.create('td'):wikitext(winners[property])
if winners[property]~='' then
thereisawinner=true
if tonumber(year)<firstyeartodisplay then firstyeartodisplay=tonumber(year) end
end
tCellstr= tCellstr..tostring(tCell)
end
end
if firstyeartodisplay<=tonumber(year) then
rows[#rows+1]={year..month, tRowsitelink, tCellstr}
end
end
Line 5.989 ⟶ 6.039:
end
table.sort(rows, function(a, b) return a[1] < b[1] end) -- Sort by year
local clear = "left"
if wiki == "ar" then clear = "right" end
Line 6.008 ⟶ 6.059:
local table_center=''
local nb_year_inrow=1
local lastyear
for i, row in ipairs(rows) do
sitelink=row[2]
 
local tRowWD=mw.html.create('tr')
local tCell=tRowWD:tag('td'):css('text-align','left')
if lastyear and mw.ustring.sub(row[1],1,4)==lastyear then
nb_year_inrow=nb_year_inrow+1
tCell:wikitext(sitelink..' ('..tostring(nb_year_inrow)..')')
else
tCell:wikitext(sitelink)
nb_year_inrow=1
end
lastyear=mw.ustring.sub(row[1],1,4)
tRowWD:node(row[3]) --add the end of the row
if WPcontent.row[i] then
tRow=mw.html.create('tr'):tag('td'):attr('colspan','4')
:css('text-align','center')
tRow:wikitext(WPcontent.row[i])
 
if WPcontent.code[i]==0 then --above
table_center=table_center..tostring(tRow)
table_center=table_center..tostring(row[2]tRowWD)
else --below
table_center=table_center..tostring(row[2]tRowWD)
table_center=table_center..tostring(tRow)
end
else
table_center=table_center..tostring(row[2]tRowWD)
end
end