Minecraft Wiki
Advertisement
La versión para imprimir ya no se admite y puede contener errores de representación. Actualiza los marcadores del navegador y utiliza en su lugar la función de impresión predeterminada del navegador.
[Ver | Editar | Purgar]DocumentaciónVer código ↴

This module implements |tecla=.

The key symbols are kept at Módulo:Keys/Symbols.

[Ver | Editar | Purgar]La documentación arriba es transcluída desde Módulo:Keys/doc.
local p = {}
p.keys = function( f )
	local args = f
	if f == mw.getCurrentFrame() then
		args = f:getParent().args
	end
	local keys = {}
	
	for _, key in ipairs( args ) do
		key = mw.text.trim( key )
		if key ~= '+' and key:find( '%+' ) then
			local comboKeys = {}
			for comboKey in mw.text.gsplit( key, '%s*%+%s*' ) do
				table.insert( comboKeys, p.key( comboKey ) )
			end
			table.insert( keys, table.concat( comboKeys, ' + ' ) )
		else
			table.insert( keys, p.key( key ) )
		end
	end
	
	return table.concat( keys )
end

p.key = function( key )
	if key == '' then
		return ''
	end
	
	local symbols = mw.loadData( 'Módulo:Keys/Symbols' )
	return '<kbd class="key nowrap" style="' .. table.concat( {
		'background-color: #f8f9fa',
		'color: #222',
		'font-size: 80%',
		'font-family: inherit',
		'font-weight: bold',
		'border: 1px solid #c8ccd1',
		'border-radius: 2px',
		'box-shadow: 0 1px 0 rgba(0,0,0,0.2), 0 0 0 2px #fff inset',
		'padding: 0.1em 0.4em',
		'text-shadow: 0 1px 0 #fff',
		'text-align: center'
	}, ';' ) .. '">' .. ( symbols[key:lower()] or key ) .. '</kbd>'
end
return p
Advertisement