toc.gp



Creator information
Current maintainer :Joe Vaughan
Author(s) :Joe Vaughan
Recipe homepage :http://www.freddyfrog.com/hacks/genpage/recipes/toc.html

Version history
The documentation file was last modified on Tue Nov 29 18:22:58 2016.

Overview
toc.gp creates a Table of Contents within the current page using tags
Compatible Genpage Versions
Version 1.0.3 and above.
Syntax
toc( aStartLevel )
toc( aStartLevel aStopLevel)

In the simplest form toc back parses the current content file, replacing all occurences of <H(aLevel+)> with anchor tags and generates a multilevel Table of contents that is inserted wherever a content("TOC") tag is located. It will do this upto and including <H7> tags.

The form with two parameters again replaces all occurences of <H(aLevel+)> with anchor tags and generates a multilevel Table of contents that is inserted wherever a content("TOC") tag is located. However, It will only do this upto and including <H(aStopLevel)> tags.

The caveat is that in order to be sure that all of the content file is preparsed properly before toc() is called, you should place the call to toc() as near to the end of a parsing run as possible (e.g. at the bottom of your template)


Examples

Firstly, include the toc.gp recipe by calling <-- _GP_ require("$root/include/toc.gp") --> somewhere in the content.

Place a content("TOC") tag where you want the table of contents to be generated.

As the last entry in your template, include <-- _GP_ toc("2") --> to have a table of contents generated from all <H2> and greater tags with appropriate HREFS and anchors.

Alternatively, as the last entry in your template, include <-- _GP_ toc("2","4") --> to have a multilevel table of contents generated from all <H2>,<H3> and <H4> again with appropriate HREFS and anchors.


To-do List

Known Bugs
None known :)

Back to Top


This page generated using Genpage - Version: 1.0.7 on Wed Nov 30 16:34:11 2016

© Joe Vaughan
1999