HTML::GenToc 2.30 review
DownloadHTML::GenToc is a Perl module that generate a Table of Contents for HTML documents. SYNOPSIS use HTML::GenToc; # create
|
|
HTML::GenToc is a Perl module that generate a Table of Contents for HTML documents.
SYNOPSIS
use HTML::GenToc;
# create a new object
my $toc = new HTML::GenToc();
my $toc = new HTML::GenToc(title=>"Table of Contents",
toc=>$my_toc_file,
toc_entry=>{
H1=>1,
H2=>2
},
toc_end=>{
H1=>'/H1',
H2=>'/H2'
}
);
# add further arguments
$toc->args(toc_tag=>"BODY",
toc_tag_replace=>0,
);
# generate anchors for a file
$toc->generate_anchors(infile=>$html_file,
overwrite=>0,
);
# generate a ToC from a file
$toc->generate_toc(infile=>$html_file,
footer=>$footer_file,
header=>$header_file
);
HTML::GenToc generates anchors and a table of contents for HTML documents. Depending on the arguments, it will insert the information it generates, or output to a string, a separate file or STDOUT.
While it defaults to taking H1 and H2 elements as the significant elements to put into the table of contents, any tag can be defined as a significant element. Also, it doesn't matter if the input HTML code is complete, pure HTML, one can input pseudo-html or page-fragments, which makes it suitable for using on templates and HTML meta-languages such as WML.
Also included in the distrubution is hypertoc, a script which uses the module so that one can process files on the command-line in a user-friendly manner.
Requirements:
Perl
HTML::GenToc 2.30 keywords