Module:Sprite: Difference between revisions
No edit summary |
No edit summary |
||
| Line 80: | Line 80: | ||
end | end | ||
local category = '' | |||
if tonumber( args[1] ) then | if tonumber( args[1] ) then | ||
args.pos = args[1] | args.pos = args[1] | ||
| Line 85: | Line 86: | ||
local ids = mw.loadData( 'Module:Sprite/' .. args.name ) | local ids = mw.loadData( 'Module:Sprite/' .. args.name ) | ||
local name = mw.text.trim( args[1] or '' ) | local name = mw.text.trim( args[1] or '' ) | ||
local pos = ids[name] or ids[name:lower():gsub( '%s', '-' )] | |||
if not pos then | |||
category = '[[Category:Pages with invalid sprite ids]]' | |||
end | |||
args.pos = pos | |||
end | end | ||
return p.base( args ) | return p.base( args ) .. category | ||
end | end | ||
| Line 94: | Line 99: | ||
local args = f | local args = f | ||
if f == mw.getCurrentFrame() then | if f == mw.getCurrentFrame() then | ||
args = require( 'Module:ProcessArgs' ).merge() | args = require( 'Module:ProcessArgs' ).merge( true ) | ||
end | end | ||
local link = | local link = ( args[1] or '' ):match( '^(.-)%-' ) | ||
local text = args[2] or link | local text = args[2] or link | ||
args[1] = args.id or args[1] | args[1] = args.id or args[1] | ||
args.link = link | args.link = link | ||
args.text = text | args.text = text | ||