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 28, 2023
1 parent 005adc0 commit 610ea79
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion 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 Expand Up @@ -489,4 +501,4 @@ Here are some Phew! community projects and guides that you might find useful. No

- :link: [Hacking Big Mouth Billy Bass](https://www.youtube.com/watch?v=dOEjfBplueM)
- :link: [How to set up a Phew! Access Point](https://www.kevsrobots.com/blog/phew-access-point.html)
- :link: [Wireless Networking Setup Example for Raspberry Pi Pico W](https://github.com/simonprickett/phewap)
- :link: [Wireless Networking Setup Example for Raspberry Pi Pico W](https://github.com/simonprickett/phewap)

0 comments on commit 610ea79

Please sign in to comment.