Module:Category described in year/sandbox: Difference between revisions

Content deleted Content added
m Hard-code 's' after %decade%
Implement Category:Described in year configuration error for various errors; cat table length check
Line 95:
local categories = {}
local trackingCategories = {
[1] = nil'', --placeholder for [[Category:Described in year unknown category]]
[2] = '', --placeholder for [[Category:Described in year configuration error]]
}
local outString = nil
Line 112 ⟶ 113:
currQID = mw.wikibase.getEntityIdForTitle('Category:' .. currCat)
else
trackingCategories[2] = '[[Category:Described in year configuration error]]' --currQID & currCat are nil at this point
return --add err msg?
end
end
Line 142 ⟶ 143:
end
end
--ignore duplicates
if commonsLinks[1] then
Line 286 ⟶ 288:
--append cats to outString
if currentTitle.namespace == 14 then --Category:
if table.maxn(categories) > 0 then outString = outString .. table.concat(categories) .. table.concat(trackingCategories)end
outString = outString .. '<br />' .. table.concat(trackingCategories, '<br />')
else
if table.maxn(categories) > 0 then --might be 0 if there's an error before setting cats
outString = outString .. '<br />' .. mw.ustring.gsub(table.concat(categories, '<br />'), '%[%[', '[[:')
if table.maxn(trackingCategories) > 0 then
outString = outString .. '<br />' .. table.concat(trackingCategories, '<br />')
end
outString = outString .. '<br />' .. mw.ustring.gsub(outStringtable.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 > 2 or 3)
end