Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Humanipedia
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Module:Infobox cyclist tracking
Module
Discussion
English
Read
Edit source
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit source
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
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 hasli = 0 local hasul = 0 local hasnewline = 0 local toohighnumber = 0 local missingyears = {0, 0, 0} local missingteams = {0, 0, 0} local hasyears = {0, 0, 0} local hasteams = {0, 0, 0} local prefixes = {'pro', 'amateur', 'manage'} local maxindices = {25, 15, 25} for k=1,3 do local prefix = prefixes[k] local maxindex = maxindices[k] if (isnotblank(args[prefix .. 'years']) ) then hasyears[k] = 1 end if (isnotblank(args[prefix .. 'years']) and isblank(args[prefix .. 'teams']) ) then missingteams[k] = 1 end if (isnotblank(args[prefix .. 'teams']) ) then hasteams[k] = 1 end if (isnotblank(args[prefix .. 'teams']) and isblank(args[prefix .. 'years']) ) then missingyears[k] = 1 end if (args[prefix .. 'years'] or ''):match('<[\t ]*[Bb]') then hasbr = 1 end if (args[prefix .. 'years'] or ''):match('<[\t ]*[Ll][Ii]') then hasli = 1 end if (args[prefix .. 'years'] or ''):match('<[\t ]*[Uu][Ll]') then hasul = 1 end if (args[prefix .. 'teams'] or ''):match('<[\t ]*[Bb]') then hasbr = 1 end if (args[prefix .. 'teams'] or ''):match('<[\t ]*[Ll][Ii]') then hasli = 1 end if (args[prefix .. 'teams'] or ''):match('<[\t ]*[Uu][Ll]') then hasul = 1 end if (args[prefix .. 'years'] or ''):match('[\r\n]') then hasnewline = 1 end if (args[prefix .. 'teams'] or ''):match('[\r\n]') then hasnewline = 1 end for i = 1,maxindex do if (isnotblank(args[prefix .. 'years'.. tostring(i)]) ) then hasyears[k] = 1 end if (isnotblank(args[prefix .. 'years'.. tostring(i)]) and isblank(args[prefix .. 'team'.. tostring(i)]) ) then missingteams[k] = 1 end if (isnotblank(args[prefix .. 'team'.. tostring(i)]) ) then hasteams[k] = 1 end if (isnotblank(args[prefix .. 'team'.. tostring(i)]) and isblank(args[prefix .. 'years'.. tostring(i)]) ) then missingyears[k] = 1 end if(args[prefix .. 'years' .. tostring(i)] or ''):match('<[\t ]*[Bb]') then hasbr = 1 end if(args[prefix .. 'years' .. tostring(i)] or ''):match('<[\t ]*[Ll][Ii]') then hasli = 1 end if(args[prefix .. 'years' .. tostring(i)] or ''):match('<[\t ]*[Uu][Ll]') then hasul = 1 end if(args[prefix .. 'team' .. tostring(i)] or ''):match('<[\t ]*[Bb]') then hasbr = 1 end if(args[prefix .. 'team' .. tostring(i)] or ''):match('<[\t ]*[Ll][Ii]') then hasli = 1 end if(args[prefix .. 'team' .. tostring(i)] or ''):match('<[\t ]*[Uu][Ll]') then hasul = 1 end if(args[prefix .. 'years' .. tostring(i)] or ''):match('[\r\n]') then hasnewline = 1 end if(args[prefix .. 'team' .. tostring(i)] or ''):match('[\r\n]') then hasnewline = 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 (isnotblank(args['weight'])) then local w = frame:expandTemplate{ title = 'Infobox person/weight', args = {args['weight'] .. ' '} } w = mw.ustring.gsub(w, '[β~]', ' ') w = mw.ustring.gsub(w, '<abbr[^<>]*>c.</abbr> ', '') w = mw.ustring.gsub(w, '​', '') w = mw.ustring.gsub(w, 'β[%d][%d]*%.[%d]', '') w = mw.ustring.gsub(w, 'β[%d][%d]*', '') w = mw.ustring.gsub(w, '[%d][%d]%.[%d] kg %([%d][%d]* lb%)', '') w = mw.ustring.gsub(w, '[%d][%d]%.[%d] kg %([%d][%d]* lb; [%d][%.%d]* st%)', '') w = mw.ustring.gsub(w, '[%d][%d]%.[%d] kg %([%d][%d]* lb; [%d][%d]* st [%d][%d]* lb%)', '') w = mw.ustring.gsub(w, '[%d][%d]%.[%d] kg %([%d][%.%d]* st; [%d][%.%d]* lb%)', '') w = mw.ustring.gsub(w, '[%d][%.%d]* kg %([%d][%d]* lb%)', '') w = mw.ustring.gsub(w, '[%d][%d]* kg %([%d][%d]* lb; [%d][%.%d]* st%)', '') w = mw.ustring.gsub(w, '[%d][%d]* kg %([%d][%d]* lb; [%d][%d]* st [%d][%d]* lb%)', '') w = mw.ustring.gsub(w, '[%d][%d]* kg %([%d][%d]* st; [%d][%.%d]* lb%)', '') w = mw.ustring.gsub(w, '[%d][%d]* st [%d][%d]* lb %([%d][%d]* kg%)', '') w = mw.ustring.gsub(w, '[%d][%d]* lb %([%d][%d]* kg%)', '') w = mw.ustring.gsub(w, '[%d][%d]* lb %([%d][%d]* kg; [%d][%.%d]* st%)', '') w = mw.ustring.gsub(w, '[%d][%d]*[ ]*kg ', '') w = mw.ustring.gsub(w, '[%d][%d]*[ ]*lb ', '') w = mw.ustring.gsub(w, '%([1-2][%d][%d][%d]%)', '') w = mw.ustring.gsub(w, '%([1-2][%d][%d][%d]%-[%d][%d]%)', '') w = mw.text.unstrip(w) w = mw.ustring.gsub(w, '[<]', '.LT.') w = mw.ustring.gsub(w, '[>]', '.GT.') w = mw.ustring.gsub(w, '&', '&') if(isnotblank(w)) then cats = cats .. '[[Category:Pages using infobox cyclist with atypical values for height or weight|W]]' -- cats = cats .. '<span class=error>Atypical value: weight = ' .. w .. '</span>' end end if (isnotblank(args['height'])) then local h = frame:expandTemplate{ title = 'Infobox person/height', args = {args['height'] .. ' '} } h = mw.ustring.gsub(h, '<templatestyles[^<>]*><%/templatestyles>', '') h = mw.ustring.gsub(h, '[β~]', ' ') h = mw.ustring.gsub(h, '<abbr[^<>]*>c.</abbr> ', '') h = mw.ustring.gsub(h, '​', '') h = mw.ustring.gsub(h, '<span class="frac">([%d][%d]*)<span class="sr%-only">[^<>]*<%/span><span class="num">1<%/span>[^<>]*<span class="den">2<%/span><%/span>', '%1') h = mw.ustring.gsub(h, '<span class="frac"><span class="num">1<%/span>[^<>]*<span class="den">2<%/span><%/span>', '0') h = mw.ustring.gsub(h, '<span class="frac nowrap">([%d][%d]*)<span class="sr%-only"> <%/span><sup>1<%/sup>⁄<sub>2<%/sub><%/span>', '%1') h = mw.ustring.gsub(h, '<span class="frac nowrap"><sup>1<%/sup>⁄<sub>2<%/sub><%/span>', '0') h = mw.ustring.gsub(h, '[1-2]%.[%d][%d]? m %([4-7] ft [%d][%d]* in%)', '') h = mw.ustring.gsub(h, '[1-2][%d][%d] cm %([4-7] ft [%d][%d]* in%)', '') h = mw.ustring.gsub(h, '[4-7] ft [%d][%d]* in %([1-2]%.[%d][%d] m%)', '') h = mw.ustring.gsub(h, '[4-7] ft [%d][%d]* in %([1-2][%d][%d] cm%)', '') h = mw.ustring.gsub(h, '[1-2]%.[%d][%d][ ]*m ', '') h = mw.ustring.gsub(h, '[1-2][%d][%d][ ]*cm ', '') h = mw.ustring.gsub(h, '[4-7] ft [%d][%d]* in ', '') h = mw.ustring.gsub(h, '%([1-2][%d][%d][%d]%)', '') h = mw.ustring.gsub(h, '%([1-2][%d][%d][%d]-[%d][%d]%)', '') h = mw.text.unstrip(h) h = mw.ustring.gsub(h, '[<]', '.LT.') h = mw.ustring.gsub(h, '[>]', '.GT.') h = mw.ustring.gsub(h, '&', '&') if(isnotblank(h)) then cats = cats .. '[[Category:Pages using infobox cyclist with atypical values for height or weight|H]]' -- cats = cats .. '<span class=error style="display:none">Atypical value: height = ' .. h .. '</span>' end end if (hasli > 0) then cats = cats .. '[[Category:Pages using infobox cyclist with multiple entries in single field|Ξ»]]' end if (hasul > 0) then cats = cats .. '[[Category:Pages using infobox cyclist with multiple entries in single field|ΞΌ]]' end if (hasbr > 0) then cats = cats .. '[[Category:Pages using infobox cyclist with multiple entries in single field|Ξ²]]' end if (hasnewline > 0) then cats = cats .. '[[Category:Pages using infobox cyclist with multiple entries in single field|Ξ½]]' end for k=1,3 do if (missingyears[k] > 0 and hasyears[k] > 0) then cats = cats .. '[[Category:Pages using infobox cyclist with unknown parameters|Ξ₯]]' end if (missingteams[k] > 0 and hasteams[k] > 0) then cats = cats .. '[[Category:Pages using infobox cyclist with unknown parameters|Ξ€]]' end end return cats end return p
Summary:
Please note that all contributions to Humanipedia may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Humanipedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Template used on this page:
Module:Infobox cyclist tracking/doc
(
edit
)