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 mode=='long' then
starttime =lang:formatDate( "Y", sTime )
else
starttime =
end
else
if y ~= y2 then
if mode=='long' then
starttime = lang:formatDate( "j F Y", sTime )
else
starttime = lang:formatDate( "j M Y", sTime )
end
elseif m ~= m2 then
if mode=='long' then
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( " elseif m ~= m2 then starttime = lang:formatDate( "
else starttime = lang:formatDate( "
elseif wiki == "br" then
if y ~= y2 then starttime = lang:formatDate( "j", sTime ) .." a viz ".. lang:formatDate( "F Y", sTime )
end
elseif wiki == "ca" or wiki == "es" or wiki == "ast" then
elseif m ~= m2 then
else starttime = lang:formatDate( "j", sTime ) .." "
end
elseif wiki == "cs" then
elseif else starttime = lang:formatDate( "j", sTime )
end
if y ~= y2 then starttime = lang:formatDate( "j. F Y", sTime )
elseif else end
elseif wiki == "fi" then
if y ~= y2 then starttime = lang:formatDate( 'j. F"ta" Y', sTime )
elseif m ~= m2 then starttime = lang:formatDate( 'j. F"ta"', sTime )
else starttime = lang:formatDate( "
end
elseif wiki == "eo" then
else starttime = lang:formatDate( "j", sTime ) .."-a "
end
elseif wiki == "eu" then
elseif m ~= m2 then starttime = lang:formatDate( "F", sTime ) .."k ".. lang:formatDate( "j", sTime )
else starttime = lang:formatDate( "F", sTime ) .."k ".. lang:formatDate( "j", sTime )
end
elseif wiki == "hu" then
elseif wiki == "ja" then
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
if mode=='long' then
endtime= lang:formatDate( "Y", eTime )
else
endtime
end
else
if mode=='long' or y ~= y2 then
endtime = lang:formatDate(
else
endtime = lang:formatDate(
end
if wiki == "ar" then
elseif m ~= m2 then endtime = lang:formatDate( "
end
elseif
if mode=='long' or y ~= y2 then
endtime = lang:formatDate( "j", eTime ) .." de "..
else
end
elseif wiki == "cs" then endtime = lang:formatDate( "j. xg Y", eTime )
if mode=='long' or y ~= y2 then
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
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
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:#
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
local temp=firstValue(partID, 'P1346','id')
if temp and temp=='Q30108381' then --race cancelled
local cancelledlabel = getLabelFallback('Q30108381', {wikilang, 'en', 'fr', 'de'})
: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
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,
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(
else --below
table_center=table_center..tostring(
table_center=table_center..tostring(tRow)
end
else
table_center=table_center..tostring(
end
end
|