Template:Anchor

From OpenMW Wiki
Revision as of 10:35, 5 August 2017 by Darklocq (talk | contribs) (→‎HTML note: rm. trivia)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Documentation

Anchor: This creates an HTML anchor (in-page link target for an article_name#anchor_name_here link – the part after the #) for the given text, invisibly. This is useful for providing alternative names to linkable things (e.g. British spellings, acronyms, or old names of article sections that someone may have linked to). For a version with displayed anchor text, see Template:Vanchor.


This template replaces something like:

<span id="Anchor name here"></span>Blah blah blah, more text here.

with:

{{Anchor|Anchor name here}}Blah blah blah, more text here.

which displays as:

Blah blah blah, more text here.

(without the indentation; this is an inline template). That spot can be linked to on this template page as Template:Anchor#Anchor name here. The real space and mess savings are when this is used with multiple parameters (see below).


Important: This text cannot contain markup of any kind, only plain text – no wikimarkup, no templates. It's invisible anyway.

If the text includes an equals sign (=) anywhere in it, you must use a numbered parameter for the text:

{{Anchor|1=Anchor = name here}}


Also, the text is a literal string. These two are not equivalent:

  • {{Anchor|Anchor name here}}
  • {{Anchor| Anchor name here}}

Additional parameters

The template will create up to 9 anchors, for spelling variations, etc. All are invisible. These are given in series or numbered:

  • {{Anchor|anchor|alternative 1|alternative 2|alternative 3|alternative 4}}
  • {{Anchor|1=anchor|2=alternative 1|3=alternative 2|4=alternative 3|5=alternative 4}}