Editing Template:Anchor/doc
From Guild of Archivists
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
{{Documentation subpage}} | {{Documentation subpage}} | ||
{{high-use|40,000+}} | |||
{{lua|Module:Anchor}} | {{lua|Module:Anchor}} | ||
<!-- PLEASE ADD CATEGORIES AT THE END OF THIS PAGE, ND INTERWIKIS LINKS TO WIKIDATA --> | <!-- PLEASE ADD CATEGORIES AT THE END OF THIS PAGE, ND INTERWIKIS LINKS TO WIKIDATA --> | ||
The template <nowiki>{{</nowiki>[[{{ns:Template}}:{{BASEPAGENAME}}|{{lc:{{BASEPAGENAME}}}}]]<nowiki>}}</nowiki> inserts one or more HTML fragment identifiers (anchor names) in a page. Those locations can then be linked to using <code><nowiki>[[#Location|...]]</nowiki></code> syntax. {{#ifeq:{{BASEPAGENAME}}|Visible anchor| Unlike {{tl|Anchor}}, the first parameter will be visible text on the page.|}} (Usually the first letter of the ''location'' is capitalised to reflect the common capitalisation used in section headers.) | The template <nowiki>{{</nowiki>[[{{ns:Template}}:{{BASEPAGENAME}}|{{lc:{{BASEPAGENAME}}}}]]<nowiki>}}</nowiki> inserts one or more [[Fragment identifier|HTML fragment identifiers]] (anchor names) in a page. Those locations can then be linked to using <code><nowiki>[[#Location|...]]</nowiki></code> syntax. {{#ifeq:{{BASEPAGENAME}}|Visible anchor| Unlike {{tl|Anchor}}, the first parameter will be visible text on the page.|}} (Usually the first letter of the ''location'' is capitalised to reflect the common capitalisation used in section headers – see [[MOS:HEAD]].) | ||
== Examples == | == Examples == | ||
Line 15: | Line 16: | ||
{|class="wikitable" style="float:right" | {|class="wikitable" style="float:right" | ||
!Character | !Character | ||
!Code | ![[Character entity reference|Code]] | ||
!Template | !Template | ||
!Meaning | !Meaning | ||
Line 22: | Line 23: | ||
|<code>&quot;</code> <br /><code>&#34;</code> | |<code>&quot;</code> <br /><code>&#34;</code> | ||
|{{N/a}} | |{{N/a}} | ||
|(double) quotation mark | |(double) [[quotation mark]] | ||
|- | |- | ||
|# | |# | ||
|<code>&#35;</code> | |<code>&#35;</code> | ||
|{{N/a}} | |{{N/a}} | ||
|hash | |[[Number sign|hash]] | ||
|- | |- | ||
|| | || | ||
|<code>&#124;</code> | |<code>&#124;</code> | ||
|{{tl|!}} | |{{tl|!}} | ||
|pipe | |[[Vertical bar|pipe]] | ||
|- | |- | ||
|= | |= | ||
|<code>&#61;</code> | |<code>&#61;</code> | ||
|{{tl|{{=}}}} | |{{tl|{{=}}}} | ||
|equals | |[[Equals sign|equals]] | ||
|} | |} | ||
* 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 "&#" 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. | * 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 "&#" 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. | ||
* Anchor names should be unique on a page, and should not duplicate any heading titles. Duplicate anchors will not work as expected since the <code><nowiki>#location</nowiki></code> links go to the first anchor with that name. Duplicate anchors result in invalid HTML; you can check for duplicate anchors by running the page through the [[ | * Anchor names should be unique on a page, and should not duplicate any heading titles. Duplicate anchors will not work as expected since the <code><nowiki>#location</nowiki></code> links go to the first anchor with that name. Duplicate anchors result in invalid HTML; you can check for duplicate anchors by running the page through the [[W3C Markup Validation Service]]. | ||
* If the template is added to a section title then the code will appear in the edit summary window when that section is edited, as in {{nowrap|1="<code><nowiki>/* {{anchor|Issues}}Limitations */ New issue</nowiki></code>"}}. Also, when the section is saved, browsers may not return to the section. Consider using <code><nowiki><span id="..."></span></nowiki></code> directly, rather than using the anchor template, when in a section title. | * If the template is added to a section title then the code will appear in the edit summary window when that section is edited, as in {{nowrap|1="<code><nowiki>/* {{anchor|Issues}}Limitations */ New issue</nowiki></code>"}}. Also, when the section is saved, browsers may not return to the section. Consider using <code><nowiki><span id="..."></span></nowiki></code> directly, rather than using the anchor template, when in a section title. | ||
* Anchor links are case sensitive in some browsers, so treat all anchor links as case sensitive. | * Anchor links are case sensitive in some browsers, so treat all anchor links as case sensitive. | ||
Line 84: | Line 85: | ||
=== See also === | === See also === | ||
* {{#ifeq:{{BASEPAGENAME}}|Visible anchor|{{tl|Anchor}}|{{tl|Visible anchor}}}} | |||
* {{tl|Anchored list}} | |||
* {{tl|Anchor comment}} | |||
* {{tl|Shortcut}} | * {{tl|Shortcut}} | ||
* [[WP:ANCHOR]] | |||
* [[WP:TARGET]] | |||
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox|| | <includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox|| |