Blame


1 014c66b6 2023-06-25 op {!
2 014c66b6 2023-06-25 op #include <sys/queue.h>
3 014c66b6 2023-06-25 op #include <string.h>
4 014c66b6 2023-06-25 op #include "lists.h"
5 014c66b6 2023-06-25 op #include "tmpl.h"
6 014c66b6 2023-06-25 op
7 014c66b6 2023-06-25 op int list(struct template *, struct tailhead *);
8 014c66b6 2023-06-25 op
9 014c66b6 2023-06-25 op !}
10 014c66b6 2023-06-25 op
11 014c66b6 2023-06-25 op {{ define base(struct template *tp, struct tailhead *head) }}
12 014c66b6 2023-06-25 op <!doctype html>
13 014c66b6 2023-06-25 op <html>
14 014c66b6 2023-06-25 op <body>
15 014c66b6 2023-06-25 op {{ render list(tp, head) }}
16 014c66b6 2023-06-25 op </body>
17 014c66b6 2023-06-25 op </html>
18 014c66b6 2023-06-25 op {{ end }}
19 014c66b6 2023-06-25 op
20 014c66b6 2023-06-25 op {{ define list(struct template *tp, struct tailhead *head) }}
21 014c66b6 2023-06-25 op {!
22 014c66b6 2023-06-25 op struct entry *np;
23 014c66b6 2023-06-25 op int i;
24 014c66b6 2023-06-25 op !}
25 014c66b6 2023-06-25 op {{ if !TAILQ_EMPTY(head) }}
26 014c66b6 2023-06-25 op <p>items:</p>
27 014c66b6 2023-06-25 op <ul>
28 014c66b6 2023-06-25 op {{ tailq-foreach np head entries }}
29 014c66b6 2023-06-25 op <li>{{ np->text }}</li>
30 014c66b6 2023-06-25 op {{ end }}
31 014c66b6 2023-06-25 op </ul>
32 014c66b6 2023-06-25 op {{ else }}
33 014c66b6 2023-06-25 op <p>no items</p>
34 014c66b6 2023-06-25 op {{ end }}
35 014c66b6 2023-06-25 op
36 014c66b6 2023-06-25 op <p>
37 014c66b6 2023-06-25 op {{ for i = 0; i < 3; ++i }}
38 014c66b6 2023-06-25 op hello{{ " " }}
39 014c66b6 2023-06-25 op {{ end }}
40 014c66b6 2023-06-25 op world!
41 014c66b6 2023-06-25 op </p>
42 014c66b6 2023-06-25 op {{ end }}