Module:Category described in year: Difference between revisions

Content deleted Content added
+3rd method for finding commons media: check Commons gallery property (P935); var ce; from sandbox
+[Category:Described in year error|U] for unknown configuration; --ce
Line 5:
--[[========================================================================
'Fish' is the default category tree: year -> century -> Species, no decades.
'Spiders' & 'Plants' use year -> decade -> century -> Species.
Any category group (i.e. Birds/Crustaceans/Molluscs/etc.) NOT explicitly outlined here in conf{}
outlined here in conf{} will follow the 'Fish' tree for that group.
To create a customized tree, like 'Spiders' below, add it to the bottom of the conf{} table,
the conf{} table, following the same general table format.
========================================================================]]--
['tocmin'] = 401, --integer; minimum category size to placeadd {{Category TOC}} on
['Fish'] = { --group
Line 173:
local currGroup = mw.ustring.match(currCat, '^%w+') --Fish/Spiders/default/etc.
if conf[currGroup] == nil then conf[currGroup] = conf['Fish'] end --'Fish' == default
local currYDC = nil --possible 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$')
Line 210:
description = conf[currGroup][currYDC].description
if mw.ustring.match(description, '%%year%%') then
if currYear then description = mw.ustring.gsub(description, '%%year%%', currYear) --"2001"
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') --"2000s"
else description = mw.ustring.gsub(description, '%%decade%%', 'this decade') end
end
if mw.ustring.match(description, '%%century%%') then
if currCent then description = mw.ustring.gsub(description, '%%century%%', addOrd(currCent)) --"21st"
else description = mw.ustring.gsub(description, '%%century%%', 'this century') end
end
Line 277:
trackingCategories[2] = '[[Category:Described in year error|C]]' --invalid century-parent
end
else
trackingCategories[2] = '[[Category:Described in year error|U]]' --unknown configuration
end