وحدة:Navseasoncats/ملعب: الفرق بين النسختين

[نسخة منشورة][نسخة منشورة]
تم حذف المحتوى تمت إضافة المحتوى
طلا ملخص تعديل
طلا ملخص تعديل
سطر 58:
--Used by all nav*().
function catlink( catname, displaytext )
--mw.log("catname:'" .. catname .. "',displaytext:'" .. displaytext .. "'")
catname = mw.text.trim(catname or '')
displaytext = mw.text.trim(displaytext or '')
سطر 335:
end
local ndec = tonumber(dec)
local keykeyNoBC = mw.ustring.gsub(keykey, '%sق م$' , '') --easier than splitting keykey up in 2; AD never used
mw.log("keykeyNoBC: " .. (keykeyNoBC or "") )
--sterilize mindecade & determine AD/BC
السطر 427 ⟵ 431:
if D < -10 then
d = math.abs(d + 10) --b/c 2 "0s" decades exist: "0s BC" & "0s" (AD)
BC = 'BCق م'
if d == 0 then
D = -10 --track 1st d = 0 use (BC)
السطر 437 ⟵ 441:
elseif parentBC then
if switchADBC == -1 then --parentBC looking at the BC side (the common case)
BC = 'BCق م '
if d == 0 then --prepare to switch to the AD side on the next iteration
switchADBC = 1 --1st d = 0 use (BC)
السطر 447 ⟵ 451:
end
end
if BC ~= '' and ndec <= 50 then
BCdisp = ' ق م' --show BC for all BC decades whenever a "0s" is displayed on the nav
السطر 454 ⟵ 459:
local hidden = '*<span style="visibility:hidden">عقد '..d..''..BCdisp..'</span>\n'
--local fff = firstpart .. ' '..d..'s'..tspace..BC..lastpart
local fff = mw.ustring.gsub( keykeykeykeyNoBC , "keykey", 'عقد '..d..''..tspace..BC )
local shown = '*'..catlink( fff , "عقد " .. d..''..BCdisp )..'\n'
local dsign = d --use d for display & dsign for logic
السطر 516 ⟵ 523:
-- {{{7}}}=1999 ('max' starting season shown; optional; 1999 will show 1999-00)
-- {{{8}}}=0 (testcasegap parameter for easier testing; optional)
 
--sterilize start
if string.match(start or '', '^%d%d?%d?%d?$') == nil then --1-4 digits, AD only
السطر 720 ⟵ 727:
local parentBC = mw.ustring.match(lastpart, '%s(ق م)')
--local parentBC = mw.ustring.match(lastpart, '%s(BC?)')
--if parentBC then
-- mw.log("parentBC: " .. (parentBC or "") )
--end
-- "1st-century BC" format
--local lastpartNoBC = mw.ustring.gsub(lastpart, '%sBC?', '') --easier than splitting lastpart up in 2; AD never used
السطر 728 ⟵ 735:
local keykeyNoBC = mw.ustring.gsub(keykey, '%sق م$' , '') --easier than splitting keykey up in 2; AD never used
--mw.log("lastpartNoBCkeykeyNoBC: " .. (lastpartNoBCkeykeyNoBC or "") )
mw.log("keykeyNoBC: " .. (keykeyNoBC or "") )
local BCe = parentBC or 'ق م'