Home
Categories
Dictionary
Download
Project Details
Changes Log
What Links Here
How To
Syntax
FAQ
License

Templates



A template is similar to a regular article but has the top-level element "template". It can contain:
  • Paragraphs, which in turn can contain various construction elements. See syntax
  • Chapters and titles. See chapters and titles
Contrary to regular articles, it can't contain an optional "See Also" chapter alternate titles, or Categories definition.

Using a template

You can include a template article in another article by using the include element.

You can not have circular include references. For example, this is not allowed:

First article:
      <article desc="root article">
         <include id="my template" />
      </article>
Included article:
<template desc="my template">
   <include id="root article" />
</template>


keepLevels attribute

By default the levels of the chapters and titles in the template are kept as they appear.

For example, if you have for the article:
  <article desc="root article">
  The Article.
     <title title="the top level title" />
     <include id="template article" />
  </article>
and for the template:
   <template desc="template article">
   The template.
      <title title="template title" />
   </template>
You will have the same result as:
   <article desc="root article">
   The Article.
      <title title="the top level title" />
   The template.
      <title title="template title" />
   </article>
If you set the value false to the keepLevels or keepNumbering attribute in the include element, the generator will make sure that titles in the template are under those in the calling article[1]
which means that they have a greater level
.

For example, if you have for the article:
   <article desc="root article">
   The Article.
      <title title="the top level title" />
      <include id="template article" keepLevels="false"/>
   </article>
You will have the same result as:
  <article desc="root article">
  The Article.
     <title title="the top level title" />
  The template.
     <title level="2" title="template title" />
  </article>

Multiple include usage

You are not limited to only one level of inclusion. For example a template article can itself include another article or template.

Example

  <template desc="my template">
  This is a very simple template.
     <title title="template title" />
  </template>
Usage example:
   <article desc="an article">
   This is a very simple article.
      <include id="my template" />
      <see id="anotherArticle" desc="the other linked article" text="example of a SeeAlso element" />
      <cat id="myCategory" />
   </article>

Using the keepLevel attribute with more than one level of include

If you have more than one level of include, and one include has the keepLevels or keepNumbering attribute set toe false, the children include elements will also be processed as if their values for this attribute is false.

This is to ensure that when you specigy this attribute, all the children titles will be always under those in the calling article.


For example, if you have for the article:
   <article desc="root article">
   The Article.
      <title title="the top level title" />
      <include id="template article" keepLevels="false"/>
   </article>

Notes

  1. ^ which means that they have a greater level

See also


Categories: structure | syntax

docJGenerator Copyright (c) 2016-2023 Herve Girod. All rights reserved.