Template:Key press/doc: Difference between revisions
m 1 revision imported |
m →Wikilinks: Corrected Alt key |
||
| (3 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
This is the {{ | This is the <code><nowiki>{{key press}}</nowiki></code> template primarily designed to illustrate keys and keystrokes on a [https://en.wikipedia.org/wiki/Keyboard_technology computer keyboard]. With additional parameters, a single template can even illustrate a combination of multiple ''simultaneous'' keystrokes. A sequence of keystrokes, on the other hand, need to be demonstrated with separate templates. | ||
Example | Example | ||
: {{ | : <code><nowiki>{{key press|A}}</nowiki></code> → {{key press|A}} | ||
===Keystroke combinations=== | ===Keystroke combinations=== | ||
To illustrate keystroke combinations, just use extra parameters: | To illustrate keystroke combinations, just use extra parameters: | ||
: {{ | : <code><nowiki>{{key press|Alt|P}}</nowiki></code> → {{key press|Alt|P}} | ||
: {{ | : <code><nowiki>{{key press|Ctrl|Alt|Del}}</nowiki></code> → {{key press|Ctrl|Alt|Del}} | ||
When you feed several key names to this template, it adds a "+" (or whatever the contents of the optional ''chain'' parameter) 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: | When you feed several key names to this template, it adds a "+" (or whatever the contents of the optional ''chain'' parameter) 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: | ||
: {{ | : <code><nowiki>{{key press|Ctrl}}</nowiki></code> + <code><nowiki>{{key press|Alt}}</nowiki></code> + <code><nowiki>{{key press|Del}}</nowiki></code> → {{key press|Ctrl}} + {{key press|Alt}} + {{key press|Del}} | ||
: {{ | : <code><nowiki>{{key press|Ctrl|Alt|Del|5=chain=&#32;+&#32;}}</nowiki></code> → {{key press|Ctrl|Alt|Del|chain= + }} | ||
On the other hand, to illustrate Windows [ | On the other hand, to illustrate Windows [https://en.wikipedia.org/wiki/Alt_code Alt code]s you might want to use separate templates with no intervening punctuation or space. In most Windows systems in North America and Western Europe, for example, the [https://en.wikipedia.org/wiki/Plus%E2%80%93minus_sign plus-minus sign] (±) can be entered by holding down the Alt key while typing <code>0177</code> (with the [https://en.wikipedia.org/wiki/Numeric_keypad numeric keypad]): | ||
: {{ | : <code><nowiki>{{key press|Alt|0}}{{key press|1}}{{key press|7}}{{key press|7}}</nowiki></code> → {{key press|Alt|0}}{{key press|1}}{{key press|7}}{{key press|7}} | ||
An example of a use case where more than 5 might be used is explaining usage of a macro (keyboard shortcut) created by a third-party application: | An example of a use case where more than 5 might be used is explaining usage of a macro (keyboard shortcut) created by a third-party application: | ||
: {{ | : <code><nowiki>{{Key press|Ctrl|Alt|Shift|Win|Menu|fn|L}}</nowiki></code> → {{Key press|Ctrl|Alt|Shift|Win|Menu|fn|L}} | ||
===Wikilinks=== | ===Wikilinks=== | ||
If there is an article about the key you can [ | If there is an article about the key you can [https://en.wikipedia.org/wiki/Wikipedia:Wikilink wikilink] the key's name like any other wiki text. Like this: | ||
* {{ | * <code><nowiki>{{key press|[[https://en.wikipedia.org/wiki/Alt_key|Alt]]}}</nowiki></code> → {{key press|Alt}} | ||
If you are wikilinking the keys, please ensure that you are piping to the correct page (e.g. <code><nowiki>[[Control key|Ctrl]]</nowiki></code> instead of <code><nowiki>[[Ctrl]]</nowiki></code>, which leads to a [ | If you are wikilinking the keys, please ensure that you are piping to the correct page (e.g. <code><nowiki>[[Control key|Ctrl]]</nowiki></code> instead of <code><nowiki>[[Ctrl]]</nowiki></code>, which leads to a [https://en.wikipedia.org/wiki/Wikipedia:Disambiguation_page disambiguation page]). | ||
===Wiki markup characters=== | ===Wiki markup characters=== | ||
Some wiki markup characters, like the [ | Some wiki markup characters, like the [https://en.wikipedia.org/wiki/Pipe_symbol pipe symbol], the [https://en.wikipedia.org/wiki/Semicolon semicolon] and the [https://en.wikipedia.org/wiki/Equals_sign equals sign], need to be entered using the <code><nowiki>{{!}}</nowiki></code>, <code><nowiki>{{;}}</nowiki></code> and <code><nowiki>{{=}}</nowiki></code> templates or as an [https://en.wikipedia.org/wiki/HTML_entity HTML entity] &#124;, &#59;, &#61; respectively: | ||
* {{ | * <code><nowiki>{{key press|{{pipe}}}}</nowiki></code> → {{key press|{{pipe}}}} | ||
* {{ | * <code><nowiki>{{key press|&#124;}}</nowiki></code> → {{key press||}} | ||
* {{ | * <code><nowiki>{{key press|{{;}}}}</nowiki></code> → {{key press|{{;}}}} | ||
* {{ | * <code><nowiki>{{key press|&#59;}}</nowiki></code> → {{key press|;}} | ||
* {{ | * <code><nowiki>{{key press|{{=}}}}</nowiki></code> → {{key press|{{=}}}} | ||
* {{ | * <code><nowiki>{{key press|&#61;}}</nowiki></code> → {{key press|=}} | ||
However, if the characters are marked as wikilinks, they can be entered as such: | However, if the characters are marked as wikilinks, they can be entered as such: | ||
* {{ | * <code><nowiki>{{key press|[[|]]}}</nowiki></code> → {{key press|}} | ||
* {{ | * <code><nowiki>{{key press|[[;]]}}</nowiki></code> → {{key press|[[;]]}} | ||
* {{ | * <code><nowiki>{{key press|[[=]]}}</nowiki></code> → {{key press|[[=]]}} | ||
Most markup characters also have aliases: | Most markup characters also have aliases: | ||
* {{ | * <code><nowiki>{{key press|pipe}}</nowiki></code> → {{key press|pipe}} | ||
* {{ | * <code><nowiki>{{key press|semicolon}}</nowiki></code> → {{key press|semicolon}} | ||
* {{ | * <code><nowiki>{{key press|equals}}</nowiki></code> → {{key press|equals}} | ||
* {{ | * <code><nowiki>{{key press|colon}}</nowiki></code> → {{key press|colon}} | ||
* {{ | * <code><nowiki>{{key press|asterisk}}</nowiki></code> → {{key press|asterisk}} | ||
* {{ | * <code><nowiki>{{key press|hash}}</nowiki></code> → {{key press|hash}} | ||
===Key symbols=== | ===Key symbols=== | ||
Some key names have a fitting [ | Some key names have a fitting [https://en.wikipedia.org/wiki/Unicode Unicode] character. This template automatically adds such "icons" to the following key names among others. | ||
* {{ | * <code><nowiki>{{key press|Shift}}</nowiki></code> → {{key press|Shift}} | ||
* {{ | * <code><nowiki>{{key press|Tab}}</nowiki></code> → {{key press|Tab}} | ||
* {{ | * <code><nowiki>{{key press|Enter}}</nowiki></code> → {{key press|Enter}} | ||
* {{ | * <code><nowiki>{{key press|Option}}</nowiki></code> → {{key press|Option}} | ||
* {{ | * <code><nowiki>{{key press|Opt}}</nowiki></code> → {{key press|Opt}} | ||
* {{ | * <code><nowiki>{{key press|Command}}</nowiki></code> → {{key press|Command}} | ||
* {{ | * <code><nowiki>{{key press|Cmd}}</nowiki></code> → {{key press|Cmd}} | ||
* {{ | * <code><nowiki>{{key press|Caps Lock}}</nowiki></code> → {{key press|Caps Lock}} | ||
* {{ | * <code><nowiki>{{key press|Scroll Lock}}</nowiki></code> → {{key press|Scroll Lock}} | ||
* {{ | * <code><nowiki>{{key press|Up}}</nowiki></code> → {{key press|Up}} | ||
* {{ | * <code><nowiki>{{key press|Down}}</nowiki></code> → {{key press|Down}} | ||
* {{ | * <code><nowiki>{{key press|Left}}</nowiki></code> → {{key press|Left}} | ||
* {{ | * <code><nowiki>{{key press|Right}}</nowiki></code> → {{key press|Right}} | ||
There are no characters for the [https://en.wikipedia.org/wiki/Windows_key|Windows key] and [https://en.wikipedia.org/wiki/Menu_key|Menu key]. So this template shows approximate characters for them, namely the {{sc2|SQUARED PLUS}} and {{sc2|STRICTLY EQUIVALENT TO}} from the [https://en.wikipedia.org/wiki/Mathematical_Operators|Mathematical Operators] Unicode block: | |||
* <code><nowiki>{{key press|Win}}</nowiki></code> → {{key press|Win}} | |||
There are no characters for the [ | * <code><nowiki>{{key press|Menu}}</nowiki></code> → {{key press|Menu}} | ||
* {{ | |||
* {{ | |||
====Video games==== | ====Video games==== | ||
| Line 79: | Line 73: | ||
=====Directional input===== | =====Directional input===== | ||
The following should only be used when the input sequence uses something other than the primary input or mixes input between directional devices. | The following should only be used when the input sequence uses something other than the primary input or mixes input between directional devices. | ||
* {{ | * <code><nowiki>{{key press|l-down}}</nowiki></code> → {{key press|l-down}} | ||
* {{ | * <code><nowiki>{{key press|c-left}}</nowiki></code> → {{key press|c-left}} | ||
* {{ | * <code><nowiki>{{key press|r-up}}</nowiki></code> → {{key press|r-up}} | ||
Stick specific diagonals are also supported: | Stick specific diagonals are also supported: | ||
* {{ | * <code><nowiki>{{key press|l-nw}}</nowiki></code> → {{key press|l-nw}} | ||
* {{ | * <code><nowiki>{{key press|c-se}}</nowiki></code> → {{key press|c-se}} | ||
* {{ | * <code><nowiki>{{key press|r-ne}}</nowiki></code> → {{key press|r-ne}} | ||
=====PlayStation===== | =====PlayStation===== | ||
* {{ | * <code><nowiki>{{key press|ex}}</nowiki></code> → {{key press|ex}} | ||
* {{ | * <code><nowiki>{{key press|circle}}</nowiki></code> → {{key press|circle}} | ||
* {{ | * <code><nowiki>{{key press|triangle}}</nowiki></code> → {{key press|triangle}} | ||
* {{ | * <code><nowiki>{{key press|square}}</nowiki></code> → {{key press|square}} | ||
{{clear}} | {{clear}} | ||
===TemplateData=== | ===TemplateData=== | ||
This is the TemplateData docuementation for this template used by VisualEditor and other tools; see the monthly parameter usage report for this template. | |||
====TemplateData for Key press==== | |||
Illustrates keys and keystrokes on a computer keyboard. Keys can include: Ctrl, Alt, Del, Opt, Menu, Left etc. console keys: ex, circle, triangle, square, and left right and center analog sticks: l-down, c-left, r-ne. The names are case insensitive. | |||
" | {| class="wikitable" | ||
" | !scope="col" colspan="2"|Parameter | ||
" | !scope="col"|Description | ||
" | !scope="col"|Type | ||
!scope="col"|Status | |||
|- | |||
!scope="col"|First key. | |||
" | |<code>1</code> | ||
|First key | |||
|Line | |||
|'''required''' | |||
" | |- | ||
!scope="col"|Second key | |||
|<code>2</code> | |||
|Optional key press in combination as the first. | |||
|Line | |||
|optional | |||
|- | |||
" | !scope="col"|Third key | ||
|<code>3</code> | |||
|Optional key press in combination as the first. | |||
|Line | |||
" | |optional | ||
|- | |||
!scope="col"|Fourth key | |||
|<code>4</code> | |||
" | |Optional key press in combination as the first. | ||
|Line | |||
|optional | |||
|- | |||
" | !scope="col"|Fifth key | ||
|<code>5</code> | |||
|Optional key press in combination as the first. | |||
|Line | |||
" | |optional | ||
|- | |||
!scope="col"|Sixth key | |||
|<code>6</code> | |||
" | |Optional key press in combination as the first. | ||
|Line | |||
|optional | |||
|- | |||
" | !scope="col"|Seventh key | ||
|<code>7</code> | |||
|Optional key press in combination as the first. | |||
|Line | |||
" | |optional | ||
|- | |||
!scope="col"|Eighth key | |||
|<code>8</code> | |||
|Optional key press in combination as the first. | |||
" | |Line | ||
|optional | |||
|- | |||
!scope="col"|Ninth key | |||
" | |<code>9</code> | ||
|Optional key press in combination as the first. | |||
|Line | |||
|optional | |||
" | |- | ||
!scope="col"|Tenth key | |||
|<code>10</code> | |||
|Optional key press in combination as the first. | |||
" | |Line | ||
|optional | |||
|- | |||
!scope="col"|Chaining character | |||
|<code>chain</code> | |||
} | |Character between chained key presses.<br>'''Default'''<br>+ | ||
|Line | |||
|optional | |||
|- | |||
!scope="col"|Chaining character | |||
|<code>10</code> | |||
|Character between first and second key press.<br>'''Default'''<br>+ | |||
|Line | |||
|optional | |||
|- | |||
!scope="col"|Chaining character | |||
|<code>10</code> | |||
|Character between second and third key press.<br>'''Default'''<br>+ | |||
|Line | |||
|optional | |||
|- | |||
!scope="col"|Chaining character | |||
|<code>10</code> | |||
|Character between third and fourth key press.<br>'''Default'''<br>+ | |||
|Line | |||
|optional | |||
|- | |||
!scope="col"|Chaining character | |||
|<code>10</code> | |||
|Character between fourth and fifth key press.<br>'''Default'''<br>+ | |||
|Line | |||
|optional | |||
|} | |||
===See also=== | ===See also=== | ||
* {{ | * <code><nowiki>{{Key top}}</nowiki></code> – produces a similar visual effect, but includes more symbols and does not directly support key combinations (e.g. <code><nowiki>{{key top|Caps Lock}}</nowiki></code>). | ||
* {{ | * <code><nowiki>{{Button}}</nowiki></code> – produces a similar visual effect but without the semantic markup (e.g. {{Button|sample text}}); more for representing interface elements. | ||
* {{ | * <code><nowiki>{{Playstation key press}}</nowiki></code> – to simulate gamepad buttons (e.g. <code><nowiki>{{Playstation key press|s}}</nowiki></code>). | ||
* {{ | * <code><nowiki>{{Kbd}}</nowiki></code> – to indicate user input (of any kind) without making it look like keys or buttons. | ||