.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" 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 >0, 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 "HYPERTOC 1p" .TH HYPERTOC 1p "2022-06-14" "perl v5.34.0" "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" hypertoc \- generate a table of contents for HTML documents .SH "VERSION" .IX Header "VERSION" version 3.20 .SH "SYNOPSIS" .IX Header "SYNOPSIS" hypertoc \-\-help | \-\-manpage | \-\-man_help | \-\-man .PP hypertoc [\-\-bak \fIstring\fR ] [ \-\-debug ] [ \-\-entrysep \fIstring\fR ] [ \-\-footer \fIfile\fR ] [ \-\-header \fIfile\fR ] [ \-\-ignore_only_one ] [ \-\-ignore_sole_first ] [ \-\-inline ] [ \-\-make_anchors ] [ \-\-make_toc ] [ \-\-notoc_match \fIstring\fR ] [ \-\-ol | \-\-nool ] [ \-\-ol_num_levels ] [ \-\-outfile \fIfile\fR ] [ \-\-overwrite ] [ \-\-quiet ] [ \-\-textonly ] [ \-\-title \fIstring\fR ] { \-\-toc_after \fItag=suffix\fR } { \-\-toc_before \fItag=prefix\fR } { \-\-toc_end \fItag=endtag\fR } { \-\-toc_entry \fItag=level\fR } [ \-\-toc_label \fIstring\fR ] [ \-\-toc_only | \-\-notoc_only ] [ \-\-toc_tag \fIstring\fR ] [ \-\-toc_tag_replace ] [ \-\-use_id ] [ \-\-useorg ] file ... .SH "DESCRIPTION" .IX Header "DESCRIPTION" hypertoc allows you to specify \*(L"significant elements\*(R" that will be hyperlinked to in a \*(L"Table of Contents\*(R" (ToC) for a given set of \s-1HTML\s0 documents. .PP Basically, the ToC generated is a multi-level level list containing links to the significant elements. hypertoc 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 There are two aspects to the ToC generation: (1) putting suitable anchors into the \s-1HTML\s0 documents (\-\-make_anchors), and (2) generating the ToC from \s-1HTML\s0 documents which have anchors in them for the ToC to link to (\-\-make_toc). One can choose to do one or both of these. .PP hypertoc also supports the ability to incorporate the ToC into the \s-1HTML\s0 document itself via the \-\-inline option. .PP In order for hypertoc to support linking to significant elements, hypertoc inserts anchors into the significant elements. One can use hypertoc 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. .PP One can also define options in a config file as well as on the command-line. .SH "OPTIONS" .IX Header "OPTIONS" Options can start with \*(L"\-\-\*(R" or \*(L"\-\*(R"; boolean options can be negated by preceding them with \*(L"no\*(R"; options with hash or array values can be added to by giving the option again for each value. .PP See Getopt::Long for more information. .IP "\-\-argfile \fIfilename\fR" 4 .IX Item "--argfile filename" The name of a file to read more options from. This can be used more than once. For example: .Sp \&\-\-argfile your.args \-\-argfile my.args .Sp See \*(L"Options Files\*(R" for more information. .IP "\-\-bak" 4 .IX Item "--bak" \&\-\-bak \fIstring\fR .Sp If the input file/files is/are being overwritten (\-\-overwrite is on), copy the original file to "\fIfilename\fR.\fIstring\fR". If the value is empty, there is no backup file written. (default:org) .IP "\-\-debug" 4 .IX Item "--debug" 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 "\-\-footer" 4 .IX Item "--footer" \&\-\-footer \fIfile\fR .Sp File containing footer text for table of contents. .IP "\-\-header" 4 .IX Item "--header" \&\-\-header \fIfile\fR .Sp File containing header text for table of contents. .IP "\-\-help" 4 .IX Item "--help" Print a short help message and exit. .IP "\-\-ignore_only_one" 4 .IX Item "--ignore_only_one" 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" 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" Put ToC in document at a given point. See \*(L"Inlining the ToC\*(R" for more information. .IP "\-\-make_anchors | \-\-gen_anchors" 4 .IX Item "--make_anchors | --gen_anchors" Create anchors for the table-of-contents to link to. .IP "\-\-make_toc | \-\-gen_toc" 4 .IX Item "--make_toc | --gen_toc" Make a Table-of-Contents which links to anchored significant elements. .IP "\-\-man_help | \-\-manpage | \-\-man" 4 .IX Item "--man_help | --manpage | --man" Print all documentation and exit. .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: class=\*(L"notoc\*(R") .IP "\-\-ol | \-\-nool" 4 .IX Item "--ol | --nool" Use an ordered list for Table-of-Contents entries (to a given depth). If \-\-ol is false (i.e. \-\-nool is set) then \fIdon't\fR use an ordered list for ToC entries. .Sp (default:false) .Sp (See \-\-ol_num_levels to determine how deep the ordered-list listing goes) .IP "\-\-ol_num_levels" 4 .IX Item "--ol_num_levels" The number of levels deep the \s-1OL\s0 listing will go if \-\-ol is true. If set to zero, will use an ordered list for all levels. (default:1) .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 and the Table-of-Contents goes to. If you give '\-' as the filename, then output will go to \s-1STDOUT.\s0 (default: \s-1STDOUT\s0) .IP "\-\-overwrite" 4 .IX Item "--overwrite" Overwrite the input file with the output. If this is in effect, \-\-outfile is ignored. Used in \fIgenerate_anchors\fR for creating the anchors \*(L"in place\*(R" and in \fIgenerate_toc\fR if the \-\-inline option is in effect. (default:off) .IP "\-\-quiet" 4 .IX Item "--quiet" Suppress informative messages. (default: off) .IP "\-\-textonly" 4 .IX Item "--textonly" Use only text content in significant elements. .IP "\-\-title" 4 .IX Item "--title" \&\-\-title \fIstring\fR .Sp Title for ToC page (if not using \-\-header or \-\-inline or \-\-toc_only) (default: \*(L"Table of Contents\*(R") .IP "\-\-toc_after" 4 .IX Item "--toc_after" \&\-\-toc_after \fItag\fR=\fIsuffix\fR .Sp \&\-\-toc_after \*(L"H2=\*(R" .Sp For defining layout of significant elements in the ToC. 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. This is a cumulative hash argument. (default: undefined) .IP "\-\-toc_before" 4 .IX Item "--toc_before" \&\-\-toc_before \fItag\fR=\fIprefix\fR .Sp \&\-\-toc_before \*(L"H2=\*(R" .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. This is a cumulative hash argument. (default: undefined) .IP "\-\-toc_end" 4 .IX Item "--toc_end" \&\-\-toc_end \fItag\fR=\fIendtag\fR .Sp \&\-\-toc_end \*(L"H1=/H1\*(R" .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!). This is a cumulative hash argument. (default: H1=/H1 H2=/H2) .IP "\-\-toc_entry" 4 .IX Item "--toc_entry" \&\-\-toc_entry \fItag\fR=\fIlevel\fR .Sp \&\-\-toc_entry \*(L"TITLE=1\*(R" \-\-toc_entry \*(L"H1=2\*(R" .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 \-\-entrysep option. This is a cumulative hash argument. (default: H1=1 H2=2) .IP "\-\-toc_label | \-\-toclabel" 4 .IX Item "--toc_label | --toclabel" \&\-\-toc_label \fIstring\fR .Sp \&\s-1HTML\s0 text that labels the ToC. Always used. (default: \*(L"

    Table of Contents

    \*(R") .IP "\-\-toc_only | \-\-notoc_only" 4 .IX Item "--toc_only | --notoc_only" Output only the Table of Contents, that is, the Table of Contents plus the toc_label. If there is a \-\-header or a \-\-footer, these will also be output. .Sp If \-\-toc_only is false (i.e. \-\-notoc_only is set) then if there is no \&\-\-header, and \-\-inline is not true, then a suitable \s-1HTML\s0 page header will be output, and if there is no \-\-footer and \-\-inline is not true, then a \s-1HTML\s0 page footer will be output. (default:\-\-notoc_only) .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" In conjunction with \-\-toc_tag, 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 "\-\-use_id" 4 .IX Item "--use_id" 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 \s-1ID\s0 for that particular element. .IP "\-\-useorg" 4 .IX Item "--useorg" Use pre-existing backup files as the input source; that is, files of the form \fIfilename\fR.\fIbak\fR (see \-\-bak). .SH "FILE FORMATS" .IX Header "FILE FORMATS" .SS "Options Files" .IX Subsection "Options Files" Options can be given in files as well as on the command-line by using the \-\-argfile \fIfilename\fR option in the command-line. Also, the files ~/.hypertocrc and ./.hypertocrc are checked for options. .PP The format is as follows: Lines starting with # are comments. Lines enclosed in PoD markers are also comments. Blank lines are ignored. The options themselves should be given the way they would be on the command line, that is, the option name (\fIincluding\fR the \-\-) followed by its value (if any). .PP For example: .PP .Vb 4 \& # set the ToC to be three\-level \& \-\-toc_entry H1=1 \& \-\-toc_entry H2=2 \& \-\-toc_entry H3=3 \& \& \-\-toc_end H1=/H1 \& \-\-toc_end H2=/H2 \& \-\-toc_end H3=/H3 .Ve .PP Option files can be nested, by giving an \-\-argfile \fIfilename\fR argument inside the option file, it will go and get that referred file as well. .PP See Getopt::ArgvFile for more information. .SH "DETAILS" .IX Header "DETAILS" .SS "Significant Elements" .IX Subsection "Significant Elements" Here are some examples of defining the significant elements for your Table of Contents. .PP \fIExample of Default\fR .IX Subsection "Example of Default" .PP The following reflects the default setting if nothing is explicitly specified: .PP .Vb 1 \& \-\-toc_entry "H1=1" \-\-toc_end "H1=/H1" \-\-toc_entry "H2=2" \-\-toc_end "H2=/H2" .Ve .PP Or, if it was defined in one of the possible \*(L"Options Files\*(R": .PP .Vb 5 \& # default settings \& \-\-toc_entry H1=1 \& \-\-toc_end H1=/H1 \& \-\-toc_entry H2=2 \& \-\-toc_end H2=/H2 .Ve .PP \fIExample of before/after\fR .IX Subsection "Example of before/after" .PP The following options make use of the before/after options: .PP .Vb 6 \& # An options file that adds some formatting \& # make level 1 ToC entries \& \-\-toc_entry H1=1 \& \-\-toc_end H1=/H1 \& \-\-toc_before H1= \& \-\-toc_after H1= \& \& # make level 2 ToC entries \& \-\-toc_entry H2=2 \& \-\-toc_end H2=/H2 \& \-\-toc_before H2= \& \-\-toc_after H2= \& \& # Make level 3 entries as is \& \-\-toc_entry H3=3 \& \-\-toc_end H3=/H3 .Ve .PP \fIExample of custom end\fR .IX Subsection "Example of custom end" .PP The following options try to index definition terms: .PP .Vb 5 \& # An options file that can work for Glossary type documents \& \-\-toc_entry H1=1 \& \-\-toc_end H1=/H1 \& \-\-toc_entry H2=2 \& \-\-toc_end H2=/H2 \& \& # Assumes document has a DD for each DT, otherwise ToC \& # will get entries with a lot of text. \& \-\-toc_entry DT=3 \& \-\-toc_end DT=DD \& \-\-toc_before DT= \& \-\-toc_after DT= .Ve .SS "Formatting the ToC" .IX Subsection "Formatting the ToC" The \-\-toc_entry etc. 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 \-\-header option, the contents of the given file 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 \-\-header 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 \-\-inline options is used. See \*(L"Inlining the ToC\*(R" for information on what the header file should contain for inlining the ToC. .PP With the \-\-toc_label option, the contents of the given string will be prepended before the generated ToC (but after any text taken from a \&\-\-header file). .PP With the \-\-footer option, the contents of the file will be appended after the generated ToC. .IP "Note:" 4 .IX Item "Note:" If you use the \-footer, make sure it includes the closing \s-1BODY\s0 and \s-1HTML\s0 tags (unless, of course, you are using the \-\-inline option). .PP If the \-\-header option is not specified, the appropriate starting \&\s-1HTML\s0 markup will be added, unless the \-\-toc_only option is specified. If the \-\-footer option is not specified, the appropriate closing \&\s-1HTML\s0 markup will be added, unless the \-\-toc_only option is specified. .PP If you do not want/need to deal with header, and footer, files, then you are alloed to specify the title, \-\-title option, of the ToC file; and it allows you to specify a heading, or label, to put before ToC entries' list, the \-\-toc_label option. Both options have default values, see \*(L"\s-1OPTIONS\*(R"\s0 for more information on each option. .PP If you do not want \s-1HTML\s0 page tags to be supplied, and just want the ToC itself, then specify the \-\-toc_only option. If there are no \-\-header or \-\-footer files, then this will simply output the contents of \-\-toc_label 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 \-\-inline 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 \&\-\-toc_tag value. .PP If \-\-overwrite 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 \-\-outfile option. .PP The options \-\-toc_tag and \-\-toc_tag_replace are used to determine where and how the ToC is inserted into the output. .PP \fIExample 1\fR .IX Subsection "Example 1" .PP .Vb 2 \& # this is the default \& \-\-toc_tag BODY \-\-notoc_tag_replace .Ve .PP This will put the generated ToC after the \s-1BODY\s0 tag of the first file. If the \-\-header option is specified, then the contents of the specified file are inserted after the \s-1BODY\s0 tag. If the \-\-toc_label option is not empty, then the text specified by the \-\-toc_label option is inserted. Then the ToC is inserted, and finally, if the \-\-footer option is specified, it inserts the footer. Then the rest of the input file follows as it was before. .PP \fIExample 2\fR .IX Subsection "Example 2" .PP .Vb 1 \& \-\-toc_tag \*(Aq!\-\-toc\-\-\*(Aq \-\-toc_tag_replace .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 \-\-header \-\-toc_label ToC \-\-footer) 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 "EXAMPLES" .IX Header "EXAMPLES" .SS "Create an inline ToC for one file" .IX Subsection "Create an inline ToC for one file" .Vb 1 \& hypertoc \-\-inline \-\-make_anchors \-\-overwrite \-\-make_toc index.html .Ve .PP This will create anchors in \f(CW\*(C`index.html\*(C'\fR, create a ToC with a heading of \*(L"Table of Contents\*(R" and place it after the \s-1BODY\s0 tag of \f(CW\*(C`index.html\*(C'\fR. The file index.html.org will contain the original index.html file, without ToC or anchors. .SS "Create a ToC file from multiple files" .IX Subsection "Create a ToC file from multiple files" First, create the anchors. .PP .Vb 1 \& hypertoc \-\-make_anchors \-\-overwrite index.html fred.html george.html .Ve .PP Then create the ToC .PP .Vb 1 \& hypertoc \-\-make_toc \-\-outfile table.html index.html fred.html george.html .Ve .SS "Create an inline ToC after the first heading of the first file" .IX Subsection "Create an inline ToC after the first heading of the first file" .Vb 2 \& hypertoc \-\-make_anchors \-\-inline \-\-overwrite \-\-make_toc \-\-toc_tag /H1 \e \& \-\-notoc_tag_replace \-\-toc_label "" index.html fred.html george.html .Ve .PP This will create anchors in the \f(CW\*(C`index.html\*(C'\fR, \f(CW\*(C`fred.html\*(C'\fR and \&\f(CW\*(C`george.html\*(C'\fR files, create a ToC with no header and place it after the first H1 header in \f(CW\*(C`index.html\*(C'\fR and back up the original files to \&\f(CW\*(C`index.html.org\*(C'\fR, \f(CW\*(C`fred.html.org\*(C'\fR and \f(CW\*(C`george.html.org\*(C'\fR .SS "Create an inline ToC with custom elements" .IX Subsection "Create an inline ToC with custom elements" .Vb 5 \& hypertoc \-\-quiet \-\-make_anchors \-\-bak "" \-\-overwrite \e \& \-\-make_toc \-\-inline \-\-toc_label "" \-\-toc_tag \*(Aq!\-\-toc\-\-\*(Aq \e \& \-\-toc_tag_replace \e \& \-\-toc_entry H2=1 \-\-toc_entry H3=2 \e \& \-\-toc_end H2=/H2 \-\-toc_end H3=/H3 myfile.html .Ve .PP This will create an inline ToC overwriting the original file, and replacing a comment, and which takes H2 headers as level 1 and H3 headers as level 2. This can be useful where the .html file is generated by some other process, and you can then create the ToC as the last step. .SS "Create a ToC with custom elements" .IX Subsection "Create a ToC with custom elements" .Vb 6 \& hypertoc \-\-quiet \-\-make_anchors \-\-bak "" \-\-overwrite \e \& \-\-toc_entry TITLE=1 \-\-toc_end TITLE=/TITLE \& \-\-toc_entry H2=2 \-\-toc_entry H3=3 \e \& \-\-toc_end H2=/H2 \-\-toc_end H3=/H3 \e \& \-\-make_toc \-\-outfile index.html \e \& mary.html fred.html george.html .Ve .PP This creates anchors at the H2 and H3 elements, and creates a ToC file called index.html, indexing on the \s-1TITLE,\s0 and the H2 and H3 elements. .SS "Create a ToC with custom elements and options file" .IX Subsection "Create a ToC with custom elements and options file" Given an options file called 'custom.opt' as follows: .PP .Vb 7 \& # Title, H2 and H3 \& \-\-toc_entry TITLE=1 \& \-\-toc_end TITLE=/TITLE \& \-\-toc_entry H2=2 \& \-\-toc_end H2=/H2 \& \-\-toc_entry H3=3 \& \-\-toc_end H3=/H3 .Ve .PP then the previous example can have shorter command lines as follows: .PP .Vb 2 \& hypertoc \-\-quiet \-\-make_anchors \-\-bak "" \-\-overwrite \e \& \-\-argfile custom.opt \-\-make_toc \-\-outfile index.html mary.html fred.html george.html .Ve .SH "NOTES" .IX Header "NOTES" .IP "\(bu" 4 hypertoc is smart enough to detect anchors inside significant elements. If the anchor defines the \s-1NAME\s0 attribute, hypertoc uses the value. Else, it adds its own \s-1NAME\s0 attribute to the anchor. If \-\-use_id is true, then it likewise checks for and uses IDs. .IP "\(bu" 4 The \s-1TITLE\s0 element is treated specially if specified as a significant element. It is illegal to insert anchors (A) into \s-1TITLE\s0 elements. Therefore, hypertoc will actually link to the filename itself instead of the \s-1TITLE\s0 element of the document. .IP "\(bu" 4 hypertoc 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 hypertoc 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 \-\-ol option. .IP "\(bu" 4 If one is not using \-\-overwrite when generating anchors, then the command needs to be done in two passes, in order to give the correct filenames (the ones with the actual anchors in them) to the ToC generation part. Otherwise the ToC will have anchors pointing to files that don't have them. .IP "\(bu" 4 When using \-\-inline, care needs to be taken if overwriting \*(-- if one sets the ToC to be included after a given tag (such as the default \&\s-1BODY\s0) then if one runs the command repeatedly one could get multiple ToCs in the same file, one after the other. .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 hypertoc behaves somewhat differently than Version 2.x of hypertoc. It is now designed to do everything in one pass, and has dropped certain options: the \-\-infile option is no longer used (all filenames are put at the end of the command); the \-\-toc_file option no longer exists; use the \-\-outfile option instead; the \-\-tocmap option is no longer supported. .Sp It now generates lower-case tags rather than upper-case ones. .IP "\(bu" 4 hypertoc 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 hypertoc will detect the \*(L"foo\*(R" \s-1NAME\s0 and use it. .Sp Even better is to use IDs: .Sp .Vb 1 \&

    The FOO command

    .Ve .IP "\(bu" 4 \&\s-1NAME\s0 attributes without quotes are not recognized. .SH "BUGS" .IX Header "BUGS" Tell me about them. .SH "REQUIRES" .IX Header "REQUIRES" .Vb 7 \& Getopt::Long \& Getopt::ArgvFile \& File::Basename \& Pod::Usage \& HTML::LinkList \& HTML::Entities \& HTML::GenToc .Ve .SH "SCRIPT CATEGORIES" .IX Header "SCRIPT CATEGORIES" Web .SH "ENVIRONMENT" .IX Header "ENVIRONMENT" .IP "\s-1HOME\s0" 4 .IX Item "HOME" hypertoc looks in the \s-1HOME\s0 directory for config files. .SH "FILES" .IX Header "FILES" .ie n .IP """~/.hypertocrc""" 4 .el .IP "\f(CW~/.hypertocrc\fR" 4 .IX Item "~/.hypertocrc" User configuration file. .ie n .IP """.hypertocrc""" 4 .el .IP "\f(CW.hypertocrc\fR" 4 .IX Item ".hypertocrc" Configuration file in the current working directory; overrides options in \f(CW\*(C`~/.hypertocrc\*(C'\fR and is overridden by command-line options. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fBperl\fR\|(1) \&\fBhtmltoc\fR\|(1) HTML::GenToc Getopt::ArgvFile Getopt::Long .SH "AUTHOR" .IX Header "AUTHOR" Kathryn Andersen http://www.katspace.org/tools/hypertoc/ .PP Based on htmltoc by Earl Hood ehood \s-1AT\s0 medusa.acs.uci.edu .PP Contributions from 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