Blob


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