1 2c02675e 2022-12-14 op .\" Copyright (c) 2022 Omar Polo <op@openbsd.org>
3 2c02675e 2022-12-14 op .\" Permission to use, copy, modify, and distribute this software for any
4 2c02675e 2022-12-14 op .\" purpose with or without fee is hereby granted, provided that the above
5 2c02675e 2022-12-14 op .\" copyright notice and this permission notice appear in all copies.
7 2c02675e 2022-12-14 op .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8 2c02675e 2022-12-14 op .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9 2c02675e 2022-12-14 op .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
10 2c02675e 2022-12-14 op .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11 2c02675e 2022-12-14 op .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
12 2c02675e 2022-12-14 op .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
13 2c02675e 2022-12-14 op .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 196a7c5f 2023-01-06 op .Dd January 06, 2022
16 2c02675e 2022-12-14 op .Dt TEMPLATE 1
20 2c02675e 2022-12-14 op .Nd templating system compiler
24 2c02675e 2022-12-14 op .Op Fl o Ar out
26 2c02675e 2022-12-14 op .Sh DESCRIPTION
28 2c02675e 2022-12-14 op is an utility that converts files written in the
29 2c02675e 2022-12-14 op .Xr template 7
30 2c02675e 2022-12-14 op format format to a set of routine writtens in the C programming
33 2c02675e 2022-12-14 op converts the files given as arguments or from standard input, and
34 2c02675e 2022-12-14 op writes to standard output.
36 2c02675e 2022-12-14 op The options are as follows:
37 2c02675e 2022-12-14 op .Bl -tag -width Ds
39 2c02675e 2022-12-14 op Do not emit debug info in the generated source.
40 2c02675e 2022-12-14 op It's disabled by default, unless
42 2c02675e 2022-12-14 op is reading from standard input.
43 2c02675e 2022-12-14 op .It Fl o Ar out
44 2c02675e 2022-12-14 op Write output to file.
46 2c02675e 2022-12-14 op will be created or truncated if exists and will be removed if
48 2c02675e 2022-12-14 op encounters any error.
50 2c02675e 2022-12-14 op .Sh EXIT STATUS
53 2c02675e 2022-12-14 op .Xr template 7
58 2c02675e 2022-12-14 op utility was written by
59 2c02675e 2022-12-14 op .An Omar Polo Aq Mt op@openbsd.org .
61 2c02675e 2022-12-14 op The compiler is very naive, so there are quite a few shortcomings:
62 2c02675e 2022-12-14 op .Bl -bullet -compact
64 2c02675e 2022-12-14 op No attempt is made to validate the C code provided inline, nor the
65 2c02675e 2022-12-14 op validity of the arguments to many constructs.
67 2c02675e 2022-12-14 op The generated code assumes that a variable called
70 2c02675e 2022-12-14 op .Vt struct template *
71 2c02675e 2022-12-14 op is in scope inside each block.
73 2c02675e 2022-12-14 op Each block may have additional variables used for the template
74 2c02675e 2022-12-14 op generation implicitly defined: to avoid clashes, don't name variables
75 2c02675e 2022-12-14 op or arguments with the
79 2c02675e 2022-12-14 op Blanks are, in most cases, trimmed.
80 2c02675e 2022-12-14 op Normally this is not a problem, but a workaround is needed in case
81 2c02675e 2022-12-14 op they need to be preserved, for e.g.:
82 2c02675e 2022-12-14 op .Bd -literal -offset indent
83 2c02675e 2022-12-14 op Name: {{ " " }} {{ render name_field(tp) }}