From 610ea79e2bc0aa12c83e3906924f08df2395d201 Mon Sep 17 00:00:00 2001 From: Charlie Crighton Date: Fri, 9 Jun 2023 01:02:17 +1200 Subject: [PATCH] Document approach to processing lists in templates. --- README.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 850ddcf..66f0c43 100644 --- a/README.md +++ b/README.md @@ -314,6 +314,18 @@ It's also possible to perform more complicated transformations using any built i
{{"/".join(name.split(" "))}}
``` +##### Lists + +It is possible to perform operations on lists using str.join and list comprehension as in the following table example. + +```html + +{{"".join([f"\r\n" for item in mylist])}} +
item
+``` + + + ##### Conditional display If you want to show a value only if some other condition is met then you can use the @@ -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) \ No newline at end of file +- :link: [Wireless Networking Setup Example for Raspberry Pi Pico W](https://github.com/simonprickett/phewap)