Amaya

## Assembling large document collections

Amaya enables you to handle document collections. Such a collection may, for example, represent a technical documentation made up of several web pages. The present manual is a document collection.

One of the web pages in the collection contains the title of the entire documentation (an `h1` element), an introduction (some other elements), and a list `ol` or `ul` whose items `li` contain links to each chapter. Chapters are separate documents that can have a similar structure.

This organization is useful for browsing, but has several drawbacks when the entire documentation has to be printed.

Amaya addresses this problem with the Tools/Make book command, which assembles a document collection into a single volume. You use typed links for linking chapters, by associating an attribute `rel="chapter"` or `rel="subdocument"` with the anchor that refers to a chapter (create a link and use the Attributes tool for the `rel` attribute).

Each referred chapter or sub-document may be:

- a full external document,
- a subset of a larger external document.

To refer to a document subset, you usually define a `div` element to identify the part of the document you want to include, and you create a link to this `div` element.

Then, when you activate the Tools/Make book command, all blocks (`li` elements in the above example) containing a typed link to a chapter will be replaced by the corresponding actual web pages (or a part of it), and Amaya will display a unique document containing the whole collection:

- If the link refers to a web page as a whole, Amaya includes all the content of the `body` element of the target document.
- If the link refers to an element in a web page, Amaya includes this element with its content.
- If the link refers to a target anchor (`a` element), Amaya includes the content of the anchor, but not the anchor itself.

Before each replacement, the Make book command generates a new `div` element with an `id` attribute to clearly separate each included piece.

Pieces of the new generated document may contain normal links, target anchors, and target elements. During the Make book operation, Amaya ensures that each `name` and `id` attribute value remains unique in the new document. Amaya changes these values ss needed, and updates all relative links.

Amaya automatically transforms external links referring to external documents or to document parts, into internal links to the part that are now included. For example, if the link originally pointed to an external document, the link will now refer to the `div` element generated by the Make book command. This ensures that all links are preserved in the new unique document containing the whole collection.

This large document can then be numbered and printed with a complete table of contents and a list of all links.