From Wikipedia, the free encyclopedia

local p = {}



function p.teamroster(frame)

	local columns = tonumber(frame.args.columns) == 1 and tonumber(frame.args.columns) or 2 --defaults to two columns

	local squadSeason = mw.wikibase.getEntityObject( frame.args1 )

	local flags = {}

	local riderIds = {}

	local riderNames = {}

	local riderBirthdays = {}

	local labelMissing = false

	local wiki = mw.site.server	

	local WDlink_off = false	



	-- WDlink_off is used to decide if a Wikidata flag will be shown

	if wiki == "//www.wikidata.org" or wiki == "//fr.wikipedia.org" or wiki == "//en.wikipedia.org" or wiki == "//br.wikipedia.org" or wiki == "//ca.wikipedia.org" or 

	wiki == "//de.wikipedia.org" or wiki == "//eo.wikipedia.org" or wiki == "//es.wikipedia.org" or wiki == "//lb.wikipedia.org" or 

	wiki == "//nl.wikipedia.org" or wiki == "//no.wikipedia.org" or wiki == "//pl.wikipedia.org" or wiki == "//pt.wikipedia.org" or 

	wiki == "//ro.wikipedia.org" then WDlink_off = true end	



	local startOfSeason = squadSeason.claims"P580"][1].mainsnak.datavalue.value.time

	local _, _, seasonYear, seasonMonth, seasonDay = string.find(startOfSeason, "(%d+)-(%d+)-0*(%d+)")



	local i = 1

 	while squadSeason.claims"P527"][i  do

 		riderIdsi = 'Q' .. squadSeason.claims"P527"][i].mainsnak.datavalue.value'numeric-id'

 		local rider = mw.wikibase.getEntityObject(riderIdsi])

 		

 		local label = rider:getLabel()

 		local link = rider:getSitelink()

 		

 		if label == null then

 			label = '\'\'' .. rider:getLabel('en') .. ' (en)\'\''

 			labelMissing = true

 		end

 		

 		if link == null then

 			riderNamesi = label

 		elseif label == link then

 			riderNamesi = '[[' .. label .. ']]'

 		else

 			riderNamesi = '[[' .. link .. '|' .. label .. ']]'

 		end

 		

 		if pcall(function()

 			local riderBirthday = rider.claims"P569"][1].mainsnak.datavalue.value.time 

       		local _, _, year, month, day = string.find(riderBirthday, "(%d+)-(%d+)-0*(%d+)")

       		riderBirthdaysi = { year = year, month = month, day = day }

        	end       	

    	) then else riderBirthdaysi = '' end



 		if pcall(function()

        	flagsi = flag(getNationalityOnDate (riderIdsi], startOfSeason), startOfSeason)

  			end

		) then else flagsi = '' end



 	    i = i + 1 

    end



    local tableBody = ''

    local tableHeader = frame:expandTemplate{title = 'User:Relentlessly/cycling race/top'}

    local tableFoot = frame:expandTemplate{title = 'User:Relentlessly/cycling race/foot'}

    i = 1  

    

    local tableSize = table.getn(riderNames)

    

    while riderNamesi do

    	tableBody = tableBody .. frame:expandTemplate{title = 'User:Relentlessly/cycling race/row', args = {

    		name = riderNamesi],

    		nationality = 'ITA',

    		seasonyear = seasonYear,

    		seasonmonth = seasonMonth,

    		seasonday = seasonDay,

    		birthyear = riderBirthdaysi]['year'],

    		birthmonth = riderBirthdaysi]['month'],

    		birthday = riderBirthdaysi]['day'

    	}}



    	if columns == 2 and math.floor((tableSize + 1)/2) == i then

    		tableBody = tableBody .. tableFoot ..'</td><td width="1%"></td><td style="vertical-align:top;" width="44%">' .. tableHeader

    	end

    	i = i + 1	

    end	

    

    local tableStart = '<table border="0"><tr><td style="vertical-align:top;" width="44%">'

    local tableEnd = '</td></tr></table>'

    

    --[[

    if labelMissing then

    	tableEnd = tableEnd .. getMissingLabelTrackingCategory()

    end

    --]]



	return '<table style="border:1px solid rgb(200,200,200)"><tr><td>'.. 

		tableStart.. tableHeader.. tableBody.. tableFoot.. tableEnd.. '</td></tr></table>'

end



return p
From Wikipedia, the free encyclopedia

local p = {}



function p.teamroster(frame)

	local columns = tonumber(frame.args.columns) == 1 and tonumber(frame.args.columns) or 2 --defaults to two columns

	local squadSeason = mw.wikibase.getEntityObject( frame.args1 )

	local flags = {}

	local riderIds = {}

	local riderNames = {}

	local riderBirthdays = {}

	local labelMissing = false

	local wiki = mw.site.server	

	local WDlink_off = false	



	-- WDlink_off is used to decide if a Wikidata flag will be shown

	if wiki == "//www.wikidata.org" or wiki == "//fr.wikipedia.org" or wiki == "//en.wikipedia.org" or wiki == "//br.wikipedia.org" or wiki == "//ca.wikipedia.org" or 

	wiki == "//de.wikipedia.org" or wiki == "//eo.wikipedia.org" or wiki == "//es.wikipedia.org" or wiki == "//lb.wikipedia.org" or 

	wiki == "//nl.wikipedia.org" or wiki == "//no.wikipedia.org" or wiki == "//pl.wikipedia.org" or wiki == "//pt.wikipedia.org" or 

	wiki == "//ro.wikipedia.org" then WDlink_off = true end	



	local startOfSeason = squadSeason.claims"P580"][1].mainsnak.datavalue.value.time

	local _, _, seasonYear, seasonMonth, seasonDay = string.find(startOfSeason, "(%d+)-(%d+)-0*(%d+)")



	local i = 1

 	while squadSeason.claims"P527"][i  do

 		riderIdsi = 'Q' .. squadSeason.claims"P527"][i].mainsnak.datavalue.value'numeric-id'

 		local rider = mw.wikibase.getEntityObject(riderIdsi])

 		

 		local label = rider:getLabel()

 		local link = rider:getSitelink()

 		

 		if label == null then

 			label = '\'\'' .. rider:getLabel('en') .. '&nbsp;(en)\'\''

 			labelMissing = true

 		end

 		

 		if link == null then

 			riderNamesi = label

 		elseif label == link then

 			riderNamesi = '[[' .. label .. ']]'

 		else

 			riderNamesi = '[[' .. link .. '|' .. label .. ']]'

 		end

 		

 		if pcall(function()

 			local riderBirthday = rider.claims"P569"][1].mainsnak.datavalue.value.time 

       		local _, _, year, month, day = string.find(riderBirthday, "(%d+)-(%d+)-0*(%d+)")

       		riderBirthdaysi = { year = year, month = month, day = day }

        	end       	

    	) then else riderBirthdaysi = '' end



 		if pcall(function()

        	flagsi = flag(getNationalityOnDate (riderIdsi], startOfSeason), startOfSeason)

  			end

		) then else flagsi = '' end



 	    i = i + 1 

    end



    local tableBody = ''

    local tableHeader = frame:expandTemplate{title = 'User:Relentlessly/cycling race/top'}

    local tableFoot = frame:expandTemplate{title = 'User:Relentlessly/cycling race/foot'}

    i = 1  

    

    local tableSize = table.getn(riderNames)

    

    while riderNamesi do

    	tableBody = tableBody .. frame:expandTemplate{title = 'User:Relentlessly/cycling race/row', args = {

    		name = riderNamesi],

    		nationality = 'ITA',

    		seasonyear = seasonYear,

    		seasonmonth = seasonMonth,

    		seasonday = seasonDay,

    		birthyear = riderBirthdaysi]['year'],

    		birthmonth = riderBirthdaysi]['month'],

    		birthday = riderBirthdaysi]['day'

    	}}



    	if columns == 2 and math.floor((tableSize + 1)/2) == i then

    		tableBody = tableBody .. tableFoot ..'</td><td width="1%"></td><td style="vertical-align:top;" width="44%">' .. tableHeader

    	end

    	i = i + 1	

    end	

    

    local tableStart = '<table border="0"><tr><td style="vertical-align:top;" width="44%">'

    local tableEnd = '</td></tr></table>'

    

    --[[

    if labelMissing then

    	tableEnd = tableEnd .. getMissingLabelTrackingCategory()

    end

    --]]



	return '<table style="border:1px solid rgb(200,200,200)"><tr><td>'.. 

		tableStart.. tableHeader.. tableBody.. tableFoot.. tableEnd.. '</td></tr></table>'

end



return p

Videos

Youtube | Vimeo | Bing

Websites

Google | Yahoo | Bing

Encyclopedia

Google | Yahoo | Bing

Facebook