Template:Anchor/doc: Difference between revisions

no edit summary
k6ka>K6ka
(Created page with "==Description== This creates one or more HTML anchors (up to 10) so you can jump to where this template appears with <code><nowiki></nowiki></code>''pagename''<code>#</code>...")
No edit summary
 
(8 intermediate revisions by 2 users not shown)
Line 1:
{{Lua|
* [[Module:Anchor]]}}
==Description==
This creates one or more HTML anchors (up to 10) so you can jump to where this template appears with <code><nowiki>[[</nowiki></code>''pagename''<code>#</code>''anchorname''<code><nowiki>]]</nowiki></code>. The result of the template should not be visible on the page.
 
==Syntax==
Type <code>{{t|Anchor|anchorname1|anchorname2|anchorname3|...|anchorname10}}</code> somewhere.
 
==Example==
Line 19 ⟶ 21:
:.
:[[#jumphere|Click me to jump to anchor]].
 
==Limitations==
{|class="wikitable" style="float:right"
!Character
![[wikipedia:Character entity reference|Code]]
!Template
!Meaning
|-
|"
|<code>&amp;quot;</code> <br /><code>&amp;#34;</code>
|N/A
|(double)&nbsp;[[wikipedia:quotation mark|quotation mark]]
|-
|#
|<code>&amp;#35;</code>
|N/A
|[[wikipedia:Number sign|hash]]
|-
|&#124;
|<code>&amp;#124;</code>
|{{tl|!}}
|[[wikipedia:Vertical bar|pipe]]
|-
|&#61;
|<code>&amp;#61;</code>
|{{tl|{{=}}}}
|[[wikipedia:Equals sign|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 <code>&amp;quot;</code> or <code>&amp;#34;</code>.
 
Alternatively, if you need to use pipe (|) or equal sign (=) characters, you may use the {{tl|!}} and {{tl|{{=}}}} templates, respectively, to use them.
 
== Use in tables ==
Anchors may be used within tables, subject to certain restrictions. The {{tlx|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:<source enclose=div lang=text>|+ {{anchor|FooX}} A table caption</source> and the following forms of cell are valid:
 
<source enclose=div lang=text>!{{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</source>
 
You need to ensure that the {{tlx|anchor}} is not in that portion of the markup intended for the classes, styles etc. Thus, {{tlx|anchor}} cannot be placed anywhere on lines that begin with <code><nowiki>{|</nowiki></code> (start of table) or <code><nowiki>|-</nowiki></code> (new row), and the following forms of cell are not valid:
 
<source enclose=div lang=text>!{{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</source>
 
If it is necessary for an anchor to be in any of these positions, a different technique is used—the <code>id=</code> attribute. This is placed in that portion of the markup where the classes, styles etc. may be used, as follows:
 
<source enclose=div lang=text>{| 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</source>
 
The <code>id=</code> attribute may appear before, between or after any other attributes that may be present, but only one <code>id=</code> attribute may be used in each of these areas.
 
==Credits==
The template's Lua code wasand parts of its documentation were taken from the [[wikia:w:c:templatesen:Template:Anchor|TemplatesEnglish WikiWikipedia]] on Wikia.
 
A non-Lua version of the template was formerly used <span class="plainlinks">[https://www.thesimswiki.com/w/index.php?title=Template:Anchor&oldid=1644 here]</span>. That code was taken from the [[wikia:w:c:templates:Template:Anchor|Templates Wiki]] on Wikia.
 
==TemplateData==
{{TemplateData header}}
<templatedata>
{
"description": "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.",
"params": {
"1": {
"label": "First anchor",
"description": "First anchor value.",
"type": "string",
"required": true
},
"2": {
"label": "Second anchor",
"description": "Second anchor value.",
"type": "string",
"required": false
},
"3": {
"label": "Third anchor",
"description": "Third anchor value.",
"type": "string",
"required": false
},
"4": {
"label": "Fourth anchor",
"description": "Fourth anchor value.",
"type": "string",
"required": false
},
"5": {
"label": "Fifth anchor",
"description": "Fifth anchor value.",
"type": "string"
},
"6": {
"label": "Sixth anchor",
"description": "Sixth anchor value.",
"type": "string"
},
"7": {
"label": "Seventh anchor",
"description": "Seventh anchor value.",
"type": "string"
},
"8": {
"label": "Eight anchor",
"description": "Eight anchor value.",
"type": "string"
},
"9": {
"label": "Ninth anchor",
"description": "Ninth anchor value.",
"type": "string"
},
"10": {
"label": "Tenth anchor",
"description": "Tenth anchor value.",
"type": "string"
}
}
}
</templatedata>
 
<includeonly>[[Category:General wiki templates|{{PAGENAME}}]]</includeonly>
<noinclude>[[Category:Template documentation|{{PAGENAME}}]]</noinclude>