on master help sign in
Merge pull request #512 from beerendlauwers/patch-2

Added information about the separator functionality in $for$.

commit06508151275f7a9ad785b5566093351dd741dc1f authorJasper Van der Jeugt <jaspervdj@gmail.com> dateTue 17 Jan 2017, 13:23 (10 years ago) parent9770dd97558a4c
1 file changed+14
web/tutorials/04-compilers.markdown+14
web/tutorials/04-compilers.markdown+14
@@ -236,6 +236,20 @@ This uses the `$for(foo)$` construct. This construct allows you loop over a
236236list, in this case, `$posts$`. Inside the body of this for loop, all fields
237237refer to the current post, e.g.: `$url$`, `$title$` and `$date$`.
238238
239+You can also add a simple separator with the special `$sep$` field.
240+Everything between `$sep$` and `$endfor$` will be regarded as a separator
241+that will only be shown if there is more than one item in the list.
242+
243+```html
244+<ul>
245+ $for(posts)$
246+ $x$
247+ $sep$,
248+ $endfor$
249+</ul>
250+```
251+
252+
239253Of course, $posts$ does not magically appear. We have to specify this in
240254`site.hs`. Let's look at how `archive.html` is generated:
241255