تضامنًا مع حق الشعب الفلسطيني |
الفرق بين الصفحتين: «وحدة:Cycling race» و«وحدة:Cycling race/ملعب»
(الفرق بين الصفحتين)
عبود السكاف (نقاش | مساهمات) لا ملخص تعديل |
عبود السكاف (نقاش | مساهمات) لا ملخص تعديل |
||
سطر 5: | سطر 5: | ||
end | end | ||
--import translation | --import translation | ||
local l10n = mw.loadData("Module:Cycling race/l10n") | local l10n = mw.loadData("Module:Cycling race/l10n/ملعب") | ||
--import data | --import data | ||
سطر 114: | سطر 114: | ||
local function istrue(x) | local function istrue(x) | ||
if x and (x == 1 or x == "1" or x == "true") then return true end | |||
return nil | |||
end | end | ||
سطر 186: | سطر 186: | ||
local word1 | local word1 | ||
local word2=translate("func_prologue",2) --stage | local word2=translate("func_prologue",2) --stage | ||
local word=word2 | local word = word2 | ||
if wiki=="ar" then return word2 .. " " .. ( a or "" ) , "#" .. word2 .. " " .. ( a or "" ) end | if wiki=="ar" then return word2.." "..( a or "" ) , "#"..word2.." "..( a or "" ) end | ||
-- default | -- default | ||
word1 = x | word1 = x -- table text = 1, 2a, 3 | ||
word2 = "#"..word.." ".. x -- text of section header = #Etappe 2a, #Stage 4 | word2 = "#"..word.." "..x -- text of section header = #Etappe 2a, #Stage 4 | ||
return word1, word2 | return word1, word2 | ||
end | end | ||
سطر 203: | سطر 203: | ||
local border | local border | ||
if noborder then border="" else border="|border|right" end | if noborder then border="" else border="|border|right" end | ||
local stages = { | |||
["plain stage"] = "[[File:Plainstage.svg"..border.."|20px|"..l10n.plain.."]]", | |||
["hilly stage"] = "[[File:Hillystage.svg"..border.."|20px|"..l10n.hilly.."]]", | |||
["intermediate stage"] = "[[File:Mediummountainstage.svg"..border.."|20px|"..l10n.inter.."]]", | |||
["mountain stage"] = "[[File:Mountainstage.svg"..border.."|20px|"..l10n.mount.."]]", | |||
["uphill time trial stage"] = "[[File:Mountain Time Trial Stage.svg"..border.."|20px|"..l10n.uphill.."]]", | |||
["rest day"] = "[[File:Stage rest day.svg"..border.."|20px|"..l10n.rest.."]]" | |||
} | |||
if arwiki_totemplate then | if arwiki_totemplate then | ||
mw.log("totemplate2") | mw.log("totemplate2") | ||
سطر 234: | سطر 234: | ||
end | end | ||
return "{{مرحلة سباق الدراجات|"..str.."}}" | return "{{مرحلة سباق الدراجات|"..str.."}}" | ||
else | |||
if stages[x] then | |||
return stages[x] | |||
end | |||
if x=='time trial stage' then | |||
if noborder then border="" else border="|right" end | |||
local stages2 = { | |||
["Q2348250"] = "[[File:Team Time Trial Stage.svg"..border.."|20px|"..l10n.time_team.."]]", | |||
["Q2266066"] = "[[File:Time Trial.svg"..border.."|20px|"..l10n.time_indiv.."]]", | |||
["Q485321"] = "[[File:Time Trial.svg"..border.."|20px|"..l10n.time_prologue.."]]" | |||
} | |||
if stages2[typ] then | |||
return stages2[typ] | |||
end | |||
end | end | ||
end | end | ||
سطر 315: | سطر 316: | ||
if link then return link end | if link then return link end | ||
for _, lang in ipairs(fallback) do | for _, lang in ipairs(fallback) do | ||
link = mw.wikibase.getSitelink(itemID, lang .. 'wiki') | link = mw.wikibase.getSitelink(itemID, lang..'wiki') | ||
if link then return link end | if link then return link end | ||
end | end | ||
سطر 329: | سطر 330: | ||
lf = frame:getParent() | lf = frame:getParent() | ||
end | end | ||
if wiki == "ar" then lf = frame:getParent() | if wiki == "ar" then lf = frame:getParent() end | ||
return lf | return lf | ||
end | end | ||
سطر 343: | سطر 344: | ||
local function make_IllWD2_link(q, arlabel, enlabel, text) | local function make_IllWD2_link(q, arlabel, enlabel, text) | ||
local argse = { ["المعرف"] = q, target='en | local argse = { ["المعرف"] = q, target='en' } | ||
if arlabel and arlabel ~= '' then | if arlabel and arlabel ~= '' then | ||
argse.label = arlabel | argse.label = arlabel | ||
سطر 356: | سطر 357: | ||
final = "{{Ill-WD2" | final = "{{Ill-WD2" | ||
for k,v in pairs(argse) do | for k,v in pairs(argse) do | ||
final = final.."|"..k.."="..v | |||
end | |||
final = final.."}}" | |||
end | |||
return final | return final | ||
end | end | ||
سطر 422: | سطر 423: | ||
if wiki == 'fo' then cost = string.gsub(cost, "%.", ",") end | if wiki == 'fo' then cost = string.gsub(cost, "%.", ",") end | ||
if unit == "http://www.wikidata.org/entity/Q4916" then | if unit == "http://www.wikidata.org/entity/Q4916" then | ||
cost = cost .. ' €' | cost = cost..' €' | ||
elseif unit == "http://www.wikidata.org/entity/Q4917" then | elseif unit == "http://www.wikidata.org/entity/Q4917" then | ||
cost = cost .. ' $' | cost = cost..' $' | ||
end | end | ||
return cost | return cost | ||
سطر 461: | سطر 462: | ||
end | end | ||
if endPrecision == 9 or timePrecision==9 then -- precision 9 is 'years' | if endPrecision == 9 or timePrecision==9 then -- precision 9 is 'years' | ||
END = string.sub(END, 1, 6) .. '13' -- Set month to 13 | END = string.sub(END, 1, 6)..'13' -- Set month to 13 | ||
elseif endPrecision == 10 then -- precision 10 is 'months' | elseif endPrecision == 10 then -- precision 10 is 'months' | ||
END = string.sub(END, 1, 9) .. '32' -- Set day to 32 | END = string.sub(END, 1, 9)..'32' -- Set day to 32 | ||
end | end | ||
if END >= time then | if END >= time then | ||
سطر 494: | سطر 495: | ||
local starttime, endtime | 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[''] | --local format = formats[wiki] or formats[''] | ||
if mode==nil then mode='long' end | if mode==nil then mode='long' end | ||
سطر 501: | سطر 504: | ||
if m=='00' then --manage the 30 November issue | if m=='00' then --manage the 30 November issue | ||
if | if mode=='long' or mode=="verylong" then | ||
starttime =lang:formatDate( "Y", sTime ) | starttime =lang:formatDate( "Y", sTime ) | ||
else | else | ||
سطر 584: | سطر 587: | ||
if m2=='00' then --manage the 30 November issue | if m2=='00' then --manage the 30 November issue | ||
if | if mode=='long' or mode=="verylong" then | ||
endtime= lang:formatDate( "Y", eTime ) | endtime= lang:formatDate( "Y", eTime ) | ||
else | else | ||
سطر 652: | سطر 655: | ||
-- local mode = 'small' | -- local mode = 'small' | ||
local format = formats[wiki] or formats[''] | local format = formats[wiki] or formats[''] | ||
local lang = contentLanguage | |||
--handle problems with lack of precision | --handle problems with lack of precision | ||
local dispDate = date | local dispDate = date | ||
سطر 714: | سطر 717: | ||
local cyrillic = {mk = true, ru = true} | local cyrillic = {mk = true, ru = true} | ||
local strictLangBool= strictLang[wiki] or strict | local strictLangBool= strictLang[wiki] or strict | ||
local correcttime, best, name, nametemp | |||
local wantedLanguages = {} | |||
for i, lang in ipairs(lang_priority) do | for i, lang in ipairs(lang_priority) do | ||
wantedLanguages[lang] = i | 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 | |||
best = 999 | |||
for _, p1448 in statements(teamID, 'P1448') do | for _, p1448 in statements(teamID, 'P1448') do | ||
correcttime=true | correcttime=true | ||
سطر 731: | سطر 734: | ||
if p1448.qualifiers and p1448.qualifiers.P1448 then | if p1448.qualifiers and p1448.qualifiers.P1448 then | ||
local q = p1448.qualifiers.P1448 | local q = p1448.qualifiers.P1448 | ||
best = 999 | |||
for _, l in pairs(q) do | for _, l in pairs(q) do | ||
if l.snaktype == 'value' then | if l.snaktype == 'value' then | ||
سطر 760: | سطر 763: | ||
end | end | ||
end | end | ||
if name then | |||
return name, true | |||
elseif not strictLangBool and nametemp then | |||
return nametemp, false | |||
end | |||
--no official name, get label | |||
local label=wikibase.getLabel(teamID) | local label=wikibase.getLabel(teamID) | ||
if season and season==true then | if season and season==true then | ||
سطر 845: | سطر 848: | ||
if sitelink and officialname then --if there is an official name, then use it | if sitelink and officialname then --if there is an official name, then use it | ||
return "[[" .. sitelink .. "|" ..officialname.."]]", correctlanguage | return "[["..sitelink.."|" ..officialname.."]]", correctlanguage | ||
else | else | ||
if officialname then return officialname end | if officialname then return officialname end | ||
سطر 856: | سطر 859: | ||
local c = p27[1].mainsnak.datavalue.value.id | 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 | if c=="Q159" or c=="Q184" or c=="Q212" or c=="Q232" then -- Q159, Q184, Q212, Q232 is Russia, Belarus, Ukraine, Kazakhstan | ||
return "[[" .. sitelink .. "|" .. label .. "]]", correctlanguage | return "[["..sitelink.."|"..label.."]]", correctlanguage | ||
end | end | ||
end | end | ||
سطر 863: | سطر 866: | ||
if wiki == 'ru' then | if wiki == 'ru' then | ||
local label = revertfirstlast(mw.text.trim(string.gsub(sitelink, "%b()", ""))) | local label = revertfirstlast(mw.text.trim(string.gsub(sitelink, "%b()", ""))) | ||
return "[[" .. sitelink .. "|" .. label.. "]]", correctlanguage | return "[["..sitelink.."|"..label.. "]]", correctlanguage | ||
else | else | ||
return "[[" .. sitelink .. "|" .. mw.text.trim(string.gsub(sitelink, "%b()", "")) .. "]]", correctlanguage | return "[["..sitelink.."|"..mw.text.trim(string.gsub(sitelink, "%b()", "")).."]]", correctlanguage | ||
end | end | ||
end | end | ||
سطر 887: | سطر 890: | ||
link = label | link = label | ||
else | else | ||
link = "[[" .. label.. "]]" | link = "[["..label.. "]]" | ||
end | end | ||
end | end | ||
سطر 933: | سطر 936: | ||
name = label | name = label | ||
elseif lang then | elseif lang then | ||
name = label .. ' (' .. lang .. ')' | name = label..' ('..lang..')' | ||
end | end | ||
end | end | ||
سطر 1٬022: | سطر 1٬025: | ||
end | end | ||
end | end | ||
if not name or (not isLocal and l10n["lang_priority"]) then | if not name or (not isLocal and l10n["lang_priority"]) then | ||
local partName, partIsLocal = getOfficialName(teamID, timeOfRace) | local partName, partIsLocal = getOfficialName(teamID, timeOfRace) | ||
سطر 1٬032: | سطر 1٬035: | ||
if sitelink then | if sitelink then | ||
if name then | if name then | ||
sitelink = '[[' .. sitelink .. '|' .. name .. ']]' | sitelink = '[['..sitelink..'|'..name..']]' | ||
else | else | ||
sitelink = '[[' .. sitelink .. ']]' | sitelink = '[['..sitelink..']]' | ||
end | end | ||
else | else | ||
if wiki == "ar" then | |||
local arlabel = mw.wikibase.getLabelByLang((parentID or ''), 'ar') or "" | local arlabel = mw.wikibase.getLabelByLang((parentID or ''), 'ar') or "" | ||
local texte = mw.wikibase.getLabelByLang(teamID, 'ar') or "" | |||
sitelink = make_IllWD2_link((parentID or teamID), arlabel, name, texte) | |||
else | |||
if name then | |||
sitelink = name | |||
else | |||
sitelink = (parentID and wikibase.getLabel(parentID)) or | |||
wikibase.getLabel(teamID) or 'No name' | |||
end | |||
end | |||
end | end | ||
return sitelink, catID, countryID | return sitelink, catID, countryID | ||
سطر 1٬097: | سطر 1٬100: | ||
local lang = ref.P1476[1].datavalue.value.language | local lang = ref.P1476[1].datavalue.value.language | ||
if lang ~= wikilang then | if lang ~= wikilang then | ||
refLang = '(' .. lang .. ')' | refLang = '('..lang..')' | ||
if wiki == 'ar' then refLang = lang end | |||
end | |||
end | end | ||
if ref.P577 and ref.P577[1] and ref.P577[1].snaktype == 'value' then -- P577 is 'publication date' | if ref.P577 and ref.P577[1] and ref.P577[1].snaktype == 'value' then -- P577 is 'publication date' | ||
سطر 1٬105: | سطر 1٬108: | ||
refDate = formatRefDate(value.time, value.precision) | refDate = formatRefDate(value.time, value.precision) | ||
if (wiki == 'ar') then refDate = refDate | if (wiki == 'ar') then refDate = refDate | ||
else refDate = ', ' .. refDate | else refDate = ', '..refDate | ||
end | end | ||
end | end | ||
سطر 1٬112: | سطر 1٬115: | ||
refRetrieved = formatRefDate(value.time, value.precision) | refRetrieved = formatRefDate(value.time, value.precision) | ||
if wiki == "de" then | if wiki == "de" then | ||
refRetrieved = ", (abgerufen am " .. refRetrieved .. ')' | refRetrieved = ", (abgerufen am "..refRetrieved..')' | ||
elseif wiki == "ar" then | elseif wiki == "ar" then | ||
refRetrieved = refRetrieved | refRetrieved = refRetrieved | ||
elseif wiki == "fr" then | elseif wiki == "fr" then | ||
refRetrieved = " (consulté le " .. refRetrieved .. ')' | refRetrieved = " (consulté le "..refRetrieved..')' | ||
elseif wiki == "da" then | elseif wiki == "da" then | ||
refRetrieved = " Hentet " .. refRetrieved .. '.' | refRetrieved = " Hentet "..refRetrieved..'.' | ||
else | else | ||
refRetrieved = " Retrieved " .. refRetrieved .. '.' | refRetrieved = " Retrieved "..refRetrieved..'.' | ||
end | end | ||
end | end | ||
سطر 1٬129: | سطر 1٬132: | ||
local refText | local refText | ||
if wiki == "ar" then | if wiki == "ar" then | ||
refText = '{{web cite' .. | |||
'|url = ' .. refURL .. | '|url = '..refURL .. | ||
'|title= ' .. refTitle .. | '|title= '..refTitle .. | ||
'|lang = ' .. refLang .. | '|lang = '..refLang.. | ||
'|website=' .. domain .. | '|website='..domain.. | ||
'|date=' .. refDate .. | '|date='..refDate .. | ||
'|accessdate=' .. refRetrieved .. | '|accessdate='..refRetrieved .. | ||
'}}' | '}}' | ||
elseif wiki == "fr" then | |||
-- fr: "(en) « Lloyd Mondory ... EPO », sur velonews.competitor.com (consulté le 30 april 2016), 30 octobre 2015." | |||
local sur = ', sur <span style="font-style:italic;"> ' .. domain .. '</span>' | local sur = ', sur <span style="font-style:italic;"> '..domain..'</span>' | ||
refText = refLang .. ' « ['.. refURL .. ' '.. refTitle .. '] »' .. sur .. refRetrieved .. refDate .. '.' | refText = refLang..' « ['.. refURL..' '.. refTitle..'] »'..sur..refRetrieved..refDate..'.' | ||
elseif wiki == "de" then | elseif wiki == "de" then | ||
local In = ' In: <span style="font-style:italic;">' .. domain .. '</span>' | local In = ' In: <span style="font-style:italic;">'..domain..'</span>' | ||
refText = '<span style="font-style:italic;">['.. refURL.. ' '.. refTitle.. '.]</span> ' .. | refText = '<span style="font-style:italic;">['.. refURL.. ' '.. refTitle.. '.]</span> ' .. | ||
In .. refDate .. refRetrieved ..'.' | In..refDate..refRetrieved ..'.' | ||
else | else | ||
local at = ', <span style="font-style:italic;"> ' .. domain .. '</span>' | local at = ', <span style="font-style:italic;"> '..domain..'</span>' | ||
refText = refLang .. ' [' .. refURL .. ' ' .. refTitle .. ']' .. at .. refDate .. '.' .. refRetrieved | refText = refLang..' ['..refURL..' '..refTitle..']'..at..refDate..'.'..refRetrieved | ||
end | end | ||
if outputLocal==1 then | if outputLocal==1 then | ||
return refText | return refText | ||
else | else | ||
local refargs = {} | |||
if wiki ~= "ar" then | |||
refargs.name = refText | |||
end | |||
return lf:extensionTag('ref', refText, refargs) | return lf:extensionTag('ref', refText, refargs) | ||
end | end | ||
سطر 1٬226: | سطر 1٬229: | ||
local label2 = wikibase.getLabel(instanceOf) | local label2 = wikibase.getLabel(instanceOf) | ||
if sitelink then | if sitelink then | ||
if label2 then return '[[' .. sitelink .. '|' .. label2 .. ']]' end | if label2 then return '[['..sitelink..'|'..label2..']]' end | ||
return '[[' .. sitelink .. ']]' | return '[['..sitelink..']]' | ||
end | end | ||
local sitelink2 = wikibase.getSitelink(instanceOf) | local sitelink2 = wikibase.getSitelink(instanceOf) | ||
if sitelink2 then return '[[' .. sitelink2 ..'|' .. string.gsub(sitelink2, " %b()", "") .. ']]' end | if sitelink2 then return '[['..sitelink2 ..'|'..string.gsub(sitelink2, " %b()", "")..']]' end | ||
if label2 then return label2 end | if label2 then return label2 end | ||
end | end | ||
سطر 1٬246: | سطر 1٬249: | ||
-- Delete " (...)" form e.g. "Unley (South Australia)" | -- Delete " (...)" form e.g. "Unley (South Australia)" | ||
if name ~=nil then | if name ~=nil then | ||
return '[[' .. sitelink .. '|' .. name .. ']]' | return '[['..sitelink..'|'..name..']]' | ||
else | else | ||
return '[[' .. sitelink .. '|' .. string.gsub(sitelink, ' %b()', '') .. ']]' | return '[['..sitelink..'|'..string.gsub(sitelink, ' %b()', '')..']]' | ||
end | end | ||
end | end | ||
سطر 1٬280: | سطر 1٬283: | ||
if label and link then | if label and link then | ||
link = '[[' .. link .. '|' .. label .. ']]' | link = '[['..link..'|'..label..']]' | ||
elseif link then | elseif link then | ||
link = '[[' .. link .. ']]' | link = '[['..link..']]' | ||
elseif label then | elseif label then | ||
link = label | link = label | ||
سطر 1٬304: | سطر 1٬307: | ||
end | end | ||
local name_plural = content.name_plural | local name_plural = content.name_plural | ||
local name_pluralNoShy = name_plural and string.gsub(name_plural, '­', '') -- filter soft hyphen out | local name_pluralNoShy = name_plural and string.gsub(name_plural, '­', '') -- filter soft hyphen out | ||
if name_pluralNoShy then | if name_pluralNoShy then | ||
name_pluralNoShyLow = mw.ustring.lower(name_pluralNoShy) | name_pluralNoShyLow = mw.ustring.lower(name_pluralNoShy) | ||
سطر 1٬345: | سطر 1٬348: | ||
onlyRoad=false | onlyRoad=false | ||
dis="mountainBike" | dis="mountainBike" | ||
elseif | elseif q.P642[1].datavalue.value.id == 'Q335638' then | ||
onlyRoad=false | onlyRoad=false | ||
dis="cycloCross" | dis="cycloCross" | ||
سطر 1٬369: | سطر 1٬372: | ||
if p54 then | if p54 then | ||
dis=checkDis(p54.qualifiers) | dis=checkDis(p54.qualifiers) | ||
if dis=='road' then --by default | |||
teamID = p54.mainsnak.datavalue.value.id | teamID = p54.mainsnak.datavalue.value.id | ||
link, catID, countryID = getTeamLinkCat(teamID, timeOfRace) | link, catID, countryID = getTeamLinkCat(teamID, timeOfRace) | ||
سطر 1٬411: | سطر 1٬414: | ||
local function wdLink(id) | local function wdLink(id) | ||
local text = "[[File:Wikidata-logo S.svg| " .. Wikidatalogosize .. "|link=d:" .. id .. "]]" | local text = "[[File:Wikidata-logo S.svg| "..Wikidatalogosize.."|link=d:"..id.."]]" | ||
if arwiki_totemplate then | if arwiki_totemplate then | ||
text = '{{عدل في ويكي بيانات|type1=1|id='..id..'}}' | |||
end | |||
return text | |||
end | end | ||
سطر 1٬423: | سطر 1٬426: | ||
local Label = getLabelFallback(Qnumber) or '' | local Label = getLabelFallback(Qnumber) or '' | ||
if Sitelink ~= nil then link = "[[" .. Sitelink .. "|" .. mw.text.trim(string.gsub(Sitelink, "%b()", "")..' ') .. "]]" | if Sitelink ~= nil then link = "[["..Sitelink.."|"..mw.text.trim(string.gsub(Sitelink, "%b()", "")..' ').."]]" | ||
elseif wiki == 'ar' then | elseif wiki == 'ar' then | ||
arlabel = mw.wikibase.getLabelByLang(Qnumber, 'ar') or "" | arlabel = mw.wikibase.getLabelByLang(Qnumber, 'ar') or "" | ||
link = make_IllWD2_link(Qnumber , arlabel , Label) | link = make_IllWD2_link(Qnumber , arlabel , Label) | ||
else | else | ||
link = mw.ustring.gsub(Label, "^(%a)", function (x) return mw.ustring.upper(x) end) | |||
end | end | ||
سطر 1٬452: | سطر 1٬455: | ||
error_message = mw.ustring.gsub(error_message, "<2>", mw.wikibase.label( s.item )) | 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 = mw.ustring.gsub(error_message, "<3>", s.item) | ||
error_message = ' [[File:Exclam icon.svg|12px|'.. error_message .. ']]' | error_message = ' [[File:Exclam icon.svg|12px|'.. error_message..']]' | ||
end | end | ||
return error_message | return error_message | ||
سطر 1٬468: | سطر 1٬471: | ||
local title =translate(s.header_function,s.header_1, s.w_race, s.title) | local title =translate(s.header_function,s.header_1, s.w_race, s.title) | ||
if s.header_1 == 19 and wiki == "ar" then title = title .. " " .. s.year end | 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)) | local wd_link = mw.html.create('span'):cssText('float:left; margin: 0 5px'):wikitext(wdLink(s.item..'#'..s.property)) | ||
سطر 1٬549: | سطر 1٬552: | ||
tCell:node(wdlink_span) | tCell:node(wdlink_span) | ||
tCell:wikitext(translate("startlist",1,s.w_race or false)) | tCell:wikitext(translate("startlist",1,s.w_race or false)) | ||
local tRow=tCell:tag('tr') | |||
return tab, tRow | return tab, tRow | ||
سطر 1٬595: | سطر 1٬598: | ||
Q115 = {'ETH', {'Flag of Ethiopia.svg', '+1996-10-31'}}, | Q115 = {'ETH', {'Flag of Ethiopia.svg', '+1996-10-31'}}, | ||
Q117 = {'GHA', {'Flag of Ghana.svg', '+1966-02-28'}}, | Q117 = {'GHA', {'Flag of Ghana.svg', '+1966-02-28'}}, | ||
Q142 = {'FRA', {'Flag of France.svg', '+1794-05-20'}}, | |||
Q145 = {'GBR', {'Flag of the United Kingdom (3-5).svg'}}, | Q145 = {'GBR', {'Flag of the United Kingdom (3-5).svg'}}, | ||
Q148 = {'CHN', {"Flag of the People's Republic of China.svg", '+1985'}}, | Q148 = {'CHN', {"Flag of the People's Republic of China.svg", '+1985'}}, | ||
سطر 1٬769: | سطر 1٬771: | ||
if countryID == 'Q39' then flagpxSize = '16px'end -- Small size for an square flag as Switzerland | if countryID == 'Q39' then flagpxSize = '16px'end -- Small size for an square flag as Switzerland | ||
if file then | if file then | ||
result = '[[File:' .. file .. '|border|' .. flagpxSize ..'|' .. IOC .. ']]' | result = '[[File:'..file..'|border|'..flagpxSize ..'|'..IOC..']]' | ||
if arwiki_totemplate then | if arwiki_totemplate then | ||
result = '{{flagicon|' .. IOC .. '}}' | result = '{{flagicon|'..IOC..'}}' | ||
end | end | ||
elseif not date then | elseif not date then | ||
local p41 = firstValue(countryID, "P41") -- P41 is flag image | local p41 = firstValue(countryID, "P41") -- P41 is flag image | ||
if p41 then | if p41 then | ||
result = '[[File:' .. p41 .. '|border|' .. flagpxSize ..'|(Wikidata:' .. countryID .. ')]]' | result = '[[File:'..p41..'|border|'..flagpxSize ..'|(Wikidata:'..countryID..')]]' | ||
if arwiki_totemplate then | if arwiki_totemplate then | ||
result = '{{flagicon image|' .. p41 .. '}}' | result = '{{flagicon image|'..p41..'}}' | ||
end | end | ||
end | end | ||
سطر 1٬785: | سطر 1٬787: | ||
local p41 = getStatementForTime(countryID, "P41", date) -- P41 is flag image | local p41 = getStatementForTime(countryID, "P41", date) -- P41 is flag image | ||
if p41 then | if p41 then | ||
result = '[[File:' .. p41.mainsnak.datavalue.value .. '|border|' .. flagpxSize ..'|(Wikidata:' .. countryID .. ')]]' | result = '[[File:'..p41.mainsnak.datavalue.value..'|border|'..flagpxSize ..'|(Wikidata:'..countryID..')]]' | ||
if arwiki_totemplate then | if arwiki_totemplate then | ||
result = '{{flagicon image|' .. p41.mainsnak.datavalue.value .. '}}' | result = '{{flagicon image|'..p41.mainsnak.datavalue.value..'}}' | ||
end | end | ||
end | end | ||
end | end | ||
return result .. trackingCategory | return result..trackingCategory | ||
end | end | ||
-- countryID --> shape ([[France|FRA]]) | -- countryID --> shape ([[France|FRA]]) | ||
local function uciCodeCountry(countryID) | local function uciCodeCountry(countryID) | ||
local uciCode, countryName | |||
local blacklist={Q736=true} | |||
if countryID then | if countryID then | ||
--get UCI code | --get UCI code | ||
سطر 1٬885: | سطر 1٬887: | ||
local jersey_name | local jersey_name | ||
if jerseys[v] then | if jerseys[v] then | ||
jersey_string = jersey_string .. '[[File:' .. jerseys[v].file .. '|20px' | jersey_string = jersey_string..'[[File:'..jerseys[v].file..'|20px' | ||
jersey_name = jerseys[v]['name_' .. wiki] or mw.wikibase.getLabel(v) or jerseys[v]['name_fr'] | jersey_name = jerseys[v]['name_'..wiki] or mw.wikibase.getLabel(v) or jerseys[v]['name_fr'] | ||
if jersey_name then | if jersey_name then | ||
jersey_string = jersey_string .. '|' .. jersey_name | jersey_string = jersey_string..'|'..jersey_name | ||
end | end | ||
jersey_string = jersey_string .. ']]' | jersey_string = jersey_string..']]' | ||
else | else | ||
local p18 = mw.wikibase.getBestStatements(v, 'P18') | local p18 = mw.wikibase.getBestStatements(v, 'P18') | ||
if p18[1] and p18[1].mainsnak.snaktype == 'value' then | if p18[1] and p18[1].mainsnak.snaktype == 'value' then | ||
jersey_string = jersey_string .. '[[File:' .. p18[1].mainsnak.datavalue.value .. '|20px' | jersey_string = jersey_string..'[[File:'..p18[1].mainsnak.datavalue.value..'|20px' | ||
jersey_name = getLabelFallback(v) | jersey_name = getLabelFallback(v) | ||
if jersey_name then | if jersey_name then | ||
jersey_string = jersey_string .. '|' .. jersey_name | jersey_string = jersey_string..'|'..jersey_name | ||
end | end | ||
jersey_string = jersey_string .. ']]' | jersey_string = jersey_string..']]' | ||
end | end | ||
end | end | ||
سطر 1٬995: | سطر 1٬997: | ||
countryID = getNationality(riderId, timeOfRace,q) | countryID = getNationality(riderId, timeOfRace,q) | ||
if countryID then | if countryID then | ||
riderLink = flag(countryID, timeOfRace) .. ' ' .. riderLink | riderLink = flag(countryID, timeOfRace)..' '..riderLink | ||
end | end | ||
riderTeam = getTeam(riderId, timeOfRace, q) or '' | riderTeam = getTeam(riderId, timeOfRace, q) or '' | ||
سطر 2٬002: | سطر 2٬004: | ||
riderLink, _, countryID = getTeamLinkCat(riderId, timeOfRace, true) | riderLink, _, countryID = getTeamLinkCat(riderId, timeOfRace, true) | ||
if countryID then | if countryID then | ||
riderLink = flag(countryID, timeOfRace) .. ' ' .. riderLink | riderLink = flag(countryID, timeOfRace)..' '..riderLink | ||
end | end | ||
end | end | ||
سطر 2٬038: | سطر 2٬040: | ||
riderLink = getRiderLink(wID, timeOfRace) | riderLink = getRiderLink(wID, timeOfRace) | ||
if reference then | if reference then | ||
riderLink = riderLink .. reference | riderLink = riderLink..reference | ||
end | end | ||
if team then | if team then | ||
local riderTeam = getTeam(wID, timeOfRace, q) | local riderTeam = getTeam(wID, timeOfRace, q) | ||
if riderTeam then | if riderTeam then | ||
riderLink = riderLink .. ' (' .. riderTeam .. ')' | riderLink = riderLink..' ('..riderTeam..')' | ||
end | end | ||
end | end | ||
سطر 2٬049: | سطر 2٬051: | ||
riderLink = flag(wID, timeOfRace).." "..getCountryName(wID) | riderLink = flag(wID, timeOfRace).." "..getCountryName(wID) | ||
if reference then | if reference then | ||
riderLink = riderLink .. reference | riderLink = riderLink..reference | ||
end | end | ||
country=true | country=true | ||
سطر 2٬056: | سطر 2٬058: | ||
riderLink, _, countryID = getTeamLinkCat(wID, timeOfRace, country) | riderLink, _, countryID = getTeamLinkCat(wID, timeOfRace, country) | ||
if reference then | if reference then | ||
riderLink = riderLink .. reference | riderLink = riderLink..reference | ||
end | end | ||
end | end | ||
سطر 2٬068: | سطر 2٬070: | ||
end | end | ||
if countryID then | if countryID then | ||
riderLink = flag(countryID, timeOfRace) .. ' ' .. riderLink | riderLink = flag(countryID, timeOfRace)..' '..riderLink | ||
end | end | ||
end | end | ||
if WDlink_on then | if WDlink_on then | ||
riderLink = riderLink .. ' ' .. wdLink(wID) | riderLink = riderLink..' '..wdLink(wID) | ||
end | end | ||
else | else | ||
سطر 2٬079: | سطر 2٬081: | ||
local cause = wikibase.getLabel(wCause) | local cause = wikibase.getLabel(wCause) | ||
if cause then | if cause then | ||
riderLink = riderLink .. ' (' .. cause .. ')' | riderLink = riderLink..' ('..cause..')' | ||
end | end | ||
end | end | ||
سطر 2٬096: | سطر 2٬098: | ||
winners[wOf] = riderLink | winners[wOf] = riderLink | ||
else | else | ||
winners[wOf] = winners[wOf] .. '<br/>' .. riderLink | winners[wOf] = winners[wOf]..'<br/>'..riderLink | ||
end | end | ||
end | end | ||
سطر 2٬129: | سطر 2٬131: | ||
local year = string.match(link, '%d%d%d%d') | local year = string.match(link, '%d%d%d%d') | ||
if year then | if year then | ||
return year .. '-01-01T00:00:00Z' | return year..'-01-01T00:00:00Z' | ||
end | end | ||
end | end | ||
سطر 2٬157: | سطر 2٬159: | ||
local startTime, endTime = getStartEndTime(sTime, eTime, style1) | local startTime, endTime = getStartEndTime(sTime, eTime, style1) | ||
if functionName==nil or functionName=='infobox' then --calendar, infobox | if functionName==nil or functionName=='infobox' then --calendar, infobox | ||
return startTime..' – '..endTime, sTime, true | |||
else --victory, general classification | |||
return endTime, eTime, true | |||
end | end | ||
else | else | ||
سطر 2٬170: | سطر 2٬172: | ||
end | end | ||
local function fn_date(entityID, functionName) | local function fn_date(entityID, functionName) --to move as a general function | ||
local tempdate, timeOfRace, _ = get_formatted_date(entityID, functionName) --is there a reason why timeofrace cannot be sTime?? | local tempdate, timeOfRace, _ = get_formatted_date(entityID, functionName) --is there a reason why timeofrace cannot be sTime?? | ||
سطر 2٬188: | سطر 2٬190: | ||
-- parentID taken from fn_race, optional | -- parentID taken from fn_race, optional | ||
local country_str, country_name, country_flag | local country_str, country_name, country_flag | ||
local cssCell="text-align:" .. textalign .. ";padding:0 0.5em" | local cssCell="text-align:"..textalign..";padding:0 0.5em" | ||
local tCell= mw.html.create('td'):cssText(cssCell) | local tCell= mw.html.create('td'):cssText(cssCell) | ||
سطر 2٬308: | سطر 2٬310: | ||
prefix=''; postfix='' --general classification | prefix=''; postfix='' --general classification | ||
listOfProperty={'P2561','P1448'} | listOfProperty={'P2561','P1448'} | ||
--system with P3450 and P2094 | |||
for _, p31 in statements(entityID, 'P31') do | instanceOf=firstValue(entityID, 'P3450', 'id') | ||
--else use P31 | |||
if instanceOf==nil then | |||
for _, p31 in statements(entityID, 'P31') do | |||
instanceOfTemp = p31.mainsnak.datavalue.value.id | |||
if instanceOfTemp ~= "Q27020041" and data.class_dic[instanceOfTemp]==nil then --we don't want the class, but the main race | |||
instanceOf=instanceOfTemp | |||
end | |||
end | end | ||
end | end | ||
--get information from the parent | |||
if instanceOf then | if instanceOf then | ||
--look for | --look for | ||
سطر 2٬404: | سطر 2٬410: | ||
if Sitelink == nil then | if Sitelink == nil then | ||
if wiki == 'ar' then | if wiki == 'ar' then | ||
label = make_IllWD2_link(entityID,arlabel,label) | label = make_IllWD2_link(entityID, arlabel, label) | ||
end | end | ||
return prefix..label..postfix | return prefix..label..postfix | ||
سطر 2٬479: | سطر 2٬485: | ||
period=startTime --only (1990) | period=startTime --only (1990) | ||
else | else | ||
period=startTime .. '-'..endTime | period=startTime..'-'..endTime | ||
end | end | ||
elseif sTime then | elseif sTime then | ||
period=startTime .. '-' | period=startTime..'-' | ||
elseif eTime then | elseif eTime then | ||
period='-'..endTime | period='-'..endTime | ||
سطر 2٬549: | سطر 2٬555: | ||
if data.class_dic[classID]~=nil then | if data.class_dic[classID]~=nil then | ||
circuitID=classToCircuit(classID, entityID, false, p279.qualifiers) | |||
classLink=classLinkFn(classID,circuitID) | |||
if classLink then | |||
local period, sTime=getPeriod(p279.qualifiers, true) | |||
local classStr = classLink.." <small>"..period.."</small>" | |||
table.insert(classTable, {sTime, classStr, circuitID}) | table.insert(classTable, {sTime, classStr, circuitID}) | ||
end | end | ||
سطر 2٬569: | سطر 2٬575: | ||
end | end | ||
end | end | ||
return str, circuitLink, #classTable | |||
end | end | ||
سطر 2٬667: | سطر 2٬673: | ||
if tMonth>today['month'] then | if tMonth>today['month'] then | ||
return true | return true | ||
elseif | elseif tMonth<today['month'] then | ||
return false | return false | ||
else | else | ||
if tDay>today['day'] then | if tDay>today['day'] then | ||
return true | return true | ||
elseif | elseif tDay<today['day'] then | ||
return false | return false | ||
else | else | ||
سطر 2٬690: | سطر 2٬696: | ||
if not endDate then | if not endDate then | ||
local today=os.date("*t") | local today=os.date("*t") | ||
eYear=today['year'] | |||
eMonth=today['month'] | |||
eDay=today['day'] | |||
else | else | ||
local _, _, y, m, d = string.find(endDate, "(%d+)%p(%d+)%p(%d+)") | local _, _, y, m, d = string.find(endDate, "(%d+)%p(%d+)%p(%d+)") | ||
سطر 2٬708: | سطر 2٬714: | ||
if eMonth>tMonth then | if eMonth>tMonth then | ||
alreadyThisYear=true | alreadyThisYear=true | ||
elseif | elseif eMonth<tMonth then | ||
alreadyThisYear=false | alreadyThisYear=false | ||
else | else | ||
if eDay>tDay then | if eDay>tDay then | ||
alreadyThisYear=true | alreadyThisYear=true | ||
elseif | elseif eDay<tDay then | ||
alreadyThisYear=false | alreadyThisYear=false | ||
else | else | ||
سطر 2٬774: | سطر 2٬780: | ||
if wiki == "mk" or wiki == "ja" or wiki == "ru" then WDlink_on = true else WDlink_on = false end | if wiki == "mk" or wiki == "ja" or wiki == "ru" then WDlink_on = true else WDlink_on = false end | ||
-- Get the date to sort the editions | |||
for _, p527 in statements(itemID, 'P527') do --_, p527 | for _, p527 in statements(itemID, 'P527') do --_, p527 | ||
local raceDate, year, raceID, entity_race, a, b | local raceDate, year, raceID, entity_race, a, b | ||
سطر 2٬846: | سطر 2٬852: | ||
if lastEditionDate then | if lastEditionDate then | ||
t.lastEditionYear=funcDate(lastEditionDate,"onlyyear") | t.lastEditionYear=funcDate(lastEditionDate,"onlyyear") | ||
end | end | ||
t.numberOfEditions=numberOfEditions | t.numberOfEditions=numberOfEditions | ||
سطر 2٬856: | سطر 2٬862: | ||
sitelink = wikibase.getSitelink(t.lastID) | sitelink = wikibase.getSitelink(t.lastID) | ||
if sitelink ~= nil then | if sitelink ~= nil then | ||
t.lastLink = "[[" .. sitelink .. "]]" | t.lastLink = "[["..sitelink.."]]" | ||
else | else | ||
t.lastLink = nil | t.lastLink = nil | ||
سطر 2٬866: | سطر 2٬872: | ||
sitelink = wikibase.getSitelink(t.nextID) | sitelink = wikibase.getSitelink(t.nextID) | ||
if sitelink ~= nil then | if sitelink ~= nil then | ||
t.nextLink = "[[" .. sitelink .. "]]" | t.nextLink = "[["..sitelink.."]]" | ||
else | else | ||
t.nextLink = nil | t.nextLink = nil | ||
سطر 2٬900: | سطر 2٬906: | ||
end | end | ||
end --else result=nil | end --else result=nil | ||
return result | |||
end | end | ||
سطر 3٬002: | سطر 3٬008: | ||
text = text ..t | text = text ..t | ||
else | else | ||
text = text .. ' ' ..t | text = text..' ' ..t | ||
end | end | ||
end | end | ||
سطر 3٬115: | سطر 3٬121: | ||
else str = b.."." | else str = b.."." | ||
end | end | ||
else str = b .. ". " | else str = b..". " | ||
end | end | ||
return str | return str | ||
سطر 3٬175: | سطر 3٬181: | ||
this_label = translate("func_prologue",1) | this_label = translate("func_prologue",1) | ||
else | else | ||
this_label = stageLink(inp, a, b) | |||
end | end | ||
end | end | ||
سطر 3٬218: | سطر 3٬224: | ||
local link = wikibase.getSitelink(previousID) | local link = wikibase.getSitelink(previousID) | ||
if link then | if link then | ||
previousText = '<span style="color:#3366CC">[[' .. link .. '| ' .. previous_sign .. this_label .. ']]</span>' | previousText = '<span style="color:#3366CC">[['..link..'| '..previous_sign..this_label..']]</span>' | ||
else | else | ||
previousText = '<span style="color:#3366CC">' .. previous_sign .. '</span> ' .. this_label | previousText = '<span style="color:#3366CC">'..previous_sign..'</span> '..this_label | ||
end | end | ||
end | end | ||
سطر 3٬232: | سطر 3٬238: | ||
local link = wikibase.getSitelink(nextID) | local link = wikibase.getSitelink(nextID) | ||
if link then | if link then | ||
nextText = '<span style="color:#3366CC">[[' .. link .. '|' .. this_label .. next_sign .. ']]</span>' | nextText = '<span style="color:#3366CC">[['..link..'|'..this_label..next_sign..']]</span>' | ||
else | else | ||
nextText = this_label .. ' <span style="color:#3366CC">' .. next_sign .. '</span>' | nextText = this_label..' <span style="color:#3366CC">'..next_sign..'</span>' | ||
end | end | ||
end | end | ||
سطر 3٬241: | سطر 3٬247: | ||
local outTable = mw.html.create('tr') | local outTable = mw.html.create('tr') | ||
local tCell=outTable:tag('td') | local tCell=outTable:tag('td') | ||
tCell:cssText("text-align:" .. ((direction == 'ltr') and 'left' or 'right')):wikitext(previousText) | tCell:cssText("text-align:"..((direction == 'ltr') and 'left' or 'right')):wikitext(previousText) | ||
if stage ~= nil and wiki=="ar" then | if stage ~= nil and wiki=="ar" then | ||
tCell:css('width','50%') | tCell:css('width','50%') | ||
end | end | ||
tCell=outTable:tag('td') | tCell=outTable:tag('td') | ||
:cssText("text-align:" .. ((direction == 'ltr') and 'right' or 'left')):wikitext( nextText) | :cssText("text-align:"..((direction == 'ltr') and 'right' or 'left')):wikitext( nextText) | ||
if stage ~= nil and wiki=="ar" then | |||
tCell:css('width','50%') | tCell:css('width','50%') | ||
end | end | ||
سطر 3٬260: | سطر 3٬266: | ||
{ name = translate("infobox",30,w_race)}, -- caption | { name = translate("infobox",30,w_race)}, -- caption | ||
{ name = translate("infobox",31,w_race)}, -- map | { name = translate("infobox",31,w_race)}, -- map | ||
{ name = 'sectional'}, | { name = 'sectional'}, -- sectional | ||
{ name = translate("infobox",30,w_race)}, -- caption map | { name = translate("infobox",30,w_race)}, -- caption map | ||
{ name = translate("infobox",30,w_race)}, -- caption sectional | { name = translate("infobox",30,w_race)}, -- caption sectional | ||
سطر 3٬275: | سطر 3٬281: | ||
if not others[3].content then -- map | if not others[3].content then -- map | ||
others[3].content, others[5].content = getMap(entityID) -- P242 is 'locator map image' | others[3].content, others[5].content = getMap(entityID) -- P242 is 'locator map image' | ||
end | end | ||
سطر 3٬288: | سطر 3٬294: | ||
local place = {} | local place = {} | ||
if not place[1] then | |||
for _, p17 in statements(entityID, PID) do -- P17 is 'country' | for _, p17 in statements(entityID, PID) do -- P17 is 'country' | ||
local countryID = p17.mainsnak.datavalue.value.id | local countryID = p17.mainsnak.datavalue.value.id | ||
if PID=='P17' then | if PID=='P17' then | ||
place[#place + 1] = flag(countryID, timeOfRace) .. ' ' .. getCountryName(countryID) | place[#place + 1] = flag(countryID, timeOfRace)..' '..getCountryName(countryID) | ||
else | else | ||
place[#place + 1] = wikibase.getLabel(countryID) | place[#place + 1] = wikibase.getLabel(countryID) | ||
end | end | ||
end | end | ||
سطر 3٬399: | سطر 3٬405: | ||
if others and others[1].content then -- picture | if others and others[1].content then -- picture | ||
tab:tag('tr'):tag('td'):attr('colspan','2'):css('text-align','center') | tab:tag('tr'):tag('td'):attr('colspan','2'):css('text-align','center') | ||
:wikitext("[[File:" .. others[1].content .."|center|"..pxmax.."]]") | :wikitext("[[File:"..others[1].content .."|center|"..pxmax.."]]") | ||
if others and others[2].content then -- caption | if others and others[2].content then -- caption | ||
tab:tag('tr'):tag('td'):attr('colspan','2'):css('text-align','center'):css('font-size','80%') | tab:tag('tr'):tag('td'):attr('colspan','2'):css('text-align','center'):css('font-size','80%') | ||
سطر 3٬408: | سطر 3٬414: | ||
tab:node(addATitle(title)) | tab:node(addATitle(title)) | ||
for _, row in ipairs(details) do | for _, row in ipairs(details) do | ||
tab:node(addARow(row.name, row.content)) --node check itself if nil | |||
end | end | ||
end | end | ||
سطر 3٬416: | سطر 3٬422: | ||
if others[3].content then -- map | if others[3].content then -- map | ||
tab:tag('tr'):tag('td'):attr('colspan','2'):css('text-align','center') | tab:tag('tr'):tag('td'):attr('colspan','2'):css('text-align','center') | ||
:wikitext("[[File:".. others[3].content .. "|center|300px]]") | :wikitext("[[File:".. others[3].content.."|center|300px]]") | ||
if others[5].content then -- caption | if others[5].content then -- caption | ||
tab:tag('tr'):tag('td'):attr('colspan','2'):css('text-align','center'):css('font-size','80%') | tab:tag('tr'):tag('td'):attr('colspan','2'):css('text-align','center'):css('font-size','80%') | ||
سطر 3٬424: | سطر 3٬430: | ||
if others[4].content then -- map | if others[4].content then -- map | ||
tab:tag('tr'):tag('td'):attr('colspan','2'):css('text-align','center') | tab:tag('tr'):tag('td'):attr('colspan','2'):css('text-align','center') | ||
:wikitext("[[File:".. others[4].content .. "|center|300px]]") | :wikitext("[[File:".. others[4].content.."|center|300px]]") | ||
if others[6].content then -- caption | if others[6].content then -- caption | ||
tab:tag('tr'):tag('td'):attr('colspan','2'):css('text-align','center'):css('font-size','80%') | tab:tag('tr'):tag('td'):attr('colspan','2'):css('text-align','center'):css('font-size','80%') | ||
سطر 3٬446: | سطر 3٬452: | ||
end | end | ||
if wiki == "ar" then | if wiki == "ar" then | ||
link = wdLink(ID) .." [[" .. s .. "|" .. translation .. "]]" | link = wdLink(ID) .." [["..s.."|"..translation.."]]" | ||
else | else | ||
link = "[[" .. s .. "|" .. translation .. "]] "..wdLink(ID) | link = "[["..s.."|"..translation.."]] "..wdLink(ID) | ||
end | end | ||
tC:cssText('text-align:right; border-top:3px solid '..backgroundColor..'; font-size:75%') | tC:cssText('text-align:right; border-top:3px solid '..backgroundColor..'; font-size:75%') | ||
سطر 3٬567: | سطر 3٬573: | ||
local label =string.gsub(getLabelFallback(riderReason,lang_priority), "%b()", "") | local label =string.gsub(getLabelFallback(riderReason,lang_priority), "%b()", "") | ||
riderRef = getReference(lf,p527, 1) | riderRef = getReference(lf,p527, 1) | ||
riderReason = ', ' .. label | riderReason = ', '..label | ||
end | end | ||
end | end | ||
سطر 3٬581: | سطر 3٬587: | ||
Sitelink = wikibase.getSitelink('Q2328847') | Sitelink = wikibase.getSitelink('Q2328847') | ||
if Sitelink then | if Sitelink then | ||
riderPosition=', ' .. "[["..Sitelink .."|"..label.."]]" | riderPosition=', '.."[["..Sitelink .."|"..label.."]]" | ||
else | else | ||
riderPosition =', ' .. label | riderPosition =', '..label | ||
end | end | ||
end | end | ||
سطر 3٬604: | سطر 3٬610: | ||
local y, m, d | local y, m, d | ||
local date=trans(date, defaultMonth, defaultDay) | local date=trans(date, defaultMonth, defaultDay) | ||
if not date then | if not date then | ||
date = '+'..defaultYear..'-'..defaultMonth..'-'..defaultDay..'T00:00:00Z' | date = '+'..defaultYear..'-'..defaultMonth..'-'..defaultDay..'T00:00:00Z' | ||
y=defaultYear | y=defaultYear | ||
سطر 3٬639: | سطر 3٬645: | ||
local name_parts_mk = {'да', 'ди', 'де', 'Де', 'ла', 'Ле', 'тен', 'ван', 'Ван'} | local name_parts_mk = {'да', 'ди', 'де', 'Де', 'ла', 'Ле', 'тен', 'ван', 'Ван'} | ||
local name_parts_ru = {'да', 'ди', 'де', 'Де', 'ла', 'Ле', 'тен', 'ван', 'Ван'} | local name_parts_ru = {'да', 'ди', 'де', 'Де', 'ла', 'Ле', 'тен', 'ван', 'Ван'} | ||
local name_parts | local name_parts = {'da', 'de', 'di', 'De', 'la', 'Le', 'ten', 'van', 'Van'} | ||
if count == 3 and label ~= '' then | if count == 3 and label ~= '' then | ||
a, b, c = string.match(label, "(%S+)%s+(%S+)%s+(%S+)") | a, b, c = string.match(label, "(%S+)%s+(%S+)%s+(%S+)") | ||
سطر 3٬707: | سطر 3٬713: | ||
local p = mw.wikibase.getBestStatements(raceID, base[2]) | local p = mw.wikibase.getBestStatements(raceID, base[2]) | ||
if p[1] and p[1].mainsnak.snaktype == 'value' then | 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(lf,p[1], 1) | ref=getReference(lf,p[1], 1) | ||
if ref then table.insert(links, ref) end | if ref then table.insert(links, ref) end | ||
else | else | ||
table.insert(links, ' [' .. base[3] .. p[1].mainsnak.datavalue.value .. " " .. base[1] ..']') | table.insert(links, ' ['..base[3]..p[1].mainsnak.datavalue.value.." "..base[1] ..']') | ||
end | end | ||
end | end | ||
end | end | ||
if #links == 1 then | if #links == 1 then | ||
return translate("race_reference", 1) .. table.concat(links) | return translate("race_reference", 1)..table.concat(links) | ||
elseif #links > 1 then | elseif #links > 1 then | ||
return translate("race_reference", 2) .. table.concat(links) | return translate("race_reference", 2)..table.concat(links) | ||
else | else | ||
return '' | return '' | ||
سطر 3٬739: | سطر 3٬745: | ||
country_column=3 | country_column=3 | ||
end | end | ||
--no_country modify the way the country is displayed | |||
local no_country={} | |||
if istrue(get_arg('no_country',frame)) or wiki == "ar" then | |||
no_country={wiki} | no_country={wiki} | ||
end | end | ||
سطر 3٬755: | سطر 3٬761: | ||
end | end | ||
table.insert(headers, 7) --winner | |||
local only_winner=1 | local only_winner=1 | ||
if istrue(get_arg('podium',frame)) or wiki == "ar" then | if istrue(get_arg('podium',frame)) or wiki == "ar" then | ||
سطر 3٬778: | سطر 3٬784: | ||
end | end | ||
local w_race=isWomenrace(calendarID) | |||
local s = { | local s = { | ||
header_function = "calendar", -- translations are in function Calendar | header_function = "calendar", -- translations are in function Calendar | ||
سطر 3٬790: | سطر 3٬796: | ||
no_country = no_country, | no_country = no_country, | ||
only_winner = only_winner, | only_winner = only_winner, | ||
display_numbering = display_numbering, | display_numbering = display_numbering, | ||
displayed_class =nil, | displayed_class =nil, | ||
display_team=display_team, | display_team=display_team, | ||
سطر 3٬811: | سطر 3٬817: | ||
local header_1_tab = {["UWT"]=13 ,["europe"]=14 ,["asia"]=15,["america"]=16 ,["africa"]=17 ,["oceania"]=18, ["WWT"]=11, ["women"]=1, ["Pro"]=22} | local header_1_tab = {["UWT"]=13 ,["europe"]=14 ,["asia"]=15,["america"]=16 ,["africa"]=17 ,["oceania"]=18, ["WWT"]=11, ["women"]=1, ["Pro"]=22} | ||
local display_code_tab= {["UWT"]=1 ,["europe"]=2 ,["asia"]=2,["america"]=2 ,["africa"]=2 ,["oceania"]=2, ["WWT"]=1, ["women"]=2, ["Pro"]=2} | local display_code_tab= {["UWT"]=1 ,["europe"]=2 ,["asia"]=2,["america"]=2 ,["africa"]=2 ,["oceania"]=2, ["WWT"]=1, ["women"]=2, ["Pro"]=2} | ||
local header_1_number = 12 | local header_1_number = 12 | ||
سطر 3٬824: | سطر 3٬830: | ||
} | } | ||
local tempdic2 = { | local tempdic2 = { | ||
header_2 = | header_2 = {2, 5, 4, 6, 7}, | ||
only_winner =1, | only_winner =1, | ||
display_numbering=false, | display_numbering=false, | ||
سطر 3٬875: | سطر 3٬881: | ||
-- in the lower part of the table header. The second value 3 in {4, 3} tells where the icon will go. | -- in the lower part of the table header. The second value 3 in {4, 3} tells where the icon will go. | ||
country_column = 3, | country_column = 3, | ||
data_sort_type ={'', 'unsortable', '', '', '','',''}, | data_sort_type ={'', 'unsortable', '', '', '','',''}, -- -- see https://meta.wikimedia.org/wiki/Help:Sorting | ||
item = calendarID, | item = calendarID, | ||
property = 'P527', | property = 'P527', | ||
سطر 3٬894: | سطر 3٬900: | ||
function calendar_main(s, resultTable)--Display the UCI women calendar of one year | function calendar_main(s, resultTable)--Display the UCI women calendar of one year | ||
local lf = s.lf | local lf = s.lf | ||
local limit | local limit = tonumber(get_arg("limit",lf)) or 250 | ||
local offset = tonumber(get_arg("offset", lf) or | local offset = tonumber(get_arg("offset",lf)) or 0 | ||
local offset_limit = offset + limit | local offset_limit = offset + limit | ||
local count,kk = 0,0 | local count,kk = 0,0 | ||
سطر 3٬914: | سطر 3٬920: | ||
if ( count <= offset_limit and count >= offset ) -- to display statement with limit | if ( count <= offset_limit and count >= offset ) -- to display statement with limit | ||
then | then | ||
local RaceID = p527.mainsnak.datavalue.value.id | |||
---- Create a row ---- | |||
local timeOfRace, date_tCell, date_sortkey = fn_date(RaceID) | |||
local parentID, race_tCell, class_tCell= fn_race(RaceID,s.displayed_class,s.display_class,timeOfRace,nil,country) | |||
if race_tCell~=nil then --otherwise the class is not display | |||
local country_flag, country_name, country_tCell=fn_country(RaceID, timeOfRace, country, race_tCell, parentID) | |||
--create the table | |||
local tRow = mw.html.create('tr'):cssText( "line-height: 1.8em; padding: 5px;") | |||
tRow:node(date_tCell) | |||
if s.display_numbering == true then | |||
tRow:tag('td'):cssText("text-align:center;padding:0 0.5em"):wikitext(tostring(kk)) | |||
end | |||
tRow:node(country_tCell) | |||
if country then tRow:node(race_tCell) end | |||
if class_tCell then tRow:node(class_tCell) end | |||
local rider_tCell =fn_rider(lf,RaceID,timeOfRace,s.display_team,s.only_winner) | |||
tRow:node(rider_tCell) | |||
if s.display_leader==true then | |||
local leader_tCell=fn_rider(lf,RaceID,timeOfRace,s.display_team,3) | |||
tRow:node(leader_tCell) | |||
end | |||
---- Add the row to the table | |||
t_Body[#t_Body + 1] = {date_sortkey, tRow} | |||
end | |||
end | |||
end | end | ||
سطر 3٬972: | سطر 3٬978: | ||
header_2 = {5, 20, 21}, | header_2 = {5, 20, 21}, | ||
country_column = 1, | country_column = 1, | ||
data_sort_type = {'', '', ''}, | data_sort_type = {'', '', ''}, -- -- see https://meta.wikimedia.org/wiki/Help:Sorting | ||
item= calendarroadID, | item= calendarroadID, | ||
calendarroadID = calendarroadID, | calendarroadID = calendarroadID, | ||
سطر 4٬204: | سطر 4٬210: | ||
name= mw.ustring.gsub(name, "^(%d+)([re]+)", "%1<sup>%2</sup> ") | name= mw.ustring.gsub(name, "^(%d+)([re]+)", "%1<sup>%2</sup> ") | ||
end | end | ||
name= mw.ustring.gsub(name, "^(%a)",function (x) return mw.ustring.upper(x) end) | |||
infoGetOthers(others, stageID) | infoGetOthers(others, stageID) | ||
سطر 4٬217: | سطر 4٬223: | ||
raceId = getParentID(stageID) --for instance Tour de France 2020 | raceId = getParentID(stageID) --for instance Tour de France 2020 | ||
if raceId then | if raceId then | ||
details[2].content = (details[2].content or '') .. '، '.. WPlinkpure(raceId) | details[2].content = (details[2].content or '')..'، '.. WPlinkpure(raceId) | ||
for k, p31 in statements(raceId, 'P31') do --get Tour de France | for k, p31 in statements(raceId, 'P31') do --get Tour de France | ||
race[k] = p31.mainsnak.datavalue.value.id --for the jersey | race[k] = p31.mainsnak.datavalue.value.id --for the jersey | ||
سطر 4٬241: | سطر 4٬247: | ||
if not details[12].content then | if not details[12].content then | ||
local elevation=getElevation(stageID) | local elevation=getElevation(stageID) | ||
if | if elevation ~= nil then details[12].content =elevation else details[12].content = nil end | ||
end --Elevation | end --Elevation | ||
سطر 4٬310: | سطر 4٬316: | ||
local v=t_s[type_ofclas][name_ofclas] | local v=t_s[type_ofclas][name_ofclas] | ||
v['link']=riderLink | v['link']=riderLink | ||
v['team']=riderTeam | v['team']=riderTeam | ||
v['rank']=isdisqualified(p1346,q) | v['rank']=isdisqualified(p1346,q) | ||
سطر 4٬353: | سطر 4٬359: | ||
v['rank'] = isdisqualified(p2417, q) | v['rank'] = isdisqualified(p2417, q) | ||
local thisid= p2417.mainsnak.datavalue.value.id | local thisid= p2417.mainsnak.datavalue.value.id | ||
v['link'],_ = subwinner(thisid, timeOfRace, q) | v['link'],_ = subwinner(thisid, timeOfRace, q) | ||
if v['gap'] == nil and v['time'] == nil then | if v['gap'] == nil and v['time'] == nil then | ||
سطر 4٬413: | سطر 4٬419: | ||
temp=translate("unit",7,w_race) | temp=translate("unit",7,w_race) | ||
else | else | ||
temp=translate("unit",6,w_race) | |||
end | end | ||
v['points'] = v['points']..temp | v['points'] = v['points']..temp | ||
سطر 4٬427: | سطر 4٬433: | ||
tCell:attr('rowspan','2') | tCell:attr('rowspan','2') | ||
end | end | ||
tCell:cssText("width:1%;background-color:"..backgroundColorLight..";text-align:" .. | tCell:cssText("width:1%;background-color:"..backgroundColorLight..";text-align:".. | ||
textalign .. ";padding:0 2px 0 2px;white-space:nowrap") | textalign..";padding:0 2px 0 2px;white-space:nowrap") | ||
if value_order~='annex' and v['translation']~=40 and v['translation']~=41 then -- Cima Coppi, Cima Pantani with a line break | if value_order~='annex' and v['translation']~=40 and v['translation']~=41 then -- Cima Coppi, Cima Pantani with a line break | ||
سطر 4٬457: | سطر 4٬463: | ||
temp= "|link="..jerseyWPID | temp= "|link="..jerseyWPID | ||
end | end | ||
tCell:wikitext("[[File:"..v['jersey'].."|20px"..temp.."]]" .. title) | tCell:wikitext("[[File:"..v['jersey'].."|20px"..temp.."]]"..title) | ||
end | end | ||
end | end | ||
سطر 4٬478: | سطر 4٬484: | ||
tTab2=tCell:tag('table'):attr('cellpadding','0'):attr('cellspacing','0'):css('width','100%') | tTab2=tCell:tag('table'):attr('cellpadding','0'):attr('cellspacing','0'):css('width','100%') | ||
tRow = tTab2:tag('tr') | tRow = tTab2:tag('tr') | ||
tRow:tag('td'):cssText('width:100%;text-align:" .. textalign .. ";padding-left:2px') | tRow:tag('td'):cssText('width:100%;text-align:"..textalign..";padding-left:2px') | ||
:wikitext("("..v['team']..")") --add the team | :wikitext("("..v['team']..")") --add the team | ||
tRow:tag('td'):cssText('font-size:85%;vertical-align:top;white-space:nowrap') | tRow:tag('td'):cssText('font-size:85%;vertical-align:top;white-space:nowrap') | ||
سطر 4٬484: | سطر 4٬490: | ||
else | else | ||
if v['team']~=nil or v['speed'] ~=nil then | if v['team']~=nil or v['speed'] ~=nil then | ||
tCell:cssText("text-align:" .. textalign .. ";padding-left:2px") | tCell:cssText("text-align:"..textalign..";padding-left:2px") | ||
if v['team'] ~= nil then | if v['team'] ~= nil then | ||
tCell:wikitext("("..v['team']..")") --add the team | tCell:wikitext("("..v['team']..")") --add the team | ||
سطر 4٬509: | سطر 4٬515: | ||
local timeOfRace = getTimeOfRace(raceID, true) | local timeOfRace = getTimeOfRace(raceID, true) | ||
local w_race=isWomenrace(raceID) | local w_race=isWomenrace(raceID) | ||
local teamCats_lot = { -- {c,d,e} c = singular team type, d = plural team type, e = print order of the team types | local teamCats_lot = { -- {c,d,e} c = singular team type, d = plural team type, e = print order of the team types | ||
-- | ["Q6154783"] = {4,5,1}, -- WorldTeam | ||
["Q80425135"] = {4,5,2}, -- UCI Women’s WorldTeam | |||
[" | ["Q20638319"] = {6,7,3}, -- ProTeam (2005-2014) | ||
["Q20638319"] | ["Q78464255"] = {6,7,4}, -- ProTeam (2020-) | ||
["Q78464255"] | ["Q382927"] = {8,9,5}, -- UCI Professional Continental Team (2005-2019) | ||
["Q382927"] | ["Q1756006"] = {10,11,6}, -- UCI Continental Team | ||
["Q1756006"] | ["Q20639847"] = {16,17,7}, -- professional cycling team | ||
["Q20639847"] | ["Q20653563"] = {20,21,8}, -- Groupe Sportif I | ||
["Q20653563"] | ["Q20653564"] = {22,23,9}, -- Groupe Sportif II | ||
["Q20653564"] | ["Q20653566"] = {24,25,10}, -- Groupe Sportif III | ||
["Q20653566"] | ["Q2466826"] = {28,29,11}, -- UCI Women’s Team | ||
["Q23726798"] = {12,13,12}, -- national cycling team | |||
[" | ["Q99658502"] = {12,13,13}, -- national cycling team "B" | ||
["Q20738667"] = {12,13,14}, -- national cycling team U23 | |||
["Q54555994"] = {12,13,15}, -- national cycling team U19 | |||
[" | ["Q28492441"] = {12,13,16}, -- national cycling team with sponsor name | ||
["Q20652655"] = {18,19,17}, -- amateur cycling team | |||
["Q26849121"] = {30,31,18}, -- Women's amateur cycling team | |||
["Q20639848"] = {14,15,19}, -- club and region cycling team | |||
["Q20653570"] = {14,15,20}, -- club and region cycling team | |||
["Q99658502"] | |||
["Q20738667"] | |||
["Q54555994"] | |||
[" | |||
["Q20652655"] | |||
["Q26849121"] | |||
["Q20639848"] | |||
["Q20653570"] | |||
} | } | ||
سطر 4٬564: | سطر 4٬546: | ||
local teamLink, teamCat, countryID = getTeamLinkCat(v.mainsnak.datavalue.value.id, timeOfRace, true) | local teamLink, teamCat, countryID = getTeamLinkCat(v.mainsnak.datavalue.value.id, timeOfRace, true) | ||
local flagImage = countryID and flag(countryID, timeOfRace) or '' | local flagImage = countryID and flag(countryID, timeOfRace) or '' | ||
teams[#teams + 1] = {flagImage .. ' ' .. teamLink, teamCat, | teams[#teams + 1] = {flagImage..' '..teamLink, teamCat, | ||
teamCats_lot[teamCat] and teamCats_lot[teamCat][3] or 999, no} | teamCats_lot[teamCat] and teamCats_lot[teamCat][3] or 999, no} | ||
end | end | ||
سطر 4٬611: | سطر 4٬593: | ||
end | end | ||
local tHeader= | local tHeader= mw.html.create('span'):css('font-size','1.2em'):css('font-weight','bold') | ||
if not header then | if not header then | ||
-- Unknown team category. Get the label for the entity to display if possible | -- Unknown team category. Get the label for the entity to display if possible | ||
سطر 4٬623: | سطر 4٬605: | ||
local showcounter = 2 | local showcounter = 2 | ||
if count >= showcounter then | if count >= showcounter then | ||
tTag=mw.html.create('small'):wikitext(' (' .. count ..')') | tTag=mw.html.create('small'):wikitext(' ('..count ..')') | ||
end | end | ||
return tostring(tHeader)..tostring(tTag) | return tostring(tHeader)..tostring(tTag) | ||
سطر 4٬653: | سطر 4٬635: | ||
end | end | ||
oldCatID = team[2] | oldCatID = team[2] | ||
tOl:tag('li') | |||
:cssText("width:20em;display:inline-block;vertical-align:text-top") | :cssText("width:20em;display:inline-block;vertical-align:text-top") | ||
:wikitext(team[1]) | :wikitext(team[1]) | ||
سطر 4٬662: | سطر 4٬644: | ||
tCell:node(tOl) | tCell:node(tOl) | ||
local wd_link = mw.html.create('span'):css('float',floattable):wikitext(wdLink(raceID .. '#P1923')) | local wd_link = mw.html.create('span'):css('float',floattable):wikitext(wdLink(raceID..'#P1923')) | ||
if arwiki_totemplate then wd_link = wdLink(raceID .. '#P1923') end | if arwiki_totemplate then wd_link = wdLink(raceID..'#P1923') end | ||
local tableFooter1=mw.html.create('tr') | local tableFooter1=mw.html.create('tr') | ||
tCell=tableFooter1:tag('td') | tCell=tableFooter1:tag('td') | ||
سطر 4٬832: | سطر 4٬814: | ||
header_1 = 11, -- translation 10 in function headoftableII is printed in the upper part of the table header | 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 | 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 = | item = tempID, | ||
property = 'P4320', -- property to use for this table | property = 'P4320', -- property to use for this table | ||
team_classification = false, -- it is not a team classification table, its a rider classification table | team_classification = false, -- it is not a team classification table, its a rider classification table | ||
سطر 4٬848: | سطر 4٬830: | ||
header_1 = 12, -- translation 10 in function headoftableII is printed in the upper part of the table header | 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 | 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 = | item = tempID, | ||
property = 'P4322', -- property to use for this table | property = 'P4322', -- property to use for this table | ||
team_classification = false, -- it is not a team classification table, its a rider classification table | team_classification = false, -- it is not a team classification table, its a rider classification table | ||
سطر 4٬864: | سطر 4٬846: | ||
header_1 = 13, -- translation 10 in function headoftableII is printed in the upper part of the table header | 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 | 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 = | item = tempID, | ||
property = 'P4323', -- property to use for this table | property = 'P4323', -- property to use for this table | ||
team_classification = false, -- it is not a team classification table, its a rider classification table | team_classification = false, -- it is not a team classification table, its a rider classification table | ||
سطر 4٬880: | سطر 4٬862: | ||
header_1 = 13, -- translation 10 in function headoftableII is printed in the upper part of the table header | 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 | 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 = | item = tempID, | ||
property = 'P4323', -- property to use for this table | property = 'P4323', -- property to use for this table | ||
team_classification = false, -- it is not a team classification table, its a rider classification table | team_classification = false, -- it is not a team classification table, its a rider classification table | ||
سطر 4٬896: | سطر 4٬878: | ||
header_1 = 18, -- translation 10 in function headoftableII is printed in the upper part of the table header | 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 | 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 = | item = tempID, | ||
property = 'P4323', -- property to use for this table (same as best young classification) | 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 | team_classification = false, -- it is not a team classification table, its a rider classification table | ||
سطر 4٬928: | سطر 4٬910: | ||
header_1 = 17, -- translation 10 in function headoftableII is printed in the upper part of the table header | 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 | 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 = | item = tempID, | ||
property = 'P4321', -- property to use for this table | property = 'P4321', -- property to use for this table | ||
team_classification = false, -- it is not a team classification table, its a rider classification table | team_classification = false, -- it is not a team classification table, its a rider classification table | ||
سطر 4٬940: | سطر 4٬922: | ||
function p.custompointsclassification(frame) | function p.custompointsclassification(frame) | ||
local tempID, lf=get_and_checkID(frame) | local tempID, lf=get_and_checkID(frame) | ||
local team_title | local team_title | ||
local temp=get_arg(4,frame) | local temp=get_arg(4,frame) | ||
سطر 4٬951: | سطر 4٬933: | ||
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_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=get_arg(3,frame) or '', --with lf does not work | header_1_text=get_arg(3,frame) or '', --with lf does not work | ||
item = | item = tempID, | ||
property = get_arg(2,frame), -- property to use for this table | property = get_arg(2,frame), -- property to use for this table | ||
team_title=team_title, --for old races where there was no team, only bike brands | team_title=team_title, --for old races where there was no team, only bike brands | ||
سطر 4٬964: | سطر 4٬946: | ||
function p.customtimeclassification(frame) | function p.customtimeclassification(frame) | ||
local tempID, lf=get_and_checkID(frame) | local tempID, lf=get_and_checkID(frame) | ||
local team_title | local team_title | ||
local temp=get_arg(4,frame) | local temp=get_arg(4,frame) | ||
سطر 4٬986: | سطر 4٬967: | ||
end | end | ||
function new_classification(s, frame) | |||
local country = getCountryBool(no_country_classification) | |||
local lf = s.lf | |||
local raceID = s.item | |||
local w_race=isWomenrace(raceID) | |||
--[=[ It is possible to give the classification tables in the article commands to change the standard behaviour. They could look like this: | |||
--[=[ It is possible to give the classification tables in the article commands to change the standard behaviour. They could look like this: | |||
{{Cycling race/teamsclassificationbytime|Q18574623|newline=false|country=true}} | {{Cycling race/teamsclassificationbytime|Q18574623|newline=false|country=true}} | ||
{{Cycling race/teamsclassificationbytime|Q18574623|country= false|newline=false}} | {{Cycling race/teamsclassificationbytime|Q18574623|country= false|newline=false}} | ||
سطر 5٬112: | سطر 5٬044: | ||
:css('border' , '0') | :css('border' , '0') | ||
local wd_link = wdLink( raceID .. '#' .. s.property ) | local wd_link = wdLink( raceID..'#'..s.property ) | ||
if arwiki_totemplate then | if arwiki_totemplate then | ||
tableBody = mw.html.create('table'):addClass('sortable') | tableBody = mw.html.create('table'):addClass('sortable') | ||
سطر 5٬124: | سطر 5٬056: | ||
tableBody:tag('tr'):tag('th') | tableBody:tag('tr'):tag('th') | ||
:attr('colspan', tostring(tableHeader2_size + 1)):cssText("padding:2px 2px; text-align:center; background-color:"..backgroundColor) | |||
:wikitext(tostring(wd_span)..s.header_1_text) | :wikitext(tostring(wd_span)..s.header_1_text) | ||
سطر 5٬132: | سطر 5٬064: | ||
local header_text | local header_text | ||
if k == team_translation_index then --for team | if k == team_translation_index then --for team | ||
header_text=s.team_title | |||
else | else | ||
header_text=translate(s.header_function,k,w_race) | |||
end | end | ||
local head =header:tag('th'):wikitext(header_text) | local head =header:tag('th'):wikitext(header_text) | ||
سطر 5٬230: | سطر 5٬162: | ||
if s.background == 'color' then | if s.background == 'color' then | ||
if h.jersey[1] and bg_color then -- background color of winner depending on jersey | if h.jersey[1] and bg_color then -- background color of winner depending on jersey | ||
tStyle = tStyle .. 'background-color:' ..bg_color | tStyle = tStyle..'background-color:' ..bg_color | ||
end | end | ||
end | end | ||
سطر 5٬239: | سطر 5٬171: | ||
tBody:tag('td'):cssText("text-align:center;padding:2px 0.5em 2px 0.5em;white-space:nowrap;"..cancelled) | tBody:tag('td'):cssText("text-align:center;padding:2px 0.5em 2px 0.5em;white-space:nowrap;"..cancelled) | ||
:wikitext(number(gender, rank, wiki)) | :wikitext(number(gender, rank, wiki)) | ||
tCell= tBody:tag('td'):cssText("text-align:" .. textalign .. ";padding:0 0.2em 0 0.2em;"..cancelled) | tCell= tBody:tag('td'):cssText("text-align:"..textalign..";padding:0 0.2em 0 0.2em;"..cancelled) | ||
if not s.team_classification then | if not s.team_classification then | ||
if country then | if country then | ||
tCell:wikitext(riderLink .. jersey(h.jersey) ) | tCell:wikitext(riderLink..jersey(h.jersey) ) | ||
tBody:tag('td'):wikitext( flagLink ..' '.. countryName) | tBody:tag('td'):wikitext( flagLink ..' '.. countryName) | ||
else | else | ||
tCell:wikitext(flagLink .. ' ' .. riderLink .. jersey(h.jersey)) | tCell:wikitext(flagLink..' '..riderLink..jersey(h.jersey)) | ||
end | end | ||
if s.display_team~=false then | if s.display_team~=false then | ||
سطر 5٬254: | سطر 5٬186: | ||
else --team | else --team | ||
if country then | if country then | ||
tCell:wikitext(teamLink .. jersey(h.jersey)) | tCell:wikitext(teamLink..jersey(h.jersey)) | ||
tBody:tag('td'):wikitext(flagLink .. ' ' .. countryName) | tBody:tag('td'):wikitext(flagLink..' '..countryName) | ||
else | else | ||
tCell:wikitext(flagLink .. ' ' .. teamLink .. jersey(h.jersey)) | tCell:wikitext(flagLink..' '..teamLink..jersey(h.jersey)) | ||
end | end | ||
end | end | ||
سطر 5٬268: | سطر 5٬200: | ||
temp='' | temp='' | ||
else | else | ||
temp=plus .. calculateTime(h.value[3]) | temp=plus..calculateTime(h.value[3]) | ||
end | end | ||
else | else | ||
سطر 5٬307: | سطر 5٬239: | ||
temp=calculateTime(h.value[2]) | temp=calculateTime(h.value[2]) | ||
else | else | ||
temp=plus .. calculateTime(h.value[3]) | temp=plus..calculateTime(h.value[3]) | ||
end | end | ||
tBody:tag('td'):cssText("text-align:right;padding:0 0.2em 0 0.2em"):wikitext(temp) | tBody:tag('td'):cssText("text-align:right;padding:0 0.2em 0 0.2em"):wikitext(temp) | ||
سطر 5٬314: | سطر 5٬246: | ||
if s.property == 'P3496' then -- for table teambypointsclassification, adds points | if s.property == 'P3496' then -- for table teambypointsclassification, adds points | ||
tCell=tBody:tag('td'):cssText("text-align:right;padding:0 0.2em 0 0.2em") | tCell=tBody:tag('td'):cssText("text-align:right;padding:0 0.2em 0 0.2em") | ||
:wikitext(h.value[1]) | |||
if type(h.value[1]) == "number" then | if type(h.value[1]) == "number" then | ||
if h.value[1] > 1 then | if h.value[1] > 1 then | ||
سطر 5٬348: | سطر 5٬280: | ||
end | end | ||
tableBody=sortAndConcat(t_Body, tableBody) | |||
local tableFooter1,tableFooter2 | local tableFooter1,tableFooter2 | ||
if s.display_ref == 1 or wiki == "ar" then | if s.display_ref == 1 or wiki == "ar" then | ||
سطر 5٬376: | سطر 5٬308: | ||
--=== G) Infobox === | --=== G) Infobox === | ||
function p.infobox(frame) | function p.infobox(frame) | ||
return infobox_main(frame,0) | return infobox_main(frame,0) | ||
end | end | ||
function p. | function p.infoboxseason(frame) | ||
return infobox_main(frame,1) | return infobox_main(frame,1) | ||
end | end | ||
function p. | function p.infoboxChamp(frame) | ||
return infobox_main(frame,2) | return infobox_main(frame,2) | ||
end | end | ||
سطر 5٬398: | سطر 5٬330: | ||
local w_race=isWomenrace(entityID) | local w_race=isWomenrace(entityID) | ||
if selector==0 then -- normal infobox | if selector==0 then --normal infobox | ||
details = { | details = { | ||
{ name = translate("infobox",2,w_race)}, -- course | { name = translate("infobox",2,w_race)}, -- course | ||
سطر 5٬417: | سطر 5٬349: | ||
{ name = translate("infobox",33,w_race), special = true}, -- special 2 | { name = translate("infobox",33,w_race), special = true}, -- special 2 | ||
} | } | ||
elseif selector==1 then -- season infobox | elseif selector==1 then --season infobox | ||
details = { | details = { | ||
{ name = translate("infobox",46,w_race)}, -- edition (1) | { name = translate("infobox",46,w_race)}, -- edition (1) | ||
سطر 5٬429: | سطر 5٬361: | ||
{ name = translate("infobox",33,w_race), special = true}, -- special 2 | { name = translate("infobox",33,w_race), special = true}, -- special 2 | ||
} | } | ||
else -- champ | else --champ | ||
details = { | details = { | ||
{ name = translate("infobox",46,w_race)}, -- edition (1) | { name = translate("infobox",46,w_race)}, -- edition (1) | ||
سطر 5٬445: | سطر 5٬377: | ||
others = get_others_dic() | others = get_others_dic() | ||
if selector==0 then | if selector==0 then | ||
winners = { | winners = { | ||
{ name = translate("infobox",19,w_race), QID = 'Q20882667' }, -- first | { name = translate("infobox",19,w_race), QID = 'Q20882667' }, -- first | ||
سطر 5٬467: | سطر 5٬399: | ||
{ name = translate("infobox",42,w_race), QID ='Q61976872' } --nationality | { name = translate("infobox",42,w_race), QID ='Q61976872' } --nationality | ||
} | } | ||
elseif selector==1 then | elseif selector==1 then | ||
winners = { | winners = { | ||
{ name = translate("infobox",52,w_race), QID = 'Q20882667' }, -- individual (first) | { name = translate("infobox",52,w_race), QID = 'Q20882667' }, -- individual (first) | ||
سطر 5٬478: | سطر 5٬410: | ||
{ name = translate("infobox",59,w_race), QID = 'Q72068724' } -- country U23 | { name = translate("infobox",59,w_race), QID = 'Q72068724' } -- country U23 | ||
} | } | ||
end -- Champ | end --Champ has no winners | ||
getLocalContent(details, lf.args) | getLocalContent(details, lf.args) | ||
getLocalContent(others, lf.args) | getLocalContent(others, lf.args) | ||
سطر 5٬499: | سطر 5٬431: | ||
local nr = firstValue(entityID, 'P393') -- P393 is 'edition number' | local nr = firstValue(entityID, 'P393') -- P393 is 'edition number' | ||
if nr then | if nr then | ||
if wiki == 'fr' then nr = (nr == 1) and "1<sup>re</sup> " or (nr .. "<sup>e</sup> ") | if wiki == 'fr' then nr = (nr == 1) and "1<sup>re</sup> " or (nr.."<sup>e</sup> ") | ||
elseif wiki == "nl" then nr = nr .. "e " | elseif wiki == "nl" then nr = nr.."e " | ||
elseif wiki == "ru" then nr = nr .. "-й " | elseif wiki == "ru" then nr = nr.."-й " | ||
elseif wiki == "eo" then nr = nr .. "-a " | elseif wiki == "eo" then nr = nr.."-a " | ||
elseif wiki == "hu" then nr = nr .. ". " | elseif wiki == "hu" then nr = nr..". " | ||
else nr = nr .. ". " | else nr = nr..". " | ||
end | end | ||
end | end | ||
سطر 5٬538: | سطر 5٬470: | ||
if nr and is_a then | if nr and is_a then | ||
details[1].content = nr .. ' ' .. is_a | details[1].content = nr..' '..is_a | ||
end | end | ||
end | end | ||
سطر 5٬555: | سطر 5٬487: | ||
end | end | ||
if class then | if class then | ||
tours[1] = tours[1] .. ' ' .. class | tours[1] = tours[1]..' '..class | ||
end | end | ||
details[2].content = table.concat(tours, '<br/>') | details[2].content = table.concat(tours, '<br/>') | ||
سطر 5٬580: | سطر 5٬512: | ||
end | end | ||
if selector==0 or selector==1 then | |||
if not details[index_date].content then -- date | if not details[index_date].content then -- date | ||
details[index_date].content, timeOfRace, plural = get_formatted_date(entityID, 'infobox') | details[index_date].content, timeOfRace, plural = get_formatted_date(entityID, 'infobox') | ||
سطر 5٬587: | سطر 5٬519: | ||
end | end | ||
end | end | ||
end | |||
--from this point the functions differ fundamentally | --from this point the functions differ fundamentally | ||
سطر 5٬626: | سطر 5٬558: | ||
if not details[13].content then | if not details[13].content then | ||
local elevation=getElevation(entityID) | local elevation=getElevation(entityID) | ||
if | if elevation then details[13].content =elevation else details[13].content = nil end | ||
end --Elevation | end --Elevation | ||
سطر 5٬713: | سطر 5٬645: | ||
if others[3].content then -- map | if others[3].content then -- map | ||
tab:tag('tr'):tag('td'):attr('colspan','2'):css('text-align','center') | tab:tag('tr'):tag('td'):attr('colspan','2'):css('text-align','center') | ||
:wikitext("[[File:".. others[3].content .. "|center|300px]]") | :wikitext("[[File:".. others[3].content.."|center|300px]]") | ||
if others[5].content then -- caption | if others[5].content then -- caption | ||
tab:tag('tr'):tag('td'):attr('colspan','2'):css('text-align','center'):css('font-size','80%') | tab:tag('tr'):tag('td'):attr('colspan','2'):css('text-align','center'):css('font-size','80%') | ||
سطر 5٬765: | سطر 5٬697: | ||
local timeOfRace, class | local timeOfRace, class | ||
local listOfNames=getFormerNames(entityID, 'P1448') | |||
local sport_id=firstValue(entityID, 'P641', 'id') | local sport_id=firstValue(entityID, 'P641', 'id') | ||
سطر 5٬793: | سطر 5٬725: | ||
--number of editions | --number of editions | ||
if not details[4].content and tRace.numberOfEditions and tRace.lastEditionYear then | if not details[4].content and tRace.numberOfEditions and tRace.lastEditionYear then | ||
details[4].content = tostring(tRace.numberOfEditions).." (" .. translate("raceinfobox",31,w_race) .. " "..tostring(tRace.lastEditionYear)..")" | details[4].content = tostring(tRace.numberOfEditions).." ("..translate("raceinfobox",31,w_race).." "..tostring(tRace.lastEditionYear)..")" | ||
end | end | ||
--periodicity | --periodicity | ||
سطر 5٬825: | سطر 5٬757: | ||
details[11].content = classContent | details[11].content = classContent | ||
if numberClass >1 then | if numberClass >1 then | ||
details[11].name = details[11].name_plural | |||
end | end | ||
end | |||
if not details[12].content then | |||
details[12].content = circuitLink | details[12].content = circuitLink | ||
end | |||
--Official web site | |||
if not details[13].content then | if not details[13].content then | ||
details[13].content = officialSite(entityID) | details[13].content = officialSite(entityID) | ||
سطر 5٬849: | سطر 5٬781: | ||
if not listOfNamesAtBottom then | if not listOfNamesAtBottom then | ||
if listOfNames and #listOfNames>1 then | if listOfNames and #listOfNames>1 then | ||
tab:node(addATitle(translate("raceinfobox",18,w_race))) | tab:node(addATitle(translate("raceinfobox",18,w_race))) | ||
for _, v in pairs(listOfNames) do | for _, v in pairs(listOfNames) do | ||
tab:node(addARow(v[2],v[3])) --period, name | tab:node(addARow(v[2],v[3])) --period, name | ||
سطر 5٬855: | سطر 5٬787: | ||
end | end | ||
end | end | ||
infoFillOthersDetails(tab, nil, details,translate("raceinfobox",19,w_race),"260px") | infoFillOthersDetails(tab, nil, details,translate("raceinfobox",19,w_race),"260px") | ||
if listOfNamesAtBottom then | 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 | 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,w_race))) | tab:node(addATitle(translate("raceinfobox",18,w_race))) | ||
for _, v in pairs(listOfNames) do | for _, v in pairs(listOfNames) do | ||
tab:node(addARow(v[2],v[3])) --period, name | tab:node(addARow(v[2],v[3])) --period, name | ||
سطر 5٬883: | سطر 5٬815: | ||
if tRace.lastLink then | if tRace.lastLink then | ||
outTable = mw.html.create('tr') | |||
local tCell=outTable:tag('td'):attr('colspan','2'):css('text-align','center') | local tCell=outTable:tag('td'):attr('colspan','2'):css('text-align','center') | ||
local lastText="[[File:Crystal Clear app kworldclock.png|left|37px]]".. | local lastText="[[File:Crystal Clear app kworldclock.png|left|37px]]".. | ||
سطر 5٬896: | سطر 5٬828: | ||
outTable = mw.html.create('tr') | outTable = mw.html.create('tr') | ||
local tCell=outTable:tag('td'):attr('colspan','2'):css('text-align','center') | 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,w_race).. | |||
":<br>'''".. | |||
tRace.nextLink.."'''" | |||
tCell:cssText("text-align:center"):wikitext(nextText) | tCell:cssText("text-align:center"):wikitext(nextText) | ||
tab:node(outTable) | tab:node(outTable) | ||
سطر 5٬984: | سطر 5٬916: | ||
local w_race=isWomenrace(s.seasonID) | local w_race=isWomenrace(s.seasonID) | ||
local temp = firstValue(s.seasonID, ' | local temp = firstValue(s.seasonID, 'P361', 'id') | ||
if temp then teamID = temp end | if temp then teamID = temp end | ||
سطر 5٬991: | سطر 5٬923: | ||
if not s.year then | if not s.year then | ||
label=getLabelFallback(s.seasonID) | label=getLabelFallback(s.seasonID) | ||
s.year=string.match(label, "%d%d%d%d") | |||
end | end | ||
سطر 6٬071: | سطر 5٬994: | ||
if not endDatetemp then endDatefound=false end | if not endDatetemp then endDatefound=false end | ||
beginDate, beginYear, beginMonth, beginDay, errortext = parseDate(beginDate, '2040', '01', '01', errortext, ' missing qualifiers by rider') | beginDate, beginYear, beginMonth, beginDay, errortext = parseDate(beginDate, '2040', '01', '01', errortext, ' missing qualifiers by rider') | ||
endDate, endYear, endMonth, endDay, _ = parseDate(endDatetemp, beginYear, '12', '31', errortext, '') | |||
if beginYear < startOfSeasonYear or (beginYear == startOfSeasonYear and beginMonth < startOfSeasonMonth) or | if beginYear < startOfSeasonYear or (beginYear == startOfSeasonYear and beginMonth < startOfSeasonMonth) or | ||
سطر 6٬141: | سطر 6٬064: | ||
end | end | ||
local wd_link = mw.html.create('span'):css('float','left'):wikitext(wdLink(s.seasonID..'#P527')) | local wd_link = mw.html.create('span'):css('float','left'):wikitext(wdLink(s.seasonID..'#P527')) | ||
if arwiki_totemplate then wd_link = wdLink(s.seasonID .. '#P527') end | if arwiki_totemplate then wd_link = wdLink(s.seasonID..'#P527') end | ||
local outTable = mw.html.create('table') | local outTable = mw.html.create('table') | ||
:addClass('sortable') | |||
:attr('cellpadding', '2') | |||
:attr('cellspacing', '0') | |||
:css('border' , '1px solid rgb(200,200,200)') | |||
:css('padding', '3px') | |||
local th_colspan = 4 | local th_colspan = 4 | ||
if wiki == "ar" then th_colspan = 5 end | if wiki == "ar" then th_colspan = 5 end | ||
local tRow=outTable:tag('tr'):css('line-height','1.8em') | local tRow=outTable:tag('tr'):css('line-height','1.8em') | ||
:css('background-color',backgroundColor) | |||
:tag('th'):attr('colspan', th_colspan):cssText('text-align:center;white-space:nowrap') | |||
:wikitext(tostring(wd_link)) | :wikitext(tostring(wd_link)) | ||
if s.year then | if s.year then | ||
tRow:wikitext(translate("getSquadTableColumn",7,w_race).." "..s.year) | |||
else | else | ||
tRow:wikitext(translate("getSquadTableColumn",7,w_race)) | tRow:wikitext(translate("getSquadTableColumn",7,w_race)) | ||
سطر 6٬165: | سطر 6٬088: | ||
header:tag('th'):cssText('text-align:'..textalign..';padding:2px 20px 2px 2px;white-space:nowrap'):wikitext(translate("getSquadTableColumn",2,w_race)) | header:tag('th'):cssText('text-align:'..textalign..';padding:2px 20px 2px 2px;white-space:nowrap'):wikitext(translate("getSquadTableColumn",2,w_race)) | ||
if l10n["country_name_list"] and wiki ~= 'lv' and wiki ~= 'ar' then | if l10n["country_name_list"] and wiki ~= 'lv' and wiki ~= 'ar' then | ||
header:tag('th'):cssText('text-align:center;padding:2px 20px 2px 2px;white-space:nowrap'):wikitext(translate("getSquadTableColumn",6,w_race)) | |||
end | end | ||
if wiki == "ar" then | if wiki == "ar" then | ||
سطر 6٬215: | سطر 6٬138: | ||
end | end | ||
elseif wiki == "ar" then | elseif 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 | if v['riderTeam'] then | ||
سطر 6٬236: | سطر 6٬159: | ||
tableEndText = tableEndText.. '<span style="color:white">'.. translate("getSquadTableColumn",5,w_race)..': </span>'.. riderName.. temp | tableEndText = tableEndText.. '<span style="color:white">'.. translate("getSquadTableColumn",5,w_race)..': </span>'.. riderName.. temp | ||
end | end | ||
iii = iii | iii = iii + 1 | ||
if riderRef ~= nil then tableEndText = tableEndText.. | if riderRef ~= nil then tableEndText = tableEndText.. | ||
s.lf:extensionTag{name='ref', content=v['riderRef'], args = {name='tr_'..iii..s.seasonID}} end | s.lf:extensionTag{name='ref', content=v['riderRef'], args = {name='tr_'..iii..s.seasonID}} end | ||
سطر 6٬500: | سطر 6٬423: | ||
[ 'Q20882668' ]=translate("listofwinners",3, w_race), -- second | [ 'Q20882668' ]=translate("listofwinners",3, w_race), -- second | ||
[ 'Q20882669' ]=translate("listofwinners",4, w_race), -- third | [ 'Q20882669' ]=translate("listofwinners",4, w_race), -- third | ||
[ 'Q20883007' ]=translate("listofwinners",5, w_race), -- points | [ 'Q20883007' ]=translate("listofwinners",5, w_race), -- points | ||
[ 'Q20883212' ]=translate("listofwinners",6, w_race), -- mountains | [ 'Q20883212' ]=translate("listofwinners",6, w_race), -- mountains | ||
[ 'Q20883328' ]=translate("listofwinners",7, w_race), -- sprints | [ 'Q20883328' ]=translate("listofwinners",7, w_race), -- sprints | ||
سطر 6٬520: | سطر 6٬443: | ||
} | } | ||
else --main | else --main | ||
titletable={ | |||
-- winner: | -- winner: | ||
[ 'Q20882667' ]=translate("listofwinners",2, w_race), -- winner | [ 'Q20882667' ]=translate("listofwinners",2, w_race), -- winner | ||
[ 'Q20883007' ]=translate("listofwinners",2, w_race), -- points | [ 'Q20883007' ]=translate("listofwinners",2, w_race), -- points | ||
[ 'Q20883212' ]=translate("listofwinners",2, w_race), -- mountains | [ 'Q20883212' ]=translate("listofwinners",2, w_race), -- mountains | ||
[ 'Q20883328' ]=translate("listofwinners",2, w_race), -- sprints | [ 'Q20883328' ]=translate("listofwinners",2, w_race), -- sprints | ||
سطر 6٬592: | سطر 6٬515: | ||
local year = timeOfRace and string.sub(timeOfRace, 2, 5) or '?' | local year = timeOfRace and string.sub(timeOfRace, 2, 5) or '?' | ||
local month = timeOfRace and string.sub(timeOfRace, 7, 8) or '01' | local month = timeOfRace and string.sub(timeOfRace, 7, 8) or '01' | ||
if year == "?" then mw.log("no year at " .. partID ) end | if year == "?" then mw.log("no year at "..partID ) end | ||
if endyear==0 or (tonumber(year) or 0)<=endyear then | if endyear==0 or (tonumber(year) or 0)<=endyear then | ||
if (tonumber(year) or 0) >= beginyear then | if (tonumber(year) or 0) >= beginyear then | ||
سطر 6٬599: | سطر 6٬522: | ||
local sitelink = mw.wikibase.getSitelink(partID) | local sitelink = mw.wikibase.getSitelink(partID) | ||
if sitelink then | if sitelink then | ||
sitelink = '[[' .. sitelink .. '|' .. year .. ']]' | sitelink = '[['..sitelink..'|'..year..']]' | ||
else | else | ||
sitelink = year | sitelink = year | ||
end | end | ||
if WDlink_on then | if WDlink_on then | ||
sitelink = sitelink .. ' ' .. wdLink(partID) | sitelink = sitelink..' '..wdLink(partID) | ||
end | end | ||
local winners = {} | local winners = {} | ||
سطر 6٬611: | سطر 6٬534: | ||
local tCellstr='' | local tCellstr='' | ||
local temp=firstValue(partID, 'P1346','id') | |||
if temp and temp=='Q30108381' then --race cancelled | if temp and temp=='Q30108381' then --race cancelled | ||
local cancelledlabel = getLabelFallback('Q30108381') | local cancelledlabel = getLabelFallback('Q30108381') | ||
سطر 6٬633: | سطر 6٬556: | ||
end | end | ||
if firstyeartodisplay<=tonumber(year) then | if firstyeartodisplay<=tonumber(year) then | ||
rows[#rows+1]={year..month, sitelink, tCellstr} | |||
end | end | ||
end | end | ||
سطر 6٬651: | سطر 6٬574: | ||
:css('background-color',backgroundColor) | :css('background-color',backgroundColor) | ||
local tCell=tTitleRow:tag('th') | local tCell=tTitleRow:tag('th') | ||
local wd_link = mw.html.create('span'):css('float','left'):wikitext(wdLink(raceID .. "#P527")) | local wd_link = mw.html.create('span'):css('float','left'):wikitext(wdLink(raceID.."#P527")) | ||
if arwiki_totemplate then wd_link = wdLink(tostring(raceID) .. "#P527") end | if arwiki_totemplate then wd_link = wdLink(tostring(raceID).."#P527") end | ||
if WDlink_on == false then | if WDlink_on == false then | ||
tCell:wikitext(tostring(wd_link)) | tCell:wikitext(tostring(wd_link)) | ||
سطر 6٬699: | سطر 6٬622: | ||
--firstpart with header no foot | --firstpart with header no foot | ||
if shapka == 1 then -- standard header | if shapka == 1 then -- standard header | ||
return table_center .. "</table>" | return table_center.."</table>" | ||
elseif shapka == 2 then -- you need to add a title and you can add text at the beginning | elseif shapka == 2 then -- you need to add a title and you can add text at the beginning | ||
return table_center | return table_center | ||
else -- you need to add a title and you can add anything and anywhere | else -- you need to add a title and you can add anything and anywhere | ||
return table_first .. tostring(tTitleRow) .. table_center .. "</table>" | return table_first..tostring(tTitleRow)..table_center.."</table>" | ||
end | end | ||
end | end | ||
سطر 6٬771: | سطر 6٬694: | ||
_, _, key01, kebeginYear1, kebeginYear2 = mw.ustring.find(kebeginYear, "(%a+)%s*(%a+)%s*(%d+)") | _, _, key01, kebeginYear1, kebeginYear2 = mw.ustring.find(kebeginYear, "(%a+)%s*(%a+)%s*(%d+)") | ||
kebeginYear2 = tonumber(kebeginYear2) | kebeginYear2 = tonumber(kebeginYear2) | ||
kebeginYear1 = mw.ustring.lower(key01 .. kebeginYear1) | kebeginYear1 = mw.ustring.lower(key01..kebeginYear1) | ||
key2 = mw.ustring.lower(mw.text.trim(key2)) | key2 = mw.ustring.lower(mw.text.trim(key2)) | ||
_, _, key21, key22 = mw.ustring.find(key2, "(%a+)%s*(%a*)") | _, _, key21, key22 = mw.ustring.find(key2, "(%a+)%s*(%a*)") | ||
سطر 6٬872: | سطر 6٬795: | ||
local label, section_title | local label, section_title | ||
if sOrdinal == "0" then | if sOrdinal == "0" then | ||
label, section_title = translate("func_prologue",1), "#" .. translate("func_prologue",1) | label, section_title = translate("func_prologue",1), "#"..translate("func_prologue",1) | ||
else | else | ||
label, section_title = stageLink(sOrdinal, sNumber, sLetter) | label, section_title = stageLink(sOrdinal, sNumber, sLetter) | ||
end | end | ||
-- if there is a Wikipedia article of that stage show it or show the section | -- if there is a Wikipedia article of that stage show it or show the section | ||
local sLink = sitelink and ("[[" .. sitelink .. "|" .. label .. "]]") or | local sLink = sitelink and ("[["..sitelink.."|"..label.."]]") or | ||
("[[" .. section_title .. "|" .. label .. "]]") | ("[["..section_title.."|"..label.."]]") | ||
local sDate = funcDate(timeOfRace, 'small') | local sDate = funcDate(timeOfRace, 'small') | ||
local tempoverall | local tempoverall | ||
if | if winners['Q20882763']~='' then tempoverall=winners['Q20882763'] else tempoverall=winners['Q20882667'] end | ||
rows[#rows + 1] = { | rows[#rows + 1] = { | ||
rank=tonumber(sNumber) or 0, | rank=tonumber(sNumber) or 0, | ||
سطر 6٬904: | سطر 6٬827: | ||
return a["sortkey"] < b["sortkey"] | return a["sortkey"] < b["sortkey"] | ||
end) | end) | ||
local Id = ((not WDlink_on and wdLink(string.gsub(raceID, '%s', '') .. "#P527")) or "") | local Id = ((not WDlink_on and wdLink(string.gsub(raceID, '%s', '').."#P527")) or "") | ||
tab=mw.html.create('table') | tab=mw.html.create('table') | ||
سطر 6٬947: | سطر 6٬870: | ||
tCell=tRow:tag('td'):cssText("padding-right:0px"):wikitext( sPoint) | tCell=tRow:tag('td'):cssText("padding-right:0px"):wikitext( sPoint) | ||
if dPoint ~= '' then | if dPoint ~= '' then | ||
tCell:wikitext(" – " .. dPoint) | tCell:wikitext(" – "..dPoint) | ||
end | end | ||
tRow:tag('td'):cssText("padding-right:0px"):wikitext(sType) | tRow:tag('td'):cssText("padding-right:0px"):wikitext(sType) | ||
سطر 6٬972: | سطر 6٬895: | ||
tRow:tag('td'):cssText('text-align:right; padding:3px 0px 10px 0px;white-space:nowrap') | tRow:tag('td'):cssText('text-align:right; padding:3px 0px 10px 0px;white-space:nowrap') | ||
:wikitext(WPc['date']) | :wikitext(WPc['date']) | ||
tRow:tag('td'):cssText("text-align:" .. textalign .. "; padding:3px 4px 10px") | tRow:tag('td'):cssText("text-align:"..textalign.."; padding:3px 4px 10px") | ||
:wikitext(WPc['text']) | :wikitext(WPc['text']) | ||
else | else | ||
tRow:tag('td'):cssText('text-align:right; padding-right:0px') | tRow:tag('td'):cssText('text-align:right; padding-right:0px') | ||
:wikitext(WPc['date']) | :wikitext(WPc['date']) | ||
tRow:tag('td'):cssText("text-align:" .. textalign) | tRow:tag('td'):cssText("text-align:"..textalign) | ||
:wikitext(WPc['text']) | :wikitext(WPc['text']) | ||
end | end | ||
سطر 7٬027: | سطر 6٬950: | ||
ITT = true | ITT = true | ||
ITTtemp=true | ITTtemp=true | ||
else | |||
local raceLabel = mw.wikibase.getLabelByLang(v,"fr") | |||
if raceLabel then | if raceLabel then | ||
local testMenRoadrace, testMenITT, testWomenRoadrace, testWomenITT | local testMenRoadrace, testMenITT, testWomenRoadrace, testWomenITT | ||
سطر 7٬199: | سطر 7٬122: | ||
{ QID = 'Q27907747' }, -- azzurri | { QID = 'Q27907747' }, -- azzurri | ||
{ QID = 'Q28092831' }, -- rookie | { QID = 'Q28092831' }, -- rookie | ||
{ QID = 'Q20882921' }, | { QID = 'Q20882921' }, -- teams | ||
{ QID = 'Q27104269' }, -- teamspoints | { QID = 'Q27104269' }, -- teamspoints | ||
{ QID = 'Q61976850' }, | { QID = 'Q61976850' }, -- amateur | ||
{ QID = 'Q61976872' } --nationality | { QID = 'Q61976872' } --nationality | ||
} | } | ||
سطر 7٬223: | سطر 7٬146: | ||
['Q27104269']= 'Q27104271', -- teamspoints | ['Q27104269']= 'Q27104271', -- teamspoints | ||
['Q61976850']= 'Q61976847', -- amateur | ['Q61976850']= 'Q61976847', -- amateur | ||
['Q61976872']= 'Q61976871' | ['Q61976872']= 'Q61976871' --nationality | ||
} | } | ||
سطر 7٬233: | سطر 7٬156: | ||
local t = {key=ii, name=v.name, jersey='', bg_color='', used=false} | local t = {key=ii, name=v.name, jersey='', bg_color='', used=false} | ||
for jj = 1, #stages+1 do | for jj = 1, #stages+1 do | ||
t[jj] = { {}, {}, {} } | t[jj] = { {}, {}, {} } -- leader, first stage, number of stages consecutive (for rowspan) | ||
end | end | ||
columntable[v.QID] = t | columntable[v.QID] = t | ||
سطر 7٬272: | سطر 7٬195: | ||
local label, section_title | local label, section_title | ||
if sOrdinal == "0" then | if sOrdinal == "0" then | ||
label, section_title = translate("func_prologue",1), "#" .. translate("func_prologue",1) | label, section_title = translate("func_prologue",1), "#"..translate("func_prologue",1) | ||
else | else | ||
label, section_title = stageLink(sOrdinal, sNumber, sLetter) | label, section_title = stageLink(sOrdinal, sNumber, sLetter) | ||
end | end | ||
-- If there is a Wikipedia article of that stage show it or show the section. | -- If there is a Wikipedia article of that stage show it or show the section. | ||
local sLink = sitelink and ("[[" .. sitelink .. "|" .. label .. "]]") or | local sLink = sitelink and ("[["..sitelink.."|"..label.."]]") or | ||
("[[" .. section_title .. "|" .. label .. "]]") | ("[["..section_title.."|"..label.."]]") | ||
timeOfRace =getTimeOfRace(stageID) | timeOfRace =getTimeOfRace(stageID) | ||
سطر 7٬288: | سطر 7٬211: | ||
end | end | ||
winner(lf,stageID, win, timeOfRace, false, WDlink_on, false, false) --fill win table | winner(lf,stageID, win, timeOfRace, false, WDlink_on, false, false) --fill win table | ||
if ii | if ii==1 then --only first stage | ||
jerseytable, bgcolortable=winnerjersey(stageID, jerseytable) | jerseytable, bgcolortable=winnerjersey(stageID, jerseytable) | ||
end | end | ||
سطر 7٬298: | سطر 7٬221: | ||
if ii==1 then --first stage | if ii==1 then --first stage | ||
columntable[v.QID][ii]["start"]=1 --start at row 1 | columntable[v.QID][ii]["start"]=1 --start at row 1 | ||
columntable[v.QID][ii]["rowspan"]=1 --1 consecutive stage | columntable[v.QID][ii]["rowspan"]=1 --1 consecutive stage | ||
elseif columntable[v.QID][ii-1]["leader"]==win[v.QID] then --same winner as past stage ,make previous longer and delete this one | elseif columntable[v.QID][ii-1]["leader"]==win[v.QID] then --same winner as past stage ,make previous longer and delete this one | ||
local initialstage=columntable[v.QID][ii-1]["start"] | local initialstage=columntable[v.QID][ii-1]["start"] | ||
سطر 7٬306: | سطر 7٬229: | ||
else --new winner | else --new winner | ||
columntable[v.QID][ii]["start"]=ii --start at this row/stage | columntable[v.QID][ii]["start"]=ii --start at this row/stage | ||
columntable[v.QID][ii]["rowspan"]=1 --1 consecutive stage | columntable[v.QID][ii]["rowspan"]=1 --1 consecutive stage | ||
end | end | ||
columntable[v.QID].used=true | columntable[v.QID].used=true | ||
if ii | if ii==1 then --read the jersey in the first stage of a race | ||
columntable[v.QID].jersey=jerseytable[v.QID] | |||
columntable[v.QID].bg_color=bgcolortable[v.QID] | |||
end | end | ||
end | end | ||
سطر 7٬342: | سطر 7٬263: | ||
columntable[thiskey][#stages+1]["rowspan"]=1 | columntable[thiskey][#stages+1]["rowspan"]=1 | ||
--#stages is the last stage | --#stages is the last stage | ||
if (type(columntable[thiskey][#stages]["leader"])~="string" --combativity is not extrapolated | if (type(columntable[thiskey][#stages]["leader"])~="string" --combativity is not extrapolated | ||
and thiskey~='Q20893984') then --check nil actually, but it is a table.. | |||
columntable[thiskey][#stages]["leader"]= win[v.QID] --extrapolate the winner | columntable[thiskey][#stages]["leader"]= win[v.QID] --extrapolate the winner | ||
if (type(columntable[thiskey][#stages-1]["leader"])=="string" and | if (type(columntable[thiskey][#stages-1]["leader"])=="string" and | ||
win[v.QID]==columntable[thiskey][#stages-1]["leader"]) then --if there is a leader at forelast stage | |||
local initialstage=columntable[thiskey][#stages-1]["start"] | local initialstage=columntable[thiskey][#stages-1]["start"] | ||
سطر 7٬374: | سطر 7٬295: | ||
:css('text-align','center') | :css('text-align','center') | ||
tRow:tag('th'):css('white-space','nowrap') | tRow:tag('th'):css('white-space','nowrap') | ||
:wikitext(((not WDlink_on and wdLink(string.gsub(raceID, '%s', '') .. "#P527")) or "").. | :wikitext(((not WDlink_on and wdLink(string.gsub(raceID, '%s', '').."#P527")) or "").. | ||
translate("headoftable",1,w_race)) | translate("headoftable",1,w_race)) | ||
سطر 7٬426: | سطر 7٬347: | ||
elseif ii~=#stageinfotable then | elseif ii~=#stageinfotable then | ||
--empty | --empty | ||
elseif v.somewinner==true then | elseif v.somewinner==true then --general row | ||
tCell:cssText('border-top: 2px black solid') | tCell:cssText('border-top: 2px black solid') | ||
:wikitext(translate("listofstagesclassification",1,w_race)) --not attributed | :wikitext(translate("listofstagesclassification",1,w_race)) --not attributed | ||
سطر 7٬457: | سطر 7٬378: | ||
local resultTable, tag = tableB(s) | local resultTable, tag = tableB(s) | ||
return startlist_main(s, resultTable, tag) | return startlist_main(s, resultTable, tag) | ||
end | end | ||
سطر 7٬480: | سطر 7٬401: | ||
end | end | ||
local function startlist_sub(p710, timeOfRace, | local function startlist_sub(p710, timeOfRace, WDlink_on, istable,w_race) | ||
local h, resultTable= {}, {} | local h, resultTable= {}, {} | ||
local tBody = '' --row in our case | local tBody = '' --row in our case | ||
سطر 7٬570: | سطر 7٬491: | ||
local sortkey = riderDossard == "" and 0 or tonumber(riderDossard) | local sortkey = riderDossard == "" and 0 or tonumber(riderDossard) | ||
tBody = mw.html.create('tr'):cssText("line-height: 1.8em; padding: 5px;") | tBody = mw.html.create('tr'):cssText("line-height: 1.8em; padding: 5px;") | ||
tBody:tag('td'):cssText("text-align:right;padding:0 0.5em"):wikitext(riderDossard) | tBody:tag('td'):cssText("text-align:right;padding:0 0.5em"):wikitext(riderDossard) | ||
tBody:tag('td'):cssText('text-align:'..textalign.. ';padding:0 0.5em;'..DSQ):wikitext(riderLink) | tBody:tag('td'):cssText('text-align:'..textalign.. ';padding:0 0.5em;'..DSQ):wikitext(riderLink) | ||
سطر 7٬811: | سطر 7٬732: | ||
local lf=s.lf | local lf=s.lf | ||
local thisCompetition, rank, thisyear, sitelink, q, gender, DSQ | local thisCompetition, rank, thisyear, sitelink, q, gender, DSQ | ||
local calendarlistpresent={} | |||
local gender=getGenderCode(s.item, 'm') | local gender=getGenderCode(s.item, 'm') | ||
سطر 7٬823: | سطر 7٬744: | ||
for ii=1900,2100,1 do | for ii=1900,2100,1 do | ||
resultTable[tostring(ii)]={} | resultTable[tostring(ii)]={} | ||
for _, calendar in pairs(listofcalendar) do | for _, calendar in pairs(listofcalendar) do | ||
resultTable[tostring(ii)][calendar]={} | resultTable[tostring(ii)][calendar]={} | ||
end | end | ||
سطر 7٬831: | سطر 7٬752: | ||
for _, p1344 in statements(s.item, 'P1344') do | for _, p1344 in statements(s.item, 'P1344') do | ||
thisCompetition = p1344.mainsnak.datavalue.value.id | thisCompetition = p1344.mainsnak.datavalue.value.id | ||
for _, calendar in pairs(listofcalendar) do | for _, calendar in pairs(listofcalendar) do | ||
if UCIQtoYear[calendar][thisCompetition] then | if UCIQtoYear[calendar][thisCompetition] then | ||
thisyear=UCIQtoYear[calendar][thisCompetition] | thisyear=UCIQtoYear[calendar][thisCompetition] | ||
سطر 7٬850: | سطر 7٬771: | ||
if minmaxyear.minimum~=0 then | if minmaxyear.minimum~=0 then | ||
local finalTable =mw.html.create('table'):attr('cellspacing','0') | local finalTable =mw.html.create('table'):attr('cellspacing','0') | ||
:attr("align","center"):cssText("text-align:center; border: 1px solid #999; line-height: 1.8em;") | :attr("align","center"):cssText("text-align:center; border: 1px solid #999; line-height: 1.8em;") | ||
local wdLin = wdLink(string.gsub(s.item, '%s', '') .. "#P1344") | local wdLin = wdLink(string.gsub(s.item, '%s', '').."#P1344") | ||
local tRow= finalTable:tag('tr'):tag('th') | local tRow= finalTable:tag('tr'):tag('th') | ||
:css("background-color",backgroundColor) | :css("background-color",backgroundColor) | ||
سطر 7٬865: | سطر 7٬786: | ||
end | end | ||
for _, calendar in pairs(listofcalendar) do | for _, calendar in pairs(listofcalendar) do | ||
if calendarlistpresent[calendar] then | if calendarlistpresent[calendar] then | ||
sitelink=mw.wikibase.getSitelink(data.UCImaster[calendar]) | sitelink=mw.wikibase.getSitelink(data.UCImaster[calendar]) | ||
local tRow=finalTable:tag('tr') | local tRow=finalTable:tag('tr') | ||
local tCell = tRow:tag('th'):cssText("text-align:" .. textalign .. ";") -- left | local tCell = tRow:tag('th'):cssText("text-align:"..textalign..";") -- left | ||
local calendar_name=translate("riderranking",data.KeytoRiderRankingCode[calendar],w_race) | local calendar_name=translate("riderranking",data.KeytoRiderRankingCode[calendar],w_race) | ||
if sitelink then | if sitelink then | ||
سطر 7٬957: | سطر 7٬878: | ||
:wikitext(translate("race_reference", 1,w_race).."["..UCIlink..' UCI]') | :wikitext(translate("race_reference", 1,w_race).."["..UCIlink..' UCI]') | ||
return | return finalTable | ||
end | end | ||
end | end | ||
سطر 7٬973: | سطر 7٬894: | ||
local s = { | local s = { | ||
header_function = "riderranking", | header_function = "riderranking", | ||
header_1 = data.KeytoRiderRankingCode[calendar_key] or 1, | |||
header_2 = {1, 18, 19}, | header_2 = {1, 18, 19}, | ||
property="P527", | property="P527", | ||
سطر 7٬992: | سطر 7٬913: | ||
thisCompetition = p1344.mainsnak.datavalue.value.id | thisCompetition = p1344.mainsnak.datavalue.value.id | ||
for _, calendar in pairs(listofcalendar) do | for _, calendar in pairs(listofcalendar) do | ||
if UCIQtoYear[calendar][thisCompetition] then | if UCIQtoYear[calendar][thisCompetition] then | ||
thisyear=UCIQtoYear[calendar][thisCompetition] | thisyear=UCIQtoYear[calendar][thisCompetition] | ||
سطر 8٬033: | سطر 7٬954: | ||
countryID = getNationality(rider, thisdate) | countryID = getNationality(rider, thisdate) | ||
if countryID then | if countryID then | ||
riderLink = flag(countryID, thisdate) .. ' ' .. riderLink | riderLink = flag(countryID, thisdate)..' '..riderLink | ||
end | end | ||
if rank then | if rank then | ||
سطر 8٬072: | سطر 7٬993: | ||
for ii, p527 in statements(s.item, "P527") do | for ii, p527 in statements(s.item, "P527") do | ||
tTable=get_teamranking(p527.mainsnak.datavalue.value.id, w_race, | tTable=get_teamranking(p527.mainsnak.datavalue.value.id, w_race, | ||
UCIQtoYear,{s.calendar_key}, tTable,gender) | |||
end | end | ||
سطر 8٬261: | سطر 8٬182: | ||
boolean=true--amateur / national selection | boolean=true--amateur / national selection | ||
else | else | ||
boolean=false--pro | boolean=false--pro / not national selection | ||
end | end | ||
return boolean, sitelink | return boolean, sitelink | ||
سطر 8٬427: | سطر 8٬348: | ||
local empty=true | local empty=true | ||
local active=false | local active=false | ||
--bring together successive month with identical content | |||
for yy=initialYear,finalYear do | for yy=initialYear,finalYear do | ||
for mm=1,24 do | for mm=1,24 do | ||
سطر 8٬475: | سطر 8٬396: | ||
teamAmateur,teamPro=insertTeam(teamAmateur,teamPro,tempsDate,tempeDate,tempTeam) | teamAmateur,teamPro=insertTeam(teamAmateur,teamPro,tempsDate,tempeDate,tempTeam) | ||
tempTeam['link']=nil --avoid problem if the rider comes back in the same team | tempTeam['link']=nil --avoid problem if the rider comes back in the same team | ||
end | end | ||
end-- for mm | end-- for mm | ||
end--for yy | end--for yy | ||
سطر 8٬502: | سطر 8٬423: | ||
local teamAmateur,teamPro=synthetizeTable(analyzedTeam1, initialYear,finalYear) --table formated, global | local teamAmateur,teamPro=synthetizeTable(analyzedTeam1, initialYear,finalYear) --table formated, global | ||
local analyzedTeam2=analyzeTeam(teamRider, initialYear,finalYear, "mountainBike") | local analyzedTeam2=analyzeTeam(teamRider, initialYear,finalYear, "mountainBike") | ||
local _, teamMountainBike=synthetizeTable(analyzedTeam2, initialYear,finalYear) | |||
local analyzedTeam3=analyzeTeam(teamRider, initialYear,finalYear, "cycloCross") | |||
local _, teamCycloCross=synthetizeTable(analyzedTeam3, initialYear,finalYear) | local _, teamCycloCross=synthetizeTable(analyzedTeam3, initialYear,finalYear) | ||
local analyzedTeam4=analyzeTeam(teamRider, initialYear,finalYear, "track") | local analyzedTeam4=analyzeTeam(teamRider, initialYear,finalYear, "track") | ||
سطر 8٬527: | سطر 8٬448: | ||
if birthPlace then birthPlaceLink=getPlaceLink(birthPlace, birthDate) end | if birthPlace then birthPlaceLink=getPlaceLink(birthPlace, birthDate) end | ||
local plural, gen_singular, gen_plural = plural(age) | |||
local ans | |||
if gen_singular then | |||
ans=translate("riderinfobox",48,w_race) | |||
elseif gen_plural then | |||
ans=translate("riderinfobox",49,w_race) | |||
else | |||
ans=translate("riderinfobox",50,w_race) | |||
end | |||
if not deathDate and display_age~=false then | if not deathDate and display_age~=false then | ||
سطر 8٬542: | سطر 8٬463: | ||
temp2='<br/>' | temp2='<br/>' | ||
end | end | ||
birth=birthDateFormatted..temp2..birthPlaceLink | |||
else | else | ||
birth=nil | |||
end | end | ||
سطر 8٬554: | سطر 8٬475: | ||
if birthDate then | if birthDate then | ||
local age=calculateAge(birthDate, deathDate) | |||
local plural, gen_singular, gen_plural = plural(age) | |||
local ans | |||
if gen_singular then | |||
ans=translate("riderinfobox",48,w_race) | |||
elseif gen_plural then | |||
ans=translate("riderinfobox",49,w_race) | |||
else | |||
ans=translate("riderinfobox",50,w_race) | |||
end | |||
if display_age==false then | |||
temp2='<br/>' | |||
else | |||
temp2=' ('..tostring(age)..' '..ans..')<br/>' | temp2=' ('..tostring(age)..' '..ans..')<br/>' | ||
end | end | ||
سطر 8٬575: | سطر 8٬496: | ||
death=deathDateFormatted..temp2..deathPlaceLink | death=deathDateFormatted..temp2..deathPlaceLink | ||
else | else | ||
death=nil | |||
end | end | ||
سطر 8٬582: | سطر 8٬503: | ||
local function presentTeam(itemID) | local function presentTeam(itemID) | ||
local tToday=os.date("*t") | local tToday=os.date("*t") | ||
if mw.ustring.len(tToday["month"])==1 then tToday["month"]='0'..tToday["month"] end | if mw.ustring.len(tToday["month"])==1 then tToday["month"]='0'..tToday["month"] end | ||
if mw.ustring.len(tToday["day"])==1 then tToday["day"]='0'..tToday["day"] end | if mw.ustring.len(tToday["day"])==1 then tToday["day"]='0'..tToday["day"] end | ||
local today='+'..tToday["year"].."-"..tToday["month"].."-"..tToday["day"].."T00:00:00Z" | local today='+'..tToday["year"].."-"..tToday["month"].."-"..tToday["day"].."T00:00:00Z" | ||
local plural=false | local plural=false | ||
local teamId, result, teamLink, teamLinkRoad, row | |||
for _, s in statements(itemID, 'P54') do | for _, s in statements(itemID, 'P54') do | ||
سطر 8٬594: | سطر 8٬515: | ||
teamId= p54.mainsnak.datavalue.value.id | teamId= p54.mainsnak.datavalue.value.id | ||
teamLink=getTeamLinkCat(teamId, today) | teamLink=getTeamLinkCat(teamId, today) | ||
dis=checkDis(p54.qualifiers) | |||
row=nil | |||
if dis=='road' then | |||
teamLinkRoad=teamLink | |||
elseif dis=='mountainBike' then | |||
row=teamLink..' ('..translate("riderinfobox",56,w_race)..')' | |||
elseif dis=='cycloCross' then | |||
row=teamLink..' ('..translate("riderinfobox",57,w_race)..')' | |||
else | |||
row=teamLink..' ('..translate("riderinfobox",58,w_race)..')' | |||
end | |||
if row then | |||
if not result then | |||
result = row | |||
else | |||
result= result..'<br/>'..row | |||
plural = true | |||
end | |||
end | |||
end | end | ||
end | end | ||
سطر 8٬672: | سطر 8٬593: | ||
local function localTeamTable(tab, names, periods, title_singular, title_plural) | local function localTeamTable(tab, names, periods, title_singular, title_plural) | ||
if names then | if names then | ||
names = mw.text.split(names, '<br />') | names = mw.text.split(names, '<br />') | ||
periods = mw.text.split(periods or '', '<br />') | periods = mw.text.split(periods or '', '<br />') | ||
سطر 8٬706: | سطر 8٬627: | ||
{ name = translate("riderinfobox",17,w_race) }, -- lateralisation | { name = translate("riderinfobox",17,w_race) }, -- lateralisation | ||
{ name = translate("riderinfobox",18,w_race) }, -- blood group | { name = translate("riderinfobox",18,w_race) }, -- blood group | ||
{ name = translate("riderinfobox",19,w_race) }, -- height | { name = translate("riderinfobox",19,w_race) }, -- height | ||
{ name = translate("riderinfobox",20,w_race) }, -- weight | { name = translate("riderinfobox",20,w_race) }, -- weight | ||
{ name = translate("riderinfobox",21,w_race), name_plural =translate("riderinfobox",22,w_race)}, -- awards | { name = translate("riderinfobox",21,w_race), name_plural =translate("riderinfobox",22,w_race)}, -- awards | ||
سطر 8٬714: | سطر 8٬635: | ||
{ name = translate("riderinfobox",23,w_race), name_plural =translate("riderinfobox",24,w_race)}, -- directed teams | { name = translate("riderinfobox",23,w_race), name_plural =translate("riderinfobox",24,w_race)}, -- directed teams | ||
{ name = translate("riderinfobox",25,w_race)}, -- directed years | { name = translate("riderinfobox",25,w_race)}, -- directed years | ||
{ name = translate("riderinfobox",26,w_race), name_plural =translate("riderinfobox",27,w_race)}, -- amateur names | { name = translate("riderinfobox",26,w_race), name_plural =translate("riderinfobox",27,w_race)}, -- amateur names | ||
{ name = translate("riderinfobox",28,w_race)}, -- amateur periods | { name = translate("riderinfobox",28,w_race)}, -- amateur periods | ||
{ name = translate("riderinfobox",29,w_race), name_plural =translate("riderinfobox",30,w_race)}, -- nonUCI names | { name = translate("riderinfobox",29,w_race), name_plural =translate("riderinfobox",30,w_race)}, -- nonUCI names | ||
سطر 8٬726: | سطر 8٬647: | ||
} | } | ||
--separated to have a title | |||
local subtitle = { | local subtitle = { | ||
{ name = translate("riderinfobox",51,w_race)}, -- insertion of a sub-title | { name = translate("riderinfobox",51,w_race)}, -- insertion of a sub-title | ||
} | } | ||
--separated to have a title | |||
local victories = { | local victories = { | ||
{ name = translate("riderinfobox",38,w_race)}, -- main victories | { name = translate("riderinfobox",38,w_race)}, -- main victories | ||
سطر 8٬757: | سطر 8٬678: | ||
end | end | ||
if not subtitle[1].content then | if not subtitle[1].content then | ||
local p1559 = mw.wikibase.getBestStatements(entityID, "P1559") -- P580 is start time | |||
if p1559[1] and p1559[1].mainsnak.snaktype == 'value' then | if p1559[1] and p1559[1].mainsnak.snaktype == 'value' then | ||
subtitle[1].content = p1559[1].mainsnak.datavalue.value.text..' <b><small>('.. | subtitle[1].content = p1559[1].mainsnak.datavalue.value.text..' <b><small>('.. | ||
p1559[1].mainsnak.datavalue.value.language..')</small></b>' | |||
end | end | ||
end | end | ||
سطر 8٬770: | سطر 8٬691: | ||
getLocalContent(teams, lf.args) | getLocalContent(teams, lf.args) | ||
getLocalContent(others, lf.args) | getLocalContent(others, lf.args) | ||
getLocalContent(victories, lf.args) | |||
getLocalContent(medals, lf.args) | |||
local listOfBirthNames, listOfNickNames, listOfOfficialNames, listOfShortNames | local listOfBirthNames, listOfNickNames, listOfOfficialNames, listOfShortNames | ||
سطر 8٬852: | سطر 8٬773: | ||
end | end | ||
--weight | --weight | ||
if not details[13].content and | if not details[13].content and display_weight then | ||
details[13].content=getWeight(entityID) | details[13].content=getWeight(entityID) | ||
end | end | ||
سطر 8٬912: | سطر 8٬833: | ||
tab = infoInitTab("300px", name, icon, 2) | tab = infoInitTab("300px", name, icon, 2) | ||
if subtitle[1].content then | if subtitle[1].content then | ||
tCell=tab:tag('tr'):tag('td'):attr('colspan','2') | |||
:cssText('solid white; text-align:center') | :cssText('solid white; text-align:center') | ||
:wikitext(subtitle[1].content) | :wikitext(subtitle[1].content) | ||
سطر 8٬921: | سطر 8٬842: | ||
teamTable(tab, teamAmateur, translate("riderinfobox",26,w_race), translate("riderinfobox",27,w_race)) | teamTable(tab, teamAmateur, translate("riderinfobox",26,w_race), translate("riderinfobox",27,w_race)) | ||
else | else | ||
localTeamTable(tab,amateurTeam_names, amateurTeam_periods, translate("riderinfobox",26,w_race), translate("riderinfobox",27,w_race)) | |||
localTeamTable(tab,nonUCITeam_names, nonUCITeam_periods, translate("riderinfobox",29,w_race), translate("riderinfobox",30,w_race)) | localTeamTable(tab,nonUCITeam_names, nonUCITeam_periods, translate("riderinfobox",29,w_race), translate("riderinfobox",30,w_race)) | ||
end | end | ||
سطر 8٬974: | سطر 8٬895: | ||
end | end | ||
end | end | ||
if nb_stagiaires>0 then | |||
details[index].content = riders ..' ('.. tostring(nb_stagiaires).." "..stagiaire..')' | details[index].content = riders ..' ('.. tostring(nb_stagiaires).." "..stagiaire..')' | ||
else | else | ||
سطر 8٬994: | سطر 8٬915: | ||
{ name = translate("teaminfobox",2,w_race)}, -- sport | { name = translate("teaminfobox",2,w_race)}, -- sport | ||
{ name = translate("headoftableII",3,w_race)}, -- team | { name = translate("headoftableII",3,w_race)}, -- team | ||
{ name = translate("teaminfobox",3,w_race), name_plural = translate("teaminfobox",4,w_race)}, -- type | { name = translate("teaminfobox",3,w_race), name_plural = translate("teaminfobox",4,w_race)}, -- type | ||
{ name = translate("teaminfobox",5,w_race), name_plural = translate("teaminfobox",6,w_race)}, -- UCI-cod | { name = translate("teaminfobox",5,w_race), name_plural = translate("teaminfobox",6,w_race)}, -- UCI-cod | ||
{ name = translate("teaminfobox",7,w_race), name_plural = translate("teaminfobox",8,w_race)}, -- сountry | { name = translate("teaminfobox",7,w_race), name_plural = translate("teaminfobox",8,w_race)}, -- сountry | ||
{ name = translate("getSquadTableColumn",7,w_race)}, --team size | { name = translate("getSquadTableColumn",7,w_race)}, --team size | ||
{ name = translate("teaminfobox",13,w_race)}, -- official web site | { name = translate("teaminfobox",13,w_race)}, -- official web site | ||
{ name = translate("teaminfobox",27,w_race), name_plural = translate("teaminfobox",28,w_race)}, --sponsor | { name = translate("teaminfobox",27,w_race), name_plural = translate("teaminfobox",28,w_race)}, --sponsor | ||
{ name = translate("teaminfobox",24,w_race), name_plural = translate("teaminfobox",25,w_race) }, -- bike | { name = translate("teaminfobox",24,w_race), name_plural = translate("teaminfobox",25,w_race) }, -- bike | ||
{ name = translate("teaminfobox",26,w_race)}, -- budget | { name = translate("teaminfobox",26,w_race)}, -- budget | ||
سطر 9٬032: | سطر 8٬953: | ||
error("no timeOfRace found for "..seasonID) | error("no timeOfRace found for "..seasonID) | ||
end | end | ||
local sitelink, catID, _=getTeamLinkCat(seasonID, timeOfRace, nil, true) | |||
--team | |||
if not details[2].content then | if not details[2].content then | ||
details[2].content=sitelink | details[2].content=sitelink | ||
سطر 9٬042: | سطر 8٬963: | ||
if not details[3].content then --fallback | if not details[3].content then --fallback | ||
if catID then | |||
details[3].content=getRiderLink(catID, timeOfRace) --it is not a rider, but it gives the correct result | |||
end | |||
end | end | ||
سطر 9٬078: | سطر 8٬999: | ||
local tTable={} --no need for year, it is clear | local tTable={} --no need for year, it is clear | ||
for _, calendar in pairs(listofcalendar) do | for _, calendar in pairs(listofcalendar) do | ||
tTable[calendar]={} | tTable[calendar]={} | ||
end | end | ||
سطر 9٬106: | سطر 9٬027: | ||
tab:node(addATitle(translate("teaminfobox",18,w_race))) | tab:node(addATitle(translate("teaminfobox",18,w_race))) | ||
for _, row in ipairs(managers) do | for _, row in ipairs(managers) do | ||
tab:node(addARow(row.name, row.content)) --node check itself if nil | |||
end | end | ||
end | end | ||
سطر 9٬138: | سطر 9٬059: | ||
if get_arg('jersey',lf) then -- if the jersey is not specified, then the JERSEY header is not displayed | if get_arg('jersey',lf) then -- if the jersey is not specified, then the JERSEY header is not displayed | ||
tab:node(addATitle(translate("teaminfobox",20,w_race))) | tab:node(addATitle(translate("teaminfobox",20,w_race))) | ||
local outTable = mw.html.create('tr') | |||
local tCell=outTable:tag('td'):attr('colspan','3'):css('text-align','center') | local tCell=outTable:tag('td'):attr('colspan','3'):css('text-align','center') | ||
tCell:wikitext(get_arg('jersey',lf)) -- adding a form via "argument 2" by an image or an extraneous template | tCell:wikitext(get_arg('jersey',lf)) -- adding a form via "argument 2" by an image or an extraneous template | ||
tab:node(outTable) | tab:node(outTable) | ||
end | end | ||
-- adding a link to articles about the last and current seasons (the same as for the race) | -- adding a link to articles about the last and current seasons (the same as for the race) | ||
tab:node(getPreviousNextLine(seasonID)) | tab:node(getPreviousNextLine(seasonID)) | ||
wdDoc(tab, "d:Wikidata:WikiProject Cycling/Documentation/raceinfobox", translate("raceinfobox",26,w_race), seasonID) | wdDoc(tab, "d:Wikidata:WikiProject Cycling/Documentation/raceinfobox", translate("raceinfobox",26,w_race), seasonID) | ||
سطر 9٬166: | سطر 9٬087: | ||
local details = { | local details = { | ||
{ name = translate("teaminfobox",2,w_race)}, -- sport | { name = translate("teaminfobox",2,w_race)}, -- sport | ||
{ name = translate("teaminfobox",3,w_race), name_plural = translate("teaminfobox",4,w_race)}, -- type | { name = translate("teaminfobox",3,w_race), name_plural = translate("teaminfobox",4,w_race)}, -- type | ||
{ name = translate("teaminfobox",5,w_race), name_plural = translate("teaminfobox",6,w_race)}, -- UCI-cod | { name = translate("teaminfobox",5,w_race), name_plural = translate("teaminfobox",6,w_race)}, -- UCI-cod | ||
{ name = translate("teaminfobox",7,w_race), name_plural = translate("teaminfobox",8,w_race)}, -- сountry | { name = translate("teaminfobox",7,w_race), name_plural = translate("teaminfobox",8,w_race)}, -- сountry | ||
سطر 9٬173: | سطر 9٬094: | ||
{ name = translate("teaminfobox",11,w_race)}, -- number of season | { name = translate("teaminfobox",11,w_race)}, -- number of season | ||
{ name = translate("teaminfobox",13,w_race)}, -- official web site | { name = translate("teaminfobox",13,w_race)}, -- official web site | ||
{ name = translate("teaminfobox",27,w_race), name_plural = translate("teaminfobox",28,w_race)}, --sponsor | { name = translate("teaminfobox",27,w_race), name_plural = translate("teaminfobox",28,w_race)}, --sponsor | ||
{ name = translate("teaminfobox",24,w_race), name_plural = translate("teaminfobox",25,w_race) }, -- bike | { name = translate("teaminfobox",24,w_race), name_plural = translate("teaminfobox",25,w_race) }, -- bike | ||
{ name = translate("teaminfobox",26,w_race)}, -- budget | { name = translate("teaminfobox",26,w_race)}, -- budget | ||
سطر 9٬201: | سطر 9٬122: | ||
getLocalContent(managers, lf.args) | getLocalContent(managers, lf.args) | ||
local listOfNames=getFormerNames(entityID, 'P1448') | |||
local sport_id=firstValue(entityID, 'P641', 'id') | local sport_id=firstValue(entityID, 'P641', 'id') | ||
سطر 9٬241: | سطر 9٬162: | ||
-- number of season | -- number of season | ||
if not details[7].content and tRace.numberOfEditions and tRace.lastEditionYear then | if not details[7].content and tRace.numberOfEditions and tRace.lastEditionYear then | ||
details[7].content = tostring(tRace.numberOfEditions).." (" .. translate("teaminfobox",12,w_race) .. " "..tostring(tRace.lastEditionYear)..")" | details[7].content = tostring(tRace.numberOfEditions).." ("..translate("teaminfobox",12,w_race).." "..tostring(tRace.lastEditionYear)..")" | ||
end | end | ||
سطر 9٬278: | سطر 9٬199: | ||
tab:node(addATitle(translate("teaminfobox",18,w_race))) | tab:node(addATitle(translate("teaminfobox",18,w_race))) | ||
for _, row in ipairs(managers) do | for _, row in ipairs(managers) do | ||
tab:node(addARow(row.name, row.content)) --node check itself if nil | |||
end | end | ||
end | end | ||
سطر 9٬292: | سطر 9٬213: | ||
if get_arg(2,lf) then -- if the jersey is not specified, then the JERSEY header is not displayed | if get_arg(2,lf) then -- if the jersey is not specified, then the JERSEY header is not displayed | ||
tab:node(addATitle(translate("teaminfobox",20,w_race))) | tab:node(addATitle(translate("teaminfobox",20,w_race))) | ||
local outTable = mw.html.create('tr') | |||
local tCell=outTable:tag('td'):attr('colspan','3'):css('text-align','center') | local tCell=outTable:tag('td'):attr('colspan','3'):css('text-align','center') | ||
tCell:wikitext(get_arg(2,lf)) -- adding a form via "argument 2" by an image or an extraneous template | tCell:wikitext(get_arg(2,lf)) -- adding a form via "argument 2" by an image or an extraneous template | ||
tab:node(outTable) | tab:node(outTable) | ||
end | end | ||
-- adding a link to articles about the last and current seasons (the same as for the race) | -- adding a link to articles about the last and current seasons (the same as for the race) | ||
if tRace.lastID then | if tRace.lastID then | ||
-- manager | -- manager | ||
سطر 9٬308: | سطر 9٬229: | ||
local wins = #wikibase.getAllStatements(tRace.lastID, 'P2522') | local wins = #wikibase.getAllStatements(tRace.lastID, 'P2522') | ||
if wins then | |||
if wins | |||
details_season[2].content=tostring(wins) | details_season[2].content=tostring(wins) | ||
end | end | ||
سطر 9٬318: | سطر 9٬238: | ||
local outTable | local outTable | ||
if tRace.lastLink then | if tRace.lastLink then | ||
outTable = mw.html.create('tr') | |||
local tCell=outTable:tag('td'):attr('colspan','2'):css('text-align','center') | local tCell=outTable:tag('td'):attr('colspan','2'):css('text-align','center') | ||
local lastText="[[File:Crystal Clear app kworldclock.png|left|37px]]".. | local lastText="[[File:Crystal Clear app kworldclock.png|left|37px]]".. | ||
سطر 9٬331: | سطر 9٬251: | ||
outTable = mw.html.create('tr') | outTable = mw.html.create('tr') | ||
local tCell=outTable:tag('td'):attr('colspan','2'):css('text-align','center') | 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,w_race).. | |||
":<br>'''".. | |||
tRace.nextLink.."'''" | |||
tCell:cssText("text-align:center"):wikitext(nextText) | tCell:cssText("text-align:center"):wikitext(nextText) | ||
tab:node(outTable) | tab:node(outTable) | ||
سطر 9٬402: | سطر 9٬322: | ||
countryID = getNationality(rider, thisdate) | countryID = getNationality(rider, thisdate) | ||
if countryID then | if countryID then | ||
riderLink = flag(countryID, thisdate) .. ' ' .. riderLink | riderLink = flag(countryID, thisdate)..' '..riderLink | ||
end | end | ||
end | end | ||
سطر 9٬542: | سطر 9٬462: | ||
if argu[3]=="nil" then arg3=nil else arg3=argu[3] end | if argu[3]=="nil" then arg3=nil else arg3=argu[3] end | ||
return getPlaceLink(argu[2],arg3) | return getPlaceLink(argu[2],arg3) | ||
elseif function_name=='getPlaceLink2' then | elseif function_name=='getPlaceLink2' then | ||
return getPlaceLink(argu[2],argu[3],nil,true) | return getPlaceLink(argu[2],argu[3],nil,true) | ||
elseif function_name=='seasonToTeamID' then | elseif function_name=='seasonToTeamID' then | ||
سطر 9٬557: | سطر 9٬477: | ||
if argu[3]=='stage' then arg3='stage' else arg3=tonumber(argu[3]) end | if argu[3]=='stage' then arg3='stage' else arg3=tonumber(argu[3]) end | ||
return tostring(getMainRaceLink(argu[2],arg3,argu[4], arg5,argu[6])) | return tostring(getMainRaceLink(argu[2],arg3,argu[4], arg5,argu[6])) | ||
elseif | elseif function_name=='getYear' then | ||
return getYear(argu[2]) | return getYear(argu[2]) | ||
elseif function_name=='getCountryName' then | elseif function_name=='getCountryName' then | ||
سطر 9٬585: | سطر 9٬505: | ||
return number(argu[2],tonumber(argu[3]), argu[4]) | return number(argu[2],tonumber(argu[3]), argu[4]) | ||
elseif function_name=='classToCircuit' then | elseif function_name=='classToCircuit' then | ||
return classToCircuit(argu[2], argu[3], toboolean(argu[5]), nil) | |||
elseif function_name=='getGenderCode' then | elseif function_name=='getGenderCode' then | ||
return tostring(getGenderCode(argu[2], argu[3])) | |||
elseif function_name=='calculateTime' then | elseif function_name=='calculateTime' then | ||
return calculateTime(argu[2]) | return calculateTime(argu[2]) | ||
سطر 9٬595: | سطر 9٬515: | ||
elseif function_name=='getClass2' then | elseif function_name=='getClass2' then | ||
temp, temp2 = getClass(argu[2]) | temp, temp2 = getClass(argu[2]) | ||
return temp2 | return temp2 | ||
elseif function_name=='infoGetPlace' then | elseif function_name=='infoGetPlace' then | ||
local details = {{ name = "test", name_plural="tests"}} -- course / not used | local details = {{ name = "test", name_plural="tests"}} -- course / not used | ||
سطر 9٬643: | سطر 9٬563: | ||
return temp1 | return temp1 | ||
elseif function_name=='getBirthDeathDate1' then | elseif function_name=='getBirthDeathDate1' then | ||
temp1, temp2 = getBirthDeathDate(argu[2]) | |||
return temp1 | return temp1 | ||
elseif function_name=='getBirthDeathDate2' then | elseif function_name=='getBirthDeathDate2' then | ||
سطر 9٬650: | سطر 9٬570: | ||
elseif function_name=='getLocalContent' then | elseif function_name=='getLocalContent' then | ||
local details = { | local details = { | ||
{ name = argu[2], name_plural= argu[3]} | |||
} | |||
local arguments = {} | local arguments = {} | ||
arguments[argu[4]]="test" | arguments[argu[4]]="test" |