You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<title>{% block title %} My Lisp app {% endblock %}</title>
55
+
56
+
</head>
57
+
<body>
58
+
<divclass="container">
59
+
{% block content %} {% endblock %}
60
+
</div>
61
+
</body>
62
+
</html>
63
+
```
64
+
65
+
This base template defines two blocks: one for the page title, one for
66
+
the page content. A template that wants to inherit this base template
67
+
will use `{% extends "base.html" %}` and replace each blocks with `{% block
68
+
content %} … {‰ endblock %}`.
69
+
70
+
47
71
At last, to render the template, call `djula:render-template*` inside a route.
48
72
49
73
~~~lisp
50
74
(easy-routes:defroute root ("/" :method :get) ()
51
-
(djula:render-template* +welcome.html+ nil
52
-
:users (get-users)
75
+
(djula:render-template* +products.html+
76
+
nil
77
+
:products (products)
53
78
~~~
54
79
55
-
Note that for efficiency Djula compiles the templates before rendering them.
56
-
57
-
It is, along with its companion
80
+
Djula is, along with its companion
58
81
[access](https://github.com/AccelerationNet/access/) library, one of
59
82
the most downloaded libraries of Quicklisp.
60
83
61
84
#### Djula filters
62
85
63
-
Filters allow to modify how a variable is displayed. Djula comes with
86
+
Filters are only waiting for the developers to define their own, so we should have a work about them.
87
+
88
+
They allow to modify how a variable is displayed. Djula comes with
64
89
a good set of built-in filters and they are [well documented](https://mmontone.github.io/djula/djula/Filters.html#Filters). They are not to be confused with [tags](https://mmontone.github.io/djula/djula/Tags.html#Tags).
65
90
66
91
They look like this: `{{ var | lower }}`, where `lower` is an
@@ -112,8 +137,8 @@ HTML5 generator. It looks like this:
112
137
(:footer ("Last login: ~A" *last-login*)))
113
138
~~~
114
139
115
-
I find it is easier to compose the HTML than with the more famous
116
-
cl-who, but I personnally prefer to use HTML templates.
140
+
I find Spinneret easier to use than the more famous cl-who, but I
0 commit comments