blob: c8feed5d032670eca98c639135ae7a8135ab3aa1 (
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
45
46
47
48
49
50
51
|
# temper
Common Listp templating engine inspired by [ejs](https://ejs.co/).
## Usage
### From the command line
```command
$ ./temper.lisp template.lisp.html > generated.html
```
```command
$ ./temper.lisp template_directory
```
### In the template
You can put any Common lisp code between `<%` and `%>`.
Put the result of a form in the template with `<%=`.
```html
<ul>
<% (dotimes (_ 10)) %>
<li> <%= i %> </li>
<% ) %>
</ul>
```
Use the `render` function to include a template in another.
```html
<% (render "header.lisp.html") %>
<p>that's pretty neat</p>
<% (render "footer.lisp.html") %>
```
## TODO
* [x] value interpolation (e.g `<%= link %>`)
* [x] inject variable in local scope
* [x] auto index function from directory name
* [ ] add date support
* [ ] sort by date
* [ ] hook for setting link name
* [ ] relative path from the file and the current directory
* [ ] walk down a directory and generate all templates
* [ ] link generator `<%= (link 'about') %>` returns `about.html`
and check if `about.lisp.html` exists
* [ ] Makefile to compile and install
* [ ] escape interpolated value
|