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 *);8 int base(struct template *, struct tailhead *);10 !}12 {{ define base(struct template *tp, struct tailhead *head) }}13 <!doctype html>14 <html>15 <body>16 {{ render list(tp, head) }}17 </body>18 </html>19 {{ end }}21 {{ define list(struct template *tp, struct tailhead *head) }}22 {!23 struct entry *np;24 int i;25 !}26 {{ if !TAILQ_EMPTY(head) }}27 <p>items:</p>28 <ul>29 {{ tailq-foreach np head entries }}30 <li>{{ np->text }}</li>31 {{ end }}32 </ul>33 {{ else }}34 <p>no items</p>35 {{ end }}37 <p>38 {{ for i = 0; i < 3; ++i }}39 hello{{ " " }}40 {{ end }}41 world!42 </p>43 {{ end }}