if firstpart_dec ~= '' then
firstpart_dec = firstpart_dec..' the'
elseif firstpart_dec == 'AD' and dec <= 1 then
firstpart_dec = ''
if dec == 0 then dec = '' end
end
local decade = dec..'0s '
decadecat = mw.text.trim( firstpart_dec..' '..decade..lastpart )
local exists = catexists(decadecat)
if exists then
navborder = false
trackcat(28, 'Navseasoncats year and decade')
local nav2 = nav_decade( , firstpart_dec, decade, lastpart, minimum, maximum )..testcaseindent..table.concat(ttrackingcats)
return nav1nav2( nav1, nav2 )
elseif ttrackingcats[16] ~= '' then --nav_year isolated; check nav_hyphen (e.g. UK MPs 1974, Moldovan MPs 2009, etc.)
local hyphen = '–'
local finish = start
local nav2 = nav_hyphen( , start, hyphen, finish, firstpart, lastpart, minimum, maximum, testcasegap )..testcaseindent..table.concat(ttrackingcats)
if ttrackingcats[16] ~= '' then return nav1 --still isolated; rv to nav_year
else return nav2 end
else --regular nav_year
return nav1
end  
elseif findvar.vtype == 'decade' then --e.g. "0s", "2010s"; nav_decade..nav_nordinal; ~12% of cats
local nav1 = nav_decade( , firstpart, start, lastpart, minimum, maximum )..testcaseindent..table.concat(ttrackingcats)  
local decade = tonumber(string.match(findvar.v, '^(%d+)s'))
local century = math.floor( ((decade-1)/100) + 1 ) --from
if century == 0 then century = 1 end --no 0th century
if string.match(decade, '00$') then
century = century + 1 --'2000' is in the 20th, but the rest of the 2000s is in the 21st
end
local clastpart = ' century '..lastpart
local centurycat = mw.text.trim( firstpart..' '..p.addord(century)..clastpart )
local exists = catexists(centurycat)
if not exists then --check for hyphenated century
clastpart = '-century '..lastpart
centurycat = mw.text.trim( firstpart..' '..p.addord(century)..clastpart )
exists = catexists(centurycat)
end
if exists then
navborder = false
trackcat(29, 'Navseasoncats decade and century')
local nav2 = nav_nordinal( , firstpart, century, clastpart, minimum, maximum )..testcaseindent..table.concat(ttrackingcats)
return nav1nav2( nav1, nav2 )
else
return nav1
end  
elseif findvar.vtype == 'nordinal' then --e.g. "1st", "99th"; ~7.5% of cats
return nav_nordinal( , firstpart, start, lastpart, minimum, maximum )..testcaseindent..table.concat(ttrackingcats)  
elseif findvar.vtype == 'season' then --e.g. "1–4", "1999–2000", "2001–02", "2001–2002", "2005–2010", etc.; ~5.25%
local hyphen, finish = mw.ustring.match(findvar.v, '%d([–-])(%d+)') --ascii 150 & 45 (ndash & keyboard hyphen); mw req'd
return nav_hyphen( , start, hyphen, finish, firstpart, lastpart, minimum, maximum, testcasegap )..testcaseindent..table.concat(ttrackingcats)  
elseif findvar.vtype == 'tvseason' then --e.g. "1", "15" but preceded with "season" or "series"; <1% of cats
return nav_tvseason( , firstpart, start, lastpart, maximum )..testcaseindent..table.concat(ttrackingcats) --"minimum" defaults to 1  
elseif findvar.vtype == 'wordinal' then --e.g. "first", "ninety-ninth"; <<1% of cats
local ordinal = 'on'
return nav_wordinal( , firstpart, findvar.v, lastpart, minimum, maximum, ordinal, )..testcaseindent..table.concat(ttrackingcats)  
elseif findvar.vtype == 'enumeric' then --e.g. "one", "ninety-nine"; <<1% of cats
local ordinal = 'off'
return nav_wordinal( , firstpart, findvar.v, lastpart, minimum, maximum, ordinal, )..testcaseindent..table.concat(ttrackingcats)  
elseif findvar.vtype == 'roman' then --e.g. "I", "XXVIII"; <<1% of cats
return nav_roman( , firstpart, findvar.v, lastpart, minimum, maximum )..testcaseindent..table.concat(ttrackingcats)  
elseif findvar.vtype == 'ending' then --e.g. "2021–" (irregular; ending unknown); <<<1% of cats
local hyphen, finish = mw.ustring.match(findvar.v, '%d([–-])present$'), -1 --ascii 150 & 45 (ndash & keyboard hyphen); mw req'd
if hyphen == nil then
hyphen, finish = mw.ustring.match(findvar.v, '%d([–-])$'), 0 --0/-1 are hardcoded switches for nav_hyphen
end
return nav_hyphen( , start, hyphen, finish, firstpart, lastpart, minimum, maximum, testcasegap )..testcaseindent..table.concat(ttrackingcats)  
else --malformed
errors = p.errorclass('Failed to determine the appropriate nav function from malformed season "'..findvar.v..'". ')
return p.failedcat(errors, 'N')..table.concat(ttrackingcats)
end
end  
return p