Module:Category described in year: Difference between revisions

Content deleted Content added
m --+Sponges to Default
m Many minor changes from sandbox
Line 53:
},
['Spiders'] = { --"group"; ICZN allows names in Clerck's Aranei Svecici of 1757, earliest date used in World Spider Catalog
--[[=========================== Molluscs tree ============================]]
['yearmin'] = 1757, --integer; lowest possible year displayed in nav bars; 0/nil defaults to 1758 per ICZN Art. 5
['year'] = { --[[Category:Spiders described in 1901]]
['Bivalves'] = { --"subgroup" to Molluscs
['yearparent1'] = { 'century', --[[Category:BivalvesSpiders described in 1901the 20th century]]
['parent1parent2'] = 'centuryAnimals', --[[Category:BivalvesAnimals described in the 20th century1901]]
['description'] = '', --Year description tbd; Default-group's description doesn't apply
['parent2'] = 'Molluscs', --[[Category:Molluscs described in 1901]]
['description'] = '', --Year description tbd; 'This category should only contain species articles', etc...
},
['century'] = { --[[Category:BivalvesSpiders described in the 20th century]]
['parent1'] = 'formal', --[[Category:BivalvesSpiders by year of formal description]]
['parent2'] = 'MolluscsAnimals', --[[Category:MolluscsAnimals described in the 20th century]]
['description'] = '', --Century description tbd; container category, etc...
['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...
},
},
Line 171 ⟶ 127:
},
--[[============================ SpidersMolluscs tree ============================]]
['Bivalves'] = { --"subgroup" to Molluscs
['Spiders'] = { --"group"; ICZN allows names in Clerck's Aranei Svecici of 1757, earliest date used in World Spider Catalog
['year'] = { --[[Category:Bivalves described in 1901]]
['yearmin'] = 1757, --integer; lowest possible year displayed in nav bars; 0/nil defaults to 1758 per ICZN Art. 5
['yearparent1'] = { 'century', --[[Category:SpidersBivalves described in 1901the 20th century]]
['parent1parent2'] = 'centuryMolluscs', --[[Category:SpidersMolluscs described in the 20th century1901]]
['description'] = '', --Year description tbd; 'This category should only contain species articles', etc...
['parent2'] = 'Animals', --[[Category:Animals described in 1901]]
['description'] = '', --Year description tbd; Default-group's description doesn't apply
},
['century'] = { --[[Category:SpidersBivalves described in the 20th century]]
['parent1'] = 'formal', --[[Category:SpidersBivalves by year of formal description]]
['parent2'] = 'AnimalsMolluscs', --[[Category:AnimalsMolluscs 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...
},
},
--[[============================= Non-animals ============================]]
Line 278 ⟶ 276:
},
},
--[[==================== "Fossil taxa described in"-level ====================]]
Line 298 ⟶ 297:
}
 
--[[==========================================================================]]
--[[ Local functions ]]
--[[==========================================================================]]
 
local function addOrd( i ) --20 -> 20th, etc.
Line 318 ⟶ 321:
local p = {}
--[[==========================================================================]]
--[[ External function ]]
--[[==========================================================================]]
 
function p.autodetect( frame )
local currentTitle = mw.title.getCurrentTitle()
Line 338 ⟶ 345:
local currCat = nil
local currQID = nil
if currentTitle.namespace == 14 then --Category:category namespace
currCat = currentTitle.text --without namespace nor interwiki prefixes
currQID = mw.wikibase.getEntityIdForCurrentPage()
else
--accept 1 unnamed category parameter if not in Category:category spacenamespace; required for testing/doc/etc purposes
local parentArg = frame:getParent().args[1]
if parentArg then
Line 349 ⟶ 356:
else --currQID & currCat both nil
if currentTitle.fullText ~= 'Template:Category described in year' then --ignore self...
trackingCategories[2] = '[[Category:Described in year error|P]]' --missing a category parameter outside category-space namespace
end
end
Line 422 ⟶ 429:
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 parentDecalastCent, nextCent = nil, nil --used with currYear & currDecacurrCent
local parentDeca, parentCent = nil, nil --used with currYear & currDeca
local lastCent, nextCent = nil, nil --used with currYear & currCent
local minYear = tonumber(conf[currGroup].yearmin)
if (minYear == nil or (minYear and minYear <= 1700)) then
Line 474 ⟶ 480:
end
--produce portal, description, toc
if bConfError == false then
--produce portal
if currGroup == 'Fossil taxa' then
portal = frame:expandTemplate{ title = 'Portal', args = { 'Paleontology' } }
end
--produce description
description = conf[currGroup][currYDC].description
if mw.ustring.match(description, '%%year%%') then
Line 496 ⟶ 501:
end
--produce toc
if mw.site.stats.pagesInCategory(currCat, 'pages') >= conf['tocmin'] then --expensive
local args = { numerals = 'no' }
toc = frame:expandTemplate{ title = 'Category TOC', args = args }
end
end
--produce cats & navs
--produce cats & navs
if bConfError == false then
local iparent = 1
local parenti = 'parent' .. iparent
Line 512 ⟶ 515:
local sortkey = conf[currGroup][currYDC][sortkeyi]
--[[========================== Year ==========================]]
if currYDC == 'year' then
if nav == nil then
Line 547 ⟶ 551:
end
--[[================== Decade (deprecated) ===================]]
elseif currYDC == 'decade' then
if nav == nil then
Line 564 ⟶ 569:
end
--[[======================== Century =========================]]
elseif currYDC == 'century' then
if nav == nil then
Line 639 ⟶ 645:
--append cats to outString
if currentTitle.namespace == 14 then --Category:category namespace
if table.maxn(categories) > 0 then outString = outString .. table.concat(categories) end
outString = outString .. table.concat(trackingCategories)