From 58667e01dd2fe38cf554ed549f272f5b764c14ac 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 | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index 850ddcf..0d89b56 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