=head1 NAME
HTML::Toc - Generate, insert and update HTML Table of Contents.
=head1 DESCRIPTION
Generate, insert and update HTML Table of Contents.
=head1 Introduction
The HTML::Toc consists out of the following packages:
HTML::Toc
HTML::TocGenerator
HTML::TocInsertor
HTML::TocUpdator
HTML::Toc is the object which will eventually hold the Table of Contents. HTML::TocGenerator does the actual generation of the ToC. HTML::TocInsertor handles the insertion of the ToC in the source. HTML::TocUpdator takes care of updating previously inserted ToCs.
HTML::Parser is the base object of HTML::TocGenerator, HTML::TocInsertor and HTML::TocUpdator. Each of these objects uses its predecessor as its ancestor, as shown in the UML diagram underneath:
+---------------------+
| HTML::Parser |
+---------------------+
+---------------------+
| +parse() |
| +parse_file() |
+----------+----------+
/_\
|
+----------+----------+ <> +-----------+
| HTML::TocGenerator + - - - - - -+ HTML::Toc |
+---------------------+ +-----------+
+---------------------+ +-----------+
| +extend() | | +clear() |
| +extendFromFile() | | +format() |
| +generate() | +-----+-----+
| +generateFromFile() | :
+----------+----------+ :
/_\ :
| :
+----------+----------+ <> :
| HTML::TocInsertor + - - - - - - - - -+
+---------------------+ :
+---------------------+ :
| +insert() | :
| +insertIntoFile() | :
+----------+----------+ :
/_\ :
| :
+----------+----------+ <> :
| HTML::TocUpdator + - - - - - - - - -+
+---------------------+
+---------------------+
| +insert() |
| +insertIntoFile() |
| +update() |
| +updateFile() |
+---------------------+
When generating a ToC you'll have to decide which object you want to use:
TocGenerator:
for generating a ToC without inserting the ToC into the source
TocInsertor:
for generating a ToC and inserting the ToC into the source
TocUpdator:
for generating and inserting a ToC, removing any previously
inserted ToC elements
Thus in tabular view, each object is capable of:
generating inserting updating
---------------------------------
TocGenerator X
TocInsertor X X
TocUpdator X X X
=head2 Generating
The code underneath will generate a ToC of the HTML headings C<