Blame


1 6509b181 2022-12-30 thomas {!
2 6509b181 2022-12-30 thomas #include <stdlib.h>
3 6509b181 2022-12-30 thomas #include <string.h>
4 6509b181 2022-12-30 thomas
5 6509b181 2022-12-30 thomas #include "tmpl.h"
6 6509b181 2022-12-30 thomas
7 6509b181 2022-12-30 thomas int base(struct template *, const char *);
8 6509b181 2022-12-30 thomas !}
9 6509b181 2022-12-30 thomas
10 6509b181 2022-12-30 thomas {{ define base(struct template *tp, const char *title) }}
11 6509b181 2022-12-30 thomas {! char *foo = NULL; !}
12 6509b181 2022-12-30 thomas <!doctype html>
13 6509b181 2022-12-30 thomas <html>
14 6509b181 2022-12-30 thomas <head>
15 6509b181 2022-12-30 thomas <title>{{ title }}</title>
16 6509b181 2022-12-30 thomas </head>
17 6509b181 2022-12-30 thomas <body>
18 6509b181 2022-12-30 thomas <h1>{{ title }}</h1>
19 6509b181 2022-12-30 thomas {{ if strchr(title, '*') != NULL }}
20 6509b181 2022-12-30 thomas <p>"{{ title }}" has a '*' in it</p>
21 6509b181 2022-12-30 thomas {{ if 1 }}
22 6509b181 2022-12-30 thomas <p>tautology!</p>
23 6509b181 2022-12-30 thomas {{ end }}
24 6509b181 2022-12-30 thomas {{ else if strchr(title, '=') != NULL }}
25 6509b181 2022-12-30 thomas <p>"{{ title }}" has a '=' in it!</p>
26 6509b181 2022-12-30 thomas {{ else }}
27 6509b181 2022-12-30 thomas <p>"{{ title }}" doesn't have a '*' in it</p>
28 6509b181 2022-12-30 thomas {{ end }}
29 6509b181 2022-12-30 thomas </body>
30 6509b181 2022-12-30 thomas </html>
31 6509b181 2022-12-30 thomas {{ finally }}
32 6509b181 2022-12-30 thomas {! free(foo); !}
33 6509b181 2022-12-30 thomas {{ end }}