Template:Abbr/doc

From Angelina Jordan Wiki
Revision as of 15:56, 28 October 2020 by Dcljr (talk | contribs) (nevermind… don't bother with {w} outside of article space)
This is a subpage documenting Template:Abbr. To change the template, edit that page; to change the template's documentation (seen below), edit this one.

Documentation

This template provides a simple interface to the <abbr> HTML element. It should not be used for anything except abbreviations (including acronyms and initialisms). In particular, it should not be used merely for its side-effect (for most readers) of rendering text in a "tooltip". If that is needed for some reason, a different template can be created.

The template complains when it finds no input at all, as seen above, but not when only the expanded form is missing.

Usage

  • {{abbr|abbreviation|expanded form}}

Example

  • {{abbr|NOK|Norwegian krone}}NOK

Hover on "NOK" to see how the expanded form is displayed. Usually it appears as a "tooltip".

Limitations

Links

The expanded-form text cannot contain a link. If it does, the wiki markup used to create the link will be visible in the expanded form:

  • {{abbr|NOK|[[wikipedia:Norwegian krone|Norwegian krone]]}}NOK

(If necessary, hover on "NOK" to see why this is not what you want.)

A simple workaround is to place the abbreviation inside the link instead of the other way around:

  • [[wikipedia:Norwegian krone|{{abbr|NOK|Norwegian krone}}]]NOK

Alternatively, you might be able to accomplish what you want by using a normal "piped" wikilink, since those are already set up to show toolips when hovered on. In such a case, the link target serves as the expanded form, and should be either an existing article or a redirect to one, as seen here:

  • [[Kringkastingsorkestret|KORK]]KORK

However, this won't work as expected if page previews are enabled (i.e., the text before the pipe is not shown to the reader). But it doesn't really matter, since the target article of the link presumably will explain the meaning of the abbreviation being linked to early enough in the article text to be seen in the preview — in which case, piping is not even necessary:

Markup

The expanded-form text can contain HTML character entities (such as &ouml; for the letter ö), but not HTML elements (such as <i>italics</i>) or wiki markup (such as ''italics''). If such markup is used, it will either be visible in the expanded text or completely break the template call, as seen here:

  • {{abbr|NGT|''Norway's Got Talent''}}NGT
  • {{abbr|NGT|<i>Norway's Got Talent</i>}} ⇒ <abbr title="Norway's Got Talent">NGT

Fortunately, there shouldn't be any real need for special styles in the expanded-form text.