# DocBook to HTML - Tables of Contents

This module provides templates to create tables of contents from any division-level elements.

## Modes

`db2html.autotoc.mode`

  Renders a TOC entry for an element and its children

## Templates

`db2html.autotoc`

  Creates a table of contents for a given element

## `db2html.autotoc.mode`

Renders a TOC entry for an element and its children

### Parameters

`is_info`

  Whether this contents list is for the info page

`selected`

  A currently-selected page

`toc_depth`

  How deep to create entries in the table of contents

`labels`

  Whether to generate labels

`titleabbrev`

  Whether to use `titleabbrev` instead of `title`

### Description

This mode outputs a single element in a table of contents. If the `toc_depth` parameter is non-zero, then templates implementing this mode should call `db2html.autotoc` in their context node, passing their division-level child elements and decrementing `toc_depth` by one.

For a description of the other parameters, see `db2html.autotoc`.

## `db2html.autotoc`

Creates a table of contents for a given element

### Parameters

`node`

  The element to create a table of contents for

`show_info`

  Whether to include a link to the info page

`is_info`

  Whether this contents list is for the info page

`show_title`

  Whether to give the contents list a title

`selected`

  A currently-selected page

`divisions`

  The division-level child elements of `node`

`toc_depth`

  How deep nested contents should be listed.

`labels`

  Whether to generate labels

`titleabbrev`

  Whether to use `titleabbrev` instead of `title`

### Description

This template creates a table of contents for a given division-level element. The calling template should pass the division-level child elements in the `divisions` parameter. Nested divisions will be listed to the depth specified in the `toc_depth` parameter. If the `selected` parameter is set to an existing element, then this template will only output ancestors and siblings of ancestors of the selected element. This effectively creates a tree which is expanded sufficiently to show a particular element.

This template accepts a number of parameters that control the style of the table of contents. The `show_info` parameter specifies whether a link to the info page ("About This Document") should be shown. The `is_info` parameter specifies whether the info page should be treated as the selected page. If the info page is selected, it will not be displayed as a link.

The `show_title` specifies whether a title should be placed at the top of the table of contents. The `labels` parameter specifies whether to place section numbers as labels before each element in the list. Finally, the `titleabbrev` element specifies whether list elements should use the `titleabbrev` of each element for the link text, if available.