1HXTOC(1)                        HTML-XML-utils                        HXTOC(1)
2
3
4

NAME

6       hxtoc - insert a table of contents in an HTML file
7

SYNOPSIS

9       hxtoc [ -x ] [ -l low ] [ -h high ] [ file ] [ -t ] [ -d ] [ -c class ]
10

DESCRIPTION

12       The  hxtoc command reads an HTML file, inserts missing ID attributes in
13       all H1 to H6 elements between the levels -l and -h (unless  the  option
14       -d  is  in  effect,  see  below)  and also inserts A elements with NAME
15       attributes, so old browsers will recognize the H1 to H6 headers as tar‐
16       get  anchors as well (unless the option -t is in effect). The output is
17       written to stdout.
18
19       If there is a comment of the form
20
21           <!--toc-->
22
23       or a pair of comments
24
25           <!--begin-toc-->
26           ...
27           <!--end-toc-->
28
29       then the comment, or the pair  with  everything  in  between,  will  be
30       replaced  by a table of contents, consisting of a list (UL) of links to
31       all headers in the document.
32
33       The text of headers is copied to this table of contents, including  any
34       inline  markup,  except  that  DFN  tags  and SPAN tags with a CLASS of
35       "index" are omitted (but the elements content is copied).
36
37       If a header has a CLASS attribute with as value (or one of its  values)
38       the  keyword "no-toc", then that header will not appear in the table of
39       contents.
40

OPTIONS

42       The following options are supported:
43
44       -x        Use XML conventions: empty elements are written with a  slash
45                 at the end: <IMG />
46
47       -l low    Sets  the  lowest  numbered  header to appear in the table of
48                 content. Default is 1 (i.e., H1).
49
50       -h high   Sets the highest numbered header to appear in  the  table  of
51                 content. Default is 6 (i.e., H6).
52
53       -t        Normally,  hxtoc adds both ID attributes and empty A elements
54                 with a NAME attribute and  CLASS="bctarget",  so  that  older
55                 browsers that do no understand ID will still find the target.
56                 With this option, the A elements will not be generated.
57
58       -c class  The generated UL elements in the table of contents will  have
59                 a  CLASS  attribute  with  the  value  class.  The default is
60                 "toc".
61
62       -d        Tries to use DIV elements as targets instead of H1 to H6:  If
63                 a  header element H1 to H6 within the range -l to -h is found
64                 and it is the first child of a DIV element, then the table of
65                 contents  will  link to the DIV instead of to the header ele‐
66                 ment. The DIV will be given an ID if it doesn't have one yet.
67                 ID
68

OPERANDS

70       The following operand is supported:
71
72       file      The  name  of an HTML file. If absent, standard input is read
73                 instead.
74

DIAGNOSTICS

76       The following exit values are returned:
77
78       0         Successful completion.
79
80       > 0       An error occurred in the parsing of  the  HTML  file.   hxtoc
81                 will try to correct the error and produce output anyway.
82

SEE ALSO

84       asc2xml(1), hxnormalize(1), hxnum(1), xml2asc(1)
85

BUGS

87       The error recovery for incorrect HTML is primitive.
88
89
90
915.x                               21 Nov 2008                         HXTOC(1)
Impressum