Difference between revisions of "Template:Anchored list/doc"

From blackwiki
Jump to navigation Jump to search
blackwiki>Pi3832
m (→‎Usage: Forever in the history.)
blackwiki>Gracefool
(added name parameter, and explained anchor format)
Line 3: Line 3:
  
 
This template can be used to create an [[ordered list]] which generates [[HTML anchor]]s for every bullet point. This makes it much easier to maintain lists where anchors to individual entries are required.
 
This template can be used to create an [[ordered list]] which generates [[HTML anchor]]s for every bullet point. This makes it much easier to maintain lists where anchors to individual entries are required.
 +
 +
Note that if you use it more than once on the same page, you'll need to use the {{para|name}} parameter every time after the first, and with a different name for each, so that the generated anchors are unique. A number or lowercase character is recommended.
 +
 +
The anchors generated are of the form "<code>alist-<var>x</var></code>" where <code><var>x</var></code> is the list item number (or with {{para|name|<var>2</var>}}, the form "<code>alist<var>2</var>-<var>x</var></code>"). So to link to the first entry of a list, use <code><nowiki>[[pagename#alist-2|link to item]]</nowiki></code>.
  
 
=== Usage ===
 
=== Usage ===
Line 8: Line 12:
 
<pre>
 
<pre>
 
{{ anchored list
 
{{ anchored list
| first entry
+
|First entry
| Second entry
+
|Second entry
| So on
+
|So on
 
...
 
...
| Last entry
+
|Last entry
 +
}}
 +
</pre>
 +
 
 +
<pre>
 +
{{ anchored list |name=2
 +
|First entry
 +
|Second entry
 +
|Third entry
 +
}}
 +
</pre>
 +
 
 +
<pre>
 +
{{ anchored list |name=3
 +
|First entry
 +
|Second entry
 +
|Third entry
 
}}
 
}}
 
</pre>
 
</pre>
Line 19: Line 39:
  
 
=== See also ===
 
=== See also ===
 +
* {{tl|Anchor}}
 +
* {{tl|Visible anchor}}
 +
* {{tl|Shortcut}}
  
 
<includeonly>
 
<includeonly>

Revision as of 21:53, 21 June 2012

This template can be used to create an ordered list which generates HTML anchors for every bullet point. This makes it much easier to maintain lists where anchors to individual entries are required.

Note that if you use it more than once on the same page, you'll need to use the |name= parameter every time after the first, and with a different name for each, so that the generated anchors are unique. A number or lowercase character is recommended.

The anchors generated are of the form "alist-x" where x is the list item number (or with |name=2, the form "alist2-x"). So to link to the first entry of a list, use [[pagename#alist-2|link to item]].

Usage

{{ anchored list
|First entry
|Second entry
|So on
...
|Last entry
}}
{{ anchored list |name=2
|First entry
|Second entry
|Third entry
}}
{{ anchored list |name=3
|First entry
|Second entry
|Third entry
}}

Up to 99 entries are supported.

See also