.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{ . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "HTML::GenToc 3pm" .TH HTML::GenToc 3pm "2015-05-31" "perl v5.20.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" HTML::GenToc \- Generate a Table of Contents for HTML documents. .SH "VERSION" .IX Header "VERSION" version 3.20 .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use HTML::GenToc; \& \& # create a new object \& my $toc = new HTML::GenToc(); \& \& my $toc = new HTML::GenToc(title=>"Table of Contents", \& toc_entry=>{ \& H1=>1, \& H2=>2 \& }, \& toc_end=>{ \& H1=>\*(Aq/H1\*(Aq, \& H2=>\*(Aq/H2\*(Aq \& } \& ); \& \& # generate a ToC from a file \& $toc\->generate_toc(input=>$html_file, \& footer=>$footer_file, \& header=>$header_file \& ); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" HTML::GenToc generates anchors and a table of contents for \&\s-1HTML\s0 documents. Depending on the arguments, it will insert the information it generates, or output to a string, a separate file or \s-1STDOUT.\s0 .PP 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 \&\s-1HTML\s0 code is complete, pure \s-1HTML,\s0 one can input pseudo-html or page-fragments, which makes it suitable for using on templates and \s-1HTML\s0 meta-languages such as \s-1WML.\s0 .PP 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. .SH "DETAILS" .IX Header "DETAILS" The ToC generated is a multi-level level list containing links to the significant elements. HTML::GenToc inserts the links into the ToC to significant elements at a level specified by the user. .PP \&\fBExample:\fR .PP If H1s are specified as level 1, than they appear in the first level list of the ToC. If H2s are specified as a level 2, than they appear in a second level list in the ToC. .PP Information on the significant elements and what level they should occur are passed in to the methods used by this object, or one can use the defaults. .PP There are two phases to the ToC generation. The first phase is to put suitable anchors into the \s-1HTML\s0 documents, and the second phase is to generate the ToC from \s-1HTML\s0 documents which have anchors in them for the ToC to link to. .PP For more information on controlling the contents of the created ToC, see \&\*(L"Formatting the ToC\*(R". .PP HTML::GenToc also supports the ability to incorporate the ToC into the \s-1HTML\s0 document itself via the \fBinline\fR option. See \*(L"Inlining the ToC\*(R" for more information. .PP In order for HTML::GenToc to support linking to significant elements, HTML::GenToc inserts anchors into the significant elements. One can use HTML::GenToc as a filter, outputing the result to another file, or one can overwrite the original file, with the original backed up with a suffix (default: \*(L"org\*(R") appended to the filename. One can also output the result to a string. .SH "METHODS" .IX Header "METHODS" Default arguments can be set when the object is created, and overridden by setting arguments when the generate_toc method is called. Arguments are given as a hash of arguments. .SS "Method \*(-- new" .IX Subsection "Method new" .Vb 1 \& $toc = new HTML::GenToc(); \& \& $toc = new HTML::GenToc(toc_entry=>\e%my_toc_entry, \& toc_end=>\e%my_toc_end, \& bak=>\*(Aqbak\*(Aq, \& ... \& ); .Ve .PP Creates a new HTML::GenToc object. .PP These arguments will be used as defaults in invocations of other methods. .PP See generate_tod for possible arguments. .SS "generate_toc" .IX Subsection "generate_toc" .Vb 1 \& $toc\->generate_toc(outfile=>"index2.html"); \& \& my $result_str = $toc\->generate_toc(to_string=>1); .Ve .PP Generates a table of contents for the significant elements in the \s-1HTML\s0 documents, optionally generating anchors for them first. .PP \&\fBOptions\fR .IP "bak" 4 .IX Item "bak" bak => \fIstring\fR .Sp If the input file/files is/are being overwritten (\fBoverwrite\fR is on), copy the original file to "\fIfilename\fR.\fIstring\fR". If the value is empty, \fBno\fR backup file will be created. (default:org) .IP "debug" 4 .IX Item "debug" debug => 1 .Sp Enable verbose debugging output. Used for debugging this module; in other words, don't bother. (default:off) .IP "entrysep" 4 .IX Item "entrysep" entrysep => \fIstring\fR .Sp Separator string for non\-
  • item entries (default: \*(L", \*(R") .IP "filenames" 4 .IX Item "filenames" filenames => \e@filenames .Sp The filenames to use when creating table-of-contents links. This overrides the filenames given in the \fBinput\fR option, and is expected to have exactly the same number of elements. This can also be used when passing in string-content to the \fBinput\fR option, to give a (fake) filename to use for the links relating to that content. .IP "footer" 4 .IX Item "footer" footer => \fIfile_or_string\fR .Sp Either the filename of the file containing footer text for ToC; or a string containing the footer text. .IP "header" 4 .IX Item "header" header => \fIfile_or_string\fR .Sp Either the filename of the file containing header text for ToC; or a string containing the header text. .IP "ignore_only_one" 4 .IX Item "ignore_only_one" ignore_only_one => 1 .Sp If there would be only one item in the ToC, don't make a ToC. .IP "ignore_sole_first" 4 .IX Item "ignore_sole_first" ignore_sole_first => 1 .Sp If the first item in the ToC is of the highest level, \&\s-1AND\s0 it is the only one of that level, ignore it. This is useful in web-pages where there is only one H1 header but one doesn't know beforehand whether there will be only one. .IP "inline" 4 .IX Item "inline" inline => 1 .Sp Put ToC in document at a given point. See \*(L"Inlining the ToC\*(R" for more information. .IP "input" 4 .IX Item "input" input => \e@filenames .Sp input => \f(CW$content\fR .Sp This is expected to be either a reference to an array of filenames, or a string containing content to process. .Sp The three main uses would be: .RS 4 .IP "(a)" 4 .IX Item "(a)" you have more than one file to process, so pass in multiple filenames .IP "(b)" 4 .IX Item "(b)" you have one file to process, so pass in its filename as the only array item .IP "(c)" 4 .IX Item "(c)" you have \s-1HTML\s0 content to process, so pass in just the content as a string .RE .RS 4 .Sp (default:undefined) .RE .IP "notoc_match" 4 .IX Item "notoc_match" notoc_match => \fIstring\fR .Sp If there are certain individual tags you don't wish to include in the table of contents, even though they match the \*(L"significant elements\*(R", then if this pattern matches contents inside the tag (not the body), then that tag will not be included, either in generating anchors nor in generating the ToC. (default: \f(CW\*(C`class="notoc"\*(C'\fR) .IP "ol" 4 .IX Item "ol" ol => 1 .Sp Use an ordered list for level 1 ToC entries. .IP "ol_num_levels" 4 .IX Item "ol_num_levels" ol_num_levels => 2 .Sp The number of levels deep the \s-1OL\s0 listing will go if \fBol\fR is true. If set to zero, will use an ordered list for all levels. (default:1) .IP "overwrite" 4 .IX Item "overwrite" overwrite => 1 .Sp Overwrite the input file with the output. (default:off) .IP "outfile" 4 .IX Item "outfile" outfile => \fIfile\fR .Sp File to write the output to. This is where the modified \s-1HTML\s0 output goes to. Note that it doesn't make sense to use this option if you are processing more than one file. If you give '\-' as the filename, then output will go to \s-1STDOUT. \&\s0(default: \s-1STDOUT\s0) .IP "quiet" 4 .IX Item "quiet" quiet => 1 .Sp Suppress informative messages. (default: off) .IP "textonly" 4 .IX Item "textonly" textonly => 1 .Sp Use only text content in significant elements. .IP "title" 4 .IX Item "title" title => \fIstring\fR .Sp Title for ToC page (if not using \fBheader\fR or \fBinline\fR or \fBtoc_only\fR) (default: \*(L"Table of Contents\*(R") .IP "toc_after" 4 .IX Item "toc_after" toc_after => \e%toc_after_data .Sp \&\f(CW%toc_after_data\fR = { \fItag1\fR => \fIsuffix1\fR, \fItag2\fR => \fIsuffix2\fR }; .Sp toc_after => { H2=>'' } .Sp For defining layout of significant elements in the ToC. .Sp This expects a reference to a hash of tag=>suffix pairs. .Sp The \fItag\fR is the \s-1HTML\s0 tag which marks the start of the element. The \&\fIsuffix\fR is what is required to be appended to the Table of Contents entry generated for that tag. .Sp (default: undefined) .IP "toc_before" 4 .IX Item "toc_before" toc_before => \e%toc_before_data .Sp \&\f(CW%toc_before_data\fR = { \fItag1\fR => \fIprefix1\fR, \fItag2\fR => \fIprefix2\fR }; .Sp toc_before=>{ H2=>'' } .Sp For defining the layout of significant elements in the ToC. The \fItag\fR is the \s-1HTML\s0 tag which marks the start of the element. The \fIprefix\fR is what is required to be prepended to the Table of Contents entry generated for that tag. .Sp (default: undefined) .IP "toc_end" 4 .IX Item "toc_end" toc_end => \e%toc_end_data .Sp \&\f(CW%toc_end_data\fR = { \fItag1\fR => \fIendtag1\fR, \fItag2\fR => \fIendtag2\fR }; .Sp toc_end => { H1 => '/H1', H2 => '/H2' } .Sp For defining significant elements. The \fItag\fR is the \s-1HTML\s0 tag which marks the start of the element. The \fIendtag\fR the \s-1HTML\s0 tag which marks the end of the element. When matching in the input file, case is ignored (but make sure that all your \fItag\fR options referring to the same tag are exactly the same!). .IP "toc_entry" 4 .IX Item "toc_entry" toc_entry => \e%toc_entry_data .Sp \&\f(CW%toc_entry_data\fR = { \fItag1\fR => \fIlevel1\fR, \fItag2\fR => \fIlevel2\fR }; .Sp toc_entry => { H1 => 1, H2 => 2 } .Sp For defining significant elements. The \fItag\fR is the \s-1HTML\s0 tag which marks the start of the element. The \fIlevel\fR is what level the tag is considered to be. The value of \fIlevel\fR must be numeric, and non-zero. If the value is negative, consective entries represented by the significant_element will be separated by the value set by \fBentrysep\fR option. .IP "toclabel" 4 .IX Item "toclabel" toclabel => \fIstring\fR .Sp \&\s-1HTML\s0 text that labels the ToC. Always used. (default: \*(L"

    Table of Contents

    \*(R") .IP "toc_tag" 4 .IX Item "toc_tag" toc_tag => \fIstring\fR .Sp If a ToC is to be included inline, this is the pattern which is used to match the tag where the ToC should be put. This can be a start-tag, an end-tag or a comment, but the < should be left out; that is, if you want the ToC to be placed after the \s-1BODY\s0 tag, then give \*(L"\s-1BODY\*(R". \s0 If you want a special comment tag to make where the ToC should go, then include the comment marks, for example: \*(L"!\-\-toc\-\-\*(R" (default:BODY) .IP "toc_tag_replace" 4 .IX Item "toc_tag_replace" toc_tag_replace => 1 .Sp In conjunction with \fBtoc_tag\fR, this is a flag to say whether the given tag should be replaced, or if the ToC should be put after the tag. This can be useful if your toc_tag is a comment and you don't need it after you have the ToC in place. (default:false) .IP "toc_only" 4 .IX Item "toc_only" toc_only => 1 .Sp Output only the Table of Contents, that is, the Table of Contents plus the toclabel. If there is a \fBheader\fR or a \fBfooter\fR, these will also be output. .Sp If \fBtoc_only\fR is false then if there is no \fBheader\fR, and \fBinline\fR is not true, then a suitable \s-1HTML\s0 page header will be output, and if there is no \fBfooter\fR and \fBinline\fR is not true, then a \s-1HTML\s0 page footer will be output. .Sp (default:false) .IP "to_string" 4 .IX Item "to_string" to_string => 1 .Sp Return the modified \s-1HTML\s0 output as a string. This \fIdoes\fR override other methods of output (unlike version 3.00). If \fIto_string\fR is false, the method will return 1 rather than a string. .IP "use_id" 4 .IX Item "use_id" use_id => 1 .Sp Use id="\fIname\fR\*(L" for anchors rather than anchors. However if an anchor already exists for a Significant Element, this won't make an id for that particular element. .IP "useorg" 4 .IX Item "useorg" useorg => 1 .Sp Use pre-existing backup files as the input source; that is, files of the form \fIinfile\fR.\fIbak\fR (see \fBinput\fR and \fBbak\fR). .SH "INTERNAL METHODS" .IX Header "INTERNAL METHODS" These methods are documented for developer purposes and aren't intended to be used externally. .SS "make_anchor_name" .IX Subsection "make_anchor_name" .Vb 2 \& $toc\->make_anchor_name(content=>$content, \& anchors=>\e%anchors); .Ve .PP Makes the anchor-name for one anchor. Bases the anchor on the content of the significant element. Ensures that anchors are unique. .SS "make_anchors" .IX Subsection "make_anchors" .Vb 6 \& my $new_html = $toc\->make_anchors(input=>$html, \& notoc_match=>$notoc_match, \& use_id=>$use_id, \& toc_entry=>\e%toc_entries, \& toc_end=>\e%toc_ends, \& ); .Ve .PP Makes the anchors the given input string. Returns a string. .SS "make_toc_list" .IX Subsection "make_toc_list" .Vb 6 \& my @toc_list = $toc\->make_toc_list(input=>$html, \& labels=>\e%labels, \& notoc_match=>$notoc_match, \& toc_entry=>\e%toc_entry, \& toc_end=>\e%toc_end, \& filename=>$filename); .Ve .PP Makes a list of lists which represents the structure and content of (a portion of) the ToC from one file. Also updates a list of labels for the ToC entries. .SS "build_lol" .IX Subsection "build_lol" Build a list of lists of paths, given a list of hashes with info about paths. .SS "output_toc" .IX Subsection "output_toc" .Vb 3 \& $self\->output_toc(toc=>$toc_str, \& input=>\e@input, \& filenames=>\e@filenames); .Ve .PP Put the output (whether to file, \s-1STDOUT\s0 or string). The \*(L"output\*(R" in this case could be the ToC, the modified (anchors added) \s-1HTML,\s0 or both. .SS "put_toc_inline" .IX Subsection "put_toc_inline" .Vb 2 \& my $newhtml = $toc\->put_toc_inline(toc_str=>$toc_str, \& filename=>$filename, in_string=>$in_string); .Ve .PP Puts the given toc_str into the given input string; returns a string. .SS "cp" .IX Subsection "cp" .Vb 1 \& cp($src, $dst); .Ve .PP Copies file \f(CW$src\fR to \f(CW$dst\fR. Used for making backups of files. .SH "FILE FORMATS" .IX Header "FILE FORMATS" .SS "Formatting the ToC" .IX Subsection "Formatting the ToC" The \fBtoc_entry\fR and other related options give you control on how the ToC entries may look, but there are other options to affect the final appearance of the ToC file created. .PP With the \fBheader\fR option, the contents of the given file (or string) will be prepended before the generated ToC. This allows you to have introductory text, or any other text, before the ToC. .IP "Note:" 4 .IX Item "Note:" If you use the \fBheader\fR option, make sure the file specified contains the opening \s-1HTML\s0 tag, the \s-1HEAD\s0 element (containing the \&\s-1TITLE\s0 element), and the opening \s-1BODY\s0 tag. However, these tags/elements should not be in the header file if the \fBinline\fR option is used. See \*(L"Inlining the ToC\*(R" for information on what the header file should contain for inlining the ToC. .PP With the \fBtoclabel\fR option, the contents of the given string will be prepended before the generated ToC (but after any text taken from a \&\fBheader\fR file). .PP With the \fBfooter\fR option, the contents of the file will be appended after the generated ToC. .IP "Note:" 4 .IX Item "Note:" If you use the \fBfooter\fR, make sure it includes the closing \s-1BODY\s0 and \s-1HTML\s0 tags (unless, of course, you are using the \fBinline\fR option). .PP If the \fBheader\fR option is not specified, the appropriate starting \&\s-1HTML\s0 markup will be added, unless the \fBtoc_only\fR option is specified. If the \fBfooter\fR option is not specified, the appropriate closing \&\s-1HTML\s0 markup will be added, unless the \fBtoc_only\fR option is specified. .PP If you do not want/need to deal with header, and footer, files, then you are allowed to specify the title, \fBtitle\fR option, of the ToC file; and it allows you to specify a heading, or label, to put before ToC entries' list, the \fBtoclabel\fR option. Both options have default values. .PP If you do not want \s-1HTML\s0 page tags to be supplied, and just want the ToC itself, then specify the \fBtoc_only\fR option. If there are no \fBheader\fR or \fBfooter\fR files, then this will simply output the contents of \fBtoclabel\fR and the ToC itself. .SS "Inlining the ToC" .IX Subsection "Inlining the ToC" The ability to incorporate the ToC directly into an \s-1HTML\s0 document is supported via the \fBinline\fR option. .PP Inlining will be done on the first file in the list of files processed, and will only be done if that file contains an opening tag matching the \&\fBtoc_tag\fR value. .PP If \fBoverwrite\fR is true, then the first file in the list will be overwritten, with the generated ToC inserted at the appropriate spot. Otherwise a modified version of the first file is output to either \s-1STDOUT\s0 or to the output file defined by the \fBoutfile\fR option. .PP The options \fBtoc_tag\fR and \fBtoc_tag_replace\fR are used to determine where and how the ToC is inserted into the output. .PP \&\fBExample 1\fR .PP .Vb 5 \& $toc\->generate_toc(inline=>1, \& toc_tag => \*(AqBODY\*(Aq, \& toc_tag_replace => 0, \& ... \& ); .Ve .PP This will put the generated ToC after the \s-1BODY\s0 tag of the first file. If the \fBheader\fR option is specified, then the contents of the specified file are inserted after the \s-1BODY\s0 tag. If the \fBtoclabel\fR option is not empty, then the text specified by the \fBtoclabel\fR option is inserted. Then the ToC is inserted, and finally, if the \fBfooter\fR option is specified, it inserts the footer. Then the rest of the input file follows as it was before. .PP \&\fBExample 2\fR .PP .Vb 5 \& $toc\->generate_toc(inline=>1, \& toc_tag => \*(Aq!\-\-toc\-\-\*(Aq, \& toc_tag_replace => 1, \& ... \& ); .Ve .PP This will put the generated ToC after the first comment of the form , and that comment will be replaced by the ToC (in the order \fBheader\fR \fBtoclabel\fR ToC \fBfooter\fR) followed by the rest of the input file. .IP "Note:" 4 .IX Item "Note:" The header file should not contain the beginning \s-1HTML\s0 tag and \s-1HEAD\s0 element since the \s-1HTML\s0 file being processed should already contain these tags/elements. .SH "NOTES" .IX Header "NOTES" .IP "\(bu" 4 HTML::GenToc is smart enough to detect anchors inside significant elements. If the anchor defines the \s-1NAME\s0 attribute, HTML::GenToc uses the value. Else, it adds its own \s-1NAME\s0 attribute to the anchor. If \fBuse_id\fR is true, then it likewise checks for and uses IDs. .IP "\(bu" 4 The \s-1TITLE\s0 element is treated specially if specified in the \fBtoc_entry\fR option. It is illegal to insert anchors (A) into \s-1TITLE\s0 elements. Therefore, HTML::GenToc will actually link to the filename itself instead of the \s-1TITLE\s0 element of the document. .IP "\(bu" 4 HTML::GenToc will ignore a significant element if it does not contain any non-whitespace characters. A warning message is generated if such a condition exists. .IP "\(bu" 4 If you have a sequence of significant elements that change in a slightly disordered fashion, such as H1 \-> H3 \-> H2 or even H2 \-> H1, though HTML::GenToc deals with this to create a list which is still good \s-1HTML,\s0 if you are using an ordered list to that depth, then you will get strange numbering, as an extra list element will have been inserted to nest the elements at the correct level. .Sp For example (H2 \-> H1 with ol_num_levels=1): .Sp .Vb 3 \& 1. \& * My H2 Header \& 2. My H1 Header .Ve .Sp For example (H1 \-> H3 \-> H2 with ol_num_levels=0 and H3 also being significant): .Sp .Vb 5 \& 1. My H1 Header \& 1. \& 1. My H3 Header \& 2. My H2 Header \& 2. My Second H1 Header .Ve .Sp In cases such as this it may be better not to use the \fBol\fR option. .SH "CAVEATS" .IX Header "CAVEATS" .IP "\(bu" 4 Version 3.10 (and above) generates more verbose (SEO-friendly) anchors than prior versions. Thus anchors generated with earlier versions will not match version 3.10 anchors. .IP "\(bu" 4 Version 3.00 (and above) of HTML::GenToc is not compatible with Version 2.x of HTML::GenToc. It is now designed to do everything in one pass, and has dropped certain options: the \fBinfile\fR option is no longer used (it has been replaced with the \fBinput\fR option); the \fBtoc_file\fR option no longer exists; use the \fBoutfile\fR option instead; the \fBtocmap\fR option is no longer supported. Also the old array-parsing of arguments is no longer supported. There is no longer a \fBgenerate_anchors\fR method; everything is done with \fBgenerate_toc\fR. .Sp It now generates lower-case tags rather than upper-case ones. .IP "\(bu" 4 HTML::GenToc is not very efficient (memory and speed), and can be slow for large documents. .IP "\(bu" 4 Now that generation of anchors and of the ToC are done in one pass, even more memory is used than was the case before. This is more notable when processing multiple files, since all files are read into memory before processing them. .IP "\(bu" 4 Invalid markup will be generated if a significant element is contained inside of an anchor. For example: .Sp .Vb 1 \&

    The FOO command

    .Ve .Sp will be converted to (if H1 is a significant element), .Sp .Vb 1 \&

    The FOO command

    .Ve .Sp which is illegal since anchors cannot be nested. .Sp It is better style to put anchor statements within the element to be anchored. For example, the following is preferred: .Sp .Vb 1 \&

    The FOO command

    .Ve .Sp HTML::GenToc will detect the \*(L"foo\*(R" name and use it. .IP "\(bu" 4 name attributes without quotes are not recognized. .SH "BUGS" .IX Header "BUGS" Tell me about them. .SH "REQUIRES" .IX Header "REQUIRES" The installation of this module requires \f(CW\*(C`Module::Build\*(C'\fR. The module depends on \f(CW\*(C`HTML::SimpleParse\*(C'\fR, \f(CW\*(C`HTML::Entities\*(C'\fR and \f(CW\*(C`HTML::LinkList\*(C'\fR and uses \&\f(CW\*(C`Data::Dumper\*(C'\fR for debugging purposes. The hypertoc script depends on \&\f(CW\*(C`Getopt::Long\*(C'\fR, \f(CW\*(C`Getopt::ArgvFile\*(C'\fR and \f(CW\*(C`Pod::Usage\*(C'\fR. Testing of this distribution depends on \f(CW\*(C`Test::More\*(C'\fR. .SH "INSTALLATION" .IX Header "INSTALLATION" To install this module, run the following commands: .PP .Vb 4 \& perl Build.PL \& ./Build \& ./Build test \& ./Build install .Ve .PP Or, if you're on a platform (like \s-1DOS\s0 or Windows) that doesn't like the \&\*(L"./\*(R" notation, you can do this: .PP .Vb 4 \& perl Build.PL \& perl Build \& perl Build test \& perl Build install .Ve .PP In order to install somewhere other than the default, such as in a directory under your home directory, like \*(L"/home/fred/perl\*(R" go .PP .Vb 1 \& perl Build.PL \-\-install_base /home/fred/perl .Ve .PP as the first step instead. .PP This will install the files underneath /home/fred/perl. .PP You will then need to make sure that you alter the \s-1PERL5LIB\s0 variable to find the modules, and the \s-1PATH\s0 variable to find the script. .PP Therefore you will need to change: your path, to include /home/fred/perl/script (where the script will be) .PP .Vb 1 \& PATH=/home/fred/perl/script:${PATH} .Ve .PP the \s-1PERL5LIB\s0 variable to add /home/fred/perl/lib .PP .Vb 1 \& PERL5LIB=/home/fred/perl/lib:${PERL5LIB} .Ve .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fIperl\fR\|(1) \&\fIhtmltoc\fR\|(1) \&\fIhypertoc\fR\|(1) .SH "AUTHOR" .IX Header "AUTHOR" Kathryn Andersen (\s-1RUBYKAT\s0) http://www.katspace.org/tools/hypertoc/ .PP Based on htmltoc by Earl Hood ehood \s-1AT\s0 medusa.acs.uci.edu .PP Contributions by Dan Dascalescu, .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright (C) 1994\-1997 Earl Hood, ehood \s-1AT\s0 medusa.acs.uci.edu Copyright (C) 2002\-2008 Kathryn Andersen .PP This program is free software; you can redistribute it and/or modify it under the terms of the \s-1GNU\s0 General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. .PP This program is distributed in the hope that it will be useful, but \s-1WITHOUT ANY WARRANTY\s0; without even the implied warranty of \&\s-1MERCHANTABILITY\s0 or \s-1FITNESS FOR A PARTICULAR PURPOSE. \s0 See the \&\s-1GNU\s0 General Public License for more details. .PP You should have received a copy of the \s-1GNU\s0 General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, \s-1MA 02139, USA.\s0