Content deleted Content added
Tom.Reding (talk | contribs) m unind |
Tom.Reding (talk | contribs) m Sync from live |
||
Line 3:
--case sensitive conf/map table
local conf = {
Any category group (
used on that cateogry.
The default-style category tree is:
year -> century -> formal
year -> Animals:year -> Animals:century
Decadal categories are discouraged.
To create a new tree, only if different from the default, copy an existing
tree and paste it in an appropriate spot in the conf{} table, following the
same general table format, and updating any group-specific variables.
============================================================================]]--
['tocmin'] = 401, --integer; minimum category size to add {{Category TOC}}
['Default'] = { --"group" (e.g. Amphibians/Birds/Crustaceans/Fish/Mammals/Molluscs/Reptiles/Spiders)
['yearmin'] = 1758, --integer; lowest possible year displayed in nav bars; 0/nil defaults to 1758 per ICZN Art. 5
['year'] = { --[[Category:
['parent1'] = 'century', --[[Category:Birds described in the 20th century]] --decade, century, or formal
['parent2'] = 'Animals', --[[Category:Animals described in 1901]]
['description'] = 'This category should only contain articles on [[species]] and notable [[subspecies]].', --adapted from [[Category:Species described in the 18th century]] & [[Category:Species described in the 21st century]]
},
['century'] = { --[[Category:
['
['parent2'] = 'Animals', --[[Category:Animals described in the 20th century]]
['description'] = '', --Century description tbd; container category, etc...
},
},
['
['yearmin'] = 1757, --integer; lowest possible year
['year'] = { --[[Category:
['parent1'] = 'century', --[[Category:Animals described in the 20th century]]
['
['
},
['
['
['
['
},
},
--[[=========================== Molluscs tree ============================]]
['Bivalves'] = { --"subgroup" to Molluscs
['year'] = { --[[Category:Bivalves described in 1901]]
['parent1'] = 'century', --[[Category:Bivalves described in the 20th century]]
['parent2'] = 'Molluscs', --[[Category:Molluscs described in 1901]]
['description'] = '', --Year description tbd; 'This category should only contain species articles', etc...
},
['century'] = { --[[Category:Bivalves described in the 20th century]]
['parent1'] = 'formal', --[[Category:Bivalves by year of formal description]]
['parent2'] = 'Molluscs', --[[Category:Molluscs described in the 20th century]]
['sortkey2'] = '*',
['description'] = '', --Century description tbd; container category, etc...
},
},
['Cephalopods'] = { --"subgroup" to Molluscs
['year'] = { --[[Category:Cephalopods described in 1901]]
['parent1'] = 'century', --[[Category:Cephalopods described in the 20th century]]
['parent2'] = 'Molluscs', --[[Category:Molluscs described in 1901]]
['description'] = '', --Year description tbd; 'This category should only contain species articles', etc...
},
['century'] = { --[[Category:Cephalopods described in the 20th century]]
['parent1'] = 'formal', --[[Category:Cephalopods by year of formal description]]
['parent2'] = 'Molluscs', --[[Category:Molluscs described in the 20th century]]
['sortkey2'] = '*',
['description'] = '', --Century description tbd; container category, etc...
},
},
['Chitons'] = { --"subgroup" to Molluscs
['year'] = { --[[Category:Chitons described in 1901]]
['parent1'] = 'century', --[[Category:Chitons described in the 20th century]]
['parent2'] = 'Molluscs', --[[Category:Molluscs described in 1901]]
['description'] = '', --Year description tbd; 'This category should only contain species articles', etc...
},
['century'] = { --[[Category:Chitons described in the 20th century]]
['parent1'] = 'formal', --[[Category:Chitons by year of formal description]]
['parent2'] = 'Molluscs', --[[Category:Molluscs described in the 20th century]]
['sortkey2'] = '*',
['description'] = '', --Century description tbd; container category, etc...
},
},
['Gastropods'] = { --"subgroup" to Molluscs
['year'] = { --[[Category:Gastropods described in 1901]]
['parent1'] = 'century', --[[Category:Gastropods described in the 20th century]]
['parent2'] = 'Molluscs', --[[Category:Molluscs described in 1901]]
['description'] = '', --Year description tbd; 'This category should only contain species articles', etc...
},
['century'] = { --[[Category:Gastropods described in the 20th century]]
['parent1'] = 'formal', --[[Category:Gastropods by year of formal description]]
['parent2'] = 'Molluscs', --[[Category:Molluscs described in the 20th century]]
['sortkey2'] = '*',
['description'] = '', --Century description tbd; container category, etc...
},
},
--[[============================ Insects tree ============================]]
['Insects'] = { --"group"
['year'] = { --[[Category:Insects described in 1901]]
['parent1'] = 'century', --[[Category:Insects described in the 20th century]]
['parent2'] = 'Animals', --[[Category:Animals described in 1901]]
['description'] = '', --Year description tbd; Default-group's description doesn't apply
},
['century'] = { --[[Category:
['
['parent2'] = 'Animals', --[[Category:Animals described in the 20th century]]
['description'] = '', --Century description tbd; container category, etc...
},
},
['
['year'] = { --[[Category:Beetles described in 1901]]
['
['parent2'] = 'Insects', --[[Category:Insects described in 1901]]
['description'] = '', --Year description tbd; 'This category should only contain species articles', etc...
},
['century'] = { --[[Category:Beetles described in the 20th century]]
['parent1'] = 'formal', --[[Category:Beetles by year of formal description]]
['parent2'] = 'Insects', --[[Category:Insects described in the 20th century]]
['sortkey2'] = '*',
['description'] = '', --Century description tbd; container category, etc...
},
},
['Butterflies'] = { --"subgroup" to Insects
['yearmin'] = 1758, --integer; lowest possible year (and thus decade) displayed in nav bars; 0/nil defaults to 1758 per ICZN Art. 5
['year'] = { --[[Category:Butterflies described in 1901]]
['parent1'] = 'century', --[[Category:Butterflies described in the 20th century]]
['parent2'] = 'Insects', --[[Category:Insects described in 1901]]
['description'] = '', --Year description tbd; 'This category should only contain species articles', etc...
},
['century'] = { --[[Category:Butterflies described in the 20th century]]
['parent1'] = 'formal', --[[Category:Butterflies by year of formal description]]
['parent2'] = 'Insects', --[[Category:Insects described in the 20th century]]
['sortkey2'] = '*',
['description'] = '', --Century description tbd; container category, etc...
},
},
['Moths'] = { --"subgroup" to Insects
['yearmin'] = 1758, --integer; lowest possible year (and thus decade) displayed in nav bars; 0/nil defaults to 1758 per ICZN Art. 5
['year'] = { --[[Category:Moths described in 1901]]
['parent1'] = 'century', --[[Category:Moths described in the 20th century]]
['parent2'] = 'Insects', --[[Category:Insects described in 1901]]
['description'] = '', --Year description tbd; 'This category should only contain species articles', etc...
},
['century'] = { --[[Category:Moths described in the 20th century]]
['parent1'] = 'formal', --[[Category:Moths by year of formal description]]
['parent2'] = 'Insects', --[[Category:Insects described in the 20th century]]
['sortkey2'] = '*',
['description'] = '', --Century description tbd; container category, etc...
},
},
--[[============================= Non-animals ============================]]
['Archaea'] = { --"group"
['year'] = { --[[Category:Archaea described in 1901]]
['parent1'] = 'century', --[[Category:Archaea described in the 20th century]]
['parent2'] = 'Species', --[[Category:Species described in 1901]]
['description'] = '', --Year description tbd; 'This category should only contain species articles', etc...
},
['century'] = { --[[Category:Archaea described in the 20th century]]
['parent1'] = 'formal', --[[Category:Archaea by year of formal description]]
['parent2'] = 'Species', --[[Category:Species described in the 20th century]]
['description'] = '', --Century description tbd; container category, etc...
},
},
['Bacteria'] = { --"group"
['yearmin'] = 1758, --integer; lowest possible year displayed in nav bars; 0/nil defaults to 1758 per ICZN Art. 5
['year'] = { --[[Category:Bacteria described in 1901]]
['parent1'] = 'century', --[[Category:Bacteria described in the 20th century]]
['parent2'] = 'Species', --[[Category:Species described in 1901]]
['description'] = '', --Year description tbd; 'This category should only contain species articles', etc...
},
['century'] = { --[[Category:Bacteria described in the 20th century]]
['parent1'] = 'formal', --[[Category:Bacteria by year of formal description]]
['parent2'] = 'Species', --[[Category:Species described in the 20th century]]
['description'] = '', --Century description tbd; container category, etc...
},
},
['Fungi'] = { --"group"
['yearmin'] = 1753, --integer; lowest possible year displayed in nav bars; 0/nil defaults to 1758 per ICZN Art. 5
['year'] = { --[[Category:Fungi described in 1901]]
['parent1'] = 'century', --[[Category:Fungi described in the 20th century]]
['parent2'] = 'Species', --[[Category:Species described in 1901]]
['description'] = '', --Year description tbd; 'This category should only contain species articles', etc...
},
['century'] = { --[[Category:Fungi described in the 20th century]]
['parent1'] = 'formal', --[[Category:Fungi by year of formal description]]
['parent2'] = 'Species', --[[Category:Species described in the 20th century]]
['description'] = '', --Century description tbd; container category, etc...
},
},
['Plants'] = { --"group"
['yearmin'] = 1753, --integer; lowest possible year displayed in nav bars; 0/nil defaults to 1758 per ICZN Art. 5
['year'] = { --[[Category:Plants described in 1901]]
['parent1'] = 'century', --[[Category:Plants described in the 20th century]]
['parent2'] = 'Species', --[[Category:Species described in 1901]]
['description'] = "This category includes plants that were ''first formally and validly described'' in %year% according to the rules of the [[International Code of Botanical Nomenclature]]. Use [[WP:RS|reliable sources]] like the [[International Plant Names Index]] to figure out the proper category. For examples see the [[Wikipedia:WikiProject Plants/Description in year categories|WikiProject Plants essay]] on this topic.", --taken from [[Category:Plants described in 1928]]
},
['century'] = { --[[Category:Plants described in the 20th century]]
['parent1'] = 'formal', --[[Category:Plants by year of formal description]]
['parent2'] = 'Species', --[[Category:Species described in the 20th century]]
['description'] = 'For advice on using the subcategories of this category, see [[Wikipedia:WikiProject Plants/Description in year categories]].', --taken from [[Category:Plants described in the 21st century]]
},
},
--[[==================== "Species described in"-level ====================]]
['Species'] = {
['year'] = { --[[Category:Species described in 1901]]
['parent1'] = 'century', --[[Category:Species described in the 20th century]]
['sortkey1'] = ' ',
['parent2'] = 'Taxa', --[[Category:Taxa described in 1901]]
['description'] = '', --Year description tbd
},
['century'] = { --[[Category:Species described in the 20th century]]
['parent1'] = 'formal', --[[Category:Species by year of formal description]]
['parent2'] = 'Taxa', --[[Category:Taxa described in the 20th century]]
['description'] = "*'''[[Species]]''' of [[Biota (taxonomy)|biota]] described in the '''[[%century% century]]'''.", --taken from [[Category:Species described in the 19th century]] & [[Category:Species described in the 20th century]]
},
},
--[[===================== "Taxa described in"-level ======================]]
---Include [[Category:1890 in the environment]]-type cats, which were removed from ~34/~260 [[Category:Species described in 1868]]-type cats
---and 'in science' & 'in biology'
}
Line 164 ⟶ 343:
end --if currQID then
--[[======================================================================]]
--[[ Main ]]
--[[======================================================================]]
if currCat then
--determine current/related/adjacent cats' properties/vars/etc.
local currGroup = mw.ustring.match(currCat, '^%w+') --
if conf[currGroup] == nil then conf[currGroup] = conf['
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
local parentCent = nil --used with currYear
local lastCent, nextCent = nil, nil --used with currYear
local minYear = tonumber(conf[currGroup].yearmin)
if (minYear == nil or (minYear and minYear <= 1700)) then
Line 204 ⟶ 386:
--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
bConfError = true
trackingCategories[2] = '[[Category:Described in year error|1]]' --group (
elseif conf[currGroup][currYDC] == nil then
bConfError = true
Line 227 ⟶ 411:
description = conf[currGroup][currYDC].description
if mw.ustring.match(description, '%%year%%') then
if currYear then description = mw.ustring.gsub(description, '%%year%%', currYear) --"
else description = mw.ustring.gsub(description, '%%year%%', 'this year') end
end
if mw.ustring.match(description, '%%decade%%') then
if currDeca then description = mw.ustring.gsub(description, '%%decade%%', currDeca .. 's') --"
else description = mw.ustring.gsub(description, '%%decade%%', 'this decade') end
end
Line 248 ⟶ 432:
local iparent = 1
local parenti = 'parent' .. iparent
local sortkeyi = 'sortkey' .. iparent
while conf[currGroup][currYDC][parenti] do
local parent = conf[currGroup][currYDC][parenti]
local sortkey = conf[currGroup][currYDC][sortkeyi]
if currYDC == 'year' then
if nav == nil then
local args = {
nav = frame:expandTemplate{ title = '
end
if parent == 'decade' then
if sortkey == nil then sortkey = currYear end --default to currYear
categories[iparent] = '[[Category:'..currGroup..' described in the '..parentDeca..'s|'..sortkey..']]'
elseif parent == 'century' then
if sortkey == nil then sortkey = currYear end --default to currYear
categories[iparent] = '[[Category:'..currGroup..' described in the '..addOrd(parentCent)..' century|'..sortkey..']]'
elseif mw.ustring.match(parent, '^%u%l') then --e.g. Animals/Insects
if sortkey == nil then sortkey = '' --default to none
else sortkey = '|'..sortkey end
categories[iparent] = '[[Category:'..parent..' described in '..currYear..sortkey..']]'
else
trackingCategories[2] = '[[Category:Described in year error|Y]]' --invalid year-parent
Line 273 ⟶ 463:
end
if parent == 'century' then
if sortkey == nil then sortkey = currDeca end --default to currDeca
categories[iparent] = '[[Category:'..currGroup..' described in the '..addOrd(parentCent)..' century|'..sortkey..']]'
elseif mw.ustring.match(parent, '^%u%l') then --e.g. Animals/Insects
if sortkey == nil then sortkey = '' --default to none
else sortkey = '|'..sortkey end
categories[iparent] = '[[Category:'..parent..' described in the '..currDeca..'s'..sortkey..']]'
else
trackingCategories[2] = '[[Category:Described in year error|D]]' --invalid decade-parent
Line 288 ⟶ 481:
end
if parent == 'formal' then
categories[iparent] = '[[Category:'..currGroup..' by year of formal description|'..sortkey..']]'
elseif mw.ustring.match(parent, '^%u%l') then --e.g. Animals/Insects
if sortkey == nil then sortkey = '' --default to none
else sortkey = '|'..sortkey end
categories[iparent] = '[[Category:'..parent..' described in the '..addOrd(currCent)..' century'..sortkey..']]'
else
trackingCategories[2] = '[[Category:Described in year error|C]]' --invalid century-parent
Line 301 ⟶ 497:
iparent = iparent + 1
parenti = 'parent' .. iparent
sortkeyi = 'sortkey' .. iparent
end --while conf[currGroup][currYDC][parenti] do
end --if bConfError == false then
Line 318 ⟶ 515:
if nav then header = nav end
if commons then header = header .. commons end
if description and description ~= '' then header = header
if toc then header = header .. '<br />' .. toc end
header = mw.text.trim(header)
|