Difference between revisions of "Template:Keypress"

From MidrangeWiki
Jump to: navigation, search
 
m (attempt to add 2nd optional parameter)
Line 1: Line 1:
<span style="border:0.2em solid; border-color:#ddd #bbb #bbb #ddd; background:{{{2|#eee}}}; padding:0.1em 0.4em; font-size:0.8em; white-space:nowrap;">{{{1}}}</span><noinclude>
+
<span style="border:0.2em solid; border-color:#ddd #bbb #bbb #ddd; background:{{{2|#eee}}}; padding:0.1em 0.4em; font-size:0.8em; white-space:nowrap;">{{{1}}}</span>{{ #if:  {{{2|}}} |+<span style="border:0.2em solid; border-color:#ddd #bbb #bbb #ddd; background:{{{2|#eee}}}; padding:0.1em 0.4em; font-size:0.8em; white-space:nowrap;">{{{2}}}</span> | }}<noinclude>
 
{{{{FULLPAGENAME}}/doc}}
 
{{{{FULLPAGENAME}}/doc}}
 
<!-- Add cats and interwikis to the /doc subpage, not here! -->
 
<!-- Add cats and interwikis to the /doc subpage, not here! -->
 
</noinclude>
 
</noinclude>

Revision as of 19:36, 24 February 2008

{{{1}}}


The template documentation below is transcluded from Template:Keypress/doc [edit]

Documentation

{{keypress}} is a standard way to display one (1) to three (3) concurrent keyboard keystrokes, connected by the + sign if there are two or more parameters.

Parameters

  • Positional parameter 1 is required and can be a single letter or string
  • Positional parameters 2 and 3 are optional and can be single letters or strings
  • Named parameter background is optional and is in one of the following formats:
Six digit hex color code, including the leading # symbol
or
The text name of one of the sixteen colors of the HTML 4.01 specification HTML color names
{{keypress 
| letter(s) for first key box 
| (optional parameter) letter(s) for second key box
| (optional parameter) letter(s) for third key box
| (optional parameter) background=
}}

Arrows

Arrows can be placed inside the template by using the wikipedia:List_of_XML_and_HTML_character_entity_references as shown below. Due to wiki-substitution the leading & sign was not included in the "code" columns.

Description Single line Double line
code
(add leading &)
sample code
(add leading &)
sample
Right arrow rarr; rArr;
Left arrow larr; lArr;
Up arrow uarr; uArr;
Down arrow darr; dArr;
Horizontal arrow harr; hArr;

Examples

Code Result
Single parameter, single letter
{{keypress|A}}
A
Single parameter, multiple letters
{{keypress|Shift}}
Shift
Multiple parameter, multiple letters
{{keypress|Ctrl|Alt|Del}}
Ctrl+Alt+Del
Multiple parameter, multiple letters with background= parameter
{{keypress|Shift|F3|background=#FF00FF}}
Shift+F3
{{keypress|Shift|F3|background=aqua}}
Shift+F3