Content deleted Content added
Tom.Reding (talk | contribs) +formal.parent: 'paleontology' (technically only 1 use in Category:Fossil taxa by year of formal description, but included for continuity/consistency with year & century cats) |
Tom.Reding (talk | contribs) Fully deprecate decade cats; tighten minYear constraint (must be b/w 1700-2000); allow 'Fossil taxa' parents, for use on 'Fossil parataxa' children; from sandbox |
||
Line 133:
local currYDCF = nil --possible future values: year/decade/century/formal
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$') --deprecated
local currCent = mw.ustring.match(currCat, 'described in the (%d+)[snrt][tdh] century$')
local currFrml = mw.ustring.match(currCat, 'by year of (formal) description$')
local lastCent, nextCent = nil, nil
local
local minYear = tonumber(conf[currGroup].minyear)
if
(minYear and (minYear <= 1700 or minYear >= 2000)) then minYear = 1758 --default to 1758 per ICZN Art. 5
end
if currYear then
currYDCF = 'year'
if mw.ustring.match(currYear, '^%d%d00') then --1900 in 19th century
parentCent = mw.ustring.match(currYear, '^%d%d')
Line 154:
elseif currDeca then
currYDCF = 'decade'
bConfError = true
elseif currCent then
currYDCF = 'century'
Line 176:
elseif conf[currGroup][currYDCF] == nil then
bConfError = true
trackingCategories[2] = '[[Category:Described in year error|2]]' --year
else
if conf[currGroup][currYDCF].description == nil then
Line 191:
if bConfError == false then
--produce portal
if currGroup == 'Fossil taxa' or currGroup == 'Fossil parataxa' then
portal = frame:expandTemplate{ title = 'Portal', args = { 'Paleontology' } }
end
--produce description, evaluate %variables%
description = conf[currGroup][currYDCF].description
if mw.ustring.match(description, '%%year%%') then
if currYear then description = mw.ustring.gsub(description, '%%year%%', currYear) --"2011"
else description = mw.ustring.gsub(description, '%%year%%', 'this year') end
end
if mw.ustring.match(description, '%%century%%') then
Line 230 ⟶ 226:
nav = frame:expandTemplate{ title = 'Navseasoncats', args = args }
end
if parent == '
if isNilOrEmpty(sortkey) then sortkey = currYear end --default to currYear
categories[iparent] = '[[Category:'..currGroup..' described in the '..addOrd(parentCent)..' century|'..sortkey..']]'
Line 252 ⟶ 245:
else sortkey = '|'..sortkey end
categories[iparent] = '[[Category:'..currYear..' in the environment'..sortkey..']]'
elseif mw.ustring.match(parent, '^%u[%l ]+') then --e.g. Animals/Insects/Fossil taxa
if isNilOrEmpty(sortkey) then sortkey = '' --default to none
else sortkey = '|'..sortkey end
Line 258 ⟶ 251:
else
trackingCategories[2] = '[[Category:Described in year error|Y]]' --invalid year-parent
▲ trackingCategories[2] = '[[Category:Described in year error|D]]' --invalid decade-parent
end
Line 305 ⟶ 280:
else sortkey = '|'..sortkey end
categories[iparent] = '[[Category:'..addOrd(currCent)..' century in the environment'..sortkey..']]'
elseif mw.ustring.match(parent, '^%u[%l ]+') then --e.g. Animals/Insects/Fossil taxa
if isNilOrEmpty(sortkey) then sortkey = '' --default to none
else sortkey = '|'..sortkey end
Line 324 ⟶ 299:
if isNilOrEmpty(sortkey) then sortkey = ' ' end --default to " "
categories[iparent] = '[[Category:'..parent..' by year of formal description|'..sortkey..']]'
elseif parent == 'Species' or parent == 'Taxa' or parent == 'Fossil taxa' then
if isNilOrEmpty(sortkey) then sortkey = '' --default to none
else sortkey = '|'..sortkey end
|