Split template docs out to disorder_templates(5)
[disorder] / doc / disorder_templates.5.head
CommitLineData
3e1616b6
RK
1.\"
2.\" Copyright (C) 2008 Richard Kettlewell
3.\"
4.\" This program is free software; you can redistribute it and/or modify
5.\" it under the terms of the GNU General Public License as published by
6.\" the Free Software Foundation; either version 2 of the License, or
7.\" (at your option) any later version.
8.\"
9.\" This program is distributed in the hope that it will be useful, but
10.\" WITHOUT ANY WARRANTY; without even the implied warranty of
11.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12.\" General Public License for more details.
13.\"
14.\" You should have received a copy of the GNU General Public License
15.\" along with this program; if not, write to the Free Software
16.\" Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
17.\" USA
18.\"
19.TH disorder_templates 5
20.SH NAME
21disorder_templates - DisOrder template file syntax
22.SH DESCRIPTION
23DisOrder template files are text files containing HTML documents, with an
24expansion syntax to enable data supplied by the implementation to be inserted.
25.SS "Expansion Syntax"
26An expansion starts with an at ("@") symbol and takes the form of an expansion
27name followed by zero or more arguments.
28.PP
29Expansion names may contain letters, digits or "-" (and must start with a
30letter or digit). No spacing is allowed between the "@" and the expansion
31name.
32.PP
33Each argument is bracketed. Any of "(" and ")", "[" and "]" or "{" and "}" may
34be used but all arguments for a given expansion must use the same bracket pair.
35.PP
36Arguments may be separated from one another and the expansion name by
37whitespace (including newlines and even completely blank lines). The parser
38always reads as many arguments as are available, even if that is more than the
39expansion name can accept (so if an expansion is to be followed by an open
40bracket of the same kind it uses, you must use the \fB@_\fR separator; see
41below).
42.PP
43Arguments are expanded within themselves following the same rules, with a few
44exceptions discussed below.
45.SS "Special Symbols"
46A few sequences are special:
47.TP
48.B @@
49This expands to a single "@" sign.
50.TP
51.B @#
52This expands to nothing, and moreover removes the rest of the line it appears
53on and its trailing newline. It is intended to be used as a comment market but
54can also be used to eliminate newlines introduced merely to keep lines short.
55.TP
56.B @_
57This expands to nothing (but does not have the line-eating behaviour of
58\fB@#\fR). It is intended to be used to mark the end of an expansion where
59that would otherwise be ambiguous.
60.SS "Macros"
61It is possible to define new expansions using the \fB@define\fR expansion. For
62example,
63.PP
64.nf
65@define{reverse}{a b}{@b @a}
66.fi
67.PP
68defines an expansion called \fB@reverse\fR which expands to its two arguments
69in reversed order. The input \fB@reverse{this}{that}\fR would therefore expand
70to "that this".
71.SS "Sub-Expansions"
72Many expansions expand their argument with additional expansions defined. For
73example, the \fB@playing\fR expansion expands its argument with the extra
74expansion \fB@id\fR defined as the ID of the playing track.
75.PP
76The scope of these sub-expansions is purely lexical. Therefore if you invoke a
77macro or include another template file, if the sub-expansions appear within it
78they will not be expanded.
79.PP
80In the case of a macro you can work around this by passing the value as an
81argument. Included files do not have arguments, so in this case you must
82rewrite the inclusion as a macro.
83.SS macros.tmpl
84Before any page is expanded, the CGI will process \fBmacros.tmpl\fR (and
85discard any output). This defines a collection of commonly used macros.
86.SH EXPANSIONS
87This section lists the supported expansions.
88.\" Local Variables:
89.\" mode:nroff
90.\" fill-column:79
91.\" End:
92