-- <nowiki>
-- This template is based heavily on Wikipedia's Template:Key_press and Template:Key_press/core
local p = {}
function p.key_press( frame )
	local parameters = frame:getParent().args
	local chain = parameters['chain'] or '+'
	local key_presses = mw.html.create(""):done()
	key_presses:node(p._core(parameters[1] or ""))
	for i=2,10,1 do
		local key = parameters[i]
		if key then
	return tostring(key_presses)
-- Returns mw.html kbd
function p._core( pKey )
	local key = string.lower(pKey)
	local kbd = mw.html.create('kbd')
			["white-space"]		= "nowrap",
			["padding"]			= "1px 6px",
			["border"]			= "1px solid #CCC",
			["border-radius"]	= "3px",
			["box-shadow"]		= "0.1em 0.2em 0.2em rgba(0, 0, 0, 0.2)",
			["font-size"]		= "0.85em",
			["font-family"]		= "Arial,Helvetica,sans-serif"
	local function unicode( symbol ) return mw.html.create('span'):addClass('unicode'):wikitext(symbol):done() end
	local function firstLettersToUpper(str) return string.gsub(" "..str, "%W%l", string.upper):sub(2) end
	if     key == "caps lock"				then kbd:node(unicode("⇪")):wikitext(" Caps Lock")
	elseif key == "shift"					then kbd:node(unicode("⇧")):wikitext(" Shift")
	elseif key == "enter"					then kbd:node(unicode("↵")):wikitext(" Enter")
	elseif key == "cmd" or key == "command"	then kbd:node(unicode("⌘")):wikitext(" "..firstLettersToUpper(key))
	elseif key == "opt" or key == "option"	then kbd:node(unicode("⌥")):wikitext(" "..firstLettersToUpper(key))
	elseif key == "tab"						then kbd:wikitext("Tab "):node(unicode("↹"))
	elseif key == "backspace"				then kbd:wikitext("← Backspace")
	elseif key == "win"						then kbd:node(unicode("⊞")):wikitext(" Win")
	elseif key == "menu"					then kbd:node(unicode("≣")):wikitext(" Menu")
	elseif key == "up"						then kbd:wikitext("↑")
	elseif key == "down"					then kbd:wikitext("↓")
	elseif key == "left"					then kbd:wikitext("←")
	elseif key == "right"					then kbd:wikitext("→")
	elseif key == "*" or key == "asterisk"	then kbd:wikitext("*")
	elseif key == "#" or key == "hash"		then kbd:wikitext("#")
	elseif key == ":" or key == "colon"		then kbd:wikitext(":")
	elseif key == "pipe"					then kbd:wikitext("|")
	elseif key == ";" or key == "semicolon"	then kbd:wikitext(";")
	elseif key == "equals"					then kbd:wikitext("=")
	else									     kbd:wikitext(firstLettersToUpper(key))
	return kbd;
return p

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.