docs: Document shuffle template func
authordigitalcraftsman <digitalcraftsman@protonmail.com>
Mon, 29 Aug 2016 10:22:37 +0000 (12:22 +0200)
committerdigitalcraftsman <digitalcraftsman@protonmail.com>
Mon, 29 Aug 2016 10:22:37 +0000 (12:22 +0200)
Fixes #2393.

docs/content/templates/functions.md

index 1df0a80f83e556064c132e5b995d1cb7fa008ccc..cd212b85d9b0378c4a7371355dd855890c1df96f 100644 (file)
@@ -97,6 +97,18 @@ One use case is the concatenation of elements in combination with `delimit`:
 ```
 
 
+### shuffle
+
+`shuffle` returns a random permutation of a given array or slice, e.g.
+
+```html
+{{ shuffle (seq 1 5) }}
+<!-- returns [2 5 3 1 4] -->
+
+{{ shuffle (slice "foo" "bar" "buzz") }}
+<!-- returns [buzz foo bar] -->
+```
+
 ### echoParam
 Prints a parameter if it is set.
 
@@ -128,7 +140,7 @@ Encodes a given object to JSON.
 
 e.g.
 
-   {{ dict "title" .Title "content" .Plain | jsonify }}
+    {{ dict "title" .Title "content" .Plain | jsonify }}
 
 ### last
 Slices an array to only the last _N_ elements.