summaryrefslogtreecommitdiff
path: root/Cool/README.md
blob: 3c9f770898d3df557106057ad3467faf735cd781 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# Cool

Build server-side components with C! Use the single-header library as a standalone HTML formatter
or use the transpiler to convert `.cool` files into `.c` files that you can include directly!

## Example

Write something like so:

```code
COOL void Api(char *name, char *func, char *desc) {
    <div class="api-card">
        <h3 class="api-name">{ name }</h3>
        <code class="language-c">{ func } </code>
        <div class="api-description">
            { desc }
        </div>
    </div>
}
```

Call `compiler.py` to get `view.cool.c` and include it into your code.

```c
#include "views.cool.c" // include server side components directly

int main() {
    char func_name[256];
    char func_decl[256];
    char *comment_text = NULL;
    /* ... */
    /* call you view directly! */
    if (feel_like_it) {
        Api(func_name, func_decl, comment_text);
    }
    return 0;
}

```

## Contributing 

This is one of the few open source projects where I'm very open to contribution.
Web is not my area of expertise. And this idea deserves fome fleshing out.