Module:Sprite: Difference between revisions

Remove deprecated position handling, now treated as a normal ID. Remove cats on user and talk pages.
Inverted conditions are confusing.
Line 141: Line 141:
local title = mw.title.getCurrentTitle()
local title = mw.title.getCurrentTitle()
-- Remove categories on sub-pages, and User* and *Talk namespaces
-- Remove categories on sub-pages, and User* and *Talk namespaces
local allowCats = not title.isSubpage and ( not title.nsText:find( '^User' ) or not title.nsText:find( '[Tt]alk$' ) )
local disallowCats = title.isSubpage or title.nsText:find( '^User' ) or title.nsText:find( '[Tt]alk$' )
if idData then
if idData then
if type( idData ) == 'table' then
if type( idData ) == 'table' then
if idData.deprecated and allowCats then
if idData.deprecated and not disallowCats then
table.insert( categories, '[[Category:Pages using deprecated sprite names]]' )
table.insert( categories, '[[Category:Pages using deprecated sprite names]]' )
end
end
Line 152: Line 152:
args.pos = idData
args.pos = idData
end
end
elseif allowCats then
elseif not disallowCats then
table.insert( categories, '[[Category:Pages with missing sprites]]' )
table.insert( categories, '[[Category:Pages with missing sprites]]' )
end
end