Skip to content

Commit

Permalink
Document approach to processing lists in templates.
Browse files Browse the repository at this point in the history
  • Loading branch information
ccrighton committed Aug 12, 2023
1 parent 005adc0 commit 58667e0
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,18 @@ It's also possible to perform more complicated transformations using any built i
<div id="name">{{"/".join(name.split(" "))}}</div>
```

##### Lists

It is possible to perform operations on lists using str.join and list comprehension as in the following table example.

```html
<table>
{{"".join([f"<tr><td>item</td></tr>\r\n" for item in mylist])}}
</table>
```



##### Conditional display

If you want to show a value only if some other condition is met then you can use the
Expand Down

0 comments on commit 58667e0

Please sign in to comment.