Module:KnightMiner/Sandbox

local p = {} p.pipe = function( f ) local args = f:getParent.args local out = {} for i, _ in ipairs( args ) do		table.insert( out, args[i] ) end

return mw.text.trim( table.concat( out, '|' ) ) end

p.special = function( id ) local newID

-- Make patterned banners display their pattern as a description, and the title "Banner" if id:gsub( '^Light ',  ):gsub( '^%a- ',  ):find( ' Banner$' ) then newID = '[Banner]' .. id .. '[&7' .. id:gsub( ' Banner$', '' ) .. ']'

-- Make damaged items contain the original name elseif id:find( '^Damaged ' ) then newID = '[' .. id:gsub( '^Damaged ', '' ) .. ']' .. id

-- Make music discs display their name as a description, and the title "Music Disc" elseif id:find( ' Disc$' ) then newID = '[&bMusic Disc]' .. id .. '[&7C418 - ' .. id:gsub( ' Disc$', '' ) .. ']'	end

return newID end

function p.cell( f ) local args = f.args or f	if f == mw.getCurrentFrame and args[1] == nil then args = f:getParent.args end -- added for sandboxing local grid = require( Module:Grid ) args[1] = mw.text.trim( args[1] or '' ) -- Comment this next line out if you're not using aliases local aliases = mw.loadData( 'Module:Grid/Aliases' )

-- Simply add this line to enable special aliases, replacing "p.special" with "require( 'Module:Grid/SpecialAliases' )" local specialAliases = p.special local modAliases = args.modaliases or '' if modAliases ~= '' then modAliases = mw.loadData( 'Module:' .. modAliases ) else modAliases = nil end if aliases or specialAliases or modAliases then local frames = {} for frame in mw.text.gsplit( args[1], '%s*;%s*' ) do			local frameParts = grid.getParts( frame, args.mod ) local id = frameParts.name if frameParts.mod then id = frameParts.mod .. ':' .. id			end local alias if modAliases and modAliases[id] then alias = modAliases[id] elseif aliases and aliases[id] then alias = aliases[id] elseif specialAliases and specialAliases( id ) then -- Also requires this line and the next alias = specialAliases( id ) end if alias then table.insert( frames, grid.expandAlias( frameParts, alias ) ) else table.insert( frames, frame ) end end args[1] = table.concat( frames, ';' ) end local animated = args[1]:find( ';' ) local pageName = mw.title.getCurrentTitle.subpageText local class = args.class or '' local imgClass = args.imgclass or '' local style = args.style or '' local align = args.align or '' local numStyle = args.numstyle or '' local cell = {} for frame in mw.text.gsplit( args[1], '%s*;%s*' ) do		if frame == '' then if animated then table.insert( cell, ' ' ) else table.insert( cell, ' ' ) end else local parts = grid.getParts( frame, args.mod ) local tooltipTitle = parts.title local mod = parts.mod local name = parts.name local num = parts.num local tooltipDesc = parts.text local img if mod then img = name .. ' (' .. mod .. ')' else img = name end local link = args.link or '' if link == '' then if name == pageName then link = 'none' elseif mod then link = 'Mods/' .. mod .. '/' .. name else link = name end end local title = args.title or '' if title == '' then if tooltipTitle then title = tooltipTitle:gsub( '&[0-9a-fk-or]', '' ) end if mw.text.trim( title ) ==  or link:lower == 'none' or link ~= name:gsub( '%s%(.*',  ) then					title = name				end			end			if not tooltipTitle and title:lower == 'none' then				tooltipTitle = 0			end			local alt = img			if title:lower ~= 'none' then				alt = title			end			if link:lower == 'none' then				link = 			end			if title:lower == 'none' then				title = 			end			local tooltip = 			if tooltipTitle then				tooltip = ' data-minetip-title="' .. tooltipTitle .. '"'			end			if tooltipDesc then				tooltip = tooltip .. ' data-minetip-text="' .. tooltipDesc .. '"'			end			local image = {				' ',					,				' ',			}			image[1] = image[1]:gsub( ' title=""',  )			image[2] = image[2]:gsub( '||', '|' )			if num and num > 1 and num < 1000 then				if link ~=  then					num =  .. num .. 				end				if numStyle ~= '' then					numStyle = ' style="' .. numStyle .. '"'				end				table.insert( image, 3, ' ' .. num .. ' ' )			end			table.insert( cell, table.concat( image,  ) )		end	end	if animated then		cell[1] = cell[1]:gsub( 'class="item', 'class="item active' )		class = 'animated ' .. class	end	local styles = {}	if align ~=  then		table.insert( styles, 'vertical-align:' .. align )	end	if style ~= '' then		table.insert( styles, style )	end	if #styles > 0 then		styles = ' style="' .. table.concat( styles, ';' ) .. '"'	else		styles = 	end	local html = {		' ',			table.concat( cell,  ),		' '	}	if ( args.default or  ) ~=  then		local defaultClass = 		if animated then			defaultClass = ' skip'		end		table.insert( html, 2, ' ' )	end	html = table.concat( html,  ):gsub( ' "', '"' )	return html end return p