Module:Sprite: Difference between revisions

mw.html seems to use a lot of memory. Converting elements to wikitext string where possible before inserting them into an existing HtmlBuilder significantly reduces that memory usage for some reason, even though that just happens later anyway on output.
Don't try to use non-existent id data when cats aren't allowed
Line 132: Line 132:
local allowCats = not mw.title.getCurrentTitle().isSubpage
local allowCats = not mw.title.getCurrentTitle().isSubpage
if not idData and allowCats then
if idData then
table.insert( categories, '[[Category:Pages with missing sprites]]' )
else
if idData.deprecated and allowCats then
if idData.deprecated and allowCats then
table.insert( categories, '[[Category:Pages using deprecated sprite names]]' )
table.insert( categories, '[[Category:Pages using deprecated sprite names]]' )
Line 140: Line 138:
args.pos = idData.pos
args.pos = idData.pos
elseif allowCats then
table.insert( categories, '[[Category:Pages with missing sprites]]' )
end
end
end
end