Template:Hotkey/doc

From Miranda NG
Jump to navigation Jump to search

This is a documentation subpage for Template:Hotkey .
It contains usage information, categories and other content that is not part of the original template page.

Todo: finish

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}}A

Usage

Keystroke combinations

To illustrate keystroke combinations, just use extra parameters:

{{Hotkey|Alt|P}}Alt+P
{{Hotkey|Ctrl|Alt|Del}}Ctrl+Alt+Del

This template has no limit of the key name parameters.


Todo: add line wrap ability

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}}Ctrl + Alt + Del

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}}Alt+0177

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}}Ctrl+Alt+⇧ Shift+⊞ Win+≣ Menu+fn+L

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|{{!}}}}|
  • {{Hotkey|{{=}}}}=

But they can also be displayed using the aliases:

  • {{Hotkey|pipe}}|
  • {{Hotkey|equals}}=

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}}⇧ Shift
  • {{Hotkey|Tab}}Tab ↹
  • {{Hotkey|Enter}}↵ Enter
  • {{Hotkey|Option}}⌥ Option
  • {{Hotkey|Opt}}⌥ Opt
  • {{Hotkey|Command}}⌘ Command
  • {{Hotkey|Cmd}}⌘ Cmd
  • {{Hotkey|Caps Lock}}⇪ Caps Lock
  • {{Hotkey|Up}}
  • {{Hotkey|Down}}
  • {{Hotkey|Left}}
  • {{Hotkey|Right}}

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}}⊞ Win
  • {{Hotkey|Menu}}≣ Menu

Mouse key symbols

Mouse keys and mouse wheel can be displayed using the appropriate names:

  • {{Hotkey|LMB}}LMB Mouse-LMB.png
  • {{Hotkey|MMB}}MMB Mouse-MMB.png
  • {{Hotkey|RMB}}RMB Mouse-RMB.png
  • {{Hotkey|WheelUp}}WheelUp Mouse-MWUP.png
  • {{Hotkey|WheelDown}}WheelDown Mouse-MWD.png
  • {{Hotkey|Wheel}}Wheel Mouse-MW.png

You can also show a double clicks:

  • {{Hotkey|2xLMB}}2× LMB Mouse-LMB.png
  • {{Hotkey|2xMMB}}2× MMB Mouse-MMB.png
  • {{Hotkey|2xRMB}}2× RMB Mouse-RMB.png

Language support

Todo:

The template also supports lang parameter which overrides {{PageLang}}, e.g. on page with {{PageLang|de}} {{Hotkey|Ctrl|A}} will produce Strg+A and {{Hotkey|lang=en|Ctrl|A}} will display Ctrl+A.

Technical details

Todo:

See also

Todo: