Get our free book (in Spanish or English) on rainwater now - To Catch the Rain.

Template:AlphanumericTOC/doc

From Appropedia
Jump to: navigation, search

Purpose[edit]

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.

Usage[edit]

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.

Parameters[edit]

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.

Block and inline formatting[edit]

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 PageSee alsoReferencesExternal links

This replicates what you would see with a template like wikipedia:Template:CompactTOCrefs. The templates wikipedia:Template:CompactTOC2, wikipedia:Template:CompactTOC5T, and wikipedia:Template: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 ZTop of PageSee alsoReferencesExternal links


For a TOC which displays in a block format, like wikipedia:Template:CompactTOC4 and wikipedia:Template: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 PageSee alsoReferencesExternal links


Note: If these parameters are used in combination, multiline will always override any effects from nobreak.

Aligning the TOC[edit]

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 wikipedia:Template:CompactTOC, wikipedia:Template:CompactTOC3, and wikipedia:Template: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 PageSee alsoReferencesExternal 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 are at wikipedia:Wikipedia:Section#Floating the TOC.

Prefixing links or link descriptions[edit]

The TOC templates wikipedia:Template:CompactTOCprefix and wikipedia:Template: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 PageSee alsoReferencesExternal links
 {{AlphanumericTOC|
     prefixLink=hidden|
     prefixDesc=visible|}}
Contents: visible0–9 visibleA visibleB visibleC visibleD visibleE visibleF visibleG visibleH visibleI visibleJ visibleK visibleL visibleM visibleN visibleO visibleP visibleQ visibleR visibleS visibleT visibleU visibleV visibleW visibleX visibleY visibleZ
Top of PageSee alsoReferencesExternal links
 {{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 PageSee alsoReferencesExternal links


Suppression of the normal TOC[edit]

By default this template suppresses the generation of the normal table of contents because it assumes that this is to be replaced by the alphanumericalTOC. However, in certain situations a TOC may be desirable in addition to the alphanumericalTOC, for example: where the alphanumericalTOC applies to only a section of the article and there are more than two sections. If you want to overide the TOC suppression and allow the software to generate a table of contents in the normal way, use the parameter notoc as follows:

 {{AlphanumericTOC|
     notoc=|}}

Selective link removal[edit]

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 link
  • a, 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 letters
  • top: removes the link to the 'Top of Page'
  • seealso: removes the link to the 'See also' section
  • references: removes the link to the 'References' section
  • externallinks: 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 PageSee alsoExternal 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 ZSee alsoReferencesExternal 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 PageReferences


Optional user defined section links[edit]

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 PageAdded sectionPlus oneReferences


History[edit]

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.

External links[edit]

Wikipedia
This page or section includes content from Wikipedia. The original article was at Template:AlphanumericTOC. The list of authors can be seen in the history for that page. As with Appropedia, the text of Wikipedia is available under the CC-BY-SA.