Template:Shortcut compact/doc

From MOASSpedia
Jump to navigation Jump to search

{{Shortcut compact}} is a compact version of the {{shortcut}} template, for use in vertically-constrained locations, such as alongside list items.

It flows to the right of the page, displaying all the shortcuts in a single line of text.

Usage

Usage is similar to the {{shortcut}} template, see full documentation there. This template accepts up to five shortcuts as parameters. However, in most cases you will only want to display one or two shortcuts with this template, otherwise it may get too wide. Use {{shortcut}} if you need to display more than two shortcuts in the same box.

Originally this template is for use on the Editor's index, which needs to display shortcuts alongside list items and subitems which are vertically close together. The goal is to make the Editor's index more useful as a tool for answering questions, for example on the Help desk. A user can look up entries on the Editor's index, copy the relevant shortcuts, and paste them into links in replies to Help desk questions.

The template may be useful on other pages where multiple shortcut boxes would crowd together vertically.

Examples

Code Result
{{Shortcut compact|WP:V}}
 Shortcut:   WP:V 
{{Shortcut compact|WP:V|WP:VERIFY|WP:SOURCE}}
 Shortcuts:   WP:V   WP:VERIFY   WP:SOURCE 

An example showing how to use the template in a list:

Code Result
* A list item
* Another list item
** A subitem 
** Learning: {{Shortcut compact|WP:EIW#Learn}}
*** A subsubitem about learning
*** Another subsubitem
  • A list item
  • Another list item

Anchors

Unlike {{Shortcut}}, this template does not place anchors automatically at its location. To enable displayed shortcuts to link to positions other than section heading names, use the {{Anchor}} template alongside this template.

Adding an anchor automatically tends not to work correctly when the displayed shortcut itself contains a fragment identifier (an anchor name after a number sign character), since the anchor should only consist of the fragment identifier, but the template cannot parse out the fragment from the rest of the displayed shortcut string. Automatic anchor insertion works best for top-of-page shortcuts which do not normally display fragment identifiers, the kind that {{Shortcut}} is intended to display.

Displaying shortcuts with fragment identifiers saves a lot of work for a long page with many section-specific or list-item-specific shortcuts, since one shortcut page provides a redirect that can then link to any anchor on the target page via a fragment identifier.

Portability notes

This template uses HTML table code, which may create problems on non-Wikimedia Foundation wikis that are not running HTML Tidy. The template itself generally works when a page transcludes it, but may cause problems if you use it inside another template that uses parser functions. See:

See also