User:Lakrits/sandbox: Difference between revisions

Jump to navigation Jump to search
-
(-)
(-)
Line 12: Line 12:
===Syntax===
===Syntax===
The template's syntax is
The template's syntax is
* {{tlc|anchor|anchor1 |anchor2 |anchor3 |…|anchor10 }}
* {{tlc|User:Lakrits/templatesandbox|anchor1 |anchor2 |anchor3 |…|anchor10 }}


;<big>Example anchors</big>
;<big>Example anchors</big>
Line 30: Line 30:


;<big>Usage</big>
;<big>Usage</big>
* {{tlc|anchor|<big>'''1'''</big>}}
* {{tlc|User:Lakrits/templatesandbox|<big>'''1'''</big>}}


===Optional parameters===
===Optional parameters===
Line 42: Line 42:


;<big>Usage</big>
;<big>Usage</big>
* {{tlc|anchor|1|<big>'''2'''</big>|<big>'''3'''</big>|…|<big>'''10'''</big>}}
* {{tlc|User:Lakrits/templatesandbox|1|<big>'''2'''</big>|<big>'''3'''</big>|…|<big>'''10'''</big>}}


===Limitations===
===Limitations===
Line 81: Line 81:


;<big>Section titles</big>
;<big>Section titles</big>
* 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 "{{code|<nowiki>/*&nbsp;{{anchor|Issues}}Limitations&nbsp;*/&nbsp;New&nbsp;issue</nowiki>}}". Also, when the section is saved, browsers may not return to the section. Consider using {{code|<nowiki><span id="…"></span></nowiki>}} 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 "{{code|<nowiki>/*&nbsp;{{User:Lakrits/templatesandbox|Issues}}Limitations&nbsp;*/&nbsp;New&nbsp;issue</nowiki>}}". Also, when the section is saved, browsers may not return to the section. Consider using {{code|<nowiki><span id="…"></span></nowiki>}} directly, rather than using the anchor template, when in a section title.


;<big>Treat as case-sensitive</big>
;<big>Treat as case-sensitive</big>
Line 96: Line 96:
|-
|-
| Basic use
| Basic use
| {{tlc|anchor|Example1}} {{code|Target 1}}
| {{tlc|User:Lakrits/templatesandbox|Example1}} {{code|Target 1}}
| {{anchor|Example1}} Target 1
| {{User:Lakrits/templatesandbox|Example1}} Target 1
| Can be linked to with {{code|<nowiki>[[#Example1|…]]</nowiki>}} from within the same article, or with {{code|<nowiki>[[Article name#Example1|…]]</nowiki>}} from other articles and from redirects.
| Can be linked to with {{code|<nowiki>[[#Example1|…]]</nowiki>}} from within the same article, or with {{code|<nowiki>[[Article name#Example1|…]]</nowiki>}} from other articles and from redirects.
|-
|-
| Multiple anchors
| Multiple anchors
| {{tlc|anchor|Example2|Example3|Example4}} {{code|Target 2}}
| {{tlc|User:Lakrits/templatesandbox|Example2|Example3|Example4}} {{code|Target 2}}
| {{anchor|Example2|Example3|Example4}} Target 2
| {{User:Lakrits/templatesandbox|Example2|Example3|Example4}} Target 2
| Creates three anchors for the same target location that then can be linked to with {{code|<nowiki>[[#Example2|…]]</nowiki>}}, {{code|<nowiki>[[#Example3|…]]</nowiki>}}, or {{code|<nowiki>[[#Example4|…]]</nowiki>}}, respectively.
| Creates three anchors for the same target location that then can be linked to with {{code|<nowiki>[[#Example2|…]]</nowiki>}}, {{code|<nowiki>[[#Example3|…]]</nowiki>}}, or {{code|<nowiki>[[#Example4|…]]</nowiki>}}, respectively.
|-
|-
| Section title <br>(template)
| Section title <br>(template)
| {{code|<nowiki>==</nowiki>&nbsp;}}{{tlc|anchor|Example5}}{{code|&nbsp;Section title A&nbsp;<nowiki>==</nowiki>}}
| {{code|<nowiki>==</nowiki>&nbsp;}}{{tlc|User:Lakrits/templatesandbox|Example5}}{{code|&nbsp;Section title A&nbsp;<nowiki>==</nowiki>}}
| {{anchor|Example5}}&nbsp;<span style="font: 21px Fira Sans; text-decoration: underline;">Section title A</span>
| {{User:Lakrits/templatesandbox|Example5}}&nbsp;<span style="font: 21px Fira Sans; text-decoration: underline;">Section title A</span>
| Anchors can be more suitable for inter-article linking than section titles are. In this case, links in the format {{code|<nowiki>[[Article name#Example5]]</nowiki>}} would remain valid even if the section itself was renamed. (Note that the anchor is placed ''before'' the section name; otherwise browsers may hide the section title from view.)
| Anchors can be more suitable for inter-article linking than section titles are. In this case, links in the format {{code|<nowiki>[[Article name#Example5]]</nowiki>}} would remain valid even if the section itself was renamed. (Note that the anchor is placed ''before'' the section name; otherwise browsers may hide the section title from view.)
|-
|-
| Section title <br>(HTML)
| Section title <br>(HTML)
| {{code|<nowiki>==</nowiki>&nbsp;<nowiki><span id="Example6"></span></nowiki>&nbsp;Section title B&nbsp;<nowiki>==</nowiki>}}
| {{code|<nowiki>==</nowiki>&nbsp;<nowiki><span id="Example6"></span></nowiki>&nbsp;Section title B&nbsp;<nowiki>==</nowiki>}}
| {{anchor|Custom anchor name}}&nbsp;<span id="Example6"></span><span style="font: 21px Fira Sans; text-decoration: underline;">Section title B</span>
| {{User:Lakrits/templatesandbox|Custom anchor name}}&nbsp;<span id="Example6"></span><span style="font: 21px Fira Sans; text-decoration: underline;">Section title B</span>
| As noted under [[#Limitations|Limitations]] above, it may be preferable to use direct HTML rather than the template within section titles.
| As noted under [[#Limitations|Limitations]] above, it may be preferable to use direct HTML rather than the template within section titles.
|}
|}
Line 121: Line 121:
! Case !! What you write !! What you see
! Case !! What you write !! What you see
|-
|-
| &gt; 10 anchors || {{tlc|anchor|1|2|3|4|5|6|7|8|9|10|11}} || {{anchor|1|2|3|4|5|6|7|8|9|10|11}}
| &gt; 10 anchors || {{tlc|User:Lakrits/templatesandbox|1|2|3|4|5|6|7|8|9|10|11}} || {{User:Lakrits/templatesandbox|1|2|3|4|5|6|7|8|9|10|11}}
|-
|-
| No&nbsp;parameter || {{tlc|anchor}} || {{anchor}}
| No&nbsp;parameter || {{tlc|User:Lakrits/templatesandbox}} || {{User:Lakrits/templatesandbox}}
|}
|}


3,860

edits

Navigation menu