In the following descriptions, the current document refers to the document
whose path is retrieved by the
Here are the functions of the module, which can be associated to
levels (see
This function applies the following rules, mainly for simple formatting and referencing to the site or the current document information.
Plugins can add rules to this list, using the
lang
attribute already set to "sh".
format
attribute (see.
format
attribute (see.
The following optional attributes can be specified:
n
most recent
documents..stog/templates/doc-in-list.tmpl
.p
. The predicate can be an expression such as
Example:
doc-path
attribute.
doc-path
attribute,
or an empty string if no date were specified.
The format
attribute, if present, specifies the format used
to print the date. See the
doc-path
attribute,
or an empty string if no date were specified. It handles
the format
attribute (see.
doc-path
attribute),
that is the body code before the
doc-path
attribute).
Suppose we're handling the document whose source file is
STOGDIR/foo/bar/gee.html
. Its /foo/bar/gee.html
. The path will contain two parts, one for
foo
and one for bar
.
If a document /foo
exists, then a link to this document is
added. Else, if a document /foo/index exists, then a link to this
document is added. Else no link is added and the directory name is used,
with no link. The same is done for the /foo/bar
document.
The separator of path parts is the code given under the
To illustrate, the code
will produce the following code:
which results in:
The
will produce the following path:
doc-path
attribute.
doc-path
attribute.
doc-path
attribute.
doc-path
attribute:
is reduced to
When encountered,
This function inserts the given pre-formatted code. If the language is not
natively known by the highlight
The attr
, attr
is looked up in the current
environment. If its value is the same as the given value, the condition is verified.
For this evaluation, a tag t
not found in the environment in not
reduced to itself but to the empty string, so that the condition in
foo
is not in the environment.
The "value"
part of the condition must be valid XML, and can contain
calls to functions, as in:
Other example: Testing whether a variable is empty to known whether to output a block or not:
This inserts an image using an
The float
attribute can be used to change a class in the generated code,
so you can set the style of the image to be left or right floating.
Additional attributes are passed to the generated
keyword.tmpl
).
This function will load the file template
from the template directory
(or fail if the file does not exist). The contents of the file will then be evaluated.
The code between contents
.
With the additional attribute
If the file attribute begins with "." or "..", that is the filename is explicitely relative, the file path is concatenated to the current document source file path.
If the file attribute is an absolute filename, then this absolute filename is used.
By default, using
All additional attributes to
Here is an example. If we have the foo.tmpl
file
in the template directory, with the following contents:
The following code
will be reduced to
It is possible to include only the contents of the XML node read in the
file, by setting the attribute
Instead of including a file, it is possible to include a block
of a document, by referring to its path and id in the
href
attribute:
This code includes the XML node referenced by the href
attribute. An error is raised if the document does not exist, if
no fragment id is provided, or if the fragment id does not exist
in the referenced document.
If an id
attribute is provided, the included node has this new
id, else the original node id is kept; this is useful to avoid conflicts
with other ids.
This rule is useful to avoid code duplication. It is used in this
site to show changes of a release both in the
For example, the following code will include the paragraph with id "optiondef" of document "running":
This is the result:
sep
attribute
can be used to specify a separator between each keyword or topic.
Each keyword will be displayed using a keyword.tmpl
template file.
Each topic will be displayed using a topic.tmpl
template file.
In these templates,
will is reduced to the list of subnodes, separated by the given sep
attribute.
For example:
will be reduced to
This adds the given prefix to all id
and href
attributes
in the subnodes. This is useful when including generated SVG files to prevent
conflicts in ids.
lang
attribute already set to "ocaml".
This rule evaluates OCaml code. See the following
blog posts:
This rule returns a formatted string from the arguments.
See the following blog post:
This will put the two given XML nodes in a two-columns layout. Note that the tag used to enclose the left and right contents is not kept, so you may use any tag you want, for example:
This function creates new documents:
This function only contains two rules:
The
Since the
This function is added to the environment by the
The nodes used for sectionning can be changed, see the
By default, sectionning nodes without id
attribute are not kept.
Set attribute
This function applies the
If the document has path /foo
, this will create two more documents,
/foo-sec1
and /foo-sec2
, of the same type of
the document (here foo
). Their titles will be respectively
"Section 1" and "Section 2", i.e. the titles of the cut nodes.
The path of each created document is forged by appending "-" and the cut node id to the path of the document.
Each created document has the subnodes of the cut node as body. Each cut node
is replaced by a link to the corresponding created document. In our example,
after
If a node has no id
or no title
attribute, then
it is not cut and a warning is issued.
The following attributes can be added to
insert-link
can be set to false
to prevent adding links
to the new documents in the original document,
type
can be set to a string to specify the type of the created
documents, instead of inheriting the type of the original document,path-sep
specifies the separator used to forge the new paths;
by default it is -
but it can be for example /
,
At last, various
Of course, nodes which are not under the
This function applies the
It also applies the
This function closes the OCaml sessions previously opened with