Template:Key press/doc: Difference between revisions

Completed correcting page
m 1 revision imported
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
__NOTOC__
{{Documentation subpage}}
{{Uses TemplateStyles|Template:Key press/styles.css}}
<!-- PLEASE ADD CATEGORIES WHERE INDICATED AT THE END OF THIS PAGE. -->


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.
This is the {{tl|key press}} template primarily designed to illustrate keys and keystrokes on a 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}}
: {{tlc|key press|A}} → {{key press|A}}
As lower-case alphabetic characters a–z do not appear on most keyboards, they should not be used as parameters.


===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}}
: {{tlc|key press|Alt|P}} → {{key press|Alt|P}}
: <code><nowiki>{{key press|Ctrl|Alt|Del}}</nowiki></code> → {{key press|Ctrl|Alt|Del}}
: {{tlc|key press|Ctrl|Alt|Del}} → {{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 that might cause items to be too wide. 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}}
: {{tlc|key press|Ctrl}} + {{tlc|key press|Alt}} + {{tlc|key press|Del}} → {{key press|Ctrl}} + {{key press|Alt}} + {{key press|Del}}
: <code><nowiki>{{key press|Ctrl|Alt|Del|5=chain=&amp;#32;+&amp;#32;}}</nowiki></code> → {{key press|Ctrl|Alt|Del|chain=&#32;+&#32;}}
: {{tlc|key press|Ctrl|Alt|Del|5=chain=&amp;#32;+&amp;#32;}} → {{key press|Ctrl|Alt|Del|chain=&#32;+&#32;}}


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]):
To illustrate sequences where all keys do not need to be pressed simultaneously, the plus signs can be omitted by setting ''chain=''. For example, in most Windows systems in North America and Western Europe, alt codes can be used to insert the plus-minus sign (±) by holding down the {{key press|Alt}} key while typing <code>0177</code> with the 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}}
: {{tlc|key press|Alt|0}}{{tlc|key press|1|7|7|chain{{=}}}} → {{key press|Alt|0}}{{key press|1|7|7|chain=}}


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}}
: {{tlc|Key press|Ctrl|Alt|Shift|Win|Menu|fn|L}} → {{Key press|Ctrl|Alt|Shift|Win|Menu|fn|L}}
 
===Wikilinks===
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|[https://en.wikipedia.org/wiki/Alt_key|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 [https://en.wikipedia.org/wiki/Wikipedia:Disambiguation_page disambiguation page]).


===Wiki markup characters===
===Wiki markup characters===
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] &amp;#124;, &amp;#59;, &amp;#61; respectively:
Some wiki markup characters, like the pipe symbol (|), the semicolon and the equals sign, need to be entered using the {{tlx|!}} and {{tlx|{{=}}}} templates or as an HTML entity &amp;#124;, &amp;#59;, &amp;#61; respectively:
* <code><nowiki>{{key press|{{pipe}}}}</nowiki></code> → {{key press|{{pipe}}}}
* {{tlc|key press|{{tlc|!}}}} → {{key press|{{!}}}}
* <code><nowiki>{{key press|&amp;#124;}}</nowiki></code> → {{key press|&#124;}}
* {{tlc|key press|&amp;#124;}} → {{key press|&#124;}}
* <code><nowiki>{{key press|{{&#59;}}}}</nowiki></code> → {{key press|{{;}}}}
* {{tlc|key press|&amp;#59;}} →  {{key press|&#59;}}
* <code><nowiki>{{key press|&amp;#59;}}</nowiki></code> →  {{key press|&#59;}}
* {{tlc|key press|{{tlc|&#61;}}}} → {{key press|{{=}}}}
* <code><nowiki>{{key press|{{&#61;}}}}</nowiki></code> → {{key press|{{=}}}}
* {{tlc|key press|&amp;#61;}} →  {{key press|&#61;}}
* <code><nowiki>{{key press|&amp;#61;}}</nowiki></code> →  {{key press|&#61;}}
 
However, if the characters are marked as wikilinks, they can be entered as such:
* <code><nowiki>{{key press|[[&#124;]]}}</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}}
* {{tlc|key press|pipe}} → {{key press|pipe}}
* <code><nowiki>{{key press|semicolon}}</nowiki></code> → {{key press|semicolon}}
* {{tlc|key press|semicolon}} → {{key press|semicolon}}
* <code><nowiki>{{key press|equals}}</nowiki></code> → {{key press|equals}}
* {{tlc|key press|equals}} → {{key press|equals}}
* <code><nowiki>{{key press|colon}}</nowiki></code> → {{key press|colon}}
* {{tlc|key press|colon}} → {{key press|colon}}
* <code><nowiki>{{key press|asterisk}}</nowiki></code> → {{key press|asterisk}}
* {{tlc|key press|asterisk}} → {{key press|asterisk}}
* <code><nowiki>{{key press|hash}}</nowiki></code> → {{key press|hash}}
* {{tlc|key press|hash}} → {{key press|hash}}


===Key symbols===
===Key symbols===
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.
Some key names have a fitting 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}}
* {{tlc|key press|Shift}} → {{key press|Shift}}
* <code><nowiki>{{key press|Enter}}</nowiki></code> → {{key press|Enter}}
* {{tlc|key press|Tab}} → {{key press|Tab}}
* <code><nowiki>{{key press|Option}}</nowiki></code> → {{key press|Option}}
* {{tlc|key press|Enter}} → {{key press|Enter}}
* <code><nowiki>{{key press|Opt}}</nowiki></code> → {{key press|Opt}}
* {{tlc|key press|Option}} → {{key press|Option}}
* <code><nowiki>{{key press|Command}}</nowiki></code> → {{key press|Command}}
* {{tlc|key press|Opt}} → {{key press|Opt}}
* <code><nowiki>{{key press|Cmd}}</nowiki></code> → {{key press|Cmd}}
* {{tlc|key press|⌥}} → {{key press|⌥}}
* <code><nowiki>{{key press|Caps Lock}}</nowiki></code> → {{key press|Caps Lock}}
* {{tlc|key press|Ctrlm}} → {{key press|Ctrlm}} as it appears on Mac with <code>⌃</code>.
* <code><nowiki>{{key press|Scroll Lock}}</nowiki></code> → {{key press|Scroll Lock}}
* {{tlc|key press|controlm}} → {{key press|controlm}}
* <code><nowiki>{{key press|Up}}</nowiki></code> → {{key press|Up}}
* {{tlc|key press|⌃}} → {{key press|⌃}}
* <code><nowiki>{{key press|Down}}</nowiki></code> → {{key press|Down}}
* {{tlc|key press|Alt}} → {{key press|Alt}}
* <code><nowiki>{{key press|Left}}</nowiki></code> → {{key press|Left}}
* {{tlc|key press|Command}} → {{key press|Command}}
* <code><nowiki>{{key press|Right}}</nowiki></code> → {{key press|Right}}
* {{tlc|key press|Cmd}} → {{key press|Cmd}}
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:
* {{tlc|key press|Caps Lock}} → {{key press|Caps Lock}}
* <code><nowiki>{{key press|Win}}</nowiki></code> → {{key press|Win}}
* {{tlc|key press|Up}} → {{key press|Up}}
* <code><nowiki>{{key press|Menu}}</nowiki></code> → {{key press|Menu}}
* {{tlc|key press|Down}} → {{key press|Down}}
* {{tlc|key press|Left}} → {{key press|Left}}
* {{tlc|key press|Right}} → {{key press|Right}}
[[File:AltGr Win Menu Ctrl key.jpg|thumb|200px|Windows key and Menu key]]
[[File:Ctl wndws alt.jpg|thumb|200px|Old-style Windows key]]
There are no characters for the Windows key and Menu key. So this template shows approximate characters for them, namely the SQUARED PLUS and STRICTLY EQUIVALENT TO from the Mathematical Operators Unicode block:
* {{tlc|key press|Win}} → {{key press|Win}}
* {{tlc|key press|Menu}} → {{key press|Menu}}


====Video games====
====Video games====
Line 73: Line 71:
=====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}}
* {{tlc|key press|l-down}} → {{key press|l-down}}
* <code><nowiki>{{key press|c-left}}</nowiki></code> → {{key press|c-left}}
* {{tlc|key press|c-left}} → {{key press|c-left}}
* <code><nowiki>{{key press|r-up}}</nowiki></code> → {{key press|r-up}}
* {{tlc|key press|r-up}} → {{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}}
* {{tlc|key press|l-nw}} → {{key press|l-nw}}
* <code><nowiki>{{key press|c-se}}</nowiki></code> → {{key press|c-se}}
* {{tlc|key press|c-se}} → {{key press|c-se}}
* <code><nowiki>{{key press|r-ne}}</nowiki></code> → {{key press|r-ne}}
* {{tlc|key press|r-ne}} → {{key press|r-ne}}


=====PlayStation=====
=====PlayStation=====
* <code><nowiki>{{key press|ex}}</nowiki></code> → {{key press|ex}}
* {{tlc|key press|ex}} → {{key press|ex}}
* <code><nowiki>{{key press|circle}}</nowiki></code> → {{key press|circle}}
* {{tlc|key press|circle}} → {{key press|circle}}
* <code><nowiki>{{key press|triangle}}</nowiki></code> → {{key press|triangle}}
* {{tlc|key press|triangle}} → {{key press|triangle}}
* <code><nowiki>{{key press|square}}</nowiki></code> → {{key press|square}}
* {{tlc|key press|square}} → {{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.
{{TemplateDataHeader}}
====TemplateData for Key press====
<templatedata>
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.
{
"description": {
"en": "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.",
"cs": "Ilustruje klávesy a úhozy na klávesnici počítače. Klávesy mohou zahrnovat: Ctrl, Alt, Del, Opt, Menu, Left atd. klávesy konzoly: ex, kruh, trojúhelník, čtverec a levá pravá a středová analogová páčka: l-dolů, c-left, r-ne. Jména nerozlišují malá a velká písmena."
},
"params": {
"1": {
"label": {
"en": "First key",
"cs": "První klávesa"
},
"description": {
"en": "First key",
"cs": "První klávesa"
},
"type": "string/line",
"required": true
},
"2": {
"label": {
"en": "Second key",
"cs": "Druhá klávesa"
},
"description": {
"en": "Optional key press in combination as the first.",
"cs": "Volitelné stisknutí klávesy v kombinaci jako u první."
},
"type": "string/line",
"required": false
},
"3": {
"label": {
"en": "Third key",
"cs": "Třetí klávesa"
},
"inherits": "2"
},
"4": {
"label": {
"en": "Fourth key",
"cs": "Čtvrtá klávesa"
},
"inherits": "2"
},
"5": {
"label": {
"en": "Fifth key",
"cs": "Pátá klávesa"
},
"inherits": "2"
},
"6": {
"label": {
"en": "Sixth key",
"cs": "Šestá klávesa"
},
"inherits": "2"
},
"7": {
"label": {
"en": "Seventh key",
"cs": "Sedmá klávesa"
},
"inherits": "2"
},
"8": {
"label": {
"en": "Eighth key",
"cs": "Osmá klávesa"
},
"inherits": "2"
},
"9": {
"label": {
"en": "Ninth key",
"cs": "Devátá klávesa"
},
"inherits": "2"
},
"10": {
"label": {
"en": "Tenth key",
"cs": "Desátá klávesa"
},
"inherits": "2"
},
"chain": {
"label": {
"en": "Chaining character",
"cs": "Řetězcový znak"
},
"description": {
"en": "Character between chained key presses",
"cs": "Znaky mezi současně stisknutými klávesami"
},
"default": "+",
"inherits": "2"
},
"chain first": {
"description": {
"en": "Character between first and second key to press",
"cs": "Znak mezi první a druhou stisknutou klávesou"
},
"inherits": "chain"
},
"chain second": {
"description": {
"en": "Character between second and third key to press",
"cs": "Znak mezi druhou a třetí stisknutou klávesou"
},
"inherits": "chain"
},
"chain third": {
"description": {
"en": "Character between third and fourth key to press",
"cs": "Znak mezi třetí a čtvrtou stisknutou klávesou"
},
"inherits": "chain"
},
"chain fourth": {
"description": {
"en": "Character between fourth and fifth key to press",
"cs": "Znak mezi čtvrtou a pátou stisknutou klávesou"
},
"inherits": "chain"
}
}
}
</templatedata>


{| class="wikitable"
===See also===
!scope="col" colspan="2"|Parameter
* {{tlx|Button}} – produces a similar visual effect but without the semantic markup (e.g. {{Button|sample text}}); more for representing interface elements.)
!scope="col"|Description
* {{tlx|Kbd}} – to indicate user input (of any kind) without making it look like keys or buttons
!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===
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox||
* <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>).
<!-- CATEGORY LINKS BELOW THIS LINE, PLEASE: -->
* <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.
[[Category:Semantic markup templates]]
* <code><nowiki>{{Playstation key press}}</nowiki></code> – to simulate gamepad buttons (e.g. <code><nowiki>{{Playstation key press|s}}</nowiki></code>).
}}</includeonly>
* <code><nowiki>{{Kbd}}</nowiki></code> – to indicate user input (of any kind) without making it look like keys or buttons.