diff options
-rw-r--r-- | web/tutorials/04-compilers.markdown | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/web/tutorials/04-compilers.markdown b/web/tutorials/04-compilers.markdown index a9423dc..deb07f9 100644 --- a/web/tutorials/04-compilers.markdown +++ b/web/tutorials/04-compilers.markdown @@ -236,6 +236,20 @@ This uses the `$for(foo)$` construct. This construct allows you loop over a list, in this case, `$posts$`. Inside the body of this for loop, all fields refer to the current post, e.g.: `$url$`, `$title$` and `$date$`. +You can also add a simple separator with the special `$sep$` field. +Everything between `$sep$` and `$endfor$` will be regarded as a separator +that will only be shown if there is more than one item in the list. + +```html +<ul> + $for(posts)$ + $x$ + $sep$, + $endfor$ +</ul> +``` + + Of course, $posts$ does not magically appear. We have to specify this in `site.hs`. Let's look at how `archive.html` is generated: |