docs: Fix pipe examples - hugo - [fork] hugo port for 9front
HTML git clone git@git.drkhsh.at/hugo.git
DIR Log
DIR Files
DIR Refs
DIR Submodules
DIR README
DIR LICENSE
---
DIR commit 26084ad198044519e10b96ac5432be874c0ae1b4
DIR parent fa09e20d9aa5fd81fa3a6e40ea6d0a52933ce2fc
HTML Author: Cameron Moore <moorereason@gmail.com>
Date: Thu, 15 Dec 2016 10:56:52 -0600
docs: Fix pipe examples
Fixes #2787
Diffstat:
M docs/content/templates/go-template… | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
---
DIR diff --git a/docs/content/templates/go-templates.md b/docs/content/templates/go-templates.md
@@ -206,14 +206,11 @@ A few simple examples should help convey how to use the pipe.
**Example 1:**
- {{ if eq 1 1 }} Same {{ end }}
+ {{ shuffle (seq 1 5) }}
is the same as
- {{ eq 1 1 | if }} Same {{ end }}
-
-It does look odd to place the `if` at the end, but it does provide a good
-illustration of how to use the pipes.
+ {{ (seq 1 5) | shuffle }}
**Example 2:**
@@ -227,13 +224,13 @@ The `index` function is a [Go][] built-in, and you can read about it [here][gost
**Example 3:**
- {{ if or (or (isset .Params "title") (isset .Params "caption")) (isset .Params "attr")}}
+ {{ if or (or (isset .Params "title") (isset .Params "caption")) (isset .Params "attr") }}
Stuff Here
{{ end }}
Could be rewritten as
- {{ isset .Params "caption" | or isset .Params "title" | or isset .Params "attr" | if }}
+ {{ if isset .Params "caption" | or isset .Params "title" | or isset .Params "attr" }}
Stuff Here
{{ end }}