Content deleted Content added
Tom.Reding (talk | contribs) +Spiders tree (uses decades), add header & nav template(s) from current spider cats |
Tom.Reding (talk | contribs) +|min= navbar functionality |
||
Line 4:
local map = {
['Fish'] = { --group
['min'] = 1758, --integer; lowest possible year (and thus decade) displayed in nav bars; default to 1758 per ICZN Art. 5
['year'] = { --[[Category:Fish described in 1901]]
['description'] = 'tbd; year; This category should only contain species articles, etc....',
Line 16 ⟶ 17:
},
['Spiders'] = { --group
['min'] = 1757, --integer; lowest possible year (and thus decade) displayed in nav bars; default to 1758 per ICZN Art. 5
['year'] = { --[[Category:Spiders described in 1901]]
['description'] = 'tbd; year; This category should only contain species articles, etc....',
['parent1'] = 'decade', --[[Category:Spiders described in the 1900s]]
['parent2'] = 'Animals', --[[Category:Animals described in 1900]]
},
['decade'] = {
['description'] = 'tbd; decade; container category, etc....',
['parent1'] = 'century', --[[Spiders described in the 20th century]]
['parent2'] = 'Animals', --[[Animals described in the 1900s]]
},
['century'] = {
['description'] = 'tbd; century; container category, etc....',
['parent1'] = 'formal', --[[Spiders by year of formal description]]
['parent2'] = 'Animals', --[[Animals described in the 20th century]]
},
},
Line 59 ⟶ 61:
if currentTitle.namespace == 14 then --Category:
--determine current/related/adjacent cats' properties/vars/etc
local currCat = currentTitle.text --without namespace nor interwiki prefixes
local currGroup = mw.ustring.match(currCat, '^%w+') --Fish/Spiders/etc.
local currYDC =
local currYear = mw.ustring.match(currCat, 'in (%d%d%d%d)$')
local currDeca = mw.ustring.match(currCat, 'the (%d%d%d%d)s$')
Line 69 ⟶ 71:
local parentDeca = nil --used with currYear (i.e. Spiders) & currDeca (i.e. Spiders)
local lastCent, nextCent = nil, nil --used with currYear (i.e. Fish) & currCent (i.e. Fish)
local minYear = tonumber(map[currGroup].min)
if minYear == nil then minYear = 1758 end --default to 1758 per ICZN Art. 5
if currYear then
currYDC = 'year'
Line 88 ⟶ 92:
nextCent = currCent + 1
else
return '' --add err msg/cat?
end
Line 103 ⟶ 107:
if currYDC == 'year' then
if nav == nil then
local args = { year = currYear, min = minYear, cat = currGroup .. ' described in' }
nav = frame:expandTemplate{ title = 'Category in year', args = args }
end
Line 115 ⟶ 119:
elseif currYDC == 'decade' then
if nav == nil then
local args = { decade = currDeca, min = minYear, cat = currGroup .. ' described in the' }
nav = frame:expandTemplate{ title = 'Category by decade', args = args }
end
Line 150 ⟶ 154:
header = mw.text.trim(header)
--append header to outString
if outString then outString = outString .. header
else outString = header end
--append cats to outString
if string.sub(currentTitle.subpageText,1,9) == 'testcases' then
outString = outString .. mw.text.nowiki(table.concat(categories)) .. '<br />'
|