Template:Keypress/doc

This is an old revision of Template:Keypress/doc, edited by Ggeldenhuys at . The current revision is 64436.

new keypress template documentation

Template:Documentation subpage

This is the {{keypress}} template.

It can be used to illustrate keystrokes.

Example:

`` produces A

If there is an article about the key you can wikilink the key's name like any other wiki text. Like this:

`` produces Alt

To illustrate keystroke combinations, just use extra parameters:

`` produces Alt+P

`` produces Ctrl+Alt+Del

Key symbols

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

`` produces Shift

`` produces Enter

`` produces Cmd

`` produces Opt

`` produces Tab

`` produces Backspace

`` produces Up

`` produces Down

`` produces Left

`` produces Right

Windows key Menu key We have no characters for the Windows key and menu key. And we perhaps can't add icons for them for copyright reasons. So we usually show them as text only. Like this:

or produces Win or Win key

`` produces Menu

<div style="clear: both;">

Technical details

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:

+ + 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:Wikipedia 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

Computing templates Graphic templates

de:Vorlage:Taste es:Plantilla:Tecla eo:Ŝablono:Klavo fr:Modèle:Touche ko:틀:키눌림 hsb:Předłoha:Tasta hu:Sablon:Billentyű ja:Template:Keypress pt:Predefinição:Tecla ru:Шаблон:Клавиша vi:Tiêu bản:Keypress