Модул:Cycling race: Разлика помеѓу преработките
[проверена преработка] | [проверена преработка] |
Избришана содржина Додадена содржина
update |
update |
||
Ред 10:
"Journey origin", "Journey destination", "Teams", "Starting riders", "Arriving riders", "Average speed", "Cost", "Palmares", "Winner", "Second",
"Third", "Points", "Mountains", "Sprints", "Youth", "Combativity", "Combination", "Team"}
l10nDef["//ca.wikipedia.org"] = {"Detalls de la cursa", "Cursa", "
"Sortida", "Arribada", "
"
l10nDef["//de.wikipedia.org"] = {"Einzelheiten", "Ausgabe", "Rennserie", " Wettbewerb", "Etappen", "Datum", "Datum", "Gesamtlänge", "Austragungsland", "Austragungsländer",
"Start", "Ziel", "Teams", "Fahrer am Start", "Fahrer im Ziel", "Geschwindigkeit im Durchschnitt", "Kosten", "Sieger", "Gesamtwertung", "Zweiter",
Ред 25:
"Држава", "Држави", "Поаѓалиште", "Одредиште", "Екипи", "Возачи на почеток", "Возачи на крај", "Просечна брзина", "Трошоци", "Добитници на наградите",
"Победник", "Второпласиран", "Третопласиран", "Бодовен", "Планински", "Спринтерски", "Младински", "Борбеност", "Комбиниран", "Екипен"}
l10nDef["//
"
"derde", "punten", "bergen", "sprints", "jeugd", "aanvalslust", "combinatie", "team"}
l10nDef["//no.wikipedia.org"] = {"Detaljer", "Ritt", "Turnering", "Turneringer", "Etapper", "Dato", "Datoer", "Distanse", "Land", "Land",
"Startby", "Målby", "Lag", "Startende ryttere", "Fullførende ryttere", "Gjennomsnittsfart", "Kostnad", "Resultater", "Vinner", "2. plass", "3. plass",
"Poeng", "Klatre", "Sprint", "Ungdom", "Mest offensive", "Kombinasjon", "Lagkonkurranse"}
l10nDef["//ro.wikipedia.org"] = {"Detalii cursă", "Cursă", "Competiție", "Competiții", "Etape", "Dată", "Date", "Distanță", "Țară", "Țări", "Start", "Sosire",
"Echipe", "Cicliști la start", "Cicliști la sosire", "Viteză medie", "Cost", "Palmares", "
"Cel mai bun cățărător", "Cel mai bun sprinter", "Cel mai bun tânăr", "Combativitate", "Combinat", "Echipă"}
l10nDef["//ru.wikipedia.org"] = {"Детали гонки", "Маршрут", "Соревнование", "Соревнования", "Этапы", "Дата", "Даты", "Дистанция", "Страна", "Страны",
Ред 36 ⟶ 39:
l10nDef["//www.wikidata.org"] = l10nDef["//en.wikipedia.org"]
local l10n = l10nDef[mw.site.server]
if not l10n then l10n = l10nDef["//en.wikipedia.org"] end -- default
return l10n[x]
end
Ред 55 ⟶ 56:
l10nDef["//www.wikidata.org"] = l10nDef["//fr.wikipedia.org"]
local l10n = l10nDef[mw.site.server]
if not l10n then l10n = l10nDef["//en.wikipedia.org"] end -- default
return l10n[x]
end
function property(x) -- This function allows you to overwrite wikidata information
local l10nDef = { }
l10nDef["//fr.wikipedia.org"] = {"image", "légende", "numéro d'édition", "
"longueur", "point de départ", "destination du parcours", "équipes", "nombre de participants au départ", "nombre de participants à l'arrivée", "vitesse", "coût",
"vainqueur du classement général", "deuxième du classement général", "troisième du classement général", "vainqueur du classement par points",
"vainqueur du classement de la montagne", "vainqueur du classement des sprints", "vainqueur du classement du meilleur jeune", "vainqueur du classement de la combativité",
"vainqueur du classement du combiné", "vainqueur du classement de la meilleure équipe"
l10nDef["//en.wikipedia.org"] = {"picture", "caption", "edition number", "
"length", "journey origin", "journey destination", "teams", "number of participants at start", "number of participants at end", "speed", "cost",
"overall winner", "second overall winner", "third overall winner", "winner of the point classification", "winner of the mountain classification",
"winner of the sprint classification", "winner of the young rider classification", "winner of the fighting spirit classification",
"winner of the combination classification", "winner of the team classification"
l10nDef["//www.wikidata.org"] = l10nDef["//fr.wikipedia.org"]
local l10n = l10nDef[mw.site.server]
if not l10n then l10n = l10nDef["//en.wikipedia.org"] end -- default
return l10n[x]
function p.infobox(frame)
local t = {is_a="",
winner_combination="", winner_team="", previous="", next=""}
local tt = {icon="", picture="", caption="", name="", nr="", map="" }
local ttt = {tour={}, country={}}
local entity = ""
local y, m, d = "", "", ""
local y2, m2, d2 = "", "", ""
local snak, snak2, snak3, snak4
local a, b, c, k, num, i
local entityId = frame.args[1]
local lang = mw.language.getContentLanguage()
local
local results = false
local a1, b1, c1, a2, b2, c2
if type( entityId ) ~= 'string' then error( 'parameter must be a string') end
Ред 101 ⟶ 100:
local entity = mw.wikibase.getEntity( entityId )
if frame.args[
if frame.args[
if frame.args[
i = 5
for k in pairs(t) do --t[k], k = startplace, endplace, ...
i = i + 1
end
if entity:getLabel() ~= nil then tt.name = entity:getLabel()
Ред 162 ⟶ 142:
end
end
-- For FR Wiki and Wikidata, exception that permit to display 1er, 2e... for the edition number ;
-- for RU Wiki, -й is written after the value of P393
a, b = pcall(fooA, 'value', entity, 'P393', 1)
if a == true and tt.nr == "" then
tt.nr = b .. ". "
if wiki == "//fr.wikipedia.org" then
if b == 1 then tt.nr = "1<sup>re</sup> " else tt.nr = b .."<sup>e</sup> " end end end
-- Class of a cycling race. Class is: 1.UWT, 2.UWT, 1.HC, ... add new classes, no problem
Ред 182 ⟶ 164:
a, b = pcall(fooA, 'numeric-id', entity, 'P361', 1) -- Competition of the cycling race : UCI World Tour 2016, UCI Europe Tour 2016...
if a == true
for i, v in pairs(entity.claims["P361"]) do
ttt.tour[i] = "T" .. v.mainsnak.datavalue.value["numeric-id"]
end
end
if pcall(function() -- This function count the number of value for P527 to determine the number of stages
Ред 196 ⟶ 175:
) then else t.stage = "" end
if a1 == true and t.starttime == "" then i = 1
while a1 == true and c1 == 'deprecated' do
i = i + 1
a1, b1, c1 = pcall(fooA, 'time', entity, 'P580', i)
end
--b = "+2015-07-04T00:00:00Z"
_, _, y, m, d = string.find(b1, "(%d+)-(%d+)-(%d+)")
end
a2, b2, c2 = pcall(fooA, 'time', entity, 'P582', 1)
if a2 == true and t.endtime == "" then i = 1
while a2 == true and c2 == 'deprecated' do
i = i + 1
a2, b2, c2 = pcall(fooA, 'time', entity, 'P582', i)
end
--d = "+2015-07-05T00:00:00Z"
_, _, y2, m2, d2 = string.find(b2, "(%d+)-(%d+)-(%d+)")
end
if a1 == true and t.starttime == "" then
if y ~= y2 then t.starttime = lang:formatDate( "j F Y", b1 )
elseif m ~= m2 then t.starttime = lang:formatDate( "j F", b1 )
else t.starttime = lang:formatDate( "j", b1 )
end
if wiki == "//de.wikipedia.org" or wiki == "//no.wikipedia.org" then
if y ~= y2 then t.starttime = lang:formatDate( "j. F Y",
elseif m ~= m2 then t.starttime = lang:formatDate( "j. F",
else t.starttime = lang:formatDate( "j.",
end end
if
if y ~= y2 then t.starttime = lang:formatDate( "Y年m月d日",
elseif m ~= m2 then t.starttime = lang:formatDate( "Y年m月d日",
else t.starttime = lang:formatDate( "Y年m月d日",
end end
if
if y ~= y2 then t.starttime = lang:formatDate( "F d, Y",
elseif m ~= m2 then t.starttime = lang:formatDate( "F d",
else t.starttime = lang:formatDate( "F d",
end end
if
if y ~= y2 then t.starttime = lang:formatDate( "Y. j. F",
elseif m ~= m2 then t.starttime = lang:formatDate( "Y. j. F",
else t.starttime = lang:formatDate( "Y. j.",
end end
end -- if a1
if
t.endtime = lang:formatDate( "j
if wiki == "//de.wikipedia.org" or wiki == "//no.wikipedia.org" then
t.endtime = lang:formatDate( "j. F Y",
if
if y ~= y2 then t.endtime = lang:formatDate( "Y年m月d日",
elseif m ~= m2 then t.endtime = lang:formatDate( "m月d日",
else t.endtime = lang:formatDate( "d日",
end end
if
if y ~= y2 then t.endtime = lang:formatDate( "F d, Y",
elseif m ~= m2 then t.endtime = lang:formatDate( "F d, Y",
else t.endtime = lang:formatDate( "d, Y",
end end
if
if y ~= y2 then t.endtime = lang:formatDate( "Y. j. F",
elseif m ~= m2 then t.endtime = lang:formatDate( "j. F",
else t.endtime = lang:formatDate( "j. F",
end end
end -- if a2
while a1 == true and c1 == 'deprecated' do
i = i + 1
a1, b1, c1 = pcall(fooA, 'time', entity, 'P585', i)
end
t.time = lang:formatDate( "j F Y", b1 )
if wiki == "//de.wikipedia.org" or wiki == "//no.wikipedia.org" then
t.time = lang:formatDate( "j. F Y", b1 ) end
if wiki == "//ja.wikipedia.org" then
t.time = lang:formatDate( "Y年m月d日", b1 ) end
if wiki == "//en.wikipedia.org" then
t.time = lang:formatDate( "F d, Y", b1 ) end
if wiki == "//lv.wikipedia.org" then
t.time = lang:formatDate( "Y. j. F", b1 ) end
end
-- that have other symbols a1, b1, c1 = pcall(fooA, 'amount', entity, 'P2043', 1)
i = i + 1
a1, b1, c1 = pcall(fooA, 'amount', entity, 'P2043', i)
end
t.length = b1
a1, b1, _ = pcall(fooA, 'unit', entity, 'P2043', 1)
if b1 == "http://www.wikidata.org/entity/Q828224" then
t.length_unit = 'km'
if
if
if
end
end
a, b = pcall(fooA, 'numeric-id', entity, 'P17', 1) -- This function gives countries where the race take place
if a == true then --and
for i, v in pairs(entity.claims["P17"]) do
ttt.country[i] = "C" .. v.mainsnak.datavalue.value["numeric-id"]
end
end
-- Function that give the starting place of a race
if
while a1 == true and c1 == 'deprecated' do
i = i + 1
a1, b1, c1 = pcall(fooA, 'numeric-id', entity, 'P1427', i)
end
t.startplace = "Q" .. b1
end
-- Function that give the finishing place of a race
a1, b1, c1 = pcall(fooA, 'numeric-id', entity, 'P1444', 1)
if a1 == true and t.endplace == "" then i = 1
while a1 == true and c1 == 'deprecated' do
i = i + 1
a1, b1, c1 = pcall(fooA, 'numeric-id', entity, 'P1444', i)
end
t.endplace = "Q" .. b1
end
-- This function counts the number of value for P1923 (participating teams) and give the number of team that participate at the race
if pcall(function()
t.nr_teams = table.getn(entity.claims["P1923"])
end
) then else t.nr_teams = "" end
a1, b1, c1 = pcall(fooA, 'amount', entity, 'P1132', 1)
if a1 == true and t.nr_participants_start == "" and t.nr_participants_end == "" then i = 1
while a1 == true and c1 == 'deprecated' do
i = i + 1
a1, b1, c1 = pcall(fooA, 'amount', entity, 'P1132', i)
end
for _, v in pairs(entity.claims["P1132"]) do
if v.qualifiers["P276"][1].datavalue.value["numeric-id"] == 15053706 then
Ред 309 ⟶ 326:
) then else t.nr_participants_end = "" end
end
end -- for
end -- if a1
-- that have other symbols a1, b1, c1 = pcall(fooA, 'amount', entity, 'P2052', 1)
i = i + 1
a1, b1, c1 = pcall(fooA, 'amount', entity, 'P2052', i)
end
t.speed = b1
a1, b1 = pcall(fooA, 'unit', entity, 'P2052', 1)
if b1 == "http://www.wikidata.org/entity/Q180154" then
t.speed_unit = 'km/h'
if
if
if
end
end -- if a1
-- This function permits to display an unity for the cost of a cycling race
a, b = pcall(fooA, 'amount', entity, 'P2130', 1)
if a == true and t.cost == "" then
t.cost = b
Ред 339 ⟶ 362:
if a == true and t.next == "" then t.next = "Q"..b end
local note, qual, id
if wiki == "//fr.wikipedia.org" or wiki == "//en.wikipedia.org" or wiki == "//br.wikipedia.org" or wiki == "//ca.wikipedia.org" or
wiki == "//de.wikipedia.org" or wiki == "//es.wikipedia.org" or wiki == "//lb.wikipedia.org" or wiki == "//no.wikipedia.org" or
wiki == "//pt.wikipedia.org" or wiki == "//ro.wikipedia.org" then
note = 'f' else note = 'q' end
if pcall(foo3, entity, "P1346",
for _, v in pairs(entity.claims["P1346"]) do
if pcall(function() id = v.mainsnak.datavalue.value['numeric-id'] end) then else id = nil end
qual = v.qualifiers["P642"][1].datavalue.value["numeric-id"]
if id ~= nil and
if
if
if
if
if
if
if
if
if qual == 20882921 and t.winner_team == "" then t.winner_team = note .. id results = true end
end -- if id
end -- for
end -- end if pcall
-- transform Q/q-number into flag / WPlink / WDlink
local k
local team = true
Ред 369 ⟶ 396:
if d1 == true then datum = datum_stagerace end
if d2 == true then datum = datum_singleday end
for k in pairs(ttt) do -- "^C" ttt.country, "^T" ttt.tour
if ttt[k][1]~=nil and string.find(ttt[k][1], "^C") then for i=1,#ttt[k] do ttt[k][i] = string.gsub(ttt[k][i], "C", "Q") ttt[k][i] = flag(ttt[k][i], datum).." ".. WPlink( ttt[k][i] ) end end
if ttt[k][i]~=nil and string.find(ttt[k][1], "^T") then for i=1,#ttt[k] do ttt[k][i] = WPlink( string.gsub(ttt[k][i], "T", "Q") ) end end
end
for k in pairs(t) do
if string.find(t[k], "^Q") then --t[k], k = startplace, endplace, ... find variables with an item as value
end
if
t[k] = mw.ustring.upper( t[k] )
--look into P27 (country of citizenship) to get the Qnumber of that country
Ред 391 ⟶ 416:
end
end
if
t[k] = string.gsub(t[k], "f", "Q")
--look into P27 (country of citizenship) to get the Qnumber of that country
Ред 402 ⟶ 427:
end
end
if
t[k] = string.gsub(t[k], "c", "Q")
if pcall(foo1, t[k]) then t[k] = WPlink( t[k], "Q22348500" ) end
end
end
Ред 441 ⟶ 464:
end
local span1, span2 = "<span style='color:#3366CC'>◀ </span>", "<span style='color:#3366CC'> ▶</span>"
local k = t.previous
local i, _ = string.find(k, "|")
Ред 448 ⟶ 470:
if i ~= nil and j ~= nil then
t.previous = string.sub(k, 1, i) .. span1 .. string.gsub(string.sub(k, i+1, j-1), "%D", "") .. string.sub(k, j)
else t.previous =
k = t.next
Ред 455 ⟶ 477:
if i ~= nil and j ~= nil then
t.next = string.sub(k, 1, i) .. string.gsub(string.sub(k, i+1, j-1), "%D", "") .. span2 .. string.sub(k,j)
else t.next = string.gsub(k, "%D", "") if t.next ~="" then t.next = t.next .. span2 end end
tt.caption = string.gsub(tt.caption, "{{(%w+)}}", function (n) return frame:expandTemplate{ title = n } end)
Ред 469 ⟶ 491:
tab = tab .. "<tr><td colspan='2' style='background-color:#FFDF80; text-align:center'>'''"..infobox_left(1).."'''</td></tr>"
if tt.nr ~= "" and t.is_a ~= "" then tab = tab.."<tr><td style='width:40%'>'''"..infobox_left(2).."'''</td><td>" .. tt.nr .. " " .. t.is_a .. "</td></tr>" end
if
if #
for i=1,#
if t.stage ~= "" then tab = tab.."<tr><td>'''"..infobox_left(5).."'''</td><td>" .. t.stage.."</td></tr>" end
if t.starttime ~= "" or t.endtime ~= "" then tab = tab.."<tr><td>'''"..infobox_left(7).."'''</td><td>" .. t.starttime.." – " ..t.endtime .."</td></tr>" end
Ред 478 ⟶ 500:
if t.time ~= "" then tab = tab.."<tr><td>'''"..infobox_left(6).."'''</td><td>" .. t.time.."</td></tr>" end
if t.length ~= "" then tab = tab.."<tr><td>'''"..infobox_left(8).."'''</td><td>" .. t.length.." "..t.length_unit.."</td></tr>" end
if
if #
for i=1,#
if t.startplace ~= "" then tab = tab.."<tr><td>'''"..infobox_left(11).."'''</td><td>" .. t.startplace .. "</td></tr>" end
if t.endplace ~= "" then tab = tab.."<tr><td>'''"..infobox_left(12).."'''</td><td>" .. t.endplace .. "</td></tr>" end
Ред 571 ⟶ 592:
end
function fooA (mode,
local snak
if mode
end
end
Ред 1.137 ⟶ 1.155:
local l10n = l10nDef[mw.site.server]
if not l10n then l10n = l10nDef["//fr.wikipedia.org"] end -- default
return l10n[tonumber(x)]
function headoftable(x) -- En-tête du tableau listant les étapes
Ред 1.173 ⟶ 1.189:
local l10n = l10nDef[mw.site.server]
if not l10n then l10n = l10nDef["//fr.wikipedia.org"] end -- default
return l10n[x]
function headoftableII(x) -- En-
local l10nDef = { }
l10nDef["//fr.wikipedia.org"] = {"Coureur", "Pays", "Équipe", "Temps", "Points", "Classement de l'étape", "Classement général", "
l10nDef["//ca.wikipedia.org"] = {"Corredor", "País", "Equip", "Temps", "Punts", "Classificació de l'etapa", "Classificació general", "Classificació per punts", "Classificació de la muntanya", "Classificació dels esprints", "Classificació del millor jove", "Classificació per equips"}
l10nDef["//lb.wikipedia.org"] = {"Coureur", "Land", "Equipe", "Zäit", "Punkten", "Etappeklassement", "Generalklassement", "Klassement no Punkten", "Biergpräis", "Sprintklassement", "Beschte Jonken", "Equippeklassement"}
l10nDef["//ro.wikipedia.org"] = {"Ciclist", "Țară", "Echipă", "Timp", "Puncte", "Clasamentul etapei", "Clasament general", "Clasament pe puncte", "Clasament cățărători", "Clasament sprinteri", "Clasamentul celui mai bun tânăr", "Clasament pe echipe"}
l10nDef["//www.wikidata.org"] = l10nDef["//fr.wikipedia.org"]
local l10n = l10nDef[mw.site.server]
if not l10n then l10n = l10nDef["//fr.wikipedia.org"] end -- default
return l10n[x]
function headoftableIII(x) -- En-tête du tableau
local l10nDef = { }
l10nDef["//fr.wikipedia.org"] = {"Nom de l'équipe", "Pays", "Code", "WorldTeam", "WorldTeams", "ProTeam", "ProTeams", "Équipe continentale professionnelle", "Équipes continentales professionnelles", "Équipe continentale", "Équipes continentales", "Équipe nationale", "Équipes nationales", "Équipe régionale et de club", "Équipes régionales et de clubs", "Équipe cycliste professionnelle", "Équipes cyclistes professionnelles", "Équipe cycliste amateur", "Équipes cyclistes amateurs", "Groupe sportif I", "Groupes sportifs I", "Groupe sportif II", "Groupes sportifs II", "Groupe sportif III", "Groupes sportifs III", "Équipe mixte", "Équipes mixtes", "Équipe féminine", "Équipes féminines"}
l10nDef["//ca.wikipedia.org"] = {"Nom de l'equip", "País", "Codi", "WorldTeam", "WorldTeams", "ProTeam", "ProTeams", "Equip continental professional", "Equips continentals professionals", "Equip continental", "Equips continentals", "Equip nacional", "Equips nacionals", "Equip regional i de club", "Equips regionals i de clubs", "Equip ciclista professional", "Equips ciclistes professionals", "Equip ciclista amateur", "Equips ciclistes amateurs", "Grup esportiu I", "Grups esportius I", "Grup esportiu II", "Grups esportius II", "Grup esportiu III", "Grups esportius III", "Equip mixt", "Equips mixtos", "Equip femení", "Equips femenins"}
l10nDef["//lb.wikipedia.org"] = {"Equippennumm", "Land", "Code", "WorldTeam", "WorldTeams", "ProTeam", "ProTeams", "Professionell Kontinentalequipe", "Professionell Kontinentalequippen", "Kontinentalequipe", "Kontinentalequippen", "Nationalequipe", "Nationalequippen", "Regional- a Klubequipe", "Regional- a Klubequippen", "Professionell Vëlosequipe", "Professionell Vëlosequippen", "Amateursequipe", "Amateursequippen", "Sportsgrupp I", "Sportsgruppen I", "Sportsgrupp II", "Sportsgruppen II", "Sportsgrupp III", "Sportsgruppen III", "Gemëscht Equipe", "Gemëscht Equippen", "Dammenequipe", "Dammenequippen"}
l10nDef["//ro.wikipedia.org"] = {"Numele echipei", "Țară", "Cod", "WorldTeam", "WorldTeams", "ProTeam", "ProTeams", "Echipă continentală profesionistă", "Echipe continentale profesioniste", "Echipă continentală", "Echipe continentale", "Echipă națională", "Echipe naționale", "Echipă regională și de club", "Echipe regionale și de club", "Echipă ciclistă profesionistă", "Echipe cicliste profesioniste", "Echipă ciclistă de amatori", "Echipe cicliste de amatori", "Grup sportiv I", "Grupuri sportive I", "Grup sportiv II", "Grupuri sportive II", "Grup sportiv III", "Grupuri sportive III", "Echipă mixtă", "Echipe mixte", "Echipă feminină", "Echipe feminine"}
l10nDef["//www.wikidata.org"] = l10nDef["//fr.wikipedia.org"]
local l10n = l10nDef[mw.site.server]
if not l10n then l10n = l10nDef["//fr.wikipedia.org"] end -- default
return l10n[x]
function headoftableIV(x) -- En-tête du tableau du palmarès d'une course cycliste
local l10nDef = { }
l10nDef["//fr.wikipedia.org"] = {"Année", "Vainqueur", "Deuxième", "Troisième"}
Ред 1.227 ⟶ 1.242:
l10nDef["//www.wikidata.org"] = {"Année", "Vainqueur", "Deuxième", "Troisième"}
local l10n = l10nDef[mw.site.server]
if not l10n then l10n = l10nDef["//fr.wikipedia.org"] end -- default
return l10n[x]
function typeofstage(x, typ)
Ред 1.253 ⟶ 1.266:
l10nDef["//www.wikidata.org"] = {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'}
local l10n = l10nDef[mw.site.server]
if not l10n then l10n = l10nDef["//fr.wikipedia.org"] end -- default
local y = ""
|