ref: 26084ad198044519e10b96ac5432be874c0ae1b4
parent: fa09e20d9aa5fd81fa3a6e40ea6d0a52933ce2fc
author: Cameron Moore <[email protected]>
date: Thu Dec 15 05:56:52 EST 2016
docs: Fix pipe examples Fixes #2787
--- a/docs/content/templates/go-templates.md
+++ b/docs/content/templates/go-templates.md
@@ -206,15 +206,12 @@
**Example 1:**
- {{ if eq 1 1 }} Same {{ end }}
+ {{ shuffle (seq 1 5) }}
is the same as
- {{ eq 1 1 | if }} Same {{ end }}
+ {{ (seq 1 5) | shuffle }}
-It does look odd to place the `if` at the end, but it does provide a good
-illustration of how to use the pipes.
-
**Example 2:**
{{ index .Params "disqus_url" | html }}
@@ -227,13 +224,13 @@
**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 }}