Template:Hotkey: Difference between revisions
(doc (ru) copy) |
(lua version) |
||
Line 1: | Line 1: | ||
<includeonly> | <includeonly>{{#invoke:Keys|keys}}</includeonly><noinclude> | ||
{{Documentation}} | {{Documentation}} | ||
[[Category:Formatting and function templates]] | [[Category:Formatting and function templates]] | ||
</noinclude> | </noinclude> |
Revision as of 14:44, 28 November 2015
Uses Lua: |
This is the {{Hotkey}} 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.
Example
{{Hotkey|A}}
→ Script error: The function "keys" does not exist.
Usage
Keystroke combinations
To illustrate keystroke combinations, just use extra parameters:
{{Hotkey|Alt|P}}
→ Script error: The function "keys" does not exist.{{Hotkey|Ctrl|Alt|Del}}
→ Script error: The function "keys" does not exist.
This template has no limit of the key name parameters.
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:
{{Hotkey|Ctrl}}
+{{Hotkey|Alt}}
+{{Hotkey|Del}}
→ Script error: The function "keys" does not exist. + Script error: The function "keys" does not exist. + Script error: The function "keys" does not exist.
On the other hand, to illustrate Windows Alt codes 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 plus-minus sign (±) can be entered by holding down the Alt key while typing 0177
(with the numeric keypad):
{{Hotkey|Alt|0}}
{{Hotkey|1}}
{{Hotkey|7}}
{{Hotkey|7}}
→ Script error: The function "keys" does not exist.Script error: The function "keys" does not exist.Script error: The function "keys" does not exist.Script error: The function "keys" does not exist.
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:
{{Hotkey|Ctrl|Alt|Shift|Win|Menu|fn|L}}
→ Script error: The function "keys" does not exist.
Wiki markup characters
Only two wiki markup character, pipe symbol and the equals sign, need to be entered using the {{!}} and {{=}} templates to be dispayed correctly:
{{Hotkey|{{!}}}}
→ Script error: The function "keys" does not exist.{{Hotkey|{{=}}}}
→ Script error: The function "keys" does not exist.
But they can also be displayed using the aliases:
{{Hotkey|pipe}}
→ Script error: The function "keys" does not exist.{{Hotkey|equals}}
→ Script error: The function "keys" does not exist.
Key symbols
Some key names have a fitting Unicode character. This template automatically adds such "icons" to the following key names among others.
List of all supported key symbols can be found at Module:Keys/Symbols.
{{Hotkey|Shift}}
→ Script error: The function "keys" does not exist.{{Hotkey|Tab}}
→ Script error: The function "keys" does not exist.{{Hotkey|Enter}}
→ Script error: The function "keys" does not exist.{{Hotkey|Option}}
→ Script error: The function "keys" does not exist.{{Hotkey|Opt}}
→ Script error: The function "keys" does not exist.{{Hotkey|Command}}
→ Script error: The function "keys" does not exist.{{Hotkey|Cmd}}
→ Script error: The function "keys" does not exist.{{Hotkey|Caps Lock}}
→ Script error: The function "keys" does not exist.{{Hotkey|Up}}
→ Script error: The function "keys" does not exist.{{Hotkey|Down}}
→ Script error: The function "keys" does not exist.{{Hotkey|Left}}
→ Script error: The function "keys" does not exist.{{Hotkey|Right}}
→ Script error: The function "keys" does not exist.
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 block:
{{Hotkey|Win}}
→ Script error: The function "keys" does not exist.{{Hotkey|Menu}}
→ Script error: The function "keys" does not exist.
Mouse key symbols
Mouse keys and mouse wheel can be displayed using the appropriate names:
{{Hotkey|LMB}}
→ Script error: The function "keys" does not exist.{{Hotkey|MMB}}
→ Script error: The function "keys" does not exist.{{Hotkey|RMB}}
→ Script error: The function "keys" does not exist.{{Hotkey|WheelUp}}
→ Script error: The function "keys" does not exist.{{Hotkey|WheelDown}}
→ Script error: The function "keys" does not exist.{{Hotkey|Wheel}}
→ Script error: The function "keys" does not exist.
You can also show a double clicks:
{{Hotkey|2xLMB}}
→ Script error: The function "keys" does not exist.{{Hotkey|2xMMB}}
→ Script error: The function "keys" does not exist.{{Hotkey|2xRMB}}
→ Script error: The function "keys" does not exist.
Language support
Todo:
The template also supports lang parameter which overrides {{PageLang}}
, e.g. on page with {{PageLang|de}}
{{Hotkey|Ctrl|A}}
will produce Script error: The function "keys" does not exist. and {{Hotkey|lang=en|Ctrl|A}}
will display Script error: The function "keys" does not exist..
Technical details
Todo:
See also
Todo:
The above documentation is transcluded from Template:Hotkey/doc. (edit | history) Editors can experiment in this template's sandbox (edit | diff) and testcases (edit) pages. Please add categories to the /doc subpage. Subpages of this template. |