http://banished-wiki.com/w/index.php?title=Template:Anchor/doc&feed=atom&action=historyTemplate:Anchor/doc - Revision history2024-03-28T19:44:33ZRevision history for this page on the wikiMediaWiki 1.39.6http://banished-wiki.com/w/index.php?title=Template:Anchor/doc&diff=499&oldid=prevMastergalen: 1 revision2013-03-26T18:22:18Z<p>1 revision</p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<tr class="diff-title" lang="en-GB">
<td colspan="1" style="background-color: #fff; color: #202122; text-align: center;">← Older revision</td>
<td colspan="1" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 18:22, 26 March 2013</td>
</tr><tr><td colspan="2" class="diff-notice" lang="en-GB"><div class="mw-diff-empty">(No difference)</div>
</td></tr></table>Mastergalenhttp://banished-wiki.com/w/index.php?title=Template:Anchor/doc&diff=498&oldid=prevMastergalen: 1 revision2012-12-27T04:43:03Z<p>1 revision</p>
<p><b>New page</b></p><div>{{Documentation subpage}}<br />
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE --><br />
<br />
The template <nowiki>{{</nowiki>[[{{ns:Template}}:{{BASEPAGENAME}}|{{lc:{{BASEPAGENAME}}}}]]<nowiki>}}</nowiki> inserts one or more [http://en.wikipedia.org/wiki/HTML_element#Anchor HTML anchor]s in a page. Those locations can then be linked to using <code><nowiki>[[#link|...]]</nowiki></code> syntax. {{#ifeq:{{BASEPAGENAME}}|Visible anchor|&nbsp;Unlike {{tl|Anchor}}, the first parameter will be visible text on the page.|}}<br />
<br />
===Examples===<br />
1. <code style="color:green;"><nowiki>{{</nowiki>{{lc:{{BASEPAGENAME}}}}|foo<nowiki>}}</nowiki></code><br />
: could be linked to with <tt><nowiki>[[#foo|...]]</nowiki></tt> from within the same article,<br />
: or it could be linked to with <tt><nowiki>[[</nowiki>''<small>articlename</small>''#foo|...<nowiki>]]</nowiki></tt> from other articles and from redirects.<br />
<br />
2. Anchors can be more suitable for inter-article linking than section titles are. For example,<br />
:<code style="color:gray;"><nowiki>==</nowiki> <code style="color:green;"><nowiki>{{</nowiki>{{lc:{{BASEPAGENAME}}}}|foo<nowiki>}}</nowiki></code> Section title <nowiki>==</nowiki></code><br />
:Here, links via <tt><nowiki>[[</nowiki>''articlename''#foo<nowiki>]]</nowiki></tt> would remain valid even if the section were renamed. Consider using {{tlsp|anchor comment}} beneath the section title to generate an HTML comment alerting other editors to the purpose of anchors used in this manner.<br />
:The following is an example of what '''not''' to do:<br />
:<code style="color:gray;"><nowiki>==</nowiki> Section title <code style="color:green;"><nowiki>{{</nowiki>{{lc:{{BASEPAGENAME}}}}|bar<nowiki>}}</nowiki></code> <nowiki>==</nowiki></code><br />
:Here, the link <tt><nowiki>[[</nowiki>''articlename''#bar<nowiki>]]</nowiki></tt> would take the user to the section, but undesirably hide the section title from view.<br />
<br />
3. The template can be used to create up to ten anchors with a single call. For example,<br />
: <code style="color:green;"><nowiki>{{</nowiki>{{lc:{{BASEPAGENAME}}}}|foo|bar|baz<nowiki>}}</nowiki></code><br />
:will create three anchors that can then be linked to with <tt><nowiki>[[#foo]]</nowiki></tt>, <tt><nowiki>[[#bar]]</nowiki></tt> and <tt><nowiki>[[#baz]]</nowiki></tt>.<br />
:Specifying more than 10 anchors will cause an error message to be displayed.{{#ifeq:{{BASEPAGENAME}}|Visible anchor|<br /><br />
<br /><br />
4. If the text to be displayed must differ from the anchor (e.g. because it contains brackets for linking), the <code style="color:green;">text</code> parameter can be used:<br />
: <code style="color:green;"><nowiki>{{</nowiki>{{lc:{{BASEPAGENAME}}}}<nowiki>|foo|text=[[foo]]}}</nowiki></code><br />
: this will result in a link that constitutes an anchor of its own|}}<br />
<br />
===Limitations===<br />
{|class="wikitable" style="float:right"<br />
!character<br />
![[Character entity reference|code]]<br />
!template<br />
!meaning<br />
|-<br />
|&quot;<br />
|<code>&amp;quot;</code><br /><code>&amp;#34;</code><br />
|{{N/a}}<br />
|(double)&nbsp;[[quotation mark]]<br />
|-<br />
|&#35;<br />
|<code>&amp;#35;</code><br />
|{{N/a}}<br />
|[[Number sign|hash]]<br />
|-<br />
|&#124;<br />
|<code>&amp;#124;</code><br />
|{{tl|!}}<br />
|[[Vertical bar|pipe]]<br />
|-<br />
|&#61;<br />
|<code>&amp;#61;</code><br />
|{{tl|{{=}}}}<br />
|[[Equals sign|equals]]<br />
|}<br />
* Anchor names that contain any character shown in the table on the right will not work as expected. However, any of these characters can be replaced with the "&amp;#" codes shown for them here. Or, the pipe symbol and equals sign can be worked around with {{tl|!}} and {{tl|{{=}}}}, respectively. Markup code such as {{tag|sup|o}} and {{tag|sub|o}} (superscript and subscript) cannot be used. Most other characters, including white space and punctuation, are not a problem.<br />
* The template can create a maximum of 10 anchors. Specifying more than 10 anchors will result in an error message.<br />
* Unlike with most templates, putting each anchor name on separate lines, for example<br />
:<code style="color:green;"><nowiki>{{</nowiki>{{lc:{{BASEPAGENAME}}}}<br />
:|humpty<br />|dumpty<nowiki>}}</nowiki></code><br />
:will not work as expected.<br />
* Anchor names should be unique on a page, and should not duplicate any heading titles. Duplicate anchors will not work as expected since the #links go to the first anchor with that name. Duplicate anchors also result in invalid HTML; you can check for duplicate anchors by running the page through the [[W3C Markup Validation Service]].<br />
* If the template is added to a section title then the code will appear in the edit summary when that section is edited, as in <nowiki>"/* {{anchor|Issues}}Limitations */ New issue"</nowiki>. This can be fixed by deleting the template code from the edit summary before the changes are saved. Consider using {{tlsp|anchor comment}} beneath the section title to generate an HTML comment alerting other editors to the purpose of anchors used in this manner, so they do not move the anchor out of the section heading when they notice the deleterious effects on their edit summary.<br />
* Anchor links are case sensitive in some browsers, so treat all anchor links as case sensitive.<br />
<br />
<includeonly><!-- CATEGORIES AND INTERWIKIS HERE, THANKS --><br />
[[Category:Formatting templates]]<br />
</includeonly></div>Mastergalen