Table of contents

The draft

Let us draw the book's structure. Write down the following to some text file:

Cover
- Cover, author, version, year, site and e-mail.

Introduction
- Tasks and goal
- Features and abilities

Installation
- where to get
- book's configuration
- webserver set up

Edition and contents
- The structure
- The  text
- Images and other media
- Syntax highlighting
- Links

Appearance
- Themes
- Theme's files

Export
- export to html
- export to chm

Let's translate our draft to machine-readable format.

Table of contents in YAML

introduction.html: Introduction
installation.html: Installation
    
content:
  type: chapter
  title: The Book
  level: 1     #levels of the table of contents
               #on the chapter's first page
  topics:
    bookshelf.html: Bookshelf
    toc.html: Book's structure
    text:
      type: chapter
      title: Text
      topics:
        media.html: Images and media
        highlighting.html: Syntax highlighting
        links.html: Links

layout:
  type: chapter
  title: Appearance
  topics:
    themes_config.html:  Themes
    theme_layout.html:  How does the theme work

export:
  type: chapter
  title: Export
  topics:
    html.html:  html
    chm.html:  chm

appendix:
  type: chapter
  title: Appendix
  topics:
    topic_index.html: {type: index, title: The Index}
    similar.html:  Similar applications
    roadmap.html:  The roadmap

The content's tree consist of nodes. Each node is identified by the filename (or directory name for chapters). The text for the "Links" page in the above example will be stored in the workshop/mybook/pages/content/text/links.html file and will be available by corresponding URL. Each node has parameters:

  • type - Node's type: "page" (default), "chapter" or "index" (Automatic index).
  • title - Page's or Chapter's title. This is mandatory property
  • topics - For the chapters only. Section contains pages or chapters
  • level - For the chapters only. Sets the level for the contents table in the first chapter's page. By default all levels will be displayed. Bookshelf's parameter rootIndexLevel is used for the book's cover page (Bookshelf).

As for pages only title parameter is needed, you can set is as string, bypassing an array syntax:

html.html:  html

Look to above code for examples.


© H-type, 2008
www.bulldoc.ru