Module:Infobox cyclist tracking
Appearance
local p = {}
function p.tracking(frame)
function isblank( val )
return (val == nil) or val:match('^[%s]*$')
end
local function isnotblank(s)
return s and s:match( '^%s*(.-)%s*$' ) ~= ''
end
local cats = ''
local args = frame:getParent().args
local hasbr = 0
local toohighnumber = 0
local missingyears = 0
local missingteams = 0
local prefixes = {'pro', 'amateur', 'manage'}
local maxindices = {25, 15, 15}
for k=1,3 do
local prefix = prefixes[k]
local maxindex = maxindices[k]
if (isnotblank(args[prefix .. 'years']) and isblank(args[prefix .. 'teams']) ) then
missingteams = 1
end
if (isnotblank(args[prefix .. 'teams']) and isblank(args[prefix .. 'years']) ) then
missingyears = 1
end
if (args[prefix .. 'years'] or ''):match('<[\t ]*[Bb]') then
hasbr = 1
end
if (args[prefix .. 'teams'] or ''):match('<[\t ]*[Bb]') then
hasbr = 1
end
for i = 1,maxindex do
if (isnotblank(args[prefix .. 'years'.. tostring(i)]) and isblank(args[prefix .. 'team'.. tostring(i)]) ) then
missingteams = 1
end
if (isnotblank(args[prefix .. 'team'.. tostring(i)]) and isblank(args[prefix .. 'years'.. tostring(i)]) ) then
missingyears = 1
end
if(args[prefix .. 'years' .. tostring(i)] or ''):match('<[\t ]*[Bb]') then
hasbr = 1
end
if(args[prefix .. 'team' .. tostring(i)] or ''):match('<[\t ]*[Bb]') then
hasbr = 1
end
end
if (isnotblank(args[prefix .. 'team'.. tostring(maxindex+1)]) or isnotblank(args[prefix .. 'years'.. tostring(maxindex+1)]) ) then
toohighnumber = 1
end
end
if (hasbr > 0) then
cats = cats .. '[[Category:Pages using infobox cyclist with deprecated parameters|B{{PAGENAME}}]]'
end
if (missingyears > 0) then
cats = cats .. '[[Category:Pages using infobox cyclist with deprecated parameters|Y{{PAGENAME}}]]'
end
if (missingteams > 0) then
cats = cats .. '[[Category:Pages using infobox cyclist with deprecated parameters|T{{PAGENAME}}]]'
end
if (toohighnumber > 0) then
cats = cats .. '[[Category:Pages using infobox cyclist with deprecated parameters|N{{PAGENAME}}]]'
end
return cats
end
return p