Module:Category described in year: Difference between revisions

Content deleted Content added
m use table.maxn
+Plants tree; allow minYear <= 1700 (i.e. 0) to force default of 1758
Line 15:
['Fish'] = { --group
['min'] = 1758, --integer; lowest possible year displayed in nav bars; default0/nil defaults to 1758 per ICZN Art. 5
['year'] = { --[[Category:Fish described in 1901]]
['description'] = 'This category should only contain species-level articles.',
Line 29:
['Spiders'] = { --group
['min'] = 1757, --integer; lowest possible year (and thus decade) displayed in nav bars; default0/nil defaults to 1758 per ICZN Art. 5
['year'] = { --[[Category:Spiders described in 1901]]
['description'] = '', --'Description tbd; year; This category should only contain species articles, etc....',
Line 44:
['parent1'] = 'formal', --[[Category:Spiders by year of formal description]]
['parent2'] = 'Animals', --[[Category:Animals described in the 20th century]]
},
},
 
['Plants'] = { --group
['min'] = 0, --integer; lowest possible year (and thus decade) displayed in nav bars; 0/nil defaults to 1758 per ICZN Art. 5
['year'] = { --[[Category:Plants described in 1901]]
['description'] = 'This category should only contain species articles.', --'Description tbd; year',
['parent1'] = 'decade', --[[Category:Plants described in the 1900s]]
['parent2'] = 'Species', --[[Category:Species described in 1900]]
},
['decade'] = { --[[Category:Plants described in the 1900s]]
['description'] = '', --'Description tbd; decade; container category, etc....',
['parent1'] = 'century', --[[Category:Plants described in the 20th century]]
['parent2'] = 'Species', --[[Category:Species described in the 1900s]]
},
['century'] = { --[[Category:Plants described in the 20th century]]
['description'] = '', --'Description tbd; century; container category, etc....',
['parent1'] = 'formal', --[[Category:Plants by year of formal description]]
['parent2'] = 'Species', --[[Category:Species described in the 20th century]]
},
},
Line 97 ⟶ 116:
local lastCent, nextCent = nil, nil --used with currYear (i.e. Fish) & currCent (i.e. Fish)
local minYear = tonumber(map[currGroup].min)
if (minYear == nil thenor (minYear =and 1758minYear end<= --default1700)) to 1758 per ICZN Art. 5then
minYear = 1758 --default to 1758 per ICZN Art. 5
end
if currYear then
currYDC = 'year'
Line 170 ⟶ 191:
end --end while map[currGroup][currYDC][parenti]
--TODO: check for cat existence & output to tracking category if template attempts to link to a non-existing cat
for _, category in pairs(categories) do
local cat = mw.ustring.match(category, '%[%[Category:([%w%s]+)')