Template:Key press/doc: Difference between revisions

Started correcting documentation
Started correcting documentation
Line 4: Line 4:


Example
Example
: <nowiki>{{key press|A}}</nowiki> → {{key press|A}}
: <code><nowiki>{{key press|A}}</nowiki></code> → {{key press|A}}


===Keystroke combinations===
===Keystroke combinations===
To illustrate keystroke combinations, just use extra parameters:
To illustrate keystroke combinations, just use extra parameters:
: <nowiki>{{key press|Alt|P}}</nowiki> → {{key press|Alt|P}}
: <code><nowiki>{{key press|Alt|P}}</nowiki></code> → {{key press|Alt|P}}
: <nowiki>{{key press|Ctrl|Alt|Del}}</nowiki> → {{key press|Ctrl|Alt|Del}}
: <code><nowiki>{{key press|Ctrl|Alt|Del}}</nowiki></code> → {{key press|Ctrl|Alt|Del}}


When you feed several key names to this template, it adds a "+" (or whatever the contents of the optional ''chain'' parameter) 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:
When you feed several key names to this template, it adds a "+" (or whatever the contents of the optional ''chain'' parameter) 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:
: <nowiki>{{key press|Ctrl}}</nowiki> + <nowiki>{{key press|Alt}}</nowiki> + <nowiki>{{key press|Del}}</nowiki> → {{key press|Ctrl}} + {{key press|Alt}} + {{key press|Del}}
: <code><nowiki>{{key press|Ctrl}}</nowiki></code> + <code><nowiki>{{key press|Alt}}</nowiki></code> + <code><nowiki>{{key press|Del}}</nowiki></code> → {{key press|Ctrl}} + {{key press|Alt}} + {{key press|Del}}
: <nowiki>{{key press|Ctrl|Alt|Del|5=chain=&amp;#32;+&amp;#32;}}</nowiki> → {{key press|Ctrl|Alt|Del|chain=&#32;+&#32;}}
: <code><nowiki>{{key press|Ctrl|Alt|Del|5=chain=&amp;#32;+&amp;#32;}}</nowiki></code> → {{key press|Ctrl|Alt|Del|chain=&#32;+&#32;}}


On the other hand, to illustrate Windows [[Alt code]]s 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 <code>0177</code> (with the [[numeric keypad]]):
On the other hand, to illustrate Windows [[Alt code]]s 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 <code>0177</code> (with the [[numeric keypad]]):