2 6509b181 2022-12-30 thomas #include <sys/queue.h>
3 6509b181 2022-12-30 thomas #include <string.h>
4 6509b181 2022-12-30 thomas #include "lists.h"
5 6509b181 2022-12-30 thomas #include "tmpl.h"
7 6509b181 2022-12-30 thomas int list(struct template *, struct tailhead *);
8 6509b181 2022-12-30 thomas int base(struct template *, struct tailhead *);
12 6509b181 2022-12-30 thomas {{ define base(struct template *tp, struct tailhead *head) }}
13 6509b181 2022-12-30 thomas <!doctype html>
16 6509b181 2022-12-30 thomas {{ render list(tp, head) }}
21 6509b181 2022-12-30 thomas {{ define list(struct template *tp, struct tailhead *head) }}
23 6509b181 2022-12-30 thomas struct entry *np;
26 6509b181 2022-12-30 thomas {{ if !TAILQ_EMPTY(head) }}
27 6509b181 2022-12-30 thomas <p>items:</p>
29 6509b181 2022-12-30 thomas {{ tailq-foreach np head entries }}
30 6509b181 2022-12-30 thomas <li>{{ np->text }}</li>
33 6509b181 2022-12-30 thomas {{ else }}
34 6509b181 2022-12-30 thomas <p>no items</p>
38 6509b181 2022-12-30 thomas {{ for i = 0; i < 3; ++i }}
39 6509b181 2022-12-30 thomas hello{{ " " }}