Template:Keypress/doc: Difference between revisions

From Vintage Story Wiki
haha get fucked extra params
(created)
 
(haha get fucked extra params)
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
<languages />
<languages />
<translate>
<translate>
This template allows users to use in-line "keypress" formatting, for demonstrating which keyboard key(s) a user should press. There is currently no special key for mouse clicks.
<!--T:1-->
This template allows users to use in-line "keypress" formatting, for demonstrating which keyboard key(s) a user should press. There is currently no special key for mouse clicks. The CSS and overall style is taken from [https://en.wikipedia.org/wiki/Template:Key_press English Wikipedia's Key press template], albeit currently without the Lua module.


== Usage ==
== Usage == <!--T:2-->


At its most basic, the template can be used for regular keys by inserting the following: <code><nowiki>{{Keypress|W}}</nowiki></code>. The first parameter is the display text. The template takes two optional parameters, keyID and keyClass.
<!--T:3-->
The template can be used for regular keys by inserting the following: <code><nowiki>{{Keypress|W}}</nowiki></code>. The first parameter is the display text.  
<pre>
<pre>
{{Keypress
{{Keypress
|Display text (must be first!)
|Display text (must be first!)
|keyID= the element ID. Optional
|keyClass= the element class, without the "key " prefix. Optional
}}</pre>
}}</pre>


=== Parameters ===
=== Parameters === <!--T:4-->


<!--T:5-->
{| class="wikitable"
{| class="wikitable"
|-
|-
! Parameters !! Description !! Type !! Required
! Parameters !! Description !! Type !! Required
|-
|-
| 1 || The display text of the key. Will always display as uppercase. Must always be the '''first parameter'''! || any || yes
| 1 || The display text of the key. || any || yes
|-
| keyID || the element ID of the key, applies specific formatting to the background || css || no
|-
| keyClass || the element class of the key, applies specific formatting. ''Do not'' preface it with "key " || string || no
|}
|}


=== Examples ===
=== Examples === <!--T:6-->


<!--T:7-->
{| class="wikitable"
{| class="wikitable"
|-
|-
! Key type !! Template text !! Result !! Notes
! Key type !! Template text !! Result
|-
| Regular key || <code><nowiki>{{keypress|e}}</nowiki></code> || {{keypress|e}}
|-
|-
| Regular key || <code><nowiki>{{keypress|e}}</nowiki></code> || {{keypress|e}} || Background width is fixed
| Modifier (Shift, Ctrl, Alt) || <code><nowiki>{{keypress|CTRL}}</nowiki></code> || {{keypress|CTRL}}
|-
|-
| Modifier (Shift, Ctrl, Alt) || <code><nowiki>{{keypress|CTRL|keyID=control}}</nowiki></code> || {{keypress|CTRL|keyID=control}} || 
| Spacebar || <code><nowiki>{{keypress|Space}}</nowiki></code> || {{keypress|Space}}  
|-
|-
| Spacebar || <code><nowiki>{{keypress|Space|keyID=key-spacebar}}</nowiki></code> || {{keypress|Space|keyID=key-spacebar}} || Width is fixed
| Function keys (F1-12, Esc) || <code><nowiki>{{Keypress|F5}}</nowiki></code> || {{Keypress|F5}}
|-
|-
| Function keys (F1-12, Esc) || <code><nowiki>{{Keypress|fn|keyID=fn}}</nowiki></code><br/><code><nowiki>{{Keypress|fn|keyClass=key-fn}}</nowiki></code> || {{Keypress|fn|keyID=fn}}<br/>{{Keypress|fn|keyClass=key-fn}} || The '''keyClass''' method is flatter and wider than the top one.
| Arbitrary symbols and strings || <code><nowiki>{{keypress|⇧ Shift+⊞ Win+≣ Menu}}</nowiki></code>|| {{keypress|⇧ Shift+⊞ Win+≣ Menu}}
|}
|}
</translate>
</translate>
<!-- Template categories/interwikis here -->
<!-- Template categories/interwikis here -->
<!--e.g. [[Category:Notice templates]] or [[Category:Navbox templates]] or whatever-->
<!--e.g. [[Category:Notice templates]] or [[Category:Navbox templates]] or whatever--><includeonly>
[[Category:Template documentation]]
[[Category:Template documentation]]
[[Category:Formatting templates]]
[[Category:Formatting templates]]</includeonly>
Confirmedusers, editor
2,831

edits