Wikia

WoWWiki

Keypress

Talk0
102,281pages on
this wiki

Template page

{{{1}}}

Description Edit

This is the {{keypress}} template.

It can be used to illustrate keystrokes.

Example:

{{keypress|A}} produces A

To illustrate keystroke combinations, just use extra parameters:

{{keypress|Alt|P}} produces Alt+P
{{keypress|Ctrl|Alt|Del}} produces Ctrl+Alt+Del

Key symbols Edit

Some key names have a fitting unicode character. This template automatically adds such "icons" to the following key names:

{{keypress|Shift}} produces ⇧ Shift
{{keypress|Enter}} produces ↵ Enter
{{keypress|Cmd}} produces ⌘ Cmd
{{keypress|Opt}} produces ⌥ Opt
{{keypress|Tab}} produces Tab ⇆
{{keypress|Backspace}} produces ← Backspace
{{keypress|Up}} produces
{{keypress|Down}} produces
{{keypress|Left}} produces
{{keypress|Right}} produces

We have no characters for the Windows key and menu key. And we perhaps can't add the "real" icons for them for copyright reasons. So we usually show them the following way:

{{keypress|Win}} or {{keypress|Win key}} produces ⊞ Win or Win key
{{keypress|Menu}} produces Menu

Technical details Edit

When you feed several key names to this template, it adds a "+" with no spaces around. This means it won't line wrap. But when you show key combinations for instance in a table then that might cause too wide items. Then instead manually build the key combination with spaces around the "+" so it can line wrap. Like this:

{{keypress|Ctrl}} + {{keypress|Alt}} + {{keypress|Del}} produces Ctrl + Alt + Del

This template currently handles up to 5 key name parameters. If it gets too many key name parameters it reports the page into Category:Keypress template parameter needs fixing. This means we can easily find those pages and fix them, or we can discover if we need to make this template take more parameters.

This template calls {{keypress/core}}, which holds the code that otherwise would be repeated several times in {{keypress}}, thus simplifying the code.

See also Edit

Around Wikia's network

Random Wiki