1 .\" Copyright (c) 2022 Omar Polo <op@openbsd.org>
3 .\" Permission to use, copy, modify, and distribute this software for any
4 .\" purpose with or without fee is hereby granted, provided that the above
5 .\" copyright notice and this permission notice appear in all copies.
7 .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8 .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9 .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
10 .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11 .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
12 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
13 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 .Dd September 27, 2022
20 .Nd templating system compiler
27 is an utility that converts files written in the
29 format format to a set of routine writtens in the C programming
32 converts the files given as arguments or from standard input, and
33 writes to standard output.
35 The options are as follows:
38 Do not emit debug info in the generated source.
39 It's disabled by default, unless
41 is reading from standard input.
46 The following example shows how to use
49 .Bd -literal -offset indent
52 template $< > $@ || rm \-f $@
60 utility was written by
61 .An Omar Polo Aq Mt op@openbsd.org .
63 The compiler is very naive, so there are quite a few shortcomings:
66 No attempt is made to validate the C code provided inline, nor the
67 validity of the arguments to many constructs.
69 The generated code assumes that a variable called
73 is in scope inside the template.
75 Each block may have additional variables used for the template
76 generation: to avoid clashes, don't define variables with the
80 Blanks are, in most cases, trimmed.
81 Normally this is not a problem, but a workaround is needed in case
82 they need to be preserved, for e.g.:
83 .Bd -literal -offset indent
84 Name: {{ " " }} {{ render name_field(tp) }}