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