Module:Category described in year: Difference between revisions

Content deleted Content added
m --ce
+3rd method for finding commons media: check Commons gallery property (P935); var ce; from sandbox
Line 19:
['Fish'] = { --group
['minyearmin'] = 1758, --integer; lowest possible year displayed in nav bars; 0/nil defaults to 1758 per ICZN Art. 5
['year'] = { --[[Category:Fish described in 1901]]
['description'] = 'This category should only contain species-level articles.',
Line 33:
['Spiders'] = { --group
['minyearmin'] = 1757, --integer; lowest possible year (and thus decade) displayed in nav bars; 0/nil defaults to 1758 per ICZN Art. 5
['year'] = { --[[Category:Spiders described in 1901]]
['description'] = '', --'Description tbd; year; This category should only contain species articles, etc....',
Line 52:
 
['Plants'] = { --group
['minyearmin'] = 1753, --integer; lowest possible year (and thus decade) displayed in nav bars; 0/nil defaults to 1758 per ICZN Art. 5
['year'] = { --[[Category:Plants 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]]
Line 129:
local ccPropVal = ccPropState.mainsnak.datavalue.value
if ccPropVal then
commonsLinks[#commonsLinks + 1] = 'Category:' .. mw.ustring.gsub(ccPropVal, 'Category:', '')
end
end
--check Commons gallery property (P935)
local cgPropState = currEntity:getBestStatements('P935')[1]
if cgPropState then
local cgPropVal = cgPropState.mainsnak.datavalue.value
if cgPropVal then
commonsLinks[#commonsLinks + 1] = cgPropVal
end
end
Line 146 ⟶ 154:
--produce {{Commons}} template(s) (ignore duplicates)
if commonsLinks[1] then --turn these into a loop if # of commons sources >= 4
commons = frame:expandTemplate{ title = 'Commons', args = { commonsLinks[1] } }
if commonsLinks[2] and
commonsLinks[12] ~= commonsLinks[21] then
commons = commons .. frame:expandTemplate{ title = 'Commons', args = { commonsLinks[2] } }
end
if commonsLinks[3] and
commonsLinks[3] ~= commonsLinks[1] and
commonsLinks[3] ~= commonsLinks[2] then
commons = commons .. frame:expandTemplate{ title = 'Commons', args = { commonsLinks[3] } }
end
end
end --if currQID then
end
if currCat then
Line 166 ⟶ 180:
local parentCent = nil --used with currYear (i.e. Fish) & currDeca (i.e. Spiders)
local lastCent, nextCent = nil, nil --used with currYear (i.e. Fish) & currCent (i.e. Fish)
local minYear = tonumber(conf[currGroup].minyearmin)
if (minYear == nil or (minYear and minYear <= 1700)) then
minYear = 1758 --default to 1758 per ICZN Art. 5
Line 279 ⟶ 293:
end
end --if currCat then
end
--build header & rem surrounding whitespace
Line 304 ⟶ 318:
outString = outString .. '<br />' .. mw.ustring.gsub(table.concat(trackingCategories, '<br />'), '%[%[', '[[:')
outString = mw.ustring.gsub(outString, '<br /><br />', '<br />') --produced by empty ('') first/consecutive tracking cat/s
outString = mw.ustring.gsub(outString, '<br /><br />', '<br />') --jic (use while loop if #trackingCategories >= 3 or 4 )
end