Template:Keypress

From OpenTTD
Jump to: navigation, search

{{{1}}}

Contents

Description

keypress renders a keyboard key and/or hotkey combination to better communicate the subject within a sentance. While enforcing a consistent appearance.
It also looks nice.

Usage

{{keypress/core|n1|n2|n3|n4|n5|6}}

n1-5
are optionally the key name(s).
  • this template enforces first letter capitalization and certain key names.
6
is optionally the alternative seperator string to use instead of '+'
  • This was changed from space/Sp because "avoiding the removal of whitespace while using a named parameter, is not possible."
  • Evidently the removal of whitespace while using an unnamed parameter is not possible.
    • use   for line breaking spaces, such as would be needed in tables, or lists.

{{keypress/core}} can be transcluded directly to use these other options:

back
is optionally the key colour
  • defaut is whitesmoke. border colour not variable.
font
is optionally the CSS font-style and font-variant, in that order.
  • default is small-caps. other variants include include {normal, inherit, small-caps}. inherit does not work with all browsers when specified.

Note: This has been made to use similar syntax to the wikipedia.org version, and is limited to five keys per combination.

Example

result code
Ctrl+Alt+Delete {{keypress|ctrl|alt|delete}}
Ctrl + Alt + Delete {{keypress|ctrl|alt|delete|6= + }}
Alt+F4 BkSp ← Backspace {{keypress/core|alt|back=red}}+{{keypress|f4|bksp|backspace||| }}
Notice.png

Note
This template uses {{Template:keypress/core}} to avoid repeating code.

external link

[1] (David Göthberg,Edokter,SMcCandish,et all.) from which this was adapted.

Personal tools