Template:Anchor

From The Sims Wiki, a collaborative database for The Sims series
Jump to navigation Jump to search
Template documentation (View · Edit · History · Purge)

This template uses Lua

Description[edit source]

This creates one or more HTML anchors so you can jump to where this template appears with [[pagename#anchorname]]. The result of the template should not be visible on the page.

Syntax[edit source]

Type {{Anchor|<anchorname1>|<anchorname2>|<anchorname3>|<...>}} somewhere.

Example[edit source]

{{Anchor|jumphere}}
.
.
.
.
.
.
.
.
.
.
.
Click me to jump to anchor.

Limitations[edit source]

Character Code Template Meaning
" &quot;
&#34;
N/A (double) quotation mark
# &#35; N/A hash
| &#124; {{!}} pipe
= &#61; {{=}} equals

The characters listed on the right will cause problems with the template and should not be used. If you need to use them, replace them with the HTML character code provided. For example, if you need to use quotation marks, substitute them with &quot; or &#34;.

Alternatively, if you need to use pipe (|) or equal sign (=) characters, you may use the {{!}} and {{=}} templates, respectively, to use them.

Use in tables[edit source]

Anchors may be used within tables, subject to certain restrictions. The {{anchor}} template may be used in the caption and cells of a table, but not those portions of a table that are outside the caption and cells. It is used on the table's caption thus:
|+ {{anchor|FooX}} A table caption
and the following forms of cell are valid:
!{{anchor|Foo1}} A header cell
!style="background:white;" |{{anchor|Foo2}} A header cell with styling
|{{anchor|Foo3}} A data cell
|rowspan=2 |{{anchor|Foo4}} A data cell spanning two rows

You need to ensure that the {{anchor}} is not in that portion of the markup intended for the classes, styles etc. Thus, {{anchor}} cannot be placed anywhere on lines that begin with {| (start of table) or |- (new row), and the following forms of cell are not valid:

!{{anchor|Foo1}} |A header cell
!style="background:white;" {{anchor|Foo2}} |A header cell with styling
|{{anchor|Foo3}} |A data cell
|rowspan=2 {{anchor|Foo4}} |A data cell spanning two rows

If it is necessary for an anchor to be in any of these positions, a different technique is used—the id= attribute. This is placed in that portion of the markup where the classes, styles etc. may be used, as follows:

{| id=FooX class=wikitable
|- id=FooY
!id=Foo1 |A header cell
!style="background:white;" id=Foo2 |A header cell with styling
|id=Foo3 |A data cell
|rowspan=2 id=Foo4 |A data cell spanning two rows

The id= attribute may appear before, between or after any other attributes that may be present, but only one id= attribute may be used in each of these areas.

Credits[edit source]

The template's Lua code and parts of its documentation were taken from the English Wikipedia.

A non-Lua version of the template was formerly used here. That code was taken from the Templates Wiki on Wikia.

TemplateData[edit source]

This is the TemplateData documentation for this template used by the VisualEditor and other tools.

TemplateData for Anchor

This template inserts one or more HTML anchors in a page, which can then be linked to using [[#location|...]] syntax, or by going to https://www.thesimswiki.com/Name_of_page#Anchor_title. This is useful when you need to link to very specific parts in an article.

Template parameters[Edit template data]

ParameterDescriptionTypeStatus
First anchor1

First anchor value.

Stringrequired
Second anchor2

Second anchor value.

Stringoptional
Third anchor3

Third anchor value.

Stringoptional
Fourth anchor4

Fourth anchor value.

Stringoptional
Fifth anchor5

Fifth anchor value.

Stringoptional
Sixth anchor6

Sixth anchor value.

Stringoptional
Seventh anchor7

Seventh anchor value.

Stringoptional
Eight anchor8

Eight anchor value.

Stringoptional
Ninth anchor9

Ninth anchor value.

Stringoptional
Tenth anchor10

Tenth anchor value.

Stringoptional

Visit Template:Anchor/doc to edit this text! (How does this work?) (Refresh this text - why?)