Editing of the readme

main
Gijs 2 years ago
parent 73b392789a
commit 6f14f9a5db

@ -70,13 +70,13 @@ Open a webbrowser and open the address <http://0.0.0.0:8000/> to see the generat
It is possible to use a different template by adjusting the `env.get_template` replace for example the line:
```
```python
template = env.get_template("template.html")
```
with:
```
```python
template = env.get_template("template-pagedjs.html")
```
@ -91,13 +91,13 @@ Extensive documentation on the jinja templating engine can be found here: <https
The first way to extend the template is by providing extra variables, this can be done by providing extra keyword arguments in the template render call. With the python line below a placeholder `extra_placeholder` is added and becomes available in the template:
```
```python
rendered_template = template.render(template_placeholder="world", extra_placeholder="More information in the template")
```
In the template it is possible to refer to this placeholder with the `{{ }}` syntax, so:
```
```jinja
{{ extra_placeholder }}
```
@ -107,15 +107,15 @@ Just like python jinja supports [loops](https://jinja.palletsprojects.com/en/3.1
It is important to understand that jinja places data in a template. It is not intended to generate data. To work with loops jinja needs a list (or actually an iterable), data it can loop over. In jinja the start of a loop is indicated with `{% for %}` the end of the loop with `{% endfor %}`
Imagine this render call:
Imagine this render call in `render-template.py`:
```
```python
rendered_template = template.render(template_placeholder="world", list_of_technologies=["python", "jinja", "html", "css", "javascript", "paged.js"])
```
Now, add the following lines to the template to make jinja loop through the list and show the indvidual items in an HTML-list:
```
```jinja
<h2>Used technologies</h2>
<ul>
{% for technology in list_of_technologies %}

Loading…
Cancel
Save