Better Templates for Everyone Specification

Tags

BTE uses a processing directive format that is similar to that used by web scripting languages such as asp, jsp, and php. Tags for BTE start with "<%bte." or "<%/bte." and end with "%>". Tags are similar to html tags and can have name value pairs.

The following tags are bte tags:

Name value pairs follow the conventions for html name value pairs. The name may consist of numbers and letters. The value may consist of any characters but must be enclosed in single or double quotes if it contains characters that are not numbers or letters. A \' escapes a single quote and a \" escapes a double quote.

Documents

A bte document is enclosed by bte.doc start and end tags (<%bte.doc%> and <%/bte.doc%> ). Each document must contain at least one template, and the first template is considered the main template.

Attributes for the bte.doc tag:

super
URL for the bte document into which this bte document gets inserted. The URL may be relative or absolute. If the super name value pair is not specified then the bte document is considered a top level document and is not inserted into any other.
ext
The extension that a file generated by this document will have. In general generated documents will have the same name as the bte document but have a different extension. If no extension is specified, "html" is used.
output
legal values are 'true' and 'false'. An output file should not be produced for documents for which output is false. Useful for documents that cannot stand on their own, but must have data plugged into them from other templates. Default is 'true'.

Templates

A bte template is enclosed by bte.tpl start and end tags (<%bte.tpl%> and <%/bte.tpl%> ). Templates may appear inside a bte document.

Attributes for the bte.tpl tag:

name
A name for this template so that it may be referenced from an include. A name for a template must be specified unless it is the first template in a top level bte document.

Includes

Includes are a way of referencing other templates. An include tag is not follewed by an end include tag (<%bte.inc%>). When an include is found a template will be found to be used in its place. Templates in each sub document will be examined first to see if they fit. If not, other templates in the same document may be used as a default.

Attributes for the bte.inc tag:

name
A name for the referenced template. Corresponds to the name attribute of bte.tpl.

Groups

A bte group is enclosed by bte.grp start and end tags (<%bte.grp%> and <%/bte.grp%> ). Grouping allows for error handling. If an include in the group cannot be resolved, nothing in the group is put in the resulting document. The group can also be used to specify how errors are reported at compile time.

Attributes for the bte.grp tag:

onNoResolve
Specifies what kind of error should be reported when an include in the group cannot be resolved. Acceptable values are ok (group omitted, compile continues), warning (group omitted, user notified, compile continues), and error (user notified, compile aborted).
onDefault
Specifies what kind of error should be reported when an include in the group gets resolved to a default. Acceptable values are ok (default used, compile continues), warning (default used, user notified, compile continues), and error (user notified, compile aborted).

Ones

A bte one is enclosed by bte.one start and end tags (<%bte.one%> and <%/bte.one%> ). A one tag may contain groups and will choose the first group that resolves. It can be used as a branching mechanism.

License

Copyright (c) 2000-2004 by Stephen Ostermiller

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

ostermiller.org (site index)