Modul:Navseasoncats: Perbedaan antara revisi

Konten dihapus Konten ditambahkan
k using skip-gaps parameter → dengan parameter skip-gaps
k uji coba
Baris 1:
require[[strict]]
local p = {}
local horizontal = require('ModulModule:List').horizontal
 
--[[==========================================================================]]
Baris 36:
'', --[14] placeholder for [[Category:Navseasoncats range ends (present)]]
'', --[15] placeholder for [[Category:Navseasoncats range ends (blank, MOS)]]
'', --[16] placeholder for [[Category:Navseasoncats isolatedterisolasi]]
'', --[17] placeholder for [[Category:Navseasoncats default season gap size]]
'', --[18] placeholder for [[Category:Navseasoncats decade redirected]]
Baris 46:
'', --[24] placeholder for [[Category:Navseasoncats wordinal redirected]]
'', --[25] placeholder for [[Category:Navseasoncats TV season redirected]]
'', --[26] placeholder for [[Category:Navseasoncats dengan parameterusing skip-gaps parameter]]
'', --[27] placeholder for [[Category:Navseasoncats year and range]]
'', --[28] placeholder for [[Category:Navseasoncats year and decade]]
Baris 68:
--Determine if a category exists (in a function for easier localization).
local function catexists( title )
return mw.title.new( title, 'KategoriCategory' ).exists
end
 
--Error message handling.
function p.errorclass( msg )
return mw.text.tag( 'span', {class='error mw-ext-cite-error'}, '<b>GalatError!</b> '..string.gsub(msg, '&#', '&amp;#') )
end
 
Baris 92:
if avoidself and key and cat then
if cat ~= '' then
ttrackingcats[key] = '[['..testcasecolon..'KategoriCategory:'..cat..']]'
else
ttrackingcats[key] = ''
Baris 115:
for k, _ in pairs (tbl) do
if knownparams[k] == nil then
trackcat(3, 'Navseasoncats denganusing unknown parameter tidak dikenal')
break
end
Baris 133:
--Used by catlinkfollowr(), and so indirectly by all nav_*().
local function rtarget( frame, cat )
local catcontent = mw.title.new( cat or '', 'KategoriCategory' ):getContent()
if string.match( catcontent or '', '{{ *[Cc]at' ) then --prelim test
local regextregex = {
--the following 11 pages (6 condensed) redirect to [[Template:Category redirect]], in descending order, as of 9/2022:
'{{ *[Cc]ate?g?o?r?y?[ _]*[rR]edirect', --505+312+243+1 transclusions
Baris 144:
'{{ *[Cc]ategory[ _]*[mM]ove', --0
}
for _, v in pairs (regextregex) do
local rtarget = mw.ustring.match( catcontent, v..'%s*|%s*([^|}]+)' )
if rtarget then
Baris 208:
if displayend then
local y, hyph, ending = mw.ustring.match(R, '^.-(%d+)([–-])(.*)$')
if ending == 'sekarangpresent' then
disp = y..hyph..ending
elseif ending == '' then
Baris 246:
local nl = '\n# '
local out = ''
if currtitle.nsText == 'KategoriCategory' then
errors = p.errorclass('The <b><code>|list-all-links=yes</code></b> parameter/utility '..
'should not be saved in category space, only previewed.')
Baris 287:
local function find_terminaltxt( cat )
local terminaltxt = nil
if mw.ustring.match(cat, '%d+[–-]sekarangpresent$') then
terminaltxt = 'sekarangpresent'
trackcat(14, 'Navseasoncats range ends (sekarangpresent)')
elseif mw.ustring.match(cat, '%d+[–-]$') then
terminaltxt = ''
Baris 362:
if i == 0 then --center nav element
if navborder == true then
return '*<b>'..catlink.displaytext..'</b>\n'
else
return '*<b>'..catlink.navelement..'</b>\n'
end
else
return '*'..catlink.navelement..'\n'
end
end
Baris 728:
--begin navhyphen
local navh = '{| class="toccolours hlist" style="text-align: center; margin: auto;"\n'..'|\n'
local casenavlist = nil{}
local terminalcat = false --switch used to hide future cats
local terminaltxt = nil
Baris 853 ⟶ 854:
end
if (from >= 0) and (nminseas <= from) and (from <= nmaxseas) then
navhtable.insert(navlist, = navh..'*'..catlink.navelement..'\n')
if terminalcat then nmaxseas = nminseas_default end --prevent display of future ranges
else
local hidden = '<span style="visibility:hidden">'..disp..'</span>'
navhtable.insert(navlist, = navh..'*'..hidden..'\n')
if listall then
tlistall[#tlistall] = tlistall[#tlistall]..' ('..hidden..')'
Baris 863 ⟶ 864:
end
else --center navh
if finish == -1 then finish = 'sekarangpresent'
elseif finish == 0 then finish = '<span style="visibility:hidden">'..start..'</span>' end
local disp = start..hyph..finish
if regularparent == 'isolated' then disp = start end
navhtable.insert(navlist, = navh..'*<b>'..disp..'</b>\n')
end
i = i + 1
end
-- add the list
navh = navh .. horizontal(navlist) .. '\n'
--tracking cats & finalize
Baris 916 ⟶ 920:
--begin navtvseason
local navt = '{| class="toccolours hlist" style="text-align: center; margin: auto;"\n'..'|\n'
local navlist = {}
local i = -5 --nav position
while i <= 5 do
Baris 927 ⟶ 932:
trackcat(25, 'Navseasoncats TV season redirected')
end
navttable.insert(navlist, = navt..'*'..catlink.navelement..'\n')
else
local hidden = '<span style="visibility:hidden">'..'0'..'</span>' --'0' to maintain dot spacing
navttable.insert(navlist, = navt..'*'..hidden..'\n')
if listall then
tlistall[#tlistall] = tlistall[#tlistall]..' ('..hidden..')'
Baris 936 ⟶ 941:
end
else --center navt
navttable.insert(navlist, = navt..'*<b>'..tv..'</b>\n')
end
i = i + 1
end
-- add the list
navt = navt .. horizontal(navlist) .. '\n'
isolatedcat()
if listall then
Baris 975 ⟶ 981:
if mindec then
if string.match(mindecade, '-%d') or
string.match(mindecade, 'SMBC')
then
mindec = '-'..mindec --better +/-0 behavior with strings (0-initialized int == "-0" string...)
Baris 992 ⟶ 998:
if maxdec then
if string.match(maxdecade, '-%d') or
string.match(maxdecade, 'SMBC')
then --better +/-0 behavior with strings (0-initialized int == "-0" string...),
maxdec = '-'..maxdec --but a "-0" string -> tonumber() -> tostring() = "-0",
Baris 1.009 ⟶ 1.015:
--AD/BC switches & vars
local parentBC = string.match(lastpart, '^SMBC') --following the "0s BC" convention for all years BC
lastpart = mw.ustring.gsub(lastpart, '^SMBC%s*', '') --handle BC separately; AD never used
--TODO?: handle BCE, but only if it exists in the wild
Baris 1.038 ⟶ 1.044:
bnb = ' border-style: none; background-color: transparent;'
end
local navd = '{| class="toccolours hlist" style="text-align: center; margin: auto;'..bnb..'"\n'..'|\n'
local navlist = {}
local i = -50 --nav position x 10
while i <= 50 do
Baris 1.049 ⟶ 1.056:
if D < -10 then
d = math.abs(d + 10) --b/c 2 "0s" decades exist: "0s BC" & "0s" (AD)
BC = 'SMBC '
if d == 0 then
D = -10 --track 1st d = 0 use (BC)
Baris 1.059 ⟶ 1.066:
elseif parentBC then
if switchADBC == -1 then --parentBC looking at the BC side (the common case)
BC = 'SMBC '
if d == 0 then --prepare to switch to the AD side on the next iteration
switchADBC = 1 --1st d = 0 use (BC)
Baris 1.070 ⟶ 1.077:
end
if BC ~= '' and ndec <= 50 then
BCdisp = ' SMBC' --show BC for all BC decades whenever a "0s" is displayed on the nav
end
--determine target cat
local disp = d..'-ans'..BCdisp
local catlink = catlinkfollowr( frame, firstpart..' '..d..'s'..tspace..BC..lastpart, disp )
if catlink.rtarget then --a {{Category redirect}} was followed
Baris 1.096 ⟶ 1.103:
if (zmin <= zsign) and (zsign <= zmax) then
navdtable.insert(navlist, = navd..shown)
hidden = nil
else
navdtable.insert(navlist, = navd..'*'..hidden..'\n')
end
else
navdtable.insert(navlist, = navd..shown )--the common case
hidden = nil
end
else
table.insert(navlist, hidden)
navd = navd..'*'..hidden..'\n'
end
if listall and hidden then
Baris 1.114 ⟶ 1.121:
i = i + 10
end
-- add the list
navd = navd ..'*'..hidden horizontal(navlist) .. '\n'
isolatedcat()
if listall then
Baris 1.138 ⟶ 1.146:
local minyear = tonumber(string.match(minimumyear or '', '-?%d+')) or minyear_default --allow +/- qualifier
local maxyear = tonumber(string.match(maximumyear or '', '-?%d+')) or maxyear_default --allow +/- qualifier
if string.match(minimumyear or '', 'SMBC') then minyear = -math.abs(minyear) end --allow BC qualifier (AD otherwise assumed)
if string.match(maximumyear or '', 'SMBC') then maxyear = -math.abs(maxyear) end --allow BC qualifier (AD otherwise assumed)
if year == nil then
Baris 1.150 ⟶ 1.158:
local yearBCElastparts = { --needed for parent = AD 1-5, when the BC/E format is unknown
--"BCE" removed to match both AD & BCE cats; easier & faster than multiple string.match()s
['example_Hebrew people_example'] = 'SMBCE', --example entry format; add to & adjust as needed
}
local parentAD = string.match(firstpart, 'MAD$') --following the "AD 1" convention from AD 1 to AD 10
local parentBC = string.match(lastpart, '^SMBCE?') --following the "1 BC" convention for all years BC
firstpart = mw.ustring.gsub(firstpart, '%s*MAD$', '') --handle AD/BC separately for easier & faster accounting
lastpart = mw.ustring.gsub(lastpart, '^SMBCE?%s*', '')
local BCe = parentBC or yearBCElastparts[lastpart] or 'SMBC' --"BC" default
local year1to10 = (year >= 1 and year <= 10)
Baris 1.181 ⟶ 1.189:
local ygapdefault = 1 --assume/start at the most common case: 2001, 2002, etc.
local ygap = ygapdefault
if string.match(lastpart, 'kepresidenanpresidential') then
local ygap1, ygap2 = ygapdefault, ygapdefault --need to determine previous & next year gaps indepedently
local ygap1_success, ygap2_success = false, false
Baris 1.277 ⟶ 1.285:
--begin navyears
local navy = '{| class="toccolours hlist" style="text-align: center; margin: auto;"\n'..'|\n'
local navlist = {}
local y
local j = 0 --decrementor for special cases "2021 World Rugby Sevens Series" -> "2021–2022"
local i = -5 --nav position
while i <= 5 do
Baris 1.285 ⟶ 1.295:
y = ynogaps[i]
else
y = year + i*ygap*switchADBC - j
end
local BCdisp = ''
Baris 1.297 ⟶ 1.307:
if year >= 11 then --parent = AD 11-15
if y <= 10 then --prepend AD on y = 1-10 cats only, per existing cats
AD = 'MAD '
end
Baris 1.305 ⟶ 1.315:
y = math.abs(y - 1) --skip y = 0 (DNE)
elseif y >= 1 and y <= 10 then --prepend AD on y = 1-10 cats only, per existing cats
AD = 'MAD '
end
end
Baris 1.320 ⟶ 1.330:
Y = Y + 1 --skip y = 0 (DNE)
y = Y --easiest solution: start another iterator for these AD y's displayed on a BC year parent
AD = 'MAD '
end
end
Baris 1.340 ⟶ 1.350:
catlink = catlinkNoAD --usurp
elseif listall then
tlistall[#tlistall] = tlistall[#tlistall]..' (tried; not displayed)<sup>1</sup>'
end
end
Baris 1.352 ⟶ 1.362:
else
if listall then
tlistall[#tlistall] = tlistall[#tlistall]..' (tried; not displayed)<sup>2</sup>'
end
local yHyph_2 = y..'–'..string.match(y+1, '%d%d$') --try 2010–11 type cats
elseifif listalli == 1 then
local catlinkHyph_2 = catlinkfollowr( frame, firstpart..lspace..yHyph_2..tspace..BC..lastpart, yHyph_2 )
local yHyph_2_special = (y-1)..'–'..string.match(y, '%d%d$') --try special case 2021 -> 2021–22
if catlinkHyph_2.catexists and catlinkHyph_2.rtarget == nil then --exists & no #Rs
local catlinkHyph_2_special = catlinkfollowr( frame, firstpart..lspace..yHyph_2_special..tspace..BC..lastpart, yHyph_2_special )
catlink = catlinkHyph_2 --usurp
if catlinkHyph_2_special.catexists and catlinkHyph_2_special.rtarget == nil then --exists & no #Rs
trackcat(27, 'Navseasoncats year and range')
catlink = catlinkHyph_2_special --usurp
elseif listall then
trackcat(27, 'Navseasoncats year and range')
tlistall[#tlistall] = tlistall[#tlistall]..' (tried; not displayed)'
j = 1
elseif listall then
tlistall[#tlistall] = tlistall[#tlistall]..' (tried; not displayed)<sup>3</sup>'
end
end
if not (i == 1 and j == 1) then
local catlinkHyph_2 = catlinkfollowr( frame, firstpart..lspace..yHyph_2..tspace..BC..lastpart, yHyph_2 )
if catlinkHyph_2.catexists and catlinkHyph_2.rtarget == nil then --exists & no #Rs
catlink = catlinkHyph_2 --usurp
trackcat(27, 'Navseasoncats year and range')
elseif listall then
tlistall[#tlistall] = tlistall[#tlistall]..' (tried; not displayed)<sup>4</sup>'
end
end
end
Baris 1.367 ⟶ 1.390:
local r = catlink.rtarget
local c = catlink.cat
local regex_yearyear_regex = '%d%d%d%d[–-]?%d?%d?%d?%d?' --prioritize year/range stripping, e.g. for "2006 Super 14 season"
local regex_hyphhyph_regex = '%d%d%d%d[–-]%d+' --stricter
local regex_numnum_regex = '%d+' --strip any number otherwise
local regex_finalfinal_regex = nil --best choice goes here
if mw.ustring.match(r, regex_yearyear_regex) and mw.ustring.match(c, regex_yearyear_regex) then
regex_finalfinal_regex = regex_yearyear_regex
elseif mw.ustring.match(r, regex_numnum_regex) and mw.ustring.match(c, regex_numnum_regex) then
regex_finalfinal_regex = regex_numnum_regex
end
if regex_finalfinal_regex then
local r_base = mw.ustring.gsub(r, regex_finalfinal_regex, '')
local c_base = mw.ustring.gsub(c, regex_finalfinal_regex, '')
if r_base ~= c_base then
trackcat(19, 'Navseasoncats year redirected (base change)') --acceptable #R target
elseif mw.ustring.match(r, regex_hyphhyph_regex) then
trackcat(20, 'Navseasoncats year redirected (var change)') --e.g. "2008 in Scottish women's football" to "2008–09"
else
Baris 1.390 ⟶ 1.413:
end
end
navytable.insert(navlist, = navy..'*'..catlink.navelement..'\n')
else --OOB vs min/max
local hidden = '<span style="visibility:hidden">'..disp..'</span>'
navytable.insert(navlist, = navy..'*'..hidden..'\n')
if listall then
local dummy = catlinkfollowr( frame, firsttry, disp )
Baris 1.401 ⟶ 1.424:
else --center navy
if parentBC then BCdisp = ' '..BCe end
navytable.insert(navlist, = navy..'*<b>'..year..BCdisp..'</b>\n')
end
i = i + 1
end
--add the list
navy = navy .. horizontal(navlist) .. '\n'
isolatedcat()
Baris 1.419 ⟶ 1.445:
 
local function nav_roman( frame, firstpart, roman, lastpart, minimumrom, maximumrom )
local toarabic = require('ModulModule:ConvertNumeric').roman_to_numeral
local toroman = require('ModulModule:Roman').main
--sterilize/convert rom/num
Baris 1.427 ⟶ 1.453:
if num == nil or rom == nil then --out of range or some other error
errors = p.errorclass('Function nav_roman can\'t recognize one or more of "'..(num or 'nil')..'" & "'..
(rom or 'nil')..'" dalamin kategoricategory "'..firstpart..' '..roman..' '..lastpart..'".')
return p.failedcat(errors, 'R')
end
Baris 1.440 ⟶ 1.466:
--begin navroman
local navr = '{| class="toccolours hlist" style="text-align: center; margin: auto;"\n'..'|\n'
local navlist = {}
local i = -5 --nav position
while i <= 5 do
Baris 1.454 ⟶ 1.481:
trackcat(22, 'Navseasoncats roman numeral redirected')
end
navrtable.insert(navlist, = navr..'*'..catlink.navelement..'\n')
else
local hidden = '<span style="visibility:hidden">'..r..'</span>'
navrtable.insert(navlist, = navr..'*'..hidden..'\n')
if listall then
tlistall[#tlistall] = tlistall[#tlistall]..' ('..hidden..')'
Baris 1.463 ⟶ 1.490:
end
else --center navr
navrtable.insert(navlist, = navr..'*<b>'..r..'</b>\n')
end
else
navrtable.insert(navlist, = navr..'*<span style="visibility:hidden">'..'I'..'</span>\n')
end
Baris 1.472 ⟶ 1.499:
end
-- add the list
navr = navr .. horizontal(navlist) .. '\n'
isolatedcat()
if listall then
Baris 1.487 ⟶ 1.516:
local minord = tonumber(string.match(minimumord or '', '(-?%d+)[snrt]?[tdh]?')) or -9999 --allow full ord & +/- qualifier
local maxord = tonumber(string.match(maximumord or '', '(-?%d+)[snrt]?[tdh]?')) or 9999 --allow full ord & +/- qualifier
if string.match(minimumord or '', 'SMBC') then minord = -math.abs(minord) end --allow BC qualifier (AD otherwise assumed)
if string.match(maximumord or '', 'SMBC') then maxord = -math.abs(maxord) end --allow BC qualifier (AD otherwise assumed)
local temporal = string.match(lastpart, 'abadcentury') or
string.match(lastpart, 'mileniummillennium')
local tspace = ' ' --assume a trailing space after ordinal
Baris 1.501 ⟶ 1.530:
--lists the lastpart of valid BCE cats
--"BCE" removed to match both AD & BCE cats; easier & faster than multiple string.match()s
['-century Hebrew people'] = 'SMBCE', --WP:CFD/Log/2016 June 21#Category:11th-century BC Hebrew people
['-century Jews'] = 'SMBCE', --co-nominated
['-century Judaism'] = 'SMBCE', --co-nominated
['-century rabbis'] = 'SMBCE', --co-nominated
['-century High Priests of Israel'] = 'SMBCE',
}
local parentBC = mw.ustring.match(lastpart, '%s(SMBCE?)') --"1st-century BC" format
local lastpartNoBC = mw.ustring.gsub(lastpart, '%sSMsBCE?', '') --easier than splitting lastpart up in 2; AD never used
local BCe = parentBC or ordBCElastparts[lastpartNoBC] or 'SMBC' --"BC" default
local switchADBC = 1 -- 1=AD parent
Baris 1.524 ⟶ 1.553:
bnb = ' border-style: none; background-color: transparent;'
end
local navo = '{| class="toccolours hlist" style="text-align: center; margin: auto;'..bnb..'"\n'..'|\n'
local navlist = {}
local i = -5 --nav position
while i <= 5 do
Baris 1.567 ⟶ 1.597:
trackcat(23, 'Navseasoncats nordinal redirected')
end
navo = navo.table.insert(navlist, navcenter(i, catlink))
else
navotable.insert(navlist, = navo..'*'..hidden..'\n')
if listall then
tlistall[#tlistall] = tlistall[#tlistall]..' ('..hidden..')'
Baris 1.579 ⟶ 1.609:
trackcat(23, 'Navseasoncats nordinal redirected')
end
navo = navo.table.insert(navlist, navcenter(i, catlink))
else --either out-of-range (hide), or non-temporal + BC = something might be wrong (2nd X parliament BC?); handle exceptions if/as they arise
table.insert(navlist, hidden)
navo = navo..'*'..hidden..'\n'
end
i = i + 1
end
navo = navo ..'*'..hidden horizontal(navlist) .. '\n'
isolatedcat()
Baris 1.599 ⟶ 1.631:
 
local function nav_wordinal( frame, firstpart, word, lastpart, minimumword, maximumword, ordinal, frame )
--Module:ConvertNumeric.numeral_to_indonesianspell_number2() flagsargs:
-- ordinal == 'on'true : 'second' is output instead of 'two'
-- ordinal ~== 'on'false: 'two' is output instead of 'second'
local ord2indord2eng = require('ModulModule:ConvertNumeric').numeral_to_indonesianspell_number2
local ind2ordeng2ord = require('ModulModule:ConvertNumeric').indonesian_to_ordinalenglish_to_ordinal
local th = 'th'
if not ordinal ~= 'on' then
th = ''
ind2ordeng2ord = require('ModulModule:ConvertNumeric').indonesian_to_numeralenglish_to_numeral
end
local sccapitalize = nil ~= string.match(word, '^%u') --sentence-casedetermine checkcapitalization
local lcnord = eng2ord(string.lower(word)) --operate on/with lclowercase, and restore any sccapitalization later
local nord = ind2ord(lc)
local case = nil
if sc then case = 'U' end
local lspace = ' ' --assume a leading space (most common)
Baris 1.628 ⟶ 1.657:
minword = num
else
local ord = ind2ordeng2ord(minimumword)
if 0 < ord and ord < maxword then
minword = ord
Baris 1.639 ⟶ 1.668:
maxword = num
else
local ord = ind2ordeng2ord(maximumword)
if 0 < ord and ord < maxword then
maxword = ord
Baris 1.649 ⟶ 1.678:
--begin navwordinal
local navw = '{| class="toccolours hlist" style="text-align: center; margin: auto;"\n'..'|\n'
local navlist = {}
local i = -5 --nav position
while i <= 5 do
Baris 1.657 ⟶ 1.687:
if n >= 1 then
local nth = p.addord(n)
if not ordinal ~= 'on' then nth = n end
if i ~= 0 then --left/right navw
local frame_argsw = frame:newChildord2eng{ argsnum = { n, ordordinal = ordinal, casecapitalize = casecapitalize } } --easier to do this than modify Module:ConvertNumeric
local w = ord2eng( frame_args )
local catlink = catlinkfollowr( frame, firstpart..lspace..w..tspace..lastpart, nth )
if minword <= n and n <= maxword then
Baris 1.666 ⟶ 1.695:
trackcat(24, 'Navseasoncats wordinal redirected')
end
navwtable.insert(navlist, = navw..'*'..catlink.navelement..'\n')
else
local hidden = '<span style="visibility:hidden">'..nth..'</span>'
navwtable.insert(navlist, = navw..'*'..hidden..'\n')
if listall then
tlistall[#tlistall] = tlistall[#tlistall]..' ('..hidden..')'
Baris 1.675 ⟶ 1.704:
end
else --center navw
navwtable.insert(navlist, = navw..'*<b>'..nth..'</b>\n')
end
else
navwtable.insert(navlist, = navw..'*<span style="visibility:hidden">'..'0'..th..'</span>\n')
end
i = i + 1
end
-- Add the list
navw = navw .. horizontal(navlist) .. '\n'
isolatedcat()
Baris 1.703 ⟶ 1.734:
end
local cpagename = 'KategoriCategory:'..pagename --limited-Lua-regex workaround
local d_season = mw.ustring.match(cpagename, ':(%d+%-ans).+%(%d+[–-]%d+%)') --i.e. "1760s in the Province of Quebec (1763–1791)"
local y_season = mw.ustring.match(cpagename, ':(%d+) .+%(%d+[–-]%d+%)') --i.e. "1763 establishments in the Province of Quebec (1763–1791)"
local e_season = mw.ustring.match(cpagename, '%s(%d+[–-])$') or --irreg; ending unknown, e.g. "Members of the Scottish Parliament 2021–"
mw.ustring.match(cpagename, '%s(%d+[–-]sekarangpresent)$') --e.g. "UK MPs 2019–present"
local season = mw.ustring.match(cpagename, '[:%s%(](%d+[–-]%d+)[%)%s]') or --split in 2 b/c you can't frontier '$'/eos?
mw.ustring.match(cpagename, '[:%s](%d+[–-]%d+)$')
local tvseason = mw.ustring.match(cpagename, 'musimseason (%d+)') or
mw.ustring.match(cpagename, 'seriseries (%d+)')
local nordinal = mw.ustring.match(cpagename, 'ke[:%-s](%d+[snrt][tdh])[-%s]') or
mw.ustring.match(cpagename, 'ke[:%-s](%d+[snrt][tdh])$')
local decade = mw.ustring.match(cpagename, '[:%s](%d+s)[%s-an]') or
mw.ustring.match(cpagename, '[:%s](%d+%-ans)$')
local year = mw.ustring.match(cpagename, '[:%s](%d%d%d%d)%s') or --prioritize 4-digit years
Baris 1.755 ⟶ 1.786:
else
--try wordinals ('zeroth' to 'ninety-ninth' only)
local ind2ordeng2ord = require('ModulModule:ConvertNumeric').indonesian_to_ordinalenglish_to_ordinal
local split = mw.text.split(pagename, ' ')
for i=1, #split do
if ind2ordeng2ord(split[i]) > -1 then
return { ['vtype'] = 'wordinal', ['v'] = split[i] }
end
Baris 1.764 ⟶ 1.795:
--try English numerics ('one'/'single' to 'ninety-nine' only)
local eng2num = require('ModulModule:ConvertNumeric').indonesian_to_numeralenglish_to_numeral
local split = mw.text.split(pagename, '[%s%-]') --e.g. "Nine-cylinder engines"
for i=1, #split do
Baris 1.804 ⟶ 1.835:
if skip_gaps and skip_gaps == 'yes' then
skipgaps = true
trackcat(26, 'Navseasoncats dengan parameterusing skip-gaps parameter')
end
--ns checks
if currtitle.nsText == 'KategoriCategory' then
if cat and cat ~= '' then
trackcat(1, 'Navseasoncats using cat parameter')
Baris 1.830 ⟶ 1.861:
local firstpart, lastpart = string.match(pagename, '^(.-)'..findvar_escaped..'(.*)$')
if findvar.vtype == 'tvseason' then --double check for cases like '30 Rock (season 3) episodes'
firstpart, lastpart = string.match(pagename, '^(.-musimseason )'..findvar_escaped..'(.*)$')
if firstpart == nil then
firstpart, lastpart = string.match(pagename, '^(.-seriseries )'..findvar_escaped..'(.*)$')
end
end
Baris 1.846 ⟶ 1.877:
local firstpart_dec = firstpart
if firstpart_dec ~= '' then
firstpart_dec = firstpart_dec..' the'
elseif firstpart_dec == 'MAD' and dec <= 1 then
firstpart_dec = ''
if dec == 0 then dec = '' end
end
local decade = dec..'0%-an0s '
decadecat = mw.text.trim( firstpart_dec..' '..decade..lastpart )
local exists = catexists(decadecat)
Baris 1.872 ⟶ 1.903:
local nav1 = nav_decade( frame, firstpart, start, lastpart, minimum, maximum )..testcaseindent..table.concat(ttrackingcats)
local decade = tonumber(string.match(findvar.v, '^(%d+)%-ans'))
local century = math.floor( ((decade-1)/100) + 1 ) --from {{CENTURY}}
if century == 0 then century = 1 end --no 0th century
Baris 1.878 ⟶ 1.909:
century = century + 1 --'2000' is in the 20th, but the rest of the 2000s is in the 21st
end
local clastpart = ' abadcentury '..lastpart
local centurycat = mw.text.trim( firstpart..' '..p.addord(century)..clastpart )
local exists = catexists(centurycat)
if not exists then --check for hyphenated century
clastpart = '-abadcentury '..lastpart
centurycat = mw.text.trim( firstpart..' '..p.addord(century)..clastpart )
exists = catexists(centurycat)
Baris 1.906 ⟶ 1.937:
elseif findvar.vtype == 'wordinal' then --e.g. "first", "ninety-ninth"; <<1% of cats
local ordinal = 'on'true
return nav_wordinal( frame, firstpart, findvar.v, lastpart, minimum, maximum, ordinal, frame )..testcaseindent..table.concat(ttrackingcats)
elseif findvar.vtype == 'enumeric' then --e.g. "one", "ninety-nine"; <<1% of cats
local ordinal = 'off'false
return nav_wordinal( frame, firstpart, findvar.v, lastpart, minimum, maximum, ordinal, frame )..testcaseindent..table.concat(ttrackingcats)
Baris 1.917 ⟶ 1.948:
elseif findvar.vtype == 'ending' then --e.g. "2021–" (irregular; ending unknown); <<<1% of cats
local hyphen, finish = mw.ustring.match(findvar.v, '%d([–-])sekarangpresent$'), -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()