Module:Sprite: Difference between revisions
m Protected "Module:Sprite": High traffic page ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite)) |
Remove deprecated position handling, now treated as a normal ID. Remove cats on user and talk pages. |
||
| Line 125: | Line 125: | ||
local categories = {} | local categories = {} | ||
local idData = args.iddata | |||
if not idData then | |||
local default = {} | |||
if args.settings then | |||
default = mw.loadData( 'Module:' .. args.settings ) | |||
end | end | ||
local | local name = args.name or default.name | ||
local ids = mw.loadData( 'Module:' .. ( args.ids or default.ids or name .. '/IDs' ) ) | |||
ids = ids.ids or ids | |||
local id = mw.text.trim( tostring( args[1] or '' ) ) | |||
idData = ids[id] or ids[mw.ustring.lower( id ):gsub( '[%s%+]', '-' )] | |||
end | |||
local title = mw.title.getCurrentTitle() | |||
-- 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$' ) ) | |||
if idData then | |||
if type( idData ) == 'table' then | |||
if idData.deprecated and allowCats then | |||
table.insert( categories, '[[Category:Pages using deprecated sprite names]]' ) | |||
end | end | ||
args.pos = idData.pos | |||
else | |||
args.pos = idData | |||
end | end | ||
elseif allowCats then | |||
table.insert( categories, '[[Category:Pages with missing sprites]]' ) | |||
end | end | ||