Static template generator for C
git clone git://soophie.de/ductape
blob: e8882c47f4e921a32376a22efebe126ff36c6bbc (575 bytes)[doc][blame][raw]
1
# ctl3
Static template generator for C5
## Usage7
```html8
<h1>Hello, % STRING(name) %!</h1>9
<ul>10
% for (int i = 0; i < len; i++) { %11
<li>Item % NUMBER(i) %</li>12
% } %13
</ul>14
```16
```bash17
ctl example.html > ctl_example.h18
```20
```c21
#define LIB_CTL_IMPL22
#include <libctl.h>24
#define CTL_OUT(out, x) { \25
str_append(out, x); \26
}27
#define STRING(x) str_append(ctl_out, x);28
#define NUMBER(x) { \29
str_appendf(ctl_out, "%d", x); \30
}32
void ctl_fn_example(char **ctl_out, ctl_ctx_t ctx) {33
(void) ctx;34
char *name = "world";35
int len = 10;36
#include "ctl_example.h"37
}38
```