16 Internals

16.1 Document structure

The formatted deplate document is made up of a pre-matter, a body, and a post-matter each of which is an array of arrays of strings.

  • Pre-matter
    • Slots
      • Array of strings
  • Body
    • Slots
      • Array of strings
  • Post-matter
    • Slots
      • Array of strings

Using the docType option, you can determine into which section an element goes. Using the docSlot option, you can define the element’s position withing a section.

In multi-file output, pre-matter and post-matter are the same for all files. The actual body usually beginns, but this depends on the formatter, at position 90 of the pre-matter and ends at position 20 of the post-matter section. I.e. if you want to print some information in every file’s body, put it somewhere in the pre-matter after position 90 or in the post-matter before slot 20.

The default slot for normal text is 50 in the body section. If slot is greater than 50, the element will be moved to the end of the document. If it is smaller, it will be moved to the beginning. The utility of this feature for the user is limited. It can come handy, if you want to put LaTeX-code into the preamble or if you want to customize the output in some more advanced way.

The slots can also be addressed via names:

  • Pre
    doc_def
    The document type definition
    doc_beg
    The beginning of the document
    head_beg
    The beginning of the document head
    javascript
    Javascript
    mod_packages
    Packages loaded by a module
    user_packages
    User-required packages
    mod_head
    Additional header statements added by a module
    user_head
    Additional header statements added by the user
    head
    Document header statements
    user_head
    Document header statements added by the user
    css
    Style definitions
    head_end
    The end of the document head
    body_beg
    The beginning of the body definition
  • Body
    body
    The body (standard slot)
    footnotes
    Footnotes
  • Post
    body_end
    The end of the body definition
    doc_end
    The end of the document

The names can come handy when selectively filling in content into a template.

Any element can be located at any position in the document. This can be done by adding the option “slot” to an element. The value of “slot” can be a name, a number, or a mix of both like in “css+1” or “body-1”.

The use of numbers is deprecated and will be disabled some time in the future.

In general, you shouldn’t address slots by their number. It’s quite likely that this option will soon disappear.

Prev Home Next
1 Introduction
2 Getting deplate
3 Installation
4 Usage
5 Configuration
6 Input Formats
7 Output Formats
8 Themes
9 Modules
10 Markup
11 Regions
12 Commands
13 Macros
14 Skeletons
15 Variables and options
16 Internals
16.1 Document structure
17 Extending deplate
18 Bibliography
19 Index
About this page