SourceForge.net LogoMdoc template reference

This page provides author notes used to use the Mdoc template features.

Syntax and terms

A template is an array of template elements, with at least two VIEW elements, VIEW:author and VIEW:public.

The element reference in between bracketsis called the template variable, example: {TREE.main.name}.

There are two types of template elements:

The template variable syntax is:

{([A-Z][A-Z0-9_\.]*)(\.[a-zA-Z0-9_\.]+)?(#[a-z0-9_]+)?(\?[=\!a-zA-Z0-9_-]+)}

where:

Redirection ?blank and ?not_blank explained

If you want to display a template element only if it is not blank, use the ?not_blank reference, for example:

If the complementary reference is missing and the test is false, the reference is cleared. This works for ?empty and ?not_empty too, and also for ?exists and ?not_exists.

Redirection ?=value and ?!=value explained

If you want to display a template element only if it is equal to "value", use the ?=value reference, for example:

If the complementary reference is missing and the test is false, the reference is cleared.

Only simple string and numerical values are supported assuming they match the syntax [=\!a-zA-Z0-9_-]+ in a Perl regular expression.

Element :any explained

Elements :any (and :first and :last) support scope references.

Scope references in simple arrays are %Keyword and %Value references, for example:

Scope references in associative arrays support path in a local scope data tree:

Summary

Element reference Reference type Definition
VIEW:author template The template used to build the documentation in "author" view level.
VIEW:public template The template used to build the documentation in "public" view level.
VIEW template This read-only element is set to the view level.
ERRMSG:not_a_method template When template formating methods can't returned a valid template, they return a hard-coded error message which can be customized as a template element.
FLAG:smart_display template Set this flag "off" to disable XHTML smart display feature (default value is "on").
TREE.main.name data The file name from Mdoc->tree[main][name].
TREE.method data The array of methods from Mdoc->tree[method] so the related :frame and :any elements are required.
TREE.method:exclude data An array of keys to exclude values fom the array of methods in all views.
TREE.method:frame data The frame to embed the method array values.
TREE.method:any data The element to embed one method array value.
TREE.method:first data The element to embed the first method array value (instead of the :any element).
TREE.method:last data The element to embed the last method array value (instead of the :any element).
TREE.main.info.warning?not_blank data The element to embed the TREE.main.info.warning value if this data is not empty or is numeric zero.
TREE.main.info.warning?blank data The element to embed the TREE.main.info.warning value if this data is empty but not numeric zero.
TREE.main.info.warning?not_empty data The element to embed the TREE.main.info.warning value if this data is not empty (in the PHP sense).
TREE.main.info.warning?empty data The element to embed the TREE.main.info.warning value if this data is empty.
TREE.main.info.warning?not_exists data The element to embed the TREE.main.info.warning value if this path doesn't exist in the data tree.
TREE.main.info.warning?exists data The element to embed the TREE.main.info.warning value if this path exists in the data tree.
TREE.main.type?=library data The element to embed the TREE.main.type value if its value is "library".
TREE.main.type?!=library data The element to embed the TREE.main.type value if its value is not equal to "library".
TREE.constant data The array of constants from Mdoc->tree[constant] so the related :frame and :any elements are required.
TREE.constant#values data Another template instance for the array of methods from Mdoc->tree[method] so the related #values:frame and #values:any elements are required.
TREE.constant#values?blank data A substitution for the array of constants frame if the array of values is empty (after filtering out the :exclude values).
TREE.constant#values:frame data The frame to embed the method array values.
TREE.constant#values:any data The element to embed one method array value.
CONSTANT_URL template The template element 'CONSTANT_URL' will replace the template variable.
Mdoc:DATA:integer reserved This element is reserved to replace data value references until the last pass and avoid confusion with {TEMPLATE_LIKE} strings in Mdoc->tree values. The integer is the array index in fetch_data stack.