Blob


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