Module:Sprite: Difference between revisions

Fix mw.html performance issue (basically doubles performance). Fix the css parameter not actually working.
Add compatibility with old IDs pages
Line 96: Line 96:
if not root then
if not root then
root = mw.html.create( '' )
root = mw.html.create()
end
end
root:node( sprite )
root:node( sprite )
Line 137: Line 137:
local name = args.name or default.name
local name = args.name or default.name
local ids = mw.loadData( 'Module:' .. ( args.ids or default.ids or name .. '/IDs' ) ).ids
local ids = mw.loadData( 'Module:' .. ( args.ids or default.ids or name .. '/IDs' ) )
ids = ids.ids or ids
local id = mw.text.trim( args[1] or '' )
local id = mw.text.trim( args[1] or '' )
idData = ids[id] or ids[mw.ustring.lower( id ):gsub( '[%s%+]', '-' )]
idData = ids[id] or ids[mw.ustring.lower( id ):gsub( '[%s%+]', '-' )]
Line 148: Line 149:
end
end
args.pos = idData.pos
args.pos = idData.pos or idData
elseif allowCats then
elseif allowCats then
table.insert( categories, '[[Category:Pages with missing sprites]]' )
table.insert( categories, '[[Category:Pages with missing sprites]]' )