Content deleted Content added
Tom.Reding (talk | contribs) Allow sandbox/testcase usage, from sandbox |
Tom.Reding (talk | contribs) Make 'Fish' the default cat tree; prep for alpha (Fish only); from sandbox |
||
Line 3:
--case sensitive conf/map table
local map = {
--[[
'Fish' is the default category tree (year -> century, no decades).
'Spiders' use year -> decade -> century.
Any category group (i.e. Birds/Crustaceans/Molluscs/etc.) NOT explicitly outlined here in map{} will follow the 'Fish' tree.
To create a customized tree, like 'Spiders' below, add it to the bottom of the map{} table, following the same general table format.
]]--
['Fish'] = { --group
['min'] = 1758, --integer; lowest possible year
['year'] = { --[[Category:Fish described in 1901]]
['description'] = '', --'Description tbd; year; This category should only contain species articles, etc....',
['parent1'] = 'century', --year/decade/century/formal, i.e. 'century' for [[Category:Fish described in the 20th century]]
['parent2'] = 'Animals', --[[Category:Animals described in the 20th century]]
},
['century'] = { --[[Category:Fish described in the 20th century]]
['description'] = '', --'Description tbd; century; container category, etc....',
['parent1'] = 'formal', --[[Category:Fish by year of formal description]]
['parent2'] = 'Animals', --[[Category:Animals described in the 20th century]]
},
},
['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'] = '', --'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'] = { --[[Category:Spiders described in the 1900s]]
['description'] = '', --'Description tbd; decade; container category, etc....',
['parent1'] = 'century', --[[Category:Spiders described in the 20th century]]
['parent2'] = 'Animals', --[[Category:Animals described in the 1900s]]
},
['century'] = { --[[Category:Spiders described in the 20th century]]
['description'] = '', --'Description tbd; century; container category, etc....',
['parent1'] = 'formal', --[[Category:Spiders by year of formal description]]
['parent2'] = 'Animals', --[[Category:Animals described in the 20th century]]
Line 60 ⟶ 72:
local outString = nil
▲ local currCat = nil
▲ currCat = currentTitle.text --without namespace nor interwiki prefixes
▲ else
▲ --accept 1 unnamed category parameter; required for testing/doc purposes only
▲ local parentArg = frame:getParent().args[1]
▲ if parentArg then currCat = mw.ustring.gsub(parentArg, 'Category:', '')
if currCat then
▲ else return end
▲ end
--determine current/related/adjacent cats' properties/vars/etc
local currGroup = mw.ustring.match(currCat, '^%w+') --Fish/Spiders/default/etc.
if map[currGroup] == nil then map[currGroup] = map['Fish'] end --'Fish' == default
local currYDC = nil --placeholder for year/decade/century
local currYear = mw.ustring.match(currCat, 'in (%d%d%d%d)$')
Line 170 ⟶ 181:
--append cats to outString
if currentTitle.namespace ==
outString = outString .. '<br />' .. mw.ustring.gsub(table.concat(categories, '<br />'), '%[%[', '[[:') .. '<br />'▼
outString = outString .. table.concat(categories)
else
▲ outString = outString .. '<br />' .. mw.ustring.gsub(table.concat(categories, '<br />'), '%[%[', '[[:') .. '<br />'
end
|