Template:Anchor

From OpenMW Wiki
Revision as of 08:27, 19 July 2017 by Darklocq (talk | contribs) (creating template)
(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.


It 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.


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}}

HTML note

This uses HTML 4.01's <span id="..."></span> format only because the installed version of MediaWiki at wiki.OpenMW.org does not support the cleaner HTML5 <span id="..." /> syntax. If the system is upgraded to support it, this template should be updated to use it.