Module:Category described in year: Difference between revisions

Content deleted Content added
m --ce/update
--ce, +phab ticket T203355 (Magic word to force category number headings instead of 0-9)
Line 8:
'Spiders' uses year -> decade -> century -> Species.
Any category group (i.e.g. Birds/Crustaceans/Molluscs/etc.) NOT explicitly
outlined here in conf{} will follow the 'Fish' tree for that group.
Line 22:
['year'] = { --[[Category:Fish described in 1901]]
['description'] = 'This category should only contain species-level articles.',
['parent1'] = 'century', --year/decade/century/formal, ie.eg. 'century' for [[Category:Fish described in the 20th century]]
['parent2'] = 'Animals', --[[Category:Animals described in 1901]]
},
Line 169:
local currGroup = mw.ustring.match(currCat, '^%w+') --Fish/Spiders/default/etc.
if conf[currGroup] == nil then conf[currGroup] = conf['Fish'] end --'Fish' == default
local currYDC = nil --possible future values: year/decade/century
local currYear = mw.ustring.match(currCat, 'described in (%d%d%d%d)$')
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 parentDeca = nil --used with currYear (i.e.g. Spiders) & currDeca (i.e.g. Spiders)
local parentCent = nil --used with currYear (i.e.g. Fish) & currDeca (i.e.g. Spiders)
local lastCent, nextCent = nil, nil --used with currYear (i.e.g. Fish) & currCent (i.e.g. Fish)
local minYear = tonumber(conf[currGroup].yearmin)
if (minYear == nil or (minYear and minYear <= 1700)) then
Line 204:
--conf error checkng (missing keys)
--Numeric sortkeys are unfortunately grouped together under "0-9". Check phab T203355 (Magic word to force category number headings instead of 0-9).
if bConfError == false then
if conf[currGroup] == nil then
Line 260 ⟶ 261:
elseif parent == 'century' then
categories[iparent] = '[[Category:' .. currGroup .. ' described in the ' .. addOrd(parentCent) .. ' century]]'
elseif mw.ustring.match(parent, '^%u%l') then --i.e.g. Animals
categories[iparent] = '[[Category:' .. parent .. ' described in ' .. currYear .. ']]'
else
Line 274 ⟶ 275:
if parent == 'century' then
categories[iparent] = '[[Category:' .. currGroup .. ' described in the ' .. addOrd(parentCent) .. ' century]]'
elseif mw.ustring.match(parent, '^%u%l') then --i.e.g. Animals
categories[iparent] = '[[Category:' .. parent .. ' described in the ' .. currDeca .. 's]]'
else
Line 289 ⟶ 290:
if parent == 'formal' then
categories[iparent] = '[[Category:' .. currGroup .. ' by year of formal description|' .. addOrd(currCent) .. ']]'
elseif mw.ustring.match(parent, '^%u%l') then --i.e.g. Animals
categories[iparent] = '[[Category:' .. parent .. ' described in the ' .. addOrd(currCent) .. ' century]]'
else