Template:ShortForm

From Beansboro Wiki
Revision as of 21:17, 17 November 2026 by LunarLemon (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

ShortForm displays the full wording when it fits within the permitted number of lines. It displays the supplied short form only when the full wording is too wide or needs more lines than allowed. When shortened, a dotted underline and help cursor indicate that the full wording is available on hover; screen readers receive the full wording as its accessible label.

Usage

{{ShortForm|short=NC|long=Non-copyable|lines=2}}
{{ShortForm|short=Diff|long=Difficulty|link=User levels|lines=1}}
{{ShortForm|NC|Non-copyable||2}}

Use named parameters when clarity matters. In positional syntax the order is short, long, link, lines; leave position 3 empty when specifying position 4 without a link.

Parameters

Parameter Position Default Description
short 1 Full wording The explicitly chosen abbreviation. If omitted or blank, the full wording is used instead; the template cannot invent a shorter form.
long 2 None; required Full wording. Inline formatting and explicit <br> line breaks are supported.
link 3 No link Optional internal page title. Both displayed forms link to this page. Leave blank for plain text. Do not put another internal link inside either form when using this parameter.
lines 4 1 Positive integer: the maximum number of rendered lines allowed for the full form. Explicit line breaks count. Invalid values fall back to 1. This is a fit threshold, not a command to insert that many line breaks.

Legacy aliases remain supported: text means short, and full means long.

Fitting and line breaks

Give the containing infobox field, table cell, or block a constrained width. A normal paragraph with plenty of space will generally keep the full wording. The full form remains visible when it fits within the chosen line count; otherwise the short form replaces it. An unbroken word that is wider than the available width also does not fit. Choose a short form that fits the intended space.

For example, long=First<br>Second can retain the full form with lines=2 when both words fit. With lines=1, that explicit two-line form requires the abbreviation. The template does not change column counts or move infobox fields onto another row.

Browser support

Automatic fitting needs the ShortForm JavaScript helper. It checks the available width on page load, after font loading, and when the viewport or font selection changes. With JavaScript disabled or the helper unavailable, the full wording is displayed. Hover cues appear only while the short form is displayed.

Other languages

Russian: Сокращение. Spanish: FormaCorta. These use the same fitting implementation.

Shows the full wording when it fits within the allowed number of lines; otherwise uses an explicit short form. Requires the ShortForm JavaScript helper.

Template parameters[Edit template data]

ParameterDescriptionTypeStatus
Short formshort 1 text

Explicit abbreviation; blank or omitted uses the full wording.

Contentoptional
Full wordinglong 2 full

Full inline wording, optionally including explicit br line breaks.

Contentrequired
Link targetlink 3

Optional internal page title used by both forms.

Page nameoptional
Maximum lineslines 4

Positive integer; full wording is kept only when it fits within this many rendered lines.

Default
1
Numberoptional