Module:Category described in year/sandbox: Difference between revisions

Content deleted Content added
m Sync
m Merge 2 related if's; --ce; var ce
Line 298:
}
 
--[[==========================================================================]]
--[[ Local functions ]]
--[[==========================================================================]]
 
local function addOrd( i ) --20 -> 20th, etc.
Line 318 ⟶ 322:
local p = {}
--[[==========================================================================]]
--[[ External function ]]
--[[==========================================================================]]
 
function p.autodetect( frame )
local currentTitle = mw.title.getCurrentTitle()
Line 422 ⟶ 430:
local currDeca = mw.ustring.match(currCat, 'described in the (%d%d%d%d)s$')
local currCent = mw.ustring.match(currCat, 'described in the (%d+)[snrt][tdh] century$')
local parentDecalastCent, nextCent = nil, nil --used with currYear & currDecacurrCent
local parentDeca, parentCent = nil, nil --used with currYear & currDeca
local lastCent, nextCent = nil, nil --used with currYear & currCent
local minYear = tonumber(conf[currGroup].yearmin)
if (minYear == nil or (minYear and minYear <= 1700)) then
Line 474 ⟶ 481:
end
--produce portal, description, toc
if bConfError == false then
--produce portal
if currGroup == 'Fossil taxa' then
portal = frame:expandTemplate{ title = 'Portal', args = { 'Paleontology' } }
end
--produce description
description = conf[currGroup][currYDC].description
if mw.ustring.match(description, '%%year%%') then
Line 496 ⟶ 502:
end
--produce toc
if mw.site.stats.pagesInCategory(currCat, 'pages') >= conf['tocmin'] then --expensive
local args = { numerals = 'no' }
toc = frame:expandTemplate{ title = 'Category TOC', args = args }
end
end
--produce cats & navs
--produce cats & navs
if bConfError == false then
local iparent = 1
local parenti = 'parent' .. iparent