تضامنًا مع حق الشعب الفلسطيني |
الفرق بين الصفحتين: «وحدة:Navseasoncats» و«وحدة:Navseasoncats/ملعب»
(الفرق بين الصفحتين)
عبود السكاف (نقاش | مساهمات) (إصلاح) |
عبود السكاف (نقاش | مساهمات) لا ملخص تعديل |
||
سطر 1: | سطر 1: | ||
require[[strict]] | |||
local p = {} | local p = {} | ||
local horizontal = require('Module:List').horizontal | |||
--[[==========================================================================]] | --[[==========================================================================]] | ||
--[[ | --[[ Globals ]] | ||
--[[==========================================================================]] | --[[==========================================================================]] | ||
سطر 10: | سطر 12: | ||
local testcasecolon = '' | local testcasecolon = '' | ||
local testcases = string.match(currtitle.subpageText, '^testcases') or string.match(currtitle.subpageText, '^مختبر') | local testcases = string.match(currtitle.subpageText, '^testcases') or string.match(currtitle.subpageText, '^مختبر') | ||
if | if testcases then testcasecolon = ':' end | ||
local navborder = true | local navborder = true | ||
local followRs = true | local followRs = true | ||
سطر 25: | سطر 27: | ||
'صيانة شريط تصنيف مدى مختصر', | 'صيانة شريط تصنيف مدى مختصر', | ||
'تصنيف موسم تحويل مدى (تغيير القاعدة)', | 'تصنيف موسم تحويل مدى (تغيير القاعدة)', | ||
'Navseasoncats range redirected (var change)', | |||
'تصنيف موسم تحويل مدى (نهاية)', | 'تصنيف موسم تحويل مدى (نهاية)', | ||
'تصنيف موسم تحويل مدى (دليل الأسلوب)', | 'تصنيف موسم تحويل مدى (دليل الأسلوب)', | ||
سطر 50: | سطر 53: | ||
"تصنيف موسم خطأ في إعادة التوجيه", | "تصنيف موسم خطأ في إعادة التوجيه", | ||
} | } | ||
local ttrackingcats = { --when reindexing, Ctrl+H 'trackcat( | local ttrackingcats = { --when reindexing, Ctrl+H 'trackcat(13,' & 'ttrackingcats[16]' | ||
'', -- [1] placeholder for [[تصنيف:صيانة شريط تصنيف يستخدم cat]] | '', -- [1] placeholder for [[تصنيف:صيانة شريط تصنيف يستخدم cat]] | ||
'', -- [2] placeholder for [[تصنيف:صيانة شريط تصنيف يستخدم testcase]] | '', -- [2] placeholder for [[تصنيف:صيانة شريط تصنيف يستخدم testcase]] | ||
'', -- [3] placeholder for [[ | '', -- [3] placeholder for [[تصنيف:تصنيف موسم يستخدم وسيط غير معروف]] | ||
'', -- [4] placeholder for [[تصنيف:صيانة شريط تصنيف لا يستخدم شرطة]] | '', -- [4] placeholder for [[تصنيف:صيانة شريط تصنيف لا يستخدم شرطة]] | ||
'', -- [5] placeholder for [[تصنيف:صيانة شريط تصنيف مدى مختصر]] | '', -- [5] placeholder for [[تصنيف:صيانة شريط تصنيف مدى مختصر]] | ||
'', -- [6] placeholder for [[تصنيف:تصنيف موسم تحويل مدى (تغيير القاعدة)]] | '', -- [6] placeholder for [[تصنيف:تصنيف موسم تحويل مدى (تغيير القاعدة)]] | ||
'', -- [7] placeholder for [[Category:Navseasoncats range redirected (end)]] | '', -- [7] placeholder for [[Category:Navseasoncats range redirected (var change)]] --new | ||
'', -- [ | '', -- [8] placeholder for [[Category:Navseasoncats range redirected (end)]] | ||
'', -- [ | '', -- [9] placeholder for [[تصنيف:تصنيف موسم تحويل مدى (دليل الأسلوب)]] | ||
'', --[ | '', --[10] placeholder for [[Category:Navseasoncats range redirected (other)]] | ||
'', --[ | '', --[11] placeholder for [[تصنيف:تصنيف موسم مدى الفارق]] | ||
'', --[ | '', --[12] placeholder for [[تصنيف:تصنيف موسم مدى غير منتظم]] | ||
'', --[ | '', --[13] placeholder for [[تصنيف:تصنيف موسم مدى غير منتظم الطول-0]] | ||
'', --[ | '', --[14] placeholder for [[Category:Navseasoncats range ends (present)]] | ||
'', --[ | '', --[15] placeholder for [[Category:Navseasoncats range ends (blank, MOS)]] | ||
'', --[ | '', --[16] placeholder for [[تصنيف:صيانة شريط تصنيف معزول]] | ||
'', --[ | '', --[17] placeholder for [[تصنيف:تصنيف موسم حجم الفارق]] | ||
'', --[ | '', --[18] placeholder for [[تصنيف:تصنيف موسم تحويل تصنيف عقد]] | ||
'', --[ | '', --[19] placeholder for [[تصنيف:تصنيف موسم تحويل تصنيف سنة]] | ||
'', --[ | '', --[20] placeholder for [[Category:Navseasoncats year redirected (var change)]] | ||
'', --[ | '', --[21] placeholder for [[تصنيف:تصنيف موسم تحويل تصنيف سنة (أخرى)]] | ||
'', --[ | '', --[22] placeholder for [[تصنيف:تصنيف موسم تحويل تصنيف الأرقام الرومانية]] | ||
'', --[ | '', --[23] placeholder for [[تصنيف:تصنيف موسم تحويل تصنيف ترتيب]] | ||
'', --[ | '', --[24] placeholder for [[تصنيف:تصنيف موسم تحويل تصنيف ترتيب-كلمة]] | ||
'', --[ | '', --[25] placeholder for [[تصنيف:تصنيف موسم تحويل تصنيف موسم تلفزيون]] | ||
'', --[ | '', --[26] placeholder for [[تصنيف:تصنيف موسم يستخدم وسيط skip-gaps]] | ||
'', --[ | '', --[27] placeholder for [[تصنيف:تصنيف موسم سنة ومدى]] | ||
'', --[ | '', --[28] placeholder for [[تصنيف:تصنيف موسم سنة وعقد]] | ||
'', --[ | '', --[29] placeholder for [[تصنيف:تصنيف موسم عقد وقرن]] | ||
'', --[ | '', --[30] placeholder for [[Category:Navseasoncats in mainspace]] | ||
'', --[31] placeholder for [[Category:Navseasoncats redirection error]] | |||
} | } | ||
local avoidself = (not string.match(currtitle.text, 'Navseasoncats with') and | local avoidself = (not string.match(currtitle.text, 'Navseasoncats with') and | ||
سطر 89: | سطر 93: | ||
not string.match(currtitle.text, 'تصنيف موسم.*/ملعب') and | not string.match(currtitle.text, 'تصنيف موسم.*/ملعب') and | ||
currtitle.text ~= 'Navseasoncats' and | currtitle.text ~= 'Navseasoncats' and | ||
currtitle.text ~= 'تصنيف_موسم' and | currtitle.text ~= 'تصنيف_موسم' and | ||
currtitle.nsText ~= 'User_talk' and | currtitle.nsText ~= 'User_talk' and | ||
سطر 100: | سطر 104: | ||
local er_counts = 0 | local er_counts = 0 | ||
--[[==========================================================================]] | --[[==========================================================================]] | ||
--[[ | --[[ Utility & category functions ]] | ||
--[[==========================================================================]] | --[[==========================================================================]] | ||
--Error message handling | --Determine if a category exists (in a function for easier localization). | ||
local function catexists( title ) | |||
return mw.title.new( title, 'تصنيف' ).exists | |||
end | |||
--Error message handling. | |||
function p.errorclass( msg ) | function p.errorclass( msg ) | ||
return mw.text.tag( 'span', {class='error mw-ext-cite-error'}, '<b>Error!</b> '..string.gsub(msg, '&#', '&#') ) | return mw.text.tag( 'span', {class='error mw-ext-cite-error'}, '<b>Error!</b> '..string.gsub(msg, '&#', '&#') ) | ||
end | end | ||
--Failure handling | --Failure handling. | ||
function p.failedcat( errors, sortkey ) | function p.failedcat( errors, sortkey ) | ||
if avoidself then | if avoidself then | ||
return (errors or '')..'***صيانة شريط تصنيف فشل في إنشاء صندوق شريط***'.. | return (errors or '') .. '***صيانة شريط تصنيف فشل في إنشاء صندوق شريط***' .. | ||
'[['..testcasecolon..'تصنيف:صيانة شريط تصنيف فشل في إنشاء صندوق شريط|'..(sortkey or 'O')..']]\n' | '[[' .. testcasecolon .. 'تصنيف:صيانة شريط تصنيف فشل في إنشاء صندوق شريط|' .. (sortkey or 'O') .. ']]\n' | ||
end | end | ||
return '' | return '' | ||
end | |||
--Tracking cat handling. | |||
-- key: 15 (when reindexing ttrackingcats{}, Ctrl+H 'trackcat(13,' & 'ttrackingcats[16]') | |||
-- cat: 'Navseasoncats isolated'; '' to remove | |||
--Used by main, all nav_*(), & several utility functions. | |||
local function trackcat( key, cat ) | |||
cat = tracking_cats_dir[key] | |||
if avoidself and key and cat then | |||
if cat ~= '' then | |||
ttrackingcats[key] = '[[' .. testcasecolon .. 'تصنيف:' .. cat .. ']]' | |||
else | |||
ttrackingcats[key] = '' | |||
end | |||
end | |||
return | |||
end | end | ||
--Check for unknown parameters. | --Check for unknown parameters. | ||
--Used by main only. | --Used by main only. | ||
function checkforunknownparams( tbl ) | local function checkforunknownparams( tbl ) | ||
local knownparams = { | local knownparams = { | ||
['min'] = 'min', | ['min'] = 'min', | ||
سطر 133: | سطر 158: | ||
if knownparams[k] == nil then | if knownparams[k] == nil then | ||
trackcat(3, 'Navseasoncats using unknown parameter') | trackcat(3, 'Navseasoncats using unknown parameter') | ||
break | |||
end | end | ||
end | end | ||
end | end | ||
-- | --Check for nav_*() navigational isolation (not necessarily an error). | ||
--Used by all nav_*(). | |||
local function isolatedcat() | |||
--Used by | if nexistingcats == 0 then | ||
function | trackcat(16, 'Navseasoncats isolated') | ||
end | end | ||
end | end | ||
-- | --Returns the target of {{تحويل تصنيف}}, if it exists, else returns the original cat. | ||
--{{Title year}}, etc., if found, are evaluated. | |||
--Used by catlinkfollowr(), and so indirectly by all nav_*(). | |||
-- | |||
--Used by all nav_*(). | |||
local | -- local rtarget_cash = {} | ||
function | local function rtarget( frame, cat ) | ||
local catcontent = mw.title.new( cat or '', 'تصنيف' ):getContent() | |||
-- | if string.match( catcontent or '', '{{ *تحويل' ) then --prelim test | ||
local regex = { | |||
--the following 11 pages (7 condensed) redirect to [[قالب:تحويل تصنيف]] (as of 6/2019): | |||
'{{ *[Cc]ategory *[Rr]edirect', --most likely match 1st | |||
'{{ *[Cc]at *redirect', --444+240 transclusions | |||
'{{ *[Cc]at *redir', --8+3 | |||
'{{ *[Cc]ategory *move', --6 | |||
'{{ *[Cc]at *red', --6 | |||
-- | '{{ *[Cc]atr', --4 | ||
'{{ *[Cc]at *move', --0 | |||
'{{تحويل تصنيف', | |||
} | |||
for _, v in pairs (regex) do | |||
local rtarget = mw.ustring.match( catcontent, v..'%s*|%s*([^|}]+)' ) | |||
if rtarget then | |||
if string.match(rtarget, '{{') then --{{Title year}}, etc., exists; evaluate | |||
local regex_ty = '%s*|%s*([^{}]*{{([^{|}]+)}}[^{}]-)%s*}}' --eval null-param templates only; expanded if/as needed | |||
local rtarget_orig, ty = mw.ustring.match( catcontent, v..regex_ty ) | |||
if rtarget_orig then | |||
local ty_eval = frame:expandTemplate{ title = ty, args = { page = cat } } --frame:newChild doesn't work, use 'page' param instead | |||
local rtarget_eval = mw.ustring.gsub(rtarget_orig, '{{%s*'..ty..'%s*}}', ty_eval ) | |||
-- rtarget_cash[cat] = rtarget_eval | |||
return rtarget_eval | |||
else --sub-parameters present; track & return default | |||
trackcat(31, 'Navseasoncats redirection error') | |||
end | |||
end | end | ||
rtarget = mw.ustring.gsub(rtarget, '^1%s*=%s*', '') | |||
rtarget = string.gsub(rtarget, '^[Cc]ategory:', '') | |||
rtarget = string.gsub(rtarget, '^تصنيف:', '') | |||
-- rtarget_cash[cat] = rtarget | |||
return rtarget | |||
end | end | ||
end --for | |||
end --if | |||
return cat | |||
end | |||
end | |||
end | end | ||
-- | --Similar to {{LinkCatIfExists2}}: make a piped link to a category, if it exists; | ||
--{{ | --if it doesn't exist, just display the greyed link title without linking. | ||
--Used | --Follows {{تحويل تصنيف}}s. | ||
--Returns { | |||
-- ['cat'] = cat, | |||
-- ['catexists'] = true, | |||
-- ['rtarget'] = <#R target>, | |||
-- ['navelement'] = <#R target navelement>, | |||
-- ['displaytext'] = displaytext, | |||
-- } if #R followed; | |||
--returns { | |||
-- ['cat'] = cat, | |||
-- ['catexists'] = <true|false>, | |||
-- ['rtarget'] = nil, | |||
-- ['navelement'] = <cat navelement>, | |||
-- ['displaytext'] = displaytext, | |||
-- } otherwise. | |||
--Used by all nav_*(). | |||
local catlinkfollowr_cash = {} | |||
function | local function catlinkfollowr( frame, cat, displaytext, displayend ) | ||
cat = mw.text.trim(cat or '') | |||
displaytext = mw.text.trim(displaytext or '') | |||
--mw.log('displaytext:' .. displaytext) | |||
if string.match( cat , ".*%s*ق%s*م%s*.*" ) and not string.match( displaytext .. ' ' , ".*%s*ق%s*م%s*.*" ) then | |||
displaytext = displaytext .. " ق م" | |||
end | |||
-- --mw.log("cat:'" .. cat .. "',displaytext:'" .. displaytext .. "'") | |||
displayend = displayend or false --bool flag to override displaytext IIF the cat/target is terminal (e.g. "2021–present" or "2021–") | |||
local grey = '#888' | |||
local disp = cat | |||
if displaytext ~= '' then --use 'displaytext' parameter if present | |||
disp = mw.ustring.gsub(displaytext, '%s+%(.+$', ''); --strip any trailing disambiguator | |||
end | |||
local link, nilorR | |||
--local exists = mw.title.new( cat, 'تصنيف' ) | |||
local exists = catexists(cat) | |||
if exists then | |||
nexistingcats = nexistingcats + 1 | |||
if followRs then | |||
local R = rtarget(frame, cat) --find & follow #R | |||
if R ~= cat then --#R followed | |||
nilorR = R | |||
end | end | ||
end -- | |||
end | if displayend then | ||
return cat | local y, hyph, ending = mw.ustring.match(R, '^.-(%d+)([–-])(.*)$') | ||
end | if ending == 'present' then | ||
disp = y..hyph..ending | |||
--Returns a numbered list of all {{تحويل تصنيف}}s followed by catlinkfollowr() -> rtarget(). | elseif ending == '' then | ||
--For a nav_hyphen() cat, also returns a formatted list of all cats searched for & found, & all loop indices. | disp = y..hyph..'<span style="visibility:hidden">'..y..'</span>' --hidden y to match spacing | ||
--Used by all nav_*(). | end | ||
function listalllinks() | end | ||
local nl = '\n# ' | |||
local out = '' | link = '[[:تصنيف:' .. R .. '|' .. disp .. ']]' | ||
else | |||
if currtitle.nsText == 'تصنيف' then | link = '[[:تصنيف:' .. cat .. '|' .. disp .. ']]' | ||
errors = p.errorclass('The <b><code>|list-all-links=yes</code></b> parameter/utility '.. | end | ||
'should not be saved in category space, only previewed.') | else | ||
out = p.failedcat(errors, 'Z') | link = '<span style="color:'..grey..'">'..disp..'</span>' | ||
end | |||
if listall then | |||
if nilorR then --#R followed | |||
table.insert( tlistall, '[[:تصنيف:' .. cat .. ']] → ' .. '[[:تصنيف:' .. nilorR .. ']] (' .. link .. ')' ) | |||
else --no #R | |||
table.insert( tlistall, '[[:تصنيف:' .. cat .. ']] (' .. link .. ')' ) | |||
end | |||
end | |||
return { | |||
['cat'] = cat, | |||
['catexists'] = exists, | |||
['rtarget'] = nilorR, | |||
['navelement'] = link, | |||
['displaytext'] = disp, | |||
} | |||
end | |||
--Returns a numbered list of all {{تحويل تصنيف}}s followed by catlinkfollowr() -> rtarget(). | |||
--For a nav_hyphen() cat, also returns a formatted list of all cats searched for & found, & all loop indices. | |||
--Used by all nav_*(). | |||
local function listalllinks() | |||
local nl = '\n# ' | |||
local out = '' | |||
if currtitle.nsText == 'تصنيف' then | |||
errors = p.errorclass('The <b><code>|list-all-links=yes</code></b> parameter/utility '.. | |||
'should not be saved in category space, only previewed.') | |||
out = p.failedcat(errors, 'Z') | |||
end | end | ||
local bwd, fwd = '', '' | local bwd, fwd = '', '' | ||
if tlistallbwd[1] then | if tlistallbwd[1] then | ||
bwd = '\n\nbackward search:\n# '..table.concat(tlistallbwd, nl) | bwd = '\n\nbackward search:\n# '..table.concat(tlistallbwd, nl) | ||
end | end | ||
if tlistallfwd[1] then | if tlistallfwd[1] then | ||
fwd = '\n\nforward search:\n# '..table.concat(tlistallfwd, nl) | fwd = '\n\nforward search:\n# '..table.concat(tlistallfwd, nl) | ||
end | end | ||
if tlistall[1] then | if tlistall[1] then | ||
return out..nl..table.concat(tlistall, nl)..bwd..fwd | |||
return out | |||
else | else | ||
return out | return out..nl..'No links found!?'..bwd..fwd | ||
end | end | ||
end | end | ||
سطر 336: | سطر 327: | ||
--Returns the difference b/w 2 ints separated by endash|hyphen, nil if error. | --Returns the difference b/w 2 ints separated by endash|hyphen, nil if error. | ||
--Used by nav_hyphen() only. | --Used by nav_hyphen() only. | ||
function find_duration( cat ) | local function find_duration( cat ) | ||
local from, to = mw.ustring.match(cat, '(%d+)[–-](%d+)') | local from, to = mw.ustring.match(cat, '(%d+)[–-](%d+)') | ||
if from and to then | if from and to then | ||
if to == '00' then return nil end --doesn't follow MOS:DATERANGE | if to == '00' then return nil end --doesn't follow MOS:DATERANGE | ||
if (#from == 4) and (#to == 2) then | if (#from == 4) and (#to == 2) then --1900-01 | ||
to = string.match(from, '(%d%d)%d%d')..to | to = string.match(from, '(%d%d)%d%d')..to --1900-1901 | ||
elseif (#from == 2) and (#to == 4) then | elseif (#from == 2) and (#to == 4) then -- 01-1902 | ||
from = string.match(to, '(%d%d)%d%d')..from --1901-1902 | from = string.match(to, '(%d%d)%d%d')..from --1901-1902 | ||
end | end | ||
سطر 352: | سطر 343: | ||
--Returns the ending of a terminal cat, and sets the appropriate tracking cat, else nil. | --Returns the ending of a terminal cat, and sets the appropriate tracking cat, else nil. | ||
--Used by nav_hyphen() only. | --Used by nav_hyphen() only. | ||
function find_terminaltxt( cat ) | local function find_terminaltxt( cat ) | ||
local terminaltxt = nil | local terminaltxt = nil | ||
if mw.ustring.match(cat, '%d+[–-]present$') then | if mw.ustring.match(cat, '%d+[–-]present$') then | ||
terminaltxt = 'present' | terminaltxt = 'present' | ||
trackcat( | trackcat(14, 'Navseasoncats range ends (present)') | ||
elseif mw.ustring.match(cat, '%d+[–-]$') then | elseif mw.ustring.match(cat, '%d+[–-]$') then | ||
terminaltxt = '' | terminaltxt = '' | ||
trackcat( | trackcat(15, 'Navseasoncats range ends (blank, MOS)') | ||
end | end | ||
return terminaltxt | return terminaltxt | ||
سطر 366: | سطر 357: | ||
--Returns an unsigned string of the 1-4 digit decade ending in "0", else nil. | --Returns an unsigned string of the 1-4 digit decade ending in "0", else nil. | ||
--Used by nav_decade() only. | --Used by nav_decade() only. | ||
function sterilizedec( decade ) | local function sterilizedec( decade ) | ||
if decade == nil or decade == '' then | if decade == nil or decade == '' then | ||
return nil | return nil | ||
end | end | ||
local dec = string.match(decade, '^[-%+]?(%d?%d?%d?0)$') or | local dec = string.match(decade, '^[-%+]?(%d?%d?%d?0)$') or | ||
string.match(decade, '^[-%+]?(%d?%d?%d?0)%D') | string.match(decade, '^[-%+]?(%d?%d?%d?0)%D') | ||
if dec then | if dec then | ||
سطر 384: | سطر 375: | ||
--fix 1-digit decade | --fix 1-digit decade | ||
local decade_fixed1 = string.match(decade, '^[-%+]?(%d)$') or | local decade_fixed1 = string.match(decade, '^[-%+]?(%d)$') or | ||
string.match(decade, '^[-%+]?(%d)%D') | string.match(decade, '^[-%+]?(%d)%D') | ||
if decade_fixed1 then | if decade_fixed1 then | ||
سطر 397: | سطر 388: | ||
--Check for nav_hyphen default gap size + isolatedcat() (not necessarily an error). | --Check for nav_hyphen default gap size + isolatedcat() (not necessarily an error). | ||
--Used by nav_hyphen() only. | --Used by nav_hyphen() only. | ||
function defaultgapcat( bool ) | local function defaultgapcat( bool ) | ||
if bool and nexistingcats == 0 then | if bool and nexistingcats == 0 then | ||
--using "nexistingcats > 0" isn't as useful, since the default gap size obviously worked | --using "nexistingcats > 0" isn't as useful, since the default gap size obviously worked | ||
trackcat( | trackcat(17, 'Navseasoncats default season gap size') | ||
end | end | ||
end | end | ||
سطر 411: | سطر 402: | ||
local tens = string.match(s, '1%d$') | local tens = string.match(s, '1%d$') | ||
if | if tens then return s..'th' end | ||
local ones = string.match(s, '%d$') | local ones = string.match(s, '%d$') | ||
if | if ones == '1' then return s..'st' | ||
elseif ones == '2' then return s..'nd' | elseif ones == '2' then return s..'nd' | ||
elseif ones == '3' then return s..'rd' end | elseif ones == '3' then return s..'rd' end | ||
سطر 426: | سطر 417: | ||
--Expects an integer i, and a catlinkfollowr() table. | --Expects an integer i, and a catlinkfollowr() table. | ||
--Used by nav_decade() & nav_ordinal() only. | --Used by nav_decade() & nav_ordinal() only. | ||
function navcenter( i, catlink ) | local function navcenter( i, catlink ) | ||
if i == 0 then --center nav element | if i == 0 then --center nav element | ||
if navborder == true then | if navborder == true then | ||
return ' | return '<b>' .. catlink.displaytext .. '</b>\n' | ||
else | else | ||
return ' | return '<b>' .. catlink.navelement .. '</b>\n' | ||
end | end | ||
else | else | ||
return ' | return '' .. catlink.navelement .. '\n' | ||
end | end | ||
end | end | ||
سطر 440: | سطر 431: | ||
--Return conditionally aligned stacked navs. | --Return conditionally aligned stacked navs. | ||
--Used by main only. | --Used by main only. | ||
function nav1nav2( nav1, nav2 ) | local function nav1nav2( nav1, nav2 ) | ||
local line = nav1..'\n'..nav2 | local line = nav1 .. '\n' .. nav2 | ||
if er_counts ~= 0 then | if er_counts ~= 0 then | ||
line = '#countall: ' .. er_counts .. '\n' .. line | line = '#countall: ' .. er_counts .. '\n' .. line | ||
سطر 453: | سطر 444: | ||
end]] | end]] | ||
end | end | ||
--[[==========================================================================]] | --[[==========================================================================]] | ||
--[[ | --[[ Formerly separated templates/modules ]] | ||
--[[==========================================================================]] | --[[==========================================================================]] | ||
سطر 461: | سطر 453: | ||
--[[==========================={{ nav_hyphen }}=============================]] | --[[==========================={{ nav_hyphen }}=============================]] | ||
function nav_hyphen( frame, start, hyph, finish, firstpart, lastpart, minseas, maxseas, testgap ) | local function nav_hyphen( frame, start, hyph, finish, firstpart, lastpart, minseas, maxseas, testgap ) | ||
--Expects a PAGENAME of the form "Some sequential 2015–16 example cat", where | --Expects a PAGENAME of the form "Some sequential 2015–16 example cat", where | ||
-- start | -- start = 2015 | ||
-- hyph | -- hyph = – | ||
-- finish | -- finish = 16 (sequential years can be abbreviated, but others should be full year, e.g. "2001–2005") | ||
-- firstpart = Some sequential | -- firstpart = Some sequential | ||
-- lastpart = example cat | -- lastpart = example cat | ||
-- minseas = 1800 ('min' starting season shown; optional; defaults to -9999) | -- minseas = 1800 ('min' starting season shown; optional; defaults to -9999) | ||
-- maxseas = 2000 ('max' starting season shown; optional; defaults to 9999; 2000 will show 2000-01) | -- maxseas = 2000 ('max' starting season shown; optional; defaults to 9999; 2000 will show 2000-01) | ||
-- testgap = 0 (testcasegap parameter for easier testing; optional) | -- testgap = 0 (testcasegap parameter for easier testing; optional) | ||
--sterilize start | --sterilize start | ||
سطر 488: | سطر 480: | ||
--en dash check | --en dash check | ||
if hyph ~= '–' then | if hyph ~= '–' then | ||
trackcat(4 | trackcat(4, 'Navseasoncats range not using en dash') --nav still processable, but track | ||
end | end | ||
--sterilize finish & check for weird parents | --sterilize finish & check for weird parents | ||
local tgaps = {} --table of gap sizes found b/w terms { [<gap size found>] = 1 } | local tgaps = {} --table of gap sizes found b/w terms { [<gap size found>] = 1 } | ||
local ttlens = {} --table of term lengths found w/i terms { [<term length found>] = 1 } | local ttlens = {} --table of term lengths found w/i terms { [<term length found>] = 1 } | ||
local tirregs = {} --table of ir/regular-term-length cats' "from"s & "to"s found | local tirregs = {} --table of ir/regular-term-length cats' "from"s & "to"s found | ||
سطر 503: | سطر 495: | ||
maxseas = start --hide subsequent ranges | maxseas = start --hide subsequent ranges | ||
end | end | ||
if finish == -1 then | if finish == -1 then trackcat(14, 'Navseasoncats range ends (present)') | ||
else trackcat(15, 'Navseasoncats range ends (blank, MOS)') end | |||
else | |||
elseif (start == finish) and | elseif (start == finish) and | ||
(ttrackingcats[ | (ttrackingcats[16] ~= '') --nav_year found isolated; check for surrounding hyphenated terms (e.g. UK MPs 1974) | ||
then | then | ||
trackcat( | trackcat(16, '') --reset for another check later | ||
trackcat( | trackcat(13, 'Navseasoncats range irregular, 0-length') | ||
ttlens[0] = 1 --calc ttlens for std cases below | ttlens[0] = 1 --calc ttlens for std cases below | ||
regularparent = 'isolated' | regularparent = 'isolated' | ||
end | end | ||
if (string.match(finish or '', '^%d+$') == nil) and | if (string.match(finish or '', '^%d+$') == nil) and | ||
(string.match(finish or '', '^%-%d+$') == nil) | (string.match(finish or '', '^%-%d+$') == nil) | ||
سطر 539: | سطر 528: | ||
--save sterilized parent range for easier lookup later | --save sterilized parent range for easier lookup later | ||
tirregs['from0'] = nstart | tirregs['from0'] = nstart | ||
tirregs['to0'] | tirregs['to0'] = nfinish | ||
--sterilize min/max | --sterilize min/max | ||
سطر 581: | سطر 570: | ||
else --"2001–2005" is required for t > 1; track "2001–05"; anything else = error | else --"2001–2005" is required for t > 1; track "2001–05"; anything else = error | ||
if lenfinish == 2 then | if lenfinish == 2 then | ||
trackcat(5 | trackcat(5, 'Navseasoncats range abbreviated (MOS)') | ||
elseif lenfinish ~= 4 then | elseif lenfinish ~= 4 then | ||
errors = p.errorclass('The second part of the season passed to function nav_hyphen should be four digits, not "'..finish..'".') | errors = p.errorclass('The second part of the season passed to function nav_hyphen should be four digits, not "'..finish..'".') | ||
سطر 588: | سطر 577: | ||
end | end | ||
if finish == '00' then --full year required regardless of term length | if finish == '00' then --full year required regardless of term length | ||
trackcat(5 | trackcat(5, 'Navseasoncats range abbreviated (MOS)') | ||
end | end | ||
end | end | ||
--calculate intERseason gap size | --calculate intERseason gap size | ||
local hgap_default | local hgap_default = 0 --assume & start at the most common case: 2001–02 -> 2002–03, etc. | ||
local hgap_limit_reg = 6 --less expensive per-increment (inc x 4) | local hgap_limit_reg = 6 --less expensive per-increment (inc x 4) | ||
local hgap_limit_irreg = 6 --more expensive per-increment (inc x 23: inc x (k_bwd + k_fwd) = inc x (12 + 11)) | local hgap_limit_irreg = 6 --more expensive per-increment (inc x 23: inc x (k_bwd + k_fwd) = inc x (12 + 11)) | ||
سطر 599: | سطر 588: | ||
local hgap = hgap_default | local hgap = hgap_default | ||
while hgap <= hgap_limit_reg and regularparent == true do --verify | while hgap <= hgap_limit_reg and regularparent == true do --verify | ||
local prevseason2 = firstpart..lspace..(nstart-t-hgap)..hyph..string.match(nstart-hgap, '%d?%d$') | local prevseason2 = firstpart..lspace..(nstart-t-hgap)..hyph..string.match(nstart-hgap, '%d?%d$') ..tspace..lastpart | ||
local nextseason2 = firstpart..lspace..(nstart+t+hgap)..hyph..string.match(nstart+2*t+hgap, '%d?%d$')..tspace..lastpart | local nextseason2 = firstpart..lspace..(nstart+t+hgap)..hyph..string.match(nstart+2*t+hgap, '%d?%d$')..tspace..lastpart | ||
local prevseason4 = firstpart..lspace..(nstart-t-hgap)..hyph..(nstart-hgap) ..tspace..lastpart | local prevseason4 = firstpart..lspace..(nstart-t-hgap)..hyph..(nstart-hgap) ..tspace..lastpart | ||
local nextseason4 = firstpart..lspace..(nstart+t+hgap)..hyph..(nstart+2*t+hgap)..tspace..lastpart | local nextseason4 = firstpart..lspace..(nstart+t+hgap)..hyph..(nstart+2*t+hgap)..tspace..lastpart | ||
if t == 1 then --test abbreviated range first, then full range, to be frugal with expensive functions | if t == 1 then --test abbreviated range first, then full range, to be frugal with expensive functions | ||
if | if catexists(prevseason2) or --use 'or', in case we're at the edge of the cat structure, | ||
catexists(nextseason2) or --or we hit a "–00"/"–2000" situation on one side | |||
catexists(prevseason4) or | |||
catexists(nextseason4) | |||
then | then | ||
hgap_success = true | hgap_success = true | ||
سطر 613: | سطر 602: | ||
end | end | ||
elseif t > 1 then --test full range first, then abbreviated range, to be frugal with expensive functions | elseif t > 1 then --test full range first, then abbreviated range, to be frugal with expensive functions | ||
if | if catexists(prevseason4) or --use 'or', in case we're at the edge of the cat structure, | ||
catexists(nextseason4) or --or we hit a "–00"/"–2000" situation on one side | |||
catexists(prevseason2) or | |||
catexists(nextseason2) | |||
then | then | ||
hgap_success = true | hgap_success = true | ||
سطر 633: | سطر 622: | ||
if hgap <= hgap_limit_reg then --also to isolate temp vars | if hgap <= hgap_limit_reg then --also to isolate temp vars | ||
--find # of nav-visible ir/regular-term-length cats | --find # of nav-visible ir/regular-term-length cats | ||
local bwanchor = nstart | local bwanchor = nstart --backward anchor/common year | ||
local fwanchor = bwanchor + t --forward anchor/common year | local fwanchor = bwanchor + t --forward anchor/common year | ||
if regularparent == 'isolated' then | if regularparent == 'isolated' then | ||
سطر 646: | سطر 635: | ||
local endfound = false --switch used to stop searching forward | local endfound = false --switch used to stop searching forward | ||
local iirregs = 0 --index of tirregs[] for j < 0, since search starts from parent | local iirregs = 0 --index of tirregs[] for j < 0, since search starts from parent | ||
local j = -3 -- | local j = -3 --index of tirregs[] for j > 0 & pseudo nav position | ||
while j <= 3 do | while j <= 3 do | ||
سطر 653: | سطر 642: | ||
local g = 0 --gap size | local g = 0 --gap size | ||
while g <= hgap_limit_irreg do | while g <= hgap_limit_irreg do | ||
local k = 0 --term length | local k = 0 --term length: 0 = "0-length", 1+ = normal | ||
while k <= term_limit do | while k <= term_limit do | ||
local from = bwanchor - k - g | local from = bwanchor - k - g | ||
سطر 674: | سطر 663: | ||
if (k == 1) and | if (k == 1) and | ||
(g == 0 or g == 1) and | (g == 0 or g == 1) and | ||
( | (catexists(full) == false) | ||
then --allow bare-bones MOS:DATERANGE alternation, in case we're on a 0|1-gap, 1-year term series | then --allow bare-bones MOS:DATERANGE alternation, in case we're on a 0|1-gap, 1-year term series | ||
local to2 = string.match(to, '%d%d$') | local to2 = string.match(to, '%d%d$') | ||
سطر 683: | سطر 672: | ||
end | end | ||
end | end | ||
if | if catexists(full) then | ||
if to == '0-length' then | if to == '0-length' then | ||
trackcat( | trackcat(13, 'Navseasoncats range irregular, 0-length') | ||
end | end | ||
tlistallbwd[#tlistallbwd] = spanblue..tlistallbwd[#tlistallbwd]..span..' (found)' | tlistallbwd[#tlistallbwd] = spanblue..tlistallbwd[#tlistallbwd]..span..' (found)' | ||
سطر 720: | سطر 709: | ||
local g = 0 --gap size | local g = 0 --gap size | ||
while g <= hgap_limit_irreg do | while g <= hgap_limit_irreg do | ||
local k = -2 --term length | local k = -2 --term length: -2 = "0-length", -1 = "2020–present", 0 = "2020–", 1+ = normal | ||
while k <= term_limit do | while k <= term_limit do | ||
local from = fwanchor + g | local from = fwanchor + g | ||
سطر 744: | سطر 733: | ||
if (k == 1) and | if (k == 1) and | ||
(g == 0 or g == 1) and | (g == 0 or g == 1) and | ||
( | (catexists(full) == false) | ||
then --allow bare-bones MOS:DATERANGE alternation, in case we're on a 0|1-gap, 1-year term series | then --allow bare-bones MOS:DATERANGE alternation, in case we're on a 0|1-gap, 1-year term series | ||
to2 = string.match(to4, '%d%d$') | to2 = string.match(to4, '%d%d$') | ||
سطر 752: | سطر 741: | ||
end | end | ||
end | end | ||
if | if catexists(full) then | ||
if to4 == '0-length' then | if to4 == '0-length' then | ||
if rtarget(frame, full) == full then --only use 0-length cats that don't #R | if rtarget(frame, full) == full then --only use 0-length cats that don't #R | ||
trackcat( | trackcat(13, 'Navseasoncats range irregular, 0-length') | ||
end | end | ||
end | end | ||
سطر 790: | سطر 779: | ||
end --if j > 0 | end --if j > 0 | ||
if (lastg == (hgap_limit_irreg + 1)) and | if (lastg == (hgap_limit_irreg + 1)) and | ||
(lastk == (term_limit + 1)) | (lastk == (term_limit + 1)) | ||
then --search exhausted | then --search exhausted | ||
سطر 802: | سطر 791: | ||
--begin navhyphen | --begin navhyphen | ||
local navh = '{| class="toccolours | local navh = '{| class="toccolours" style="text-align: center; margin: auto;"\n|\n' | ||
local navlist = {} | |||
local terminalcat = false --switch used to hide future cats | local terminalcat = false --switch used to hide future cats | ||
local terminaltxt = nil | local terminaltxt = nil | ||
سطر 819: | سطر 809: | ||
end | end | ||
local to2 = string.match(to, '%d?%d$') | local to2 = string.match(to, '%d?%d$') | ||
local tofinal = (to2 or '') --assume t=1 and abbreviated 'to' (the most common case) | local tofinal = (to2 or '') --assume t=1 and abbreviated 'to' (the most common case) | ||
if t > 1 or | if t > 1 or --per MOS:DATERANGE (e.g. 1999-2004) | ||
(from2 - (to2 or from2)) > 0 --century transition exception (e.g. 1999–2000) | (from2 - (to2 or from2)) > 0 --century transition exception (e.g. 1999–2000) | ||
then | then | ||
tofinal = (to or '') | tofinal = (to or '') --default to the MOS-correct format, in case no fallbacks found | ||
end | end | ||
if to == '0-length' then | if to == '0-length' then | ||
سطر 834: | سطر 824: | ||
--determine which link exists (full or abbr) | --determine which link exists (full or abbr) | ||
local full = firstpart..lspace..from..hyph..tofinal..tspace..lastpart | local full = firstpart..lspace..from..hyph..tofinal..tspace..lastpart | ||
if not | if not catexists(full) then | ||
local abbr = firstpart..lspace..from..hyph..to2..tspace..lastpart | local abbr = firstpart..lspace..from..hyph..to2..tspace..lastpart | ||
if | if catexists(abbr) then | ||
tofinal = (to2 or '') --rv to MOS-incorrect format; if full AND abbr DNE, then tofinal is still in its MOS-correct format | tofinal = (to2 or '') --rv to MOS-incorrect format; if full AND abbr DNE, then tofinal is still in its MOS-correct format | ||
end | end | ||
سطر 842: | سطر 832: | ||
elseif t == 1 then --full-year consecutive ranges are also allowed | elseif t == 1 then --full-year consecutive ranges are also allowed | ||
local abbr = firstpart..lspace..from..hyph..tofinal..tspace..lastpart --assume tofinal is in abbr format | local abbr = firstpart..lspace..from..hyph..tofinal..tspace..lastpart --assume tofinal is in abbr format | ||
if not | if not catexists(abbr) and tofinal ~= to then | ||
local full = firstpart..lspace..from..hyph..to..tspace..lastpart | local full = firstpart..lspace..from..hyph..to..tspace..lastpart | ||
if | if catexists(full) then | ||
tofinal = (to or '') --if abbr AND full DNE, then tofinal is still in its abbr format (unless it's a century transition) | tofinal = (to or '') --if abbr AND full DNE, then tofinal is still in its abbr format (unless it's a century transition) | ||
end end end end | end end end end | ||
سطر 860: | سطر 850: | ||
if terminalcat == false then | if terminalcat == false then | ||
terminaltxt = find_terminaltxt( disp ) --also sets tracking cats | terminaltxt = find_terminaltxt( disp ) --also sets tracking cats | ||
terminalcat = (terminaltxt ~= nil) | terminalcat = (terminaltxt ~= nil) | ||
end | end | ||
if catlink.rtarget and avoidself then --a {{تحويل تصنيف}} was followed, figure out why | if catlink.rtarget and avoidself then --a {{تحويل تصنيف}} was followed, figure out why | ||
سطر 881: | سطر 871: | ||
local base_regex = '%d+[–-]%d+' | local base_regex = '%d+[–-]%d+' | ||
local origbase = mw.ustring.gsub(orig, base_regex, '') | local origbase = mw.ustring.gsub(orig, base_regex, '') | ||
local rtarbase = mw.ustring.gsub(catlink.rtarget, base_regex, '') | local rtarbase, rtarbase_success = mw.ustring.gsub(catlink.rtarget, base_regex, '') | ||
if rtarbase_success == 0 then | |||
local base_regex_lax = '%d%d%d%d' --in case rtarget is a year cat | |||
rtarbase, rtarbase_success = mw.ustring.gsub(catlink.rtarget, base_regex_lax, '') | |||
end | |||
local terminal_regex = '%d+[–-]'..(terminaltxt or '')..'$' --more manual ORs bc Lua regex sux | local terminal_regex = '%d+[–-]'..(terminaltxt or '')..'$' --more manual ORs bc Lua regex sux | ||
if mw.ustring.match(orig, terminal_regex) then | if mw.ustring.match(orig, terminal_regex) then | ||
سطر 895: | سطر 889: | ||
rtarbase = mw.text.trim(rtarbase) | rtarbase = mw.text.trim(rtarbase) | ||
if origbase ~= rtarbase then | if origbase ~= rtarbase then | ||
trackcat(6 | trackcat(6, 'Navseasoncats range redirected (base change)') | ||
elseif terminalcat == 1 then | elseif terminalcat == 1 then | ||
trackcat( | trackcat(8, 'Navseasoncats range redirected (end)') | ||
else | else --origbase == rtarbase | ||
local all4s_regex = '%d%d%d%d[–-]%d%d%d%d' | local all4s_regex = '%d%d%d%d[–-]%d%d%d%d' | ||
local | local orig_all4s = mw.ustring.match(orig, all4s_regex) | ||
local rtar_all4s = mw.ustring.match(catlink.rtarget, all4s_regex) | |||
if | if orig_all4s and rtar_all4s then | ||
trackcat( | trackcat(10, 'Navseasoncats range redirected (other)') | ||
else | else | ||
trackcat( | local year_regex1 = '%d%d%d%d$' | ||
local year_regex2 = '%d%d%d%d[%s%)]' | |||
local year_rtar = mw.ustring.match(catlink.rtarget, year_regex1) or | |||
mw.ustring.match(catlink.rtarget, year_regex2) | |||
if orig_all4s and year_rtar then | |||
trackcat(7, 'Navseasoncats range redirected (var change)') | |||
else | |||
trackcat(9, 'Navseasoncats range redirected (MOS)') | |||
end | |||
end | end | ||
end | end | ||
سطر 915: | سطر 917: | ||
end | end | ||
if (from >= 0) and (nminseas <= from) and (from <= nmaxseas) then | if (from >= 0) and (nminseas <= from) and (from <= nmaxseas) then | ||
table.insert(navlist, catlink.navelement) | |||
if terminalcat then nmaxseas = nminseas_default end --prevent display of future ranges | if terminalcat then nmaxseas = nminseas_default end --prevent display of future ranges | ||
else | else | ||
local hidden = '<span style="visibility:hidden">'..disp..'</span>' | local hidden = '<span style="visibility:hidden">'..disp..'</span>' | ||
table.insert(navlist, hidden) | |||
if listall then | if listall then | ||
tlistall[#tlistall] = tlistall[#tlistall]..' ('..hidden..')' | tlistall[#tlistall] = tlistall[#tlistall]..' ('..hidden..')' | ||
سطر 929: | سطر 931: | ||
local disp = start..hyph..finish | local disp = start..hyph..finish | ||
if regularparent == 'isolated' then disp = start end | if regularparent == 'isolated' then disp = start end | ||
table.insert(navlist, '<b>'..disp..'</b>') | |||
end | end | ||
i = i + 1 | i = i + 1 | ||
end | end | ||
-- add the list | |||
navh = navh..horizontal(navlist)..'\n' | |||
--tracking cats & finalize | --tracking cats & finalize | ||
if avoidself then | if avoidself then | ||
local igaps = 0 --# of diff gap sizes > 0 found | local igaps = 0 --# of diff gap sizes > 0 found | ||
local itlens = 0 --# of diff term lengths found | local itlens = 0 --# of diff term lengths found | ||
for s = 1, hgap_limit_reg do --must loop; #tgaps, #ttlens unreliable | for s = 1, hgap_limit_reg do --must loop; #tgaps, #ttlens unreliable | ||
سطر 945: | سطر 950: | ||
itlens = itlens + (ttlens[s] or 0) | itlens = itlens + (ttlens[s] or 0) | ||
end | end | ||
if igaps > 0 then | if igaps > 0 then trackcat(11, 'Navseasoncats range gaps') end | ||
if itlens > 1 and ttrackingcats[13] == '' then --avoid duplication in "Navseasoncats range irregular, 0-length" | |||
trackcat(12, 'Navseasoncats range irregular') | |||
if itlens > 1 and ttrackingcats[ | |||
trackcat( | |||
end | end | ||
end | end | ||
سطر 962: | سطر 965: | ||
--[[=========================={{ nav_tvseason | --[[=========================={{ nav_tvseason }}============================]] | ||
function nav_tvseason( frame, firstpart, tv, lastpart, maximumtv ) | local function nav_tvseason( frame, firstpart, tv, lastpart, maximumtv ) | ||
--Expects a PAGENAME of the form "Futurama (season 1) episodes", where | --Expects a PAGENAME of the form "Futurama (season 1) episodes", where | ||
-- firstpart = Futurama (season | -- firstpart = Futurama (season | ||
-- tv | -- tv = 1 | ||
-- lastpart = ) episodes | -- lastpart = ) episodes | ||
-- maximumtv = 7 ('max' tv season parameter; optional; defaults to 9999) | -- maximumtv = 7 ('max' tv season parameter; optional; defaults to 9999) | ||
سطر 980: | سطر 983: | ||
--begin navtvseason | --begin navtvseason | ||
local navt = '{| class="toccolours | local navt = '{| class="toccolours" style="text-align: center; margin: auto;"\n|\n' | ||
local navlist = {} | |||
local i = -5 --nav position | local i = -5 --nav position | ||
while i <= 5 do | while i <= 5 do | ||
local t = tv + i | local t = tv + i | ||
if i ~= 0 then --left/right navt | if i ~= 0 then --left/right navt | ||
local | local catlink = catlinkfollowr( frame, firstpart..' '..t..lastpart, t ) | ||
if (t >= 1 and t <= maxtv) then --hardcode mintv | if (t >= 1 and t <= maxtv) then --hardcode mintv | ||
if catlink.rtarget then --a {{تحويل تصنيف}} was followed | if catlink.rtarget then --a {{تحويل تصنيف}} was followed | ||
trackcat( | trackcat(25, 'Navseasoncats TV season redirected') | ||
end | end | ||
table.insert(navlist, catlink.navelement) | |||
else | else | ||
local hidden = '<span style="visibility:hidden">'..'0'..'</span>' --'0' to maintain dot spacing | local hidden = '<span style="visibility:hidden">'..'0'..'</span>' --'0' to maintain dot spacing | ||
table.insert(navlist, hidden) | |||
if listall then | if listall then | ||
tlistall[#tlistall] = tlistall[#tlistall]..' ('..hidden..')' | tlistall[#tlistall] = tlistall[#tlistall]..' ('..hidden..')' | ||
سطر 1٬001: | سطر 1٬004: | ||
end | end | ||
else --center navt | else --center navt | ||
table.insert(navlist, '<b>'..tv..'</b>') | |||
end | end | ||
i = i + 1 | i = i + 1 | ||
end | end | ||
-- add the list | |||
navt = navt..horizontal(navlist)..'\n' | |||
isolatedcat() | isolatedcat() | ||
if listall then | if listall then | ||
سطر 1٬018: | سطر 1٬022: | ||
--[[==========================={{ nav_decade }}=============================]] | --[[==========================={{ nav_decade }}=============================]] | ||
function nav_decade( frame, firstpart, decade, lastpart, mindecade, maxdecade ) | local function nav_decade( frame, firstpart, decade, lastpart, mindecade, maxdecade ) | ||
--Expects a PAGENAME of the form "Some sequential 2000 example cat", where | --Expects a PAGENAME of the form "Some sequential 2000 example cat", where | ||
-- firstpart = Some sequential | -- firstpart = Some sequential | ||
-- decade | -- decade = 2000 | ||
-- lastpart = example cat | -- lastpart = example cat | ||
-- mindecade = 1800 ('min' decade parameter; optional; defaults to -9999) | -- mindecade = 1800 ('min' decade parameter; optional; defaults to -9999) | ||
سطر 1٬039: | سطر 1٬043: | ||
local mindec = sterilizedec(mindecade) --returns a tostring(unsigned int), or nil | local mindec = sterilizedec(mindecade) --returns a tostring(unsigned int), or nil | ||
if mindec then | if mindec then | ||
if string.match(mindecade, '-%d') or | if string.match(mindecade, '-%d') or | ||
string.match(mindecade, 'BC') | string.match(mindecade, 'BC') | ||
then | then | ||
سطر 1٬056: | سطر 1٬060: | ||
local maxdec = sterilizedec(maxdecade) --returns a tostring(unsigned int), or nil + error | local maxdec = sterilizedec(maxdecade) --returns a tostring(unsigned int), or nil + error | ||
if maxdec then | if maxdec then | ||
if string.match(maxdecade, '-%d') or | if string.match(maxdecade, '-%d') or | ||
string.match(maxdecade, 'BC') | string.match(maxdecade, 'BC') | ||
then | then --better +/-0 behavior with strings (0-initialized int == "-0" string...), | ||
maxdec = '-'..maxdec --but a "-0" string -> tonumber() -> tostring() = "-0", | maxdec = '-'..maxdec --but a "-0" string -> tonumber() -> tostring() = "-0", | ||
end | end --and a "0" string -> tonumber() -> tostring() = "0" | ||
elseif maxdec == nil and maxdecade and maxdecade ~= '' then | elseif maxdec == nil and maxdecade and maxdecade ~= '' then | ||
errors = p.errorclass('Function nav_decade was sent "'..(maxdecade or '')..'" as its 5th parameter, '.. | errors = p.errorclass('Function nav_decade was sent "'..(maxdecade or '')..'" as its 5th parameter, '.. | ||
سطر 1٬074: | سطر 1٬078: | ||
--AD/BC switches & vars | --AD/BC switches & vars | ||
--local parentBC = string.match(lastpart, '^BC') --following the "0s BC" convention for all years BC | -- local parentBC = string.match(lastpart, '^BC') --following the "0s BC" convention for all years BC | ||
local parentBC = string.match(lastpart, '^%s*(ق%sم)') | local parentBC = string.match(lastpart, '^%s*(ق%sم)') | ||
lastpart = mw.ustring.gsub(lastpart, '^BC%s*', '') --handle BC separately; AD never used | |||
--TODO?: handle BCE, but only if it exists in the wild | --TODO?: handle BCE, but only if it exists in the wild | ||
lastpart = mw.ustring.gsub(lastpart, '^ق م%s*', '') | lastpart = mw.ustring.gsub(lastpart, '^ق م%s*', '') | ||
local dec0to40AD = (ndec >= 0 and ndec <= 40 and not parentBC) --special behavior in this range | local dec0to40AD = (ndec >= 0 and ndec <= 40 and not parentBC) --special behavior in this range | ||
local switchADBC = 1 | local switchADBC = 1 -- 1=AD parent | ||
if parentBC then switchADBC = -1 end -- -1=BC parent; possibly adjusted later | if parentBC then switchADBC = -1 end -- -1=BC parent; possibly adjusted later | ||
local BCdisp = '' | local BCdisp = '' | ||
سطر 1٬105: | سطر 1٬109: | ||
bnb = ' border-style: none; background-color: transparent;' | bnb = ' border-style: none; background-color: transparent;' | ||
end | end | ||
local navd = '{| class="toccolours | local navd = '{| class="toccolours" style="text-align: center; margin: auto;'..bnb..'"\n|\n' | ||
local navlist = {} | |||
local i = -50 --nav position x 10 | local i = -50 --nav position x 10 | ||
while i <= 50 do | while i <= 50 do | ||
سطر 1٬116: | سطر 1٬121: | ||
if D < -10 then | if D < -10 then | ||
d = math.abs(d + 10) --b/c 2 "0s" decades exist: "0s BC" & "0s" (AD) | d = math.abs(d + 10) --b/c 2 "0s" decades exist: "0s BC" & "0s" (AD) | ||
BC = ' | -- BC = 'BC ' | ||
BC = ' ق م ' | |||
if d == 0 then | if d == 0 then | ||
D = -10 --track 1st d = 0 use (BC) | D = -10 --track 1st d = 0 use (BC) | ||
سطر 1٬122: | سطر 1٬128: | ||
elseif D >= -10 then | elseif D >= -10 then | ||
D = D + 10 --now iterate from 0s AD | D = D + 10 --now iterate from 0s AD | ||
d = D | d = D --2nd d = 0 use | ||
end | end | ||
elseif parentBC then | elseif parentBC then | ||
if switchADBC == -1 then --parentBC looking at the BC side (the common case) | if switchADBC == -1 then --parentBC looking at the BC side (the common case) | ||
BC = ' ق م ' -- BC = 'BC ' | BC = ' ق م ' | ||
if d == 0 then | -- BC = 'BC ' | ||
if d == 0 then --prepare to switch to the AD side on the next iteration | |||
switchADBC = 1 --1st d = 0 use (BC) | switchADBC = 1 --1st d = 0 use (BC) | ||
D = -10 | D = -10 --prep | ||
end | end | ||
elseif switchADBC == 1 then --switched to the AD side | elseif switchADBC == 1 then --switched to the AD side | ||
D = D + 10 --now iterate from 0s AD | D = D + 10 --now iterate from 0s AD | ||
d = D | d = D --2nd d = 0 use (on first use) | ||
end | end | ||
end | end | ||
if BC ~= '' and ndec <= 50 then | |||
if BC ~= '' | |||
--BCdisp = ' BC' --show BC for all BC decades whenever a "0s" is displayed on the nav | --BCdisp = ' BC' --show BC for all BC decades whenever a "0s" is displayed on the nav | ||
BCdisp = ' ق م ' | BCdisp = ' ق م ' | ||
سطر 1٬143: | سطر 1٬149: | ||
--determine target cat | --determine target cat | ||
--local disp = d..'s'..BCdisp | -- local disp = d .. 's' .. BCdisp | ||
local disp = 'عقد ' .. d ..BCdisp | local disp = 'عقد ' .. d .. BCdisp | ||
-- local link1 = firstpart..' | -- local link1 = firstpart .. ' ' .. d .. 's' .. tspace .. BC .. lastpart | ||
local link1 = firstpart..' | local link1 = firstpart .. ' ' .. d .. '' .. tspace .. BC .. lastpart | ||
local catlink = catlinkfollowr( frame, link1, disp ) | local catlink = catlinkfollowr( frame, link1, disp ) | ||
if catlink.rtarget then --a {{تحويل تصنيف}} was followed | if catlink.rtarget then --a {{تحويل تصنيف}} was followed | ||
trackcat( | trackcat(18, 'Navseasoncats decade redirected') | ||
end | end | ||
سطر 1٬164: | سطر 1٬169: | ||
local zsign, zmin, zmax = 1, nmindec, nmaxdec | local zsign, zmin, zmax = 1, nmindec, nmaxdec | ||
if BC ~= '' then zsign = -1 end | if BC ~= '' then zsign = -1 end | ||
if | if mindec == '-0' then zmin = -1 | ||
elseif mindec == '0' then zmin = 1 end | elseif mindec == '0' then zmin = 1 end | ||
if | if maxdec == '-0' then zmax = -1 | ||
elseif maxdec == '0' then zmax = 1 end | elseif maxdec == '0' then zmax = 1 end | ||
if (zmin <= zsign) and (zsign <= zmax) then | if (zmin <= zsign) and (zsign <= zmax) then | ||
table.insert(navlist, shown) | |||
hidden = nil | hidden = nil | ||
else | else | ||
table.insert(navlist, hidden) | |||
end | end | ||
else | else | ||
table.insert(navlist, shown)--the common case | |||
hidden = nil | hidden = nil | ||
end | end | ||
else | else | ||
table.insert(navlist, hidden) | |||
end | end | ||
if listall and hidden then | if listall and hidden then | ||
سطر 1٬188: | سطر 1٬193: | ||
i = i + 10 | i = i + 10 | ||
end | end | ||
-- add the list | |||
navd = navd..horizontal(navlist)..'\n' | |||
isolatedcat() | isolatedcat() | ||
if listall then | if listall then | ||
سطر 1٬198: | سطر 1٬204: | ||
--[[============================{{ | --[[============================{{ nav_year }}==============================]] | ||
function nav_year(frame, firstpart, year, lastpart, minimumyear, maximumyear) | local function nav_year( frame, firstpart, year, lastpart, minimumyear, maximumyear ) | ||
--Expects a PAGENAME of the form "Some sequential 1760 example cat", where | |||
-- firstpart = Some sequential | |||
-- year = 1760 | |||
-- lastpart = example cat | |||
-- minimumyear = 1758 ('min' year parameter; optional) | |||
-- maximumyear = 1800 ('max' year parameter; optional) | |||
local minyear_default = -9999 | local minyear_default = -9999 | ||
local maxyear_default = 9999 | local maxyear_default = 9999 | ||
سطر 1٬221: | سطر 1٬232: | ||
local parentBC = string.match(lastpart, "^%s*(ق%sم)") | local parentBC = string.match(lastpart, "^%s*(ق%sم)") | ||
lastpart = mw.ustring.gsub(lastpart, "^%s*ق%s*م%s*", "") | |||
local BCe = parentBC or "ق م" | local BCe = parentBC or "ق م" | ||
سطر 1٬245: | سطر 1٬256: | ||
mw.ustring.match(firstpart, "%s*كأس%s*العالم%s*") or | mw.ustring.match(firstpart, "%s*كأس%s*العالم%s*") or | ||
mw.ustring.match(firstpart, "%s*الأولمبية%s*") or | mw.ustring.match(firstpart, "%s*الأولمبية%s*") or | ||
mw.ustring.match(firstpart, "%s*البارالمبية%s*") or | |||
mw.ustring.match(firstpart, "%s*الألعاب%s*الآسيوية%s*") or | mw.ustring.match(firstpart, "%s*الألعاب%s*الآسيوية%s*") or | ||
mw.ustring.match(firstpart, "%s*الرئاسة%s*الأمريكية%s*") or | mw.ustring.match(firstpart, "%s*الرئاسة%s*الأمريكية%s*") or | ||
سطر 1٬395: | سطر 1٬406: | ||
end | end | ||
end | end | ||
if BC ~= "" and year <= 5 then | |||
if BC ~= "" | |||
BCdisp = " " .. BCe | BCdisp = " " .. BCe | ||
end | end | ||
سطر 1٬431: | سطر 1٬441: | ||
if catlinkHyph_4.catexists and catlinkHyph_4.rtarget == nil then | if catlinkHyph_4.catexists and catlinkHyph_4.rtarget == nil then | ||
catlink = catlinkHyph_4 | catlink = catlinkHyph_4 | ||
trackcat( | trackcat(27, "Navseasoncats year and range") | ||
done = true | done = true | ||
else | else | ||
سطر 1٬450: | سطر 1٬460: | ||
if catlinkHyph_2.catexists and catlinkHyph_2.rtarget == nil then | if catlinkHyph_2.catexists and catlinkHyph_2.rtarget == nil then | ||
catlink = catlinkHyph_2 | catlink = catlinkHyph_2 | ||
trackcat( | trackcat(27, 'Navseasoncats year and range') | ||
elseif listall then | elseif listall then | ||
tlistall[#tlistall] = tlistall[#tlistall] .. " (tried; not displayed)" | tlistall[#tlistall] = tlistall[#tlistall] .. " (tried; not displayed)" | ||
سطر 1٬473: | سطر 1٬483: | ||
local c_base = mw.ustring.gsub(c, regex_final, "") | local c_base = mw.ustring.gsub(c, regex_final, "") | ||
if r_base ~= c_base then | if r_base ~= c_base then | ||
trackcat( | trackcat(19, 'Navseasoncats year redirected (base change)') --acceptable #R target | ||
else | else | ||
trackcat( | trackcat(21, 'Navseasoncats year redirected (other)') --exceptions go here | ||
end | end | ||
else | else | ||
trackcat( | trackcat(20, 'Navseasoncats year redirected (var change)') --e.g. "V2 engines" to "V-twin engines" | ||
end | end | ||
end | end | ||
سطر 1٬511: | سطر 1٬521: | ||
end | end | ||
end | end | ||
--[[==========================={{ nav_roman }}==============================]] | --[[==========================={{ nav_roman }}==============================]] | ||
function nav_roman( frame, firstpart, roman, lastpart, minimumrom, maximumrom ) | local function nav_roman( frame, firstpart, roman, lastpart, minimumrom, maximumrom ) | ||
local toarabic = require('Module:ConvertNumeric/en').roman_to_numeral | local toarabic = require('Module:ConvertNumeric/en').roman_to_numeral | ||
local toroman = require('Module:Roman').main | local toroman = require('Module:Roman').main | ||
سطر 1٬530: | سطر 1٬541: | ||
local minrom = tonumber(minimumrom or '') or tonumber(toarabic(minimumrom or '')) | local minrom = tonumber(minimumrom or '') or tonumber(toarabic(minimumrom or '')) | ||
local maxrom = tonumber(maximumrom or '') or tonumber(toarabic(maximumrom or '')) | local maxrom = tonumber(maximumrom or '') or tonumber(toarabic(maximumrom or '')) | ||
if minrom < 1 then minrom = 1 end | if minrom < 1 then minrom = 1 end --toarabic() returns -1 on error | ||
if maxrom < 1 then maxrom = 9999 end --toarabic() returns -1 on error | if maxrom < 1 then maxrom = 9999 end --toarabic() returns -1 on error | ||
if minrom > num then minrom = num end | if minrom > num then minrom = num end | ||
سطر 1٬536: | سطر 1٬547: | ||
--begin navroman | --begin navroman | ||
local navr = '{| class="toccolours | local navr = '{| class="toccolours" style="text-align: center; margin: auto;"\n|\n' | ||
local navlist = {} | |||
local i = -5 --nav position | local i = -5 --nav position | ||
while i <= 5 do | while i <= 5 do | ||
سطر 1٬548: | سطر 1٬560: | ||
if minrom <= n and n <= maxrom then | if minrom <= n and n <= maxrom then | ||
if catlink.rtarget then --a {{تحويل تصنيف}} was followed | if catlink.rtarget then --a {{تحويل تصنيف}} was followed | ||
trackcat( | trackcat(22, 'Navseasoncats roman numeral redirected') | ||
end | end | ||
table.insert(navlist, catlink.navelement) | |||
else | else | ||
local hidden = '<span style="visibility:hidden">'..r..'</span>' | local hidden = '<span style="visibility:hidden">'..r..'</span>' | ||
table.insert(navlist, hidden) | |||
if listall then | if listall then | ||
tlistall[#tlistall] = tlistall[#tlistall]..' ('..hidden..')' | tlistall[#tlistall] = tlistall[#tlistall]..' ('..hidden..')' | ||
سطر 1٬559: | سطر 1٬571: | ||
end | end | ||
else --center navr | else --center navr | ||
table.insert(navlist, '<b>'..r..'</b>') | |||
end | end | ||
else | else | ||
table.insert(navlist, '<span style="visibility:hidden">I</span>') | |||
end | end | ||
سطر 1٬568: | سطر 1٬580: | ||
end | end | ||
-- add the list | |||
navr = navr..horizontal(navlist)..'\n' | |||
isolatedcat() | isolatedcat() | ||
if listall then | if listall then | ||
سطر 1٬577: | سطر 1٬591: | ||
--[[=========================={{ nav_nordinal | --[[=========================={{ nav_nordinal }}============================]] | ||
function nav_nordinal( frame, firstpart, ord, lastpart, minimumord, maximumord ) | local function nav_nordinal( frame, firstpart, ord, lastpart, minimumord, maximumord ) | ||
local nord = tonumber(ord) | local nord = tonumber(ord) | ||
local minord = tonumber(string.match(minimumord or '', '(-?%d+)[snrt]?[tdh]?')) or -9999 --allow full ord & +/- qualifier | 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 | local maxord = tonumber(string.match(maximumord or '', '(-?%d+)[snrt]?[tdh]?')) or 9999 --allow full ord & +/- qualifier | ||
if string.match(minimumord or '', 'BC') then minord = -math.abs(minord) end --allow BC qualifier (AD otherwise assumed) | if string.match(minimumord or '', 'BC') then minord = -math.abs(minord) end --allow BC qualifier (AD otherwise assumed) | ||
if string.match(maximumord or '', 'BC') then maxord = -math.abs(maxord) end --allow BC qualifier (AD otherwise assumed) | if string.match(maximumord or '', 'BC') then maxord = -math.abs(maxord) end --allow BC qualifier (AD otherwise assumed) | ||
-- local temporal = string.match(lastpart, 'century') or string.match(lastpart, 'millennium') | |||
local temporal = string.match(firstpart, 'القرن') or -- century | local temporal = string.match(firstpart, 'القرن') or -- century | ||
string.match(firstpart, 'الألفية') -- millennium | string.match(firstpart, 'الألفية') -- millennium | ||
mw.log('nav_nordinal firstpart:' .. firstpart) | mw.log('nav_nordinal firstpart:' .. firstpart) | ||
local tspace = ' ' --assume a trailing space after ordinal | local tspace = ' ' --assume a trailing space after ordinal | ||
سطر 1٬599: | سطر 1٬613: | ||
--"BCE" removed to match both AD & BCE cats; easier & faster than multiple string.match()s | --"BCE" removed to match both AD & BCE cats; easier & faster than multiple string.match()s | ||
['-century Hebrew people'] = 'BCE', --WP:CFD/Log/2016 June 21#Category:11th-century BC Hebrew people | ['-century Hebrew people'] = 'BCE', --WP:CFD/Log/2016 June 21#Category:11th-century BC Hebrew people | ||
['-century Jews'] | ['-century Jews'] = 'BCE', --co-nominated | ||
['-century Judaism'] | ['-century Judaism'] = 'BCE', --co-nominated | ||
['-century rabbis'] | ['-century rabbis'] = 'BCE', --co-nominated | ||
['-century High Priests of Israel'] = 'BCE', | ['-century High Priests of Israel'] = 'BCE', | ||
} | } | ||
--local parentBC = mw.ustring.match(lastpart, '%s(BCE?)') | -- local parentBC = mw.ustring.match(lastpart, '%s(BCE?)') --"1st-century BC" format | ||
local parentBC = mw.ustring.match(lastpart, '^%s*(ق%sم)') | local parentBC = mw.ustring.match(lastpart, '^%s*(ق%sم)') | ||
-- local lastpartNoBC = mw.ustring.gsub(lastpart, '%sBCE?', '') --easier than splitting lastpart up in 2; AD never used | |||
--local lastpartNoBC = mw.ustring.gsub(lastpart, '%sBCE?', '') --easier than splitting lastpart up in 2; AD never used | |||
local lastpartNoBC = mw.ustring.gsub(lastpart, '^%s*ق%s*م%s*' , '') | local lastpartNoBC = mw.ustring.gsub(lastpart, '^%s*ق%s*م%s*' , '') | ||
-- local BCe = parentBC or ordBCElastparts[lastpartNoBC] or 'BC' --"BC" default | |||
--local BCe = parentBC or ordBCElastparts[lastpartNoBC] or 'BC' --"BC" default | |||
local BCe = parentBC or 'ق م' --"BC" default | local BCe = parentBC or 'ق م' --"BC" default | ||
local switchADBC = 1 | local switchADBC = 1 -- 1=AD parent | ||
if parentBC then switchADBC = -1 end -- -1=BC parent; possibly adjusted later | if parentBC then switchADBC = -1 end -- -1=BC parent; possibly adjusted later | ||
local O = 0 --secondary iterator for AD-on-a-BC-parent | local O = 0 --secondary iterator for AD-on-a-BC-parent | ||
سطر 1٬626: | سطر 1٬638: | ||
bnb = ' border-style: none; background-color: transparent;' | bnb = ' border-style: none; background-color: transparent;' | ||
end | end | ||
local navo = '{| class="toccolours | local navo = '{| class="toccolours" style="text-align: center; margin: auto;'..bnb..'"\n|\n' | ||
firstpart = ' ' .. firstpart .. ' ' | firstpart = ' ' .. firstpart .. ' ' | ||
local navlist = {} | |||
local i = -5 --nav position | local i = -5 --nav position | ||
while i <= 5 do | while i <= 5 do | ||
سطر 1٬636: | سطر 1٬649: | ||
if parentBC then | if parentBC then | ||
if switchADBC == -1 then --parentBC looking at the BC side | if switchADBC == -1 then --parentBC looking at the BC side | ||
if o >= 1 then | if o >= 1 then --the common case | ||
BC = ' ' .. BCe | BC = ' '..BCe | ||
elseif o == 0 then --switch to the AD side | elseif o == 0 then --switch to the AD side | ||
BC = '' | BC = '' | ||
سطر 1٬645: | سطر 1٬658: | ||
if switchADBC == 1 then --displayed o is now in the AD regime | if switchADBC == 1 then --displayed o is now in the AD regime | ||
O = O + 1 --skip o = 0 (DNE) | O = O + 1 --skip o = 0 (DNE) | ||
o = O | o = O --easiest solution: start another iterator for these AD o's displayed on a BC year parent | ||
end | end | ||
elseif o <= 0 then --parentAD looking at BC side | elseif o <= 0 then --parentAD looking at BC side | ||
BC = ' ' .. BCe | BC = ' '..BCe | ||
o = math.abs(o - 1) --skip o = 0 (DNE) | o = math.abs(o - 1) --skip o = 0 (DNE) | ||
end | end | ||
if BC ~= '' and nord <= 5 then --only show 'BC' for parent ords <= 5: saves room, easier to read, | |||
if BC ~= '' | BCdisp = ' '..BCe --and 6 is the first/last nav ord that doesn't need a disambiguator; | ||
BCdisp = ' ' .. BCe | end --the center/parent ord will always show BC, so no need to show it another 10x | ||
end | |||
--populate left/right navo | --populate left/right navo | ||
local oth = | local oth = ' ' .. o --p.addord(o) | ||
local osign = o --use o for display & osign for logic | local osign = o --use o for display & osign for logic | ||
if BC ~= '' then osign = -osign end | if BC ~= '' then osign = -osign end | ||
local hidden = '<span style="visibility:hidden"> | local hidden = '<span style="visibility:hidden">'..oth..'</span>' | ||
if temporal then --e.g. "3rd-century BC" | if temporal then --e.g. "3rd-century BC" | ||
local lastpart = lastpartNoBC --lest we recursively add multiple "BC"s | local lastpart = lastpartNoBC --lest we recursively add multiple "BC"s | ||
if BC ~= '' then | if BC ~= '' then | ||
lastpart = string.gsub(lastpart, temporal, temporal .. BC) --replace BC if needed | lastpart = string.gsub(lastpart, temporal, temporal..BC) --replace BC if needed | ||
end | end | ||
-- local catlink = catlinkfollowr( frame, firstpart .. ' ' .. oth .. tspace .. lastpart, oth .. BCdisp ) | |||
local catlink = catlinkfollowr( frame, | local catlink = catlinkfollowr( frame, firstpart .. o .. ' ' .. BCdisp .. ' ' .. tspace .. lastpart , temporal .. ' ' .. oth .. BCdisp ) | ||
if (minord <= osign) and (osign <= maxord) then | if (minord <= osign) and (osign <= maxord) then | ||
if catlink.rtarget then --a {{تحويل تصنيف}} was followed | if catlink.rtarget then --a {{تحويل تصنيف}} was followed | ||
trackcat( | trackcat(23, 'Navseasoncats nordinal redirected') | ||
end | end | ||
table.insert(navlist, navcenter(i, catlink)) | |||
else | else | ||
table.insert(navlist, hidden) | |||
if listall then | if listall then | ||
tlistall[#tlistall] = tlistall[#tlistall] .. ' (' .. hidden .. ')' | tlistall[#tlistall] = tlistall[#tlistall]..' ('..hidden..')' | ||
end | end | ||
end | end | ||
elseif BC == '' and minord <= osign and osign <= maxord then --e.g. >= "1st parliament" | elseif BC == '' and minord <= osign and osign <= maxord then --e.g. >= "1st parliament" | ||
local catlink = catlinkfollowr( frame, | -- local catlink = catlinkfollowr( frame, firstpart .. ' ' .. oth .. tspace .. lastpart, oth ) | ||
local catlink = catlinkfollowr( frame, firstpart .. o .. ' ' .. BCdisp .. ' ' .. tspace .. lastpart, temporal .. ' ' .. oth ) | |||
if catlink.rtarget then --a {{تحويل تصنيف}} was followed | if catlink.rtarget then --a {{تحويل تصنيف}} was followed | ||
trackcat( | trackcat(23, 'Navseasoncats nordinal redirected') | ||
end | end | ||
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 | 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) | |||
end | end | ||
i = i + 1 | i = i + 1 | ||
end | end | ||
navo = navo..horizontal(navlist)..'\n' | |||
isolatedcat() | isolatedcat() | ||
سطر 1٬697: | سطر 1٬711: | ||
return listalllinks() | return listalllinks() | ||
else | else | ||
return navo .. '|}' | return navo..'|}' | ||
end | end | ||
end | end | ||
--[[========================={{ nav_wordinal }}=============================]] | --[[========================={{ nav_wordinal }}=============================]] | ||
function nav_wordinal( frame, firstpart, word, lastpart, minimumword, maximumword, ordinal, frame ) | local function nav_wordinal( frame, firstpart, word, lastpart, minimumword, maximumword, ordinal, frame ) | ||
--Module:ConvertNumeric. | --Module:ConvertNumeric.spell_number2() args: | ||
-- | -- ordinal == true : 'second' is output instead of 'two' | ||
-- | -- ordinal == false: 'two' is output instead of 'second' | ||
local ord2eng = require('Module:ConvertNumeric/en').numeral_to_english | local ord2eng = require('Module:ConvertNumeric/en').numeral_to_english | ||
local eng2ord = require('Module:ConvertNumeric/en').english_to_ordinal | local eng2ord = require('Module:ConvertNumeric/en').english_to_ordinal | ||
local th = 'th' | local th = 'th' | ||
if ordinal | if not ordinal then | ||
th = '' | th = '' | ||
eng2ord = require('Module:ConvertNumeric/en').english_to_numeral | eng2ord = require('Module:ConvertNumeric/en').english_to_numeral | ||
end | end | ||
local | local capitalize = nil ~= string.match(word, '^%u') --determine capitalization | ||
local | local nord = eng2ord(string.lower(word)) --operate on/with lowercase, and restore any capitalization later | ||
local lspace = ' ' --assume a leading space (most common) | local lspace = ' ' --assume a leading space (most common) | ||
سطر 1٬755: | سطر 1٬766: | ||
--begin navwordinal | --begin navwordinal | ||
local navw = '{| class="toccolours | local navw = '{| class="toccolours" style="text-align: center; margin: auto;"\n|\n' | ||
local navlist = {} | |||
local i = -5 --nav position | local i = -5 --nav position | ||
while i <= 5 do | while i <= 5 do | ||
سطر 1٬762: | سطر 1٬774: | ||
if n >= 1 then | if n >= 1 then | ||
local nth = " القرن " .. n | -- local nth = p.addord(n) | ||
if ordinal | local nth = " القرن " .. n | ||
if not ordinal then nth = n end | |||
if i ~= 0 then --left/right navw | if i ~= 0 then --left/right navw | ||
local | local w = ord2eng{ num = n, ordinal = ordinal, capitalize = capitalize } | ||
local catlink = catlinkfollowr( frame, firstpart..lspace..w..tspace..lastpart, nth ) | local catlink = catlinkfollowr( frame, firstpart..lspace..w..tspace..lastpart, nth ) | ||
if minword <= n and n <= maxword then | if minword <= n and n <= maxword then | ||
if catlink.rtarget then --a {{تحويل تصنيف}} was followed | if catlink.rtarget then --a {{تحويل تصنيف}} was followed | ||
trackcat( | trackcat(24, 'Navseasoncats wordinal redirected') | ||
end | end | ||
table.insert(navlist, catlink.navelement) | |||
else | else | ||
local hidden = '<span style="visibility:hidden">'..nth..'</span>' | local hidden = '<span style="visibility:hidden">'..nth..'</span>' | ||
table.insert(navlist, hidden) | |||
if listall then | if listall then | ||
tlistall[#tlistall] = tlistall[#tlistall]..' ('..hidden..')' | tlistall[#tlistall] = tlistall[#tlistall]..' ('..hidden..')' | ||
سطر 1٬781: | سطر 1٬793: | ||
end | end | ||
else --center navw | else --center navw | ||
table.insert(navlist, '<b>'..nth..'</b>') | |||
end | end | ||
else | else | ||
table.insert(navlist, '<span style="visibility:hidden">'..'0'..th..'</span>') | |||
end | end | ||
i = i + 1 | i = i + 1 | ||
end | end | ||
-- Add the list | |||
navw = navw..horizontal(navlist)..'\n' | |||
isolatedcat() | isolatedcat() | ||
سطر 1٬799: | سطر 1٬813: | ||
--[[==========================={{ find_var }}===============================]] | --[[==========================={{ find_var }}===============================]] | ||
function find_var( pn ) | local function find_var( pn ) | ||
--Extracts the variable text (e.g. 2015, 2015–16, 2000s, 3rd, III, etc.) from a string, | --Extracts the variable text (e.g. 2015, 2015–16, 2000s, 3rd, III, etc.) from a string, | ||
--and returns { ['vtype'] = <'year'|'season'|etc.>, <v> = <2015|2015–16|etc.> } | --and returns { ['vtype'] = <'year'|'season'|etc.>, <v> = <2015|2015–16|etc.> } | ||
سطر 1٬809: | سطر 1٬823: | ||
end | end | ||
local cpagename = 'تصنيف:'..pagename --limited-Lua-regex workaround | local cpagename = 'تصنيف:' .. pagename --limited-Lua-regex workaround | ||
local d_season = mw.ustring.match(cpagename, ':عقد (%d+).+%(%d+[–-]%d+%)') --i.e. [[Category:1760s in the Province of Quebec (1763–1791)]] | local d_season = mw.ustring.match(cpagename, ':عقد (%d+).+%(%d+[–-]%d+%)') --i.e. [[Category: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 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–" | 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+[–-]present)$') --e.g. "UK MPs 2019–present" | mw.ustring.match(cpagename, '%s(%d+[–-]present)$') --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? | 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+)$') | mw.ustring.match(cpagename, '[:%s](%d+[–-]%d+)$') | ||
local tvseason = mw.ustring.match(cpagename, 'الموسم (%d+)') or | |||
mw.ustring.match(cpagename, 'series (%d+)') | |||
local nordinal = mw.ustring.match(cpagename, '[:%s](%d+[snrt][tdh])[-%s]') or | |||
mw.ustring.match(cpagename, '[:%s](%d+[snrt][tdh])$') | |||
local decade = mw.ustring.match(cpagename, '[%:%s]عقد%s(%d+)[%s-]') or | |||
mw.ustring.match(cpagename, '[%:%s]عقد%s(%d+)%s') or | |||
mw.ustring.match(cpagename, '[%:%s]عقد%s(%d+)%sق%sم%s') or | |||
mw.ustring.match(cpagename, '[%:%s]عقد%s(%d+)$') | |||
local century = mw.ustring.match(cpagename, '[:%s]القرن%s(%d+)[%s-]') or | |||
mw.ustring.match(cpagename, '[:%s]القرن%s(%d+)%s') or | |||
mw.ustring.match(cpagename, '[:%s]القرن%s(%d+)%s') or | |||
mw.ustring.match(cpagename, '[:%s]القرن%s(%d+)%sق%sم') or | |||
mw.ustring.match(cpagename, '[:%s]القرن%s(%d+)$') | |||
local millennium = mw.ustring.match(cpagename, '[:%s]الألفية%s(%d+)[%s-]') or | |||
mw.ustring.match(cpagename, '[:%s]الألفية%s(%d+)%s') or | |||
mw.ustring.match(cpagename, '[:%s]الألفية%s(%d+)$') | |||
local year = mw.ustring.match(cpagename, '[:%s](%d+)$') or --%) for [[Category:Futurama (season 1) episodes]], etc. | |||
mw.ustring.match(cpagename, '[:%s](%d+)[%s%)]') or | |||
mw.ustring.match(cpagename, '[:ب](%d+)$') | |||
local year44 = mw.ustring.match(cpagename, '[:%s](%d%d%d%d)%s') or --prioritize 4-digit years | |||
mw.ustring.match(cpagename, '[:%s](%d%d%d%d)$') or | |||
mw.ustring.match(cpagename, '[:%s](%d+)%s') or | |||
mw.ustring.match(cpagename, '[:%s](%d+)$') or | |||
--expand/combine exceptions below as needed | |||
mw.ustring.match(cpagename, '[:%s](%d+)-related') or | |||
mw.ustring.match(cpagename, '[:%s](%d+)-cylinder') or | |||
mw.ustring.match(cpagename, '[:%-VW](%d+)%s') --e.g. "Straight-8 engines" | |||
local roman = mw.ustring.match(cpagename, '%s([IVXLCDM]+)%s') | |||
local year | |||
mw.ustring.match(cpagename, '[:%s](%d+)[%s%)]') or | |||
mw.ustring.match(cpagename, '[:ب](%d+)$') | |||
local year44 | |||
mw.ustring.match(cpagename, '[:%s](%d%d%d%d)$') or | |||
mw.ustring.match(cpagename, '[:%s](%d+)%s') or | |||
mw.ustring.match(cpagename, '[:%s](%d+)$') or | |||
--expand/combine exceptions below as needed | |||
mw.ustring.match(cpagename, '[:%s](%d+)-related') or | |||
mw.ustring.match(cpagename, '[:%s](%d+)-cylinder') or | |||
mw.ustring.match(cpagename, '[:%-VW](%d+)%s') --e.g. "Straight-8 engines" | |||
local roman = mw.ustring.match(cpagename, '%s([IVXLCDM]+)%s') | |||
local found = d_season or y_season or e_season or season or tvseason or | local found = d_season or y_season or e_season or season or tvseason or | ||
nordinal or decade or year or roman | nordinal or decade or year or roman | ||
سطر 1٬865: | سطر 1٬879: | ||
if nordinal and season --i.e. "18th-century establishments in the Province of Quebec (1763–1791)" | if nordinal and season --i.e. "18th-century establishments in the Province of Quebec (1763–1791)" | ||
then return { ['vtype'] = 'nordinal', ['v'] = nordinal } end | then return { ['vtype'] = 'nordinal', ['v'] = nordinal } end | ||
if millennium then | if millennium then return { ['vtype'] = 'nordinal', ['v'] = millennium } end | ||
if century then return { ['vtype'] = 'century', ['v'] = century } end | if century then return { ['vtype'] = 'century', ['v'] = century } end | ||
if d_season then return { ['vtype'] = 'decade', ['v'] = d_season } end | if d_season then return { ['vtype'] = 'decade', ['v'] = d_season } end | ||
if y_season then return { ['vtype'] = 'year', | if y_season then return { ['vtype'] = 'year', ['v'] = y_season } end | ||
if e_season then return { ['vtype'] = 'ending', ['v'] = e_season } end | if e_season then return { ['vtype'] = 'ending', ['v'] = e_season } end | ||
if season | if season then return { ['vtype'] = 'season', ['v'] = season } end | ||
if tvseason then return { ['vtype'] = 'tvseason', ['v'] = tvseason } end | if tvseason then return { ['vtype'] = 'tvseason', ['v'] = tvseason } end | ||
if nordinal then return { ['vtype'] = 'nordinal', ['v'] = nordinal } end | if nordinal then return { ['vtype'] = 'nordinal', ['v'] = nordinal } end | ||
if decade | if decade then return { ['vtype'] = 'decade', ['v'] = decade } end | ||
if year | if year then return { ['vtype'] = 'year', ['v'] = year } end | ||
if roman | if roman then return { ['vtype'] = 'roman', ['v'] = roman } end | ||
end | end | ||
else | else | ||
--try wordinals ('zeroth' to 'ninety-ninth' only) | --try wordinals ('zeroth' to 'ninety-ninth' only) | ||
local eng2ord = require('Module:ConvertNumeric/en').english_to_ordinal | local eng2ord = require('Module:ConvertNumeric/en').english_to_ordinal | ||
local split = mw.text.split(pagename, ' ') | local split = mw.text.split(pagename, ' ') | ||
سطر 1٬905: | سطر 1٬918: | ||
--[[==========================================================================]] | --[[==========================================================================]] | ||
--[[ | --[[ Main ]] | ||
--[[==========================================================================]] | --[[==========================================================================]] | ||
سطر 1٬911: | سطر 1٬924: | ||
--arg checks & handling | --arg checks & handling | ||
local args = frame:getParent().args | local args = frame:getParent().args | ||
checkforunknownparams(args) | checkforunknownparams(args) --for template args | ||
checkforunknownparams(frame.args) --for #invoke'd args | checkforunknownparams(frame.args) --for #invoke'd args | ||
local cat = args['cat'] | local cat = args['cat'] --'testcase' alias for catspace | ||
local list = args['list-all-links'] | local list = args['list-all-links'] --debugging utility to output all links & followed #Rs | ||
local follow = args['follow-redirects'] --default 'yes' | local follow = args['follow-redirects'] --default 'yes' | ||
local testcase | local testcase = args['testcase'] | ||
local testcasegap = args['testcasegap'] | local testcasegap = args['testcasegap'] | ||
local minimum = args['min'] | local minimum = args['min'] | ||
سطر 1٬930: | سطر 1٬943: | ||
if skip_gaps and skip_gaps == 'yes' then | if skip_gaps and skip_gaps == 'yes' then | ||
skipgaps = true | skipgaps = true | ||
trackcat( | trackcat(26, 'Navseasoncats using skip-gaps parameter') | ||
end | end | ||
سطر 1٬936: | سطر 1٬949: | ||
if currtitle.nsText == 'تصنيف' then | if currtitle.nsText == 'تصنيف' then | ||
if cat and cat ~= '' then | if cat and cat ~= '' then | ||
trackcat(1 | trackcat(1, 'Navseasoncats using cat parameter') | ||
end | end | ||
if testcase and testcase ~= '' then | if testcase and testcase ~= '' then | ||
trackcat(2 | trackcat(2, 'Navseasoncats using testcase parameter') | ||
end | end | ||
elseif currtitle.nsText == '' then | elseif currtitle.nsText == '' then | ||
trackcat( | trackcat(30, 'Navseasoncats in mainspace') | ||
end | end | ||
سطر 1٬955: | سطر 1٬968: | ||
local findvar_escaped = string.gsub( findvar.v, '%-', '%%%-') | local findvar_escaped = string.gsub( findvar.v, '%-', '%%%-') | ||
local firstpart, lastpart = string.match(pagename, '^(.-)'..findvar_escaped..'(.*)$') | local firstpart, lastpart = string.match(pagename, '^(.-)'..findvar_escaped..'(.*)$') | ||
if findvar.vtype == 'tvseason' then --double check for cases like | if findvar.vtype == 'tvseason' then --double check for cases like "30 Rock (season 3) episodes" | ||
firstpart, lastpart = string.match(pagename, '^(.-season )'..findvar_escaped..'(.*)$') | firstpart, lastpart = string.match(pagename, '^(.-season )'..findvar_escaped..'(.*)$') | ||
if firstpart == nil then | if firstpart == nil then | ||
سطر 1٬965: | سطر 1٬978: | ||
--call the appropriate nav function, in order of decreasing popularity | --call the appropriate nav function, in order of decreasing popularity | ||
if findvar.vtype == 'year' then | if findvar.vtype == 'year' then --e.g. "500", "2001"; nav_year..nav_decade; ~75% of cats | ||
local nav1 = nav_year( frame, firstpart, start, lastpart, minimum, maximum )..testcaseindent..table.concat(ttrackingcats) | local nav1 = nav_year( frame, firstpart, start, lastpart, minimum, maximum )..testcaseindent..table.concat(ttrackingcats) | ||
سطر 1٬977: | سطر 1٬990: | ||
if dec == 0 then dec = '' end | if dec == 0 then dec = '' end | ||
end | end | ||
local decade = '' | -- local decade = dec .. '0s ' | ||
local decade = dec .. '0 ' | |||
if mw.text.trim(decade) == '00' then decade = '0 ' end | if mw.text.trim(decade) == '00' then decade = '0 ' end | ||
سطر 1٬984: | سطر 1٬998: | ||
firstpart_dec = string.gsub(firstpart_dec, ' سنة%s*عقد%s*$', ' عقد ') | firstpart_dec = string.gsub(firstpart_dec, ' سنة%s*عقد%s*$', ' عقد ') | ||
decadecat = mw.text.trim( firstpart_dec..' '..decade..lastpart ) | decadecat = mw.text.trim( firstpart_dec..' '..decade..lastpart ) | ||
local exists = catexists(decadecat) | |||
local exists = | |||
mw.log('find cat:' .. decadecat ) | mw.log('find cat:' .. decadecat ) | ||
سطر 1٬991: | سطر 2٬004: | ||
if exists then | if exists then | ||
navborder = false | navborder = false | ||
trackcat( | trackcat(28, 'Navseasoncats year and decade') | ||
local nav2 = nav_decade( frame, firstpart_dec, decade, lastpart, minimum, maximum )..testcaseindent..table.concat(ttrackingcats) | local nav2 = nav_decade( frame, firstpart_dec, decade, lastpart, minimum, maximum )..testcaseindent..table.concat(ttrackingcats) | ||
return nav1nav2( nav1, nav2 ) | return nav1nav2( nav1, nav2 ) | ||
elseif ttrackingcats[ | elseif ttrackingcats[16] ~= '' then --nav_year isolated; check nav_hyphen (e.g. UK MPs 1974, Moldovan MPs 2009, etc.) | ||
hyphen = '–' | local hyphen = '–' | ||
finish = start | local finish = start | ||
local nav2 = nav_hyphen( frame, start, hyphen, finish, firstpart, lastpart, minimum, maximum, testcasegap )..testcaseindent..table.concat(ttrackingcats) | local nav2 = nav_hyphen( frame, start, hyphen, finish, firstpart, lastpart, minimum, maximum, testcasegap )..testcaseindent..table.concat(ttrackingcats) | ||
if ttrackingcats[ | if ttrackingcats[16] ~= '' then return nav1 --still isolated; rv to nav_year | ||
else return nav2 end | else return nav2 end | ||
else --regular nav_year | else --regular nav_year | ||
سطر 2٬004: | سطر 2٬017: | ||
end | end | ||
elseif findvar.vtype == 'decade' then --e.g. "0s", "2010s"; nav_decade .. nav_nordinal; ~12% of cats | elseif findvar.vtype == 'decade' then --e.g. "0s", "2010s"; nav_decade..nav_nordinal; ~12% of cats | ||
local nav1 = nav_decade( frame, firstpart, start, lastpart, minimum, maximum ) .. testcaseindent .. table.concat(ttrackingcats) | local nav1 = nav_decade( frame, firstpart, start, lastpart, minimum, maximum )..testcaseindent..table.concat(ttrackingcats) | ||
-- local decade = tonumber(string.match(findvar.v, '^(%d+)s')) | |||
local decade = tonumber(string.match(findvar.v, '^(%d+)')) | local decade = tonumber(string.match(findvar.v, '^(%d+)')) | ||
local century = math.floor( ((decade-1)/100) + 1 ) --from {{CENTURY}} | local century = math.floor( ((decade-1)/100) + 1 ) --from {{CENTURY}} | ||
سطر 2٬022: | سطر 2٬036: | ||
local centurycat = mw.text.trim( firstpart .. century .. clastpart ) | local centurycat = mw.text.trim( firstpart .. century .. clastpart ) | ||
--mw.log('centurycat:' | --mw.log('centurycat:' .. centurycat) | ||
local exists = | local exists = catexists(centurycat) | ||
if not exists then --check for hyphenated century | if not exists then --check for hyphenated century | ||
clastpart = ' ' .. lastpart | clastpart = ' ' .. lastpart | ||
centurycat = mw.text.trim( firstpart .. century .. clastpart ) | centurycat = mw.text.trim( firstpart .. century .. clastpart ) | ||
exists = | exists = catexists(centurycat) | ||
end | end | ||
if exists then | if exists then | ||
navborder = false | navborder = false | ||
trackcat( | trackcat(29, 'Navseasoncats decade and century') | ||
local nav2 = nav_nordinal( frame, firstpart, century, clastpart, minimum, maximum ) .. testcaseindent .. table.concat(ttrackingcats) | local nav2 = nav_nordinal( frame, firstpart, century, clastpart, minimum, maximum )..testcaseindent..table.concat(ttrackingcats) | ||
return nav1nav2( nav1, nav2 ) | return nav1nav2( nav1, nav2 ) | ||
else | else | ||
سطر 2٬042: | سطر 2٬056: | ||
return nav_nordinal( frame, firstpart, start, lastpart, minimum, maximum )..testcaseindent..table.concat(ttrackingcats) | return nav_nordinal( frame, firstpart, start, lastpart, minimum, maximum )..testcaseindent..table.concat(ttrackingcats) | ||
elseif findvar.vtype == 'season' then | 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 | local hyphen, finish = mw.ustring.match(findvar.v, '%d([–-])(%d+)') --ascii 150 & 45 (ndash & keyboard hyphen); mw req'd | ||
return nav_hyphen( frame, start, hyphen, finish, firstpart, lastpart, minimum, maximum, testcasegap )..testcaseindent..table.concat(ttrackingcats) | return nav_hyphen( frame, start, hyphen, finish, firstpart, lastpart, minimum, maximum, testcasegap )..testcaseindent..table.concat(ttrackingcats) | ||
سطر 2٬050: | سطر 2٬064: | ||
elseif findvar.vtype == 'wordinal' then --e.g. "first", "ninety-ninth"; <<1% of cats | elseif findvar.vtype == 'wordinal' then --e.g. "first", "ninety-ninth"; <<1% of cats | ||
local ordinal = | local ordinal = true | ||
return nav_wordinal( frame, firstpart, findvar.v, lastpart, minimum, maximum, ordinal, frame )..testcaseindent..table.concat(ttrackingcats) | 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 | elseif findvar.vtype == 'enumeric' then --e.g. "one", "ninety-nine"; <<1% of cats | ||
local ordinal = | local ordinal = false | ||
return nav_wordinal( frame, firstpart, findvar.v, lastpart, minimum, maximum, ordinal, frame )..testcaseindent..table.concat(ttrackingcats) | return nav_wordinal( frame, firstpart, findvar.v, lastpart, minimum, maximum, ordinal, frame )..testcaseindent..table.concat(ttrackingcats) | ||
elseif findvar.vtype == 'roman' then | elseif findvar.vtype == 'roman' then --e.g. "I", "XXVIII"; <<1% of cats | ||
return nav_roman( frame, firstpart, findvar.v, lastpart, minimum, maximum )..testcaseindent..table.concat(ttrackingcats) | return nav_roman( frame, firstpart, findvar.v, lastpart, minimum, maximum )..testcaseindent..table.concat(ttrackingcats) | ||
elseif findvar.vtype == 'ending' then | 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 | local hyphen, finish = mw.ustring.match(findvar.v, '%d([–-])present$'), -1 --ascii 150 & 45 (ndash & keyboard hyphen); mw req'd | ||
if hyphen == nil then | if hyphen == nil then | ||
سطر 2٬067: | سطر 2٬081: | ||
return nav_hyphen( frame, start, hyphen, finish, firstpart, lastpart, minimum, maximum, testcasegap )..testcaseindent..table.concat(ttrackingcats) | return nav_hyphen( frame, start, hyphen, finish, firstpart, lastpart, minimum, maximum, testcasegap )..testcaseindent..table.concat(ttrackingcats) | ||
else | else --malformed | ||
errors = p.errorclass('Failed to determine the appropriate nav function from malformed season "'..findvar.v..'". ') | errors = p.errorclass('Failed to determine the appropriate nav function from malformed season "'..findvar.v..'". ') | ||
return p.failedcat(errors, 'N')..table.concat(ttrackingcats) | return p.failedcat(errors, 'N')..table.concat(ttrackingcats) |