--
local periods =
local colors =
local nameToYear = local yearToName = local startToEnd =
local function nStep(t, year, i) if type(t)
"table" then table.insert(startToEnd[i],) year = tonumber(x[2]) and x[2] or year if year
nStep(periods, "", 1)
for _,nextP in ipairs(startToEnd) do for k,period in ipairs(nextP) do for _,name in ipairs(period) do startToEnd[name] = nextP[k+1] and nextP[k+1][1] or "present" end endend
local function findandrep(text, one, two) return mw.ustring.sub(mw.ustring.gsub(tostring(text), one, two), 1, -1)end
local function round(num, rou) return num and tonumber(string.format("%." .. (rou or 0) .. "f", num))end
local function getByTable(text, t) text = mw.getContentLanguage:lc(text) for _,inside in pairs(t) do for i=2,30 do if inside[i]
local function periodID(id) local text = mw.getContentLanguage:lc(tostring(id)) local found = if found[text] then text = found[text] else text = findandrep(text, "-", "") text = findandrep(text, "%f[%w]palaeo", "paleo") text = findandrep(text, "%f[%w]early%f[%W]", "lower") text = findandrep(text, "%f[%w]mid%f[%W]", "middle") text = findandrep(text, "%f[%w]late%f[%W]", "upper") end return textend
local function periodStart(period, rou) return period and round(nameToYear[periodID(period)], rou or 5)end
local function periodEnd(period, rou) return period and periodStart(startToEnd[periodID(period)], rou or 5)end
local function periodColor(period) return getByTable(mw.getContentLanguage:lc(period), colors)end
local function mark(typ, num1, num2, num3) local g, h = typ.width, typ.all local result if (num1-num2)>5 then result = "
" if not num3 then result = result .. "
" end elseif not num3 then result = "
" .. "↓
" end return resultend
local function bar(typ, val1, val2, val3) local g, h = typ.width, typ.all local gen = g
"..(val2 and ""..val2.."" or "").."
"end
local function compare(year, num) local period for k,inside in pairs(yearToName) do if num
2 and (year >= inside[1] and (yearToName[k-1] and year <= yearToName[k-1][1])) then if year
local function _show(veri) local result = local year1 = tonumber(veri[1]) or periodStart(veri[1]) local year2 = tonumber(veri[2]) or periodEnd(veri[2]) or periodEnd(veri[1]) or tonumber(veri[1]) local year1_e = tonumber(veri["earliest"]) or periodStart(veri["earliest"]) or year1 local year2_e = tonumber(veri["latest"]) or periodEnd(veri["latest"]) or year2 local typ = year1 >= 650 and or table.insert(result, "
") if veri["prefix"] then table.insert(result, veri["prefix"]) end table.insert(result, ((veri[3] or veri["text"]) or (tostring(year1) .. (year2 and "-"..tostring(year2) or "") .. " Ma")) .. (veri[1] and "local ref = veri["ref"] or veri["reference"] or veri["refs"] or veri["references"] if ref then table.insert(result, ref) end table.insert(result, " ") local ps = veri["PS"] or veri["ps"] if ps then table.insert(result, ps) end table.insert(result, "
") table.insert(result, "") if typ.all
" .."PreЄ
") table.insert(result, bar(typ, "cambrian", "Є")) table.insert(result, bar(typ, "ordovician", "O")) table.insert(result, bar(typ, "silurian", "S")) table.insert(result, bar(typ, "devonian", "D")) table.insert(result, bar(typ, "carboniferous", "C")) table.insert(result, bar(typ, "permian", "P")) table.insert(result, bar(typ, "triassic", "T")) table.insert(result, bar(typ, "jurassic", "J")) table.insert(result, bar(typ, "cretaceous", "K")) table.insert(result, bar(typ, "paleogene", "Pg")) table.insert(result, bar(typ, "neogene", "N")) end
table.insert(result, "
") if year1 and year2 then table.insert(result, mark(typ, year1_e, year2_e, 42)) end table.insert(result, mark(typ, year1, year2)) table.insert(result, "
local function show(frame) return _show(frame:getParent.args)end
return