Module:Sprite: Difference between revisions

From Modded Wiki
Jump to navigation Jump to search
No edit summary
m 91 revisions imported
 
(61 intermediate revisions by 6 users not shown)
Line 4: Line 4:
if f == mw.getCurrentFrame() then  
if f == mw.getCurrentFrame() then  
args = require( 'Module:ProcessArgs' ).merge( true )
args = require( 'Module:ProcessArgs' ).merge( true )
else
f = mw.getCurrentFrame()
end
end
-- List of sprite names which have their default styling set in a stylesheet
local data = args.data and mw.loadData( 'Module:' .. args.data ) or {}
local imgClasses = {
local settings = data.settings
Block = 1,
Entity = 1,
Item = 1,
Schematic = 1
}
-- Default settings
-- Default settings
Line 20: Line 17:
size = 16,
size = 16,
pos = 1,
pos = 1,
link = '',
align = 'text-top'
align = 'text-top',
class = '',
text = '',
title = ''
}
}
local defaultStyle = default
local defaultStyle = default
if args.settings then
if settings then
for k, v in pairs( mw.loadData( 'Module:' .. args.settings ) ) do
if not settings.stylesheet then
-- Make a separate clone of the current default settings
defaultStyle = mw.clone( default )
end
for k, v in pairs( settings ) do
default[k] = v
default[k] = v
if imgClasses[name] then
defaultStyle[k] = v
end
end
end
end
end
local name = args.name or default.name
local setting = function( arg )
local image = args.image or default.image or name .. 'Sprite.png'
return args[arg] or default[arg]
local scale = args.scale or default.scale
end
local autoScale = args.autoscale or default.autoscale
local sheetWidth = args.sheetsize or default.sheetsize
local sprite = mw.html.create( 'span' ):addClass( 'sprite' )
local size = args.size or default.size
local pos = math.abs( args.pos or default.pos ) - 1
local link = args.link or default.link
local align = args.align or default.align
local class = args.class or default.class
local text = args.text or default.text
local title = args.title or default.title
local css = args.css or default.css
 
local tiles = sheetWidth / size
local left = pos % tiles * size
local top = math.floor( pos / tiles ) * size
-- mw.html's css method performs very slow escaping, which doubles the time it takes
-- to run, so we'll construct the styles manually, and put them in the cssText
-- method, which only does html escaping (which isn't slow)
local styles = {}
local styles = {}
if imgClasses[name] then
class = mw.ustring.lower( name ) .. '-sprite ' .. class
-- for tint
else
local classname = setting( 'classname' ) or mw.ustring.lower( setting( 'name' ):gsub( ' ', '-' ) ) .. '-sprite'
table.insert( styles, 'background-image:{{FileUrl|' .. image .. '}}' )
local css_image = "background"
if setting( 'formask' ) then
classname = classname .. '-mask'
css_image = "mask"
end
sprite:addClass( classname )
local class = setting( 'class' )
if class then
sprite:addClass( class )
end
end
if left > 0 or top > 0 then
table.insert( styles, 'background-position:-' .. left * scale .. 'px -' .. top * scale .. 'px' )
local width = setting( 'width' ) or setting( 'size' )
local height = setting( 'height' ) or setting( 'size' )
local sheetWidth = setting( 'sheetsize' )
local tiles = sheetWidth / width
local pos = setting( 'pos' ) - 1
local scale = setting( 'scale' )
local autoScale = setting( 'autoscale' )
if pos then
local left = pos % tiles * width * scale
local top = math.floor( pos / tiles ) * height * scale
if css_image == 'mask' then
styles[#styles + 1] = '-webkit-mask-position:-' .. left .. 'px -' .. top .. 'px'
end
styles[#styles + 1] = css_image .. '-position:-' .. left .. 'px -' .. top .. 'px'
end
end
if not autoScale and scale ~= defaultStyle.scale then
if not autoScale and scale ~= defaultStyle.scale then
table.insert( styles, 'background-size:' .. sheetWidth * scale .. 'px auto' )
if css_image == 'mask' then
styles[#styles + 1] = '-webkit-mask-size:' .. sheetWidth * scale .. 'px auto'
end
styles[#styles + 1] = css_image .. '-size:' .. sheetWidth * scale .. 'px auto'
end
end
if size ~= defaultStyle.size or ( not autoScale and scale ~= defaultStyle.scale ) then
if height ~= defaultStyle.size or width ~= defaultStyle.size or ( not autoScale and scale ~= defaultStyle.scale ) then
table.insert( styles, 'height:' .. size * scale .. 'px;width:' .. size * scale .. 'px' )
styles[#styles + 1] = 'height:' .. height * scale .. 'px'
styles[#styles + 1] = 'width:' .. width * scale .. 'px'
end
end
local align = setting( 'align' )
if align ~= defaultStyle.align then
if align ~= defaultStyle.align then
table.insert( styles, 'vertical-align:' .. align )
styles[#styles + 1] = 'vertical-align:' .. align
end
end
if css then
styles[#styles + 1] = setting( 'css' )
table.insert( styles, css )
sprite:cssText( table.concat( styles, ';' ) )
local text = setting( 'text' )
local root
local spriteText
if text then
if not args['wrap'] then
root = mw.html.create( 'span' ):addClass( 'nowrap' )
end
spriteText = mw.html.create( 'span' ):addClass( 'sprite-text' ):wikitext( text )
end
end
if title ~= '' then
title = ' title="' .. title .. '"'
local title = setting( 'title' )
if title then
( root or sprite ):attr( 'title', title )
end
end
local sprite = table.concat( {
if not root then
'<span',
root = mw.html.create( '' )
'class="sprite ' .. class .. '"',
end
'style="' .. table.concat( styles, ';' ) .. '"',
root:node( sprite )
title,
if spriteText then
'><br></span>'
root:node( spriteText )
}, ' ' )
sprite = sprite:gsub( '%s+([">])', '%1' )
if text ~= '' then
text = '<span class="sprite-text nowrap"' .. title .. '>' .. text .. '</span>'
end
end
if link ~= '' then
local link = setting( 'link' ) or ''
if link ~= '' and mw.ustring.lower( link ) ~= 'none' then
-- External link
if link:find( '//' ) then
if link:find( '//' ) then
-- External link
return '[' .. link .. ' ' .. tostring( root ) .. ']'
return '[' .. link .. ' ' .. sprite .. text .. ']'
else
-- Internal link
return '[[' .. link .. '|' .. sprite .. text .. ']]'
end
end
else
return sprite .. text
-- Internal link
local linkPrefix = setting( 'linkprefix' ) or ''
return '[[' .. linkPrefix .. link .. '|' .. tostring( root ) .. ']]'
end
end
return tostring( root )
end
end


Line 110: Line 134:
if f == mw.getCurrentFrame() then
if f == mw.getCurrentFrame() then
args = require( 'Module:ProcessArgs' ).merge( true )
args = require( 'Module:ProcessArgs' ).merge( true )
else
f = mw.getCurrentFrame()
end
end
local category = ''
local data = args.data and mw.loadData( 'Module:' .. args.data ) or {}
if tonumber( args[1] ) then
local categories = {}
args.pos = args[1]
local idData = args.iddata
else
if not idData then
local default = {}
local name = args.name or data.settings.name
if args.settings then
local id = mw.text.trim( tostring( args[1] or '' ) )
default = mw.loadData( 'Module:' .. args.settings )
idData = data.ids[id] or data.ids[mw.ustring.lower( id ):gsub( '[%s%+]', '-' )]
end
local title = mw.title.getCurrentTitle()
-- Remove categories on language pages, talk pages, and in User/UserWiki/UserProfile namespaces
local disallowCats = args.nocat or title.isTalkPage or title.nsText:find( '^User' )
if idData then
if idData.deprecated then
args.class = ( args.class or '' ) .. ' sprite-deprecated'
if not disallowCats then
categories[#categories + 1] = f:expandTemplate{ title = 'Translation category', args = { 'Pages using deprecated sprite names', project = 0 } }
end
end
end
local name = args.name or default.name
args.pos = idData.pos
local ids = mw.loadData( 'Module:' .. ( args.ids or default.ids or 'Sprite/' .. name ) )
elseif not disallowCats then
local id = mw.text.trim( args[1] or '' )
categories[#categories + 1] = f:expandTemplate{ title = 'Translation category', args = { 'Pages with missing sprites', project = 0 } }
local pos = ids[id] or ids[mw.ustring.lower( id ):gsub( '[%s%+]', '-' )]
if not pos then
category = '[[Category:Pages with missing sprites]]'
end
args.pos = pos
end
end
return p.base( args ) .. category
return p.base( args ), table.concat( categories )
end
end


Line 144: Line 176:
link = args[1]:match( '^(.-)%+' ) or args[1]
link = args[1]:match( '^(.-)%+' ) or args[1]
end
end
local text = args.text or args[2] or link
local text
if not args.notext then
text = args.text or args[2] or link
end
args[1] = args.id or args[1]
args[1] = args.id or args[1]
args.link = link
args.link = args.link or link
args.text = text
args.text = text
Line 154: Line 189:


function p.doc( f )
function p.doc( f )
local args = require( 'Module:ProcessArgs' ).norm( f.args )
local args = f
local idTable = mw.title.new( 'Module:Sprite/' .. args.name ):getContent()
if f == mw.getCurrentFrame() then
idTable = idTable:gsub( '(\n%s*%-%-%s*.-%s*%-%-%s*\n)', '%1,' ):gsub( '^return {', '' ):gsub( '}$', '' )
args = f.args
else
f = mw.getCurrentFrame()
end
local dataPage = mw.text.trim( args[1] )
local data = mw.loadData( 'Module:' .. dataPage )
local html = {}
local getProtection = function( title, action, extra )
local ids = {}
local protections = { 'edit' }
local posKeys = {}
if extra then
local section = ''
protections[#protections + 1] = extra
for line in mw.text.gsplit( idTable, ',' ) do
end
line = mw.text.trim( line )
id = line:match( '^%[[\'"](.+)[\'"]%]' ) or line:match( '^%w+' ) or ''
pos = line:match( '=%s*(%d+)%s*,?$' ) or ''
section = line:match( '^%-%-%s*(.+)%s*%-%-$' ) or section
if id ~= '' and pos ~= '' then
local addProtection = function( protection )
if ids[pos] then
if protection == 'autoconfirmed' then
if type( ids[pos].id ) == 'table' then
protection = 'editsemiprotected'
table.insert( ids[pos].id, id )
elseif protection == 'sysop' then
else
protection = 'editprotected'
ids[pos].id = { ids[pos].id, id }
end
else
ids[pos] = { id = id, section = section }
table.insert( posKeys, pos )
end
end
protections[#protections + 1] = protection
end
end
end
local list = {}
local direct = title.protectionLevels[action] or {}
local listHead = '<ul class="spritedoc-multicolumn">'
for _, protection in ipairs( direct ) do
local listFoot = '</ul>'
addProtection( protection )
local lastSection = ''
end
for i, pos in ipairs( posKeys ) do
local cascading = title.cascadingProtection.restrictions[action] or {}
local id = ids[pos].id
if #cascading > 0 then
local newSection = mw.text.trim( ids[pos].section )
protections[#protections + 1] = 'protect'
end
for _, protection in ipairs( cascading ) do
addProtection( protection )
end
if newSection ~= lastSection or i == 1 then
return table.concat( protections, ',' )
if newSection ~= lastSection then
end
if lastSection ~= '' then
table.insert( list, listFoot )
local spriteStyle = ''
end
if data.settings.url and data.settings.url.style then
spriteStyle = data.settings.url.style
table.insert( list, '\n===' .. newSection .. '===\n' )
end
lastSection = newSection
end
local dataTitle = mw.title.new( 'Module:' .. dataPage )
table.insert( list, listHead )
-- Temporary until this is updated
end
local spritesheet = data.settings.image or data.settings.name .. 'Sprite.png'
table.insert( list, '<li><table><tr><td data-pos="' .. pos .. '">' )
local spriteTitle = mw.title.new( 'File:' .. spritesheet )
if type( id ) == 'table' then
local dataProtection = getProtection( dataTitle, 'edit' )
for i, id2 in ipairs( id ) do
local spriteProtection = getProtection( spriteTitle, 'upload', 'upload,reupload' )
if i == 1 then
local body = mw.html.create( 'div' ):attr( {
args[1] = id2
id = 'spritedoc',
table.insert( list, p.sprite( args ) .. '</td><td><div class="sprite-id"><code>' .. id2 .. '</code></div>' )
['data-dataprotection'] = dataProtection,
else
['data-datatimestamp'] = f:callParserFunction( 'REVISIONTIMESTAMP', 'Module:' .. dataPage ),
table.insert( list, '<div class="sprite-id"><code>' .. id2 .. '</code></div>' )
['data-datapage'] = 'Module:' .. dataPage,
end
['data-spritesheet'] = spritesheet,
end
['data-spriteprotection'] = spriteProtection,
else
['data-refreshtext'] = mw.text.nowiki( '{{#invoke:sprite|doc|' .. dataPage .. '|refresh=1}}' ),
args[1] = id
['data-settings'] = mw.text.jsonEncode( data.settings ),
table.insert( list, p.sprite( args ) .. '</td><td><div class="sprite-id"><code>' .. id .. '</code></div>' )
} )
local sections = {}
for _, sectionData in ipairs( data.sections or { name = 'Uncategorized' } ) do
local sectionTag = body:tag( 'div' ):addClass( 'spritedoc-section' ):attr( 'data-section-id', sectionData.id )
sectionTag:tag( 'h3' ):wikitext( sectionData.name )
sections[sectionData.id] = { boxes = sectionTag:tag( 'ul' ):addClass( 'spritedoc-boxes' ) }
end
local keyedData = {}
local i = 1
for name, idData in pairs( data.ids ) do
keyedData[i] = {
sortKey = mw.ustring.lower( name ),
name = name,
data = idData
}
i = i + 1
end
table.sort( keyedData, function( a, b )
return a.sortKey < b.sortKey
end )
for _, data in ipairs( keyedData ) do
local idData = data.data
local pos = idData.pos
local section = sections[idData.section]
local names = section[pos]
if not names then
local box = section.boxes:tag( 'li' ):addClass( 'spritedoc-box' ):attr( 'data-pos', pos )
box:tag( 'div' ):addClass( 'spritedoc-image' )
:wikitext( p.base{ pos = pos, data = dataPage, nourl = spriteStyle ~= '' } )
names = box:tag( 'ul' ):addClass( 'spritedoc-names' )
section[pos] = names
end
end
table.insert( list, '</td></tr></table></li>' )
local nameElem = mw.html.create( 'li' ):addClass( 'spritedoc-name' )
local codeElem = nameElem:tag( 'code' ):wikitext( data.name )
if i == #posKeys then
if idData.deprecated then
table.insert( list, listFoot )
codeElem:addClass( 'spritedoc-deprecated' )
end
end
names:wikitext( tostring( nameElem ) )
end
end
local out = table.concat( list )
if args.refresh then
if not args.refresh then
return '', '', tostring( body )
out = f:preprocess( '{{#widget:stylesheet|page=Sprite doc}}' ) .. '<div id="sprite-doc" data-details=\'{"name":"' .. args.name .. '","size":' .. ( args.size or 16 ) .. '}\'>' .. out .. '</div>'
end
end
local styles = f:extensionTag( 'templatestyles', '', { src = 'Sprite/doc.css' } )
return out
return styles, spriteStyle, tostring( body )
end
end
return p
return p

Latest revision as of 12:26, 4 July 2024

Documentation for this module may be created at Module:Sprite/doc

local p = {}
function p.base( f )
	local args = f
	if f == mw.getCurrentFrame() then 
		args = require( 'Module:ProcessArgs' ).merge( true )
	else
		f = mw.getCurrentFrame()
	end
	
	local data = args.data and mw.loadData( 'Module:' .. args.data ) or {}
	local settings = data.settings
	
	-- Default settings
	local default = {
		scale = 1,
		sheetsize = 256,
		size = 16,
		pos = 1,
		align = 'text-top'
	}
	
	local defaultStyle = default
	if settings then
		if not settings.stylesheet then
			-- Make a separate clone of the current default settings
			defaultStyle = mw.clone( default )
		end
		for k, v in pairs( settings ) do
			default[k] = v
		end
	end
	
	local setting = function( arg )
		return args[arg] or default[arg]
	end
	
	local sprite = mw.html.create( 'span' ):addClass( 'sprite' )
	
	-- mw.html's css method performs very slow escaping, which doubles the time it takes
	-- to run, so we'll construct the styles manually, and put them in the cssText
	-- method, which only does html escaping (which isn't slow)
	local styles = {}
	
	-- for tint
	local classname = setting( 'classname' ) or mw.ustring.lower( setting( 'name' ):gsub( ' ', '-' ) ) .. '-sprite'
	local css_image = "background"
	if setting( 'formask' ) then
		classname = classname .. '-mask'
		css_image = "mask"
	end
	
	sprite:addClass( classname )
	local class = setting( 'class' )
	if class then
		sprite:addClass( class )
	end
	
	local width = setting( 'width' ) or setting( 'size' )
	local height = setting( 'height' ) or setting( 'size' )
	local sheetWidth = setting( 'sheetsize' )
	local tiles = sheetWidth / width
	local pos = setting( 'pos' ) - 1
	local scale = setting( 'scale' )
	local autoScale = setting( 'autoscale' )
	
	if pos then
		local left = pos % tiles * width * scale
		local top = math.floor( pos / tiles ) * height * scale
		if css_image == 'mask' then
			styles[#styles + 1] = '-webkit-mask-position:-' .. left .. 'px -' .. top .. 'px'
		end
		styles[#styles + 1] = css_image .. '-position:-' .. left .. 'px -' .. top .. 'px'
	end
	
	if not autoScale and scale ~= defaultStyle.scale then
		if css_image == 'mask' then
			styles[#styles + 1] = '-webkit-mask-size:' .. sheetWidth * scale .. 'px auto'
		end
		styles[#styles + 1] = css_image .. '-size:' .. sheetWidth * scale .. 'px auto'
	end
	if height ~= defaultStyle.size or width ~= defaultStyle.size or ( not autoScale and scale ~= defaultStyle.scale ) then
		styles[#styles + 1] = 'height:' .. height * scale .. 'px'
		styles[#styles + 1] = 'width:' .. width * scale .. 'px'
	end
	
	local align = setting( 'align' )
	if align ~= defaultStyle.align then
		styles[#styles + 1] = 'vertical-align:' .. align
	end
	styles[#styles + 1] = setting( 'css' )
	
	sprite:cssText( table.concat( styles, ';' ) )
	
	local text = setting( 'text' )
	local root
	local spriteText
	if text then
		if not args['wrap'] then
			root = mw.html.create( 'span' ):addClass( 'nowrap' )
		end
		spriteText = mw.html.create( 'span' ):addClass( 'sprite-text' ):wikitext( text )
	end
	
	local title = setting( 'title' )
	if title then
		( root or sprite ):attr( 'title', title )
	end
	
	if not root then
		root = mw.html.create( '' )
	end
	root:node( sprite )
	if spriteText then
		root:node( spriteText )
	end
	
	local link = setting( 'link' ) or ''
	if link ~= '' and mw.ustring.lower( link ) ~= 'none' then
		-- External link
		if link:find( '//' ) then
			return '[' .. link .. ' ' .. tostring( root ) .. ']'
		end
		
		-- Internal link
		local linkPrefix = setting( 'linkprefix' ) or ''
		return '[[' .. linkPrefix .. link .. '|' .. tostring( root ) .. ']]'
	end
	
	return tostring( root )
end

function p.sprite( f )
	local args = f
	if f == mw.getCurrentFrame() then
		args = require( 'Module:ProcessArgs' ).merge( true )
	else
		f = mw.getCurrentFrame()
	end
	
	local data = args.data and mw.loadData( 'Module:' .. args.data ) or {}
	local categories = {}
	local idData = args.iddata
	if not idData then
		local name = args.name or data.settings.name
		local id = mw.text.trim( tostring( args[1] or '' ) )
		idData = data.ids[id] or data.ids[mw.ustring.lower( id ):gsub( '[%s%+]', '-' )]
	end
	
	local title = mw.title.getCurrentTitle()
	-- Remove categories on language pages, talk pages, and in User/UserWiki/UserProfile namespaces
	local disallowCats = args.nocat or title.isTalkPage or title.nsText:find( '^User' )
	if idData then
		if idData.deprecated then
			args.class = ( args.class or '' ) .. ' sprite-deprecated'
			if not disallowCats then
				categories[#categories + 1] = f:expandTemplate{ title = 'Translation category', args = { 'Pages using deprecated sprite names', project = 0 } }
			end
		end
		
		args.pos = idData.pos
	elseif not disallowCats then
		categories[#categories + 1] = f:expandTemplate{ title = 'Translation category', args = { 'Pages with missing sprites', project = 0 } }
	end
	
	return p.base( args ), table.concat( categories )
end

function p.link( f )
	local args = f
	if f == mw.getCurrentFrame() then
		args = require( 'Module:ProcessArgs' ).merge( true )
	end
	
	local link = args[1]
	if args[1] and not args.id then
		link = args[1]:match( '^(.-)%+' ) or args[1]
	end
	local text
	if not args.notext then
		text = args.text or args[2] or link
	end
	
	args[1] = args.id or args[1]
	args.link = args.link or link
	args.text = text
	
	return p.sprite( args )
end

function p.doc( f )
	local args = f
	if f == mw.getCurrentFrame() then
		args = f.args
	else
		f = mw.getCurrentFrame()
	end
	local dataPage = mw.text.trim( args[1] )
	local data = mw.loadData( 'Module:' .. dataPage )
	
	local getProtection = function( title, action, extra )
		local protections = { 'edit' }
		if extra then
			protections[#protections + 1] = extra
		end
		
		local addProtection = function( protection )
			if protection == 'autoconfirmed' then
				protection = 'editsemiprotected'
			elseif protection == 'sysop' then
				protection = 'editprotected'
			end
			
			protections[#protections + 1] = protection
		end
		
		local direct = title.protectionLevels[action] or {}
		for _, protection in ipairs( direct ) do
			addProtection( protection )
		end
		local cascading = title.cascadingProtection.restrictions[action] or {}
		if #cascading > 0 then
			protections[#protections + 1] = 'protect'
		end
		for _, protection in ipairs( cascading ) do
			addProtection( protection )
		end
		
		return table.concat( protections, ',' )
	end
	
	local spriteStyle = ''
	if data.settings.url and data.settings.url.style then
		spriteStyle = data.settings.url.style
	end
	
	local dataTitle = mw.title.new( 'Module:' .. dataPage )
	-- Temporary until this is updated
	local spritesheet = data.settings.image or data.settings.name .. 'Sprite.png'
	local spriteTitle = mw.title.new( 'File:' .. spritesheet )
	local dataProtection = getProtection( dataTitle, 'edit' )
	local spriteProtection = getProtection( spriteTitle, 'upload', 'upload,reupload' )
	local body = mw.html.create( 'div' ):attr( {
		id = 'spritedoc',
		['data-dataprotection'] = dataProtection,
		['data-datatimestamp'] = f:callParserFunction( 'REVISIONTIMESTAMP', 'Module:' .. dataPage ),
		['data-datapage'] = 'Module:' .. dataPage,
		['data-spritesheet'] = spritesheet,
		['data-spriteprotection'] = spriteProtection,
		['data-refreshtext'] = mw.text.nowiki( '{{#invoke:sprite|doc|' .. dataPage .. '|refresh=1}}' ),
		['data-settings'] = mw.text.jsonEncode( data.settings ),
	} )
	
	local sections = {}
	for _, sectionData in ipairs( data.sections or { name = 'Uncategorized' } ) do
		local sectionTag = body:tag( 'div' ):addClass( 'spritedoc-section' ):attr( 'data-section-id', sectionData.id )
		sectionTag:tag( 'h3' ):wikitext( sectionData.name )
		sections[sectionData.id] = { boxes = sectionTag:tag( 'ul' ):addClass( 'spritedoc-boxes' ) }
	end
	
	local keyedData = {}
	local i = 1
	for name, idData in pairs( data.ids ) do
		keyedData[i] = {
			sortKey = mw.ustring.lower( name ),
			name = name,
			data = idData
		}
		i = i + 1
	end
	table.sort( keyedData, function( a, b )
		return a.sortKey < b.sortKey
	end )
	
	for _, data in ipairs( keyedData ) do
		local idData = data.data
		local pos = idData.pos
		local section = sections[idData.section]
		local names = section[pos]
		if not names then
			local box = section.boxes:tag( 'li' ):addClass( 'spritedoc-box' ):attr( 'data-pos', pos )
			box:tag( 'div' ):addClass( 'spritedoc-image' )
				:wikitext( p.base{ pos = pos, data = dataPage, nourl = spriteStyle ~= '' } )
			
			names = box:tag( 'ul' ):addClass( 'spritedoc-names' )
			section[pos] = names
		end
		local nameElem = mw.html.create( 'li' ):addClass( 'spritedoc-name' )
		local codeElem = nameElem:tag( 'code' ):wikitext( data.name )
		
		if idData.deprecated then
			codeElem:addClass( 'spritedoc-deprecated' )
		end
		names:wikitext( tostring( nameElem ) )
	end
	
	if args.refresh then
		return '', '', tostring( body )
	end
	local styles = f:extensionTag( 'templatestyles', '', { src = 'Sprite/doc.css' } )
	return styles, spriteStyle, tostring( body )
end
return p