Template talk:AlphanumericTOC
From Wikipedia, the free encyclopedia
|
[edit] Purpose
This TOC template was created as a customizable substitute for the growing zoo of CompactTOCs. Rather than have dozens of stylistic varieties, it is preferrable to have a single template which can be adjusted to fit the editor's wishes.
[edit] Usage
Insert {{AlphanumericTOC}}
at the point in the article where you want the TOC to appear. If using with a list, many editors have found it helpful to insert a TOC at both the beginning and end of the list.
[edit] Parameters
Toggling the style and display of elements within the TOC is accomplished by adding parameters with a null value (in the form |parameter=|
). This is a short list which will be expanded upon further in the following text:
- block v. inline formatting:
multiline
,nobreak
; - table alignment:
align
; - addition of prefixes to the links:
prefixLink
,prefixDesc
; - suppressing the automatic table of contents:
notoc
; and, - each of the links also has its own parameter which when used suppresses the display of the link.
[edit] Block and inline formatting
When the template is used without any parameters, it appears as:
Contents: 0–9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Top of Page — See also — References — External links |
This replicates what you would see with a template like {{CompactTOCrefs}}
. The templates {{CompactTOC2}}
, {{CompactTOC5T}}
, and {{CompactTOCrefs2}}
display the text in a single inline list. To accomplish this, add the parameter nobreak
to the template:
{{AlphanumericTOC| nobreak=|}}
Contents: 0–9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z— Top of Page — See also — References — External links |
For a TOC which displays in a block format, like {{CompactTOC4}}
and {{CompactTOC5}}
, add the parameter multiline
:
{{AlphanumericTOC| multiline=|}}
Contents 0–9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Top of Page — See also — References — External links |
Note: If these parameters are used in combination, multiline
will always override any effects from nobreak
.
[edit] Aligning the TOC
As is apparent from the examples already given, the natural state of the TOC is to appear along the left side of the page without any alignment. Some of the existing TOCs, including {{CompactTOC}}
, {{CompactTOC3}}
, and {{CompactTOCrefs}}
, are aligned to the center of the page. This can be replicated by adding the parameter align
with a value of 'center':
{{AlphanumericTOC| align=center|}}
Contents: 0–9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Top of Page — See also — References — External links |
The TOC may also be aligned to the right or the left, causing the article text to wrap around it, but floating the TOC is generally discouraged. Guidelines may be found at Wikipedia:Section#Floating the TOC.
[edit] Prefixing links or link descriptions
The TOC templates {{CompactTOCprefix}}
and {{CompactTOC2wprefix}}
include the ability to add a prefix to the link with or without displaying it in the TOC. This can also be accomplished with this template by using the parameters prefixLink
and prefixDesc
; the former adds the prefix to the actual link, and the latter adds the prefix to the text displayed on the page. Examples:
{{AlphanumericTOC| prefixLink=1.|}}
Contents: 0–9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Top of Page — See also — References — External links |
{{AlphanumericTOC| prefixLink=hidden| prefixDesc=visible|}}
{{AlphanumericTOC| prefixDesc=+ |}}
Contents: +0–9 +A +B +C +D +E +F +G +H +I +J +K +L +M +N +O +P +Q +R +S +T +U +V +W +X +Y +Z Top of Page — See also — References — External links |
[edit] Suppression of the normal TOC
In the cases where it might not be desirable to suppress the automatically generated table of contents this template uses the parameter notoc
to prevent suppression. If you want to allow the software to generate a table of contents, use the following:
{{AlphanumericTOC| notoc=|}}
[edit] Selective link removal
One of the reasons for having so many different versions of CompactTOC has been that some articles do not have a 'References' section, or the TOC is being used for a list contained within a larger article. This template solves the problem by providing a parameter for each link to be removed. They are as follows:
numbers
: removes the numbers linka
,b
, etc.: removes the link for that letter; alternatively it can be used to create unlinked letters (see example below)sections
: removes all links appearing after the letterstop
: removes the link to the 'Top of Page'seealso
: removes the link to the 'See also' sectionreferences
: removes the link to the 'References' sectionexternallinks
: removes the link to the 'External links' section
Some examples:
{{AlphanumericTOC| numbers=| sections=|}}
Contents: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
{{AlphanumericTOC| numbers=| i=| n=| x=| z=| references=|}}
Contents: A B C D E F G H J K L M O P Q R S T U V W Y Top of Page — See also — External links |
{{AlphanumericTOC| numbers=| i=I| j=J| v=V| x=X| nobreak=| top=|}}
Contents: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z— See also — References — External links |
{{AlphanumericTOC| multiline=| align=center| g=| seealso=| externallinks=|}}
Contents 0–9 A B C D E F H I J K L M N O P Q R S T U V W X Y Z Top of Page — References |
[edit] Optional user defined section links
Optional section links may be defined using the parameters sec1
, sec2
, sec3
, sec4
, and sec5
, as follows:
{{AlphanumericTOC| numbers=| seealso=| externallinks=| sec1=Added section| sec2=Plus one|}}
Contents: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Top of Page — Added section — Plus one — References |
[edit] History
Major revisions:
- Created & documented March 4, 2006 by Moverton
- Changed to use #if ParserFunctions June 17, 2006 by Moverton — This change should not impact the function or appearance of any existing usage.
- Added optional user defined section links November 17, 2006 by Moverton — This change should not impact the function or appearance of any existing usage.
- Added optional
top
parameter December 27, 2006 by Moverton — This allows for optional removal of the link to the 'Top of Page'; it should not impact the function of any existing usage.
[edit] Discussion
I've been trying to get this to work, but can't get it to work. I'm using IIS. Maybe its being interpreted differently? I'm getting much of the code, such as:
Contents{{{multiline|:}}} {{{numbers|[[#{{{prefixLink|}}}0–9|{{{prefixDesc|}}}0–9]]}}}{{{a| [[#{{{prefixLink|}}}A|{{{prefixDesc|}}}A]]}}}
--209.22.68.28 12:09, 6 March 2006 (UTC)
- I don't know what IIS is, but can you give an example of where you were trying to use it? —Mike 06:38, 15 March 2006 (UTC)
- IIS is a web-server which leads to the assumption that the query relates to an external site. in this case the version of MediaWiki becomes relevant because the use of parameter defaults is not available prior to version 1.6. HTH HAND —Phil | Talk 14:52, 2 May 2006 (UTC)
[edit] Parameters for extra sections on page?
Very nice template. Would it be possible to add parameters to allow for insertion of extra sections, as with Template:CompactTOC3? Would seem to be a simple matter of inserting the following parameter code from the other template:
{{#if:{{{Sec1|}}}| - [[#{{{Sec1}}}|{{{Sec1}}}]]|}} {{#if:{{{Sec2|}}}| - [[#{{{Sec2}}}|{{{Sec2}}}]]|}} {{#if:{{{Sec3|}}}| - [[#{{{Sec3}}}|{{{Sec3}}}]]|}}
This template would then have all the bells & whistles. My only concern is obviously breaking current instances of the template. --KeithB 20:08, 16 November 2006 (UTC)
- It looked like most of the pages found at Special:Whatlinkshere/Template:CompactTOC3 could use this template without modification. But because there are a few that have other sections besides the standard appendices, I added five optional section links to this template. —Mike 03:49, 18 November 2006 (UTC)
-
- Thanks! It looks great. I've already put it into use at List of Ohio county name etymologies. I had been experimenting with the template mod, but I didn't get the time, and the nerve, to make the change. --KeithB 03:57, 18 November 2006 (UTC)
[edit] Remove "Top of Page"?
Is there a way to not show the "Top of Page" link? I monkeyed with it in the sandbox and can get rid of "Top of Page", but then there's the hassle of the dashes in between and when to have one. Thoughts? -- SatyrTN (talk | contribs) 20:51, 20 December 2006 (UTC)
- Because of the dashes, it was impossible to do when I first created the template. But now that ParserFunctions can be used, it is not too hard though it does add bulk to the code. —Mike 00:18, 28 December 2006 (UTC)
[edit] Navigation bar in every section heading?
Is it OK to use Template:AlphanumericTOC repeatedly on a page to make a navigation bar below every section heading? On a long page with an alphanumeric TOC, having a copy of the navigation bar at every section heading would make navigating much simpler. For example, if I am looking at section Q and I want to see section D, currently I have to scroll to section D, or navigate manually to the top of the page to use the TOC link. On a long page that can become tedious. By "is it OK" I mean two things:
- Are there any technical reasons not to do this?
- Are there any policy reasons not to do this?
--Teratornis 18:01, 19 February 2007 (UTC)
- There isn't anything saying you can't do it. —Mike 04:50, 20 February 2007 (UTC)