Template:Anchor: Difference between revisions

From OniGalore
Jump to navigation Jump to search
(another attempt to remove the line break)
(rewrote documentation)
Line 1: Line 1:
<noinclude>If you enclose text on a page as a parameter to this template, e.g. <nowiki>{{Anchor|some_anchor_name}}</nowiki>, it creates an invisible HTML span id while still displaying that text on the page as before. This span id can be used as a "jump point" by making a link in any article such as <nowiki>[[Some_article#some_anchor_name]]</nowiki>; upon clicking it, you will be taken directly to the text that you enclosed in <nowiki>{{Anchor|}}</nowiki>.
<noinclude>When a header is created in an article with the notation "==Header Name==", it creates an HTML span id, which is also known as an anchor link; a URL can then use the "#" mark to link to that specific section by name. Sometimes you want to provide such an anchor link but you don't want to give that part of the article its own header, or perhaps it already has a header and you want to give it an alternate name as a sort of alias, which you will then use elsewhere on the wiki.


This is similar to the functionality of the "==Header Name=="-type wiki code that marks section headers, except that it does not display as text and it will not be included in the automatically-generated Table of Contents (TOC) like "=="-type headers will be. For a sample usage of the Anchor template, see the wiki markup for [[History of the Oni community]], which marks the article with year tags so that intrawiki links can jump the user to that year in history by using, for instance, <nowiki>[[History of the Oni Community#2001]]</nowiki>.
There's where this template comes in. Here are some examples of how it's been used on OniGalore:
*<nowiki>{{Anchor|Manifesto}}</nowiki> was used on the Quotes/Manual page to create this link to the Pre-Mission Briefing section under its alternate name, "Manifesto": [[Quotes/Manual#Manifesto]].
*<nowiki>{{Anchor|2001}}</nowiki> (and other template calls) were used on the [[History of the Oni community]] page so that links from other pages could simply point to a year and the reader could be forwarded to that chronological point in the article, e.g. <nowiki>[[History of the Oni Community#2001]]</nowiki>.
*<nowiki>{{Anchor|textures_tag}}</nowiki> was used on [[XML:ONLV]] to allow a specific field within a table to be linked to. Handy, huh?


The original goal in introducing this template was to create a custom TOC based on this invisible section markup that could be used to document [[BSL:Tutorial/airport1_level_logic.bsl|raw BSL]]; however, no simple solution to the issue of how to create a TOC from span ids has been found yet.
The original goal in introducing this template was to create a custom TOC based on this invisible section markup that could be used to document [[BSL:Tutorial/airport1_level_logic.bsl|raw BSL]]; however, no simple solution to the issue of how to create a TOC from span ids has been found yet.

Revision as of 15:48, 5 April 2021

When a header is created in an article with the notation "==Header Name==", it creates an HTML span id, which is also known as an anchor link; a URL can then use the "#" mark to link to that specific section by name. Sometimes you want to provide such an anchor link but you don't want to give that part of the article its own header, or perhaps it already has a header and you want to give it an alternate name as a sort of alias, which you will then use elsewhere on the wiki.

There's where this template comes in. Here are some examples of how it's been used on OniGalore:

  • {{Anchor|Manifesto}} was used on the Quotes/Manual page to create this link to the Pre-Mission Briefing section under its alternate name, "Manifesto": Quotes/Manual#Manifesto.
  • {{Anchor|2001}} (and other template calls) were used on the History of the Oni community page so that links from other pages could simply point to a year and the reader could be forwarded to that chronological point in the article, e.g. [[History of the Oni Community#2001]].
  • {{Anchor|textures_tag}} was used on XML:ONLV to allow a specific field within a table to be linked to. Handy, huh?

The original goal in introducing this template was to create a custom TOC based on this invisible section markup that could be used to document raw BSL; however, no simple solution to the issue of how to create a TOC from span ids has been found yet.