Template:Anchor: Difference between revisions

From OniGalore
Jump to navigation Jump to search
(reverting)
(another attempt to remove the line break)
(8 intermediate revisions by the same user not shown)
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>.
-->{{#if:{{{ 1|}}}|<span id="{{anchorencode:{{{ 1|}}}}}" /><!--
 
-->{{#if:{{{ 2|}}}|<span id="{{anchorencode:{{{ 2|}}}}}" /><!--
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>.
-->{{#if:{{{ 3|}}}|<span id="{{anchorencode:{{{ 3|}}}}}" /><!--
 
-->{{#if:{{{ 4|}}}|<span id="{{anchorencode:{{{ 4|}}}}}" /><!--
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.
-->{{#if:{{{ 5|}}}|<span id="{{anchorencode:{{{ 5|}}}}}" /><!--
[[Category:Basic formatting templates]]</noinclude><includeonly>{{#if:{{{1|}}}|<span id="{{{1|}}}"></span>}}<!--
-->{{#if:{{{ 6|}}}|<span id="{{anchorencode:{{{ 6|}}}}}" /><!--
-->{{#if:{{{2|}}}|<span id="{{{2|}}}"></span>}}<!--
-->{{#if:{{{ 7|}}}|<span id="{{anchorencode:{{{ 7|}}}}}" /><!--
-->{{#if:{{{3|}}}|<span id="{{{3|}}}"></span>}}<!--
-->{{#if:{{{ 8|}}}|<span id="{{anchorencode:{{{ 8|}}}}}" /><!--
-->{{#if:{{{4|}}}|<span id="{{{4|}}}"></span>}}<!--
-->{{#if:{{{ 9|}}}|<span id="{{anchorencode:{{{ 9|}}}}}" /><!--
-->{{#if:{{{5|}}}|<span id="{{{5|}}}"></span>}}<!--
-->{{#if:{{{10|}}}|<span id="{{anchorencode:{{{10|}}}}}" /><!--
-->{{#if:{{{6|}}}|<span id="{{{6|}}}"></span>}}<!--
-->{{#if:{{{11|}}}
-->{{#if:{{{7|}}}|<span id="{{{7|}}}"></span>}}<!--
    |<div style="background:yellow">[[Template:Anchor]]: too many anchors</div><!--
-->{{#if:{{{8|}}}|<span id="{{{8|}}}"></span>}}<!--
-->}}<!--
-->{{#if:{{{9|}}}|<span id="{{{9|}}}"></span>}}<!--
-->}} }} }} }} }} }} }} }} }} }}
-->{{#if:{{{10|}}}|<span id="{{{10|}}}"></span>}}<!--
-->{{#if:{{{11|}}}|<span class="error">[[Template:Anchor]]: too many anchors, maximum is 10.</span>}}</includeonly>

Revision as of 13:18, 11 November 2012

If you enclose text on a page as a parameter to this template, e.g. {{Anchor|some_anchor_name}}, 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 [[Some_article#some_anchor_name]]; upon clicking it, you will be taken directly to the text that you enclosed in {{Anchor|}}.

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, [[History of the Oni Community#2001]].

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.