Skip to content

Commit

Permalink
Update template examples to fix #5
Browse files Browse the repository at this point in the history
* Add an empty line after the `</summary>` tag.
* Remove some unnecessary blanks.
  • Loading branch information
chroju committed Aug 15, 2019
1 parent 7e0cdd4 commit 442f620
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 12 deletions.
20 changes: 12 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,22 +103,24 @@ terraform:
{{ .Title }} <sup>[CI link]( {{ .Link }} )</sup>
{{ .Message }}
{{if .Result}}
<pre><code> {{ .Result }}
<pre><code>{{ .Result }}
</pre></code>
{{end}}
<details><summary>Details (Click me)</summary>
<pre><code> {{ .Body }}
<pre><code>{{ .Body }}
</pre></code></details>
apply:
template: |
{{ .Title }}
{{ .Message }}
{{if .Result}}
<pre><code> {{ .Result }}
<pre><code>{{ .Result }}
</pre></code>
{{end}}
<details><summary>Details (Click me)</summary>
<pre><code> {{ .Body }}
<pre><code>{{ .Body }}
</pre></code></details>
```
Expand Down Expand Up @@ -152,22 +154,24 @@ terraform:
{{ .Title }} <sup>[CI link]( {{ .Link }} )</sup>
{{ .Message }}
{{if .Result}}
<pre><code> {{ .Result }}
<pre><code>{{ .Result }}
</pre></code>
{{end}}
<details><summary>Details (Click me)</summary>
<pre><code> {{ .Body }}
<pre><code>{{ .Body }}
</pre></code></details>
apply:
template: |
{{ .Title }}
{{ .Message }}
{{if .Result}}
<pre><code> {{ .Result }}
<pre><code>{{ .Result }}
</pre></code>
{{end}}
<details><summary>Details (Click me)</summary>
<pre><code> {{ .Body }}
<pre><code>{{ .Body }}
</pre></code></details>
```
Expand Down
4 changes: 2 additions & 2 deletions config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func TestLoadFile(t *testing.T) {
Template: "",
},
Plan: Plan{
Template: "{{ .Title }}\n{{ .Message }}\n{{if .Result}}\n<pre><code> {{ .Result }}\n</pre></code>\n{{end}}\n<details><summary>Details (Click me)</summary>\n<pre><code> {{ .Body }}\n</pre></code></details>\n",
Template: "{{ .Title }}\n{{ .Message }}\n{{if .Result}}\n<pre><code>{{ .Result }}\n</pre></code>\n{{end}}\n<details><summary>Details (Click me)</summary>\n\n<pre><code>{{ .Body }}\n</pre></code></details>\n",
},
Apply: Apply{
Template: "",
Expand Down Expand Up @@ -90,7 +90,7 @@ func TestLoadFile(t *testing.T) {
Template: "",
},
Plan: Plan{
Template: "{{ .Title }}\n{{ .Message }}\n{{if .Result}}\n<pre><code> {{ .Result }}\n</pre></code>\n{{end}}\n<details><summary>Details (Click me)</summary>\n<pre><code> {{ .Body }}\n</pre></code></details>\n",
Template: "{{ .Title }}\n{{ .Message }}\n{{if .Result}}\n<pre><code>{{ .Result }}\n</pre></code>\n{{end}}\n<details><summary>Details (Click me)</summary>\n\n<pre><code>{{ .Body }}\n</pre></code></details>\n",
},
Apply: Apply{
Template: "",
Expand Down
5 changes: 3 additions & 2 deletions example.tfnotify.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ terraform:
{{ .Title }}
{{ .Message }}
{{if .Result}}
<pre><code> {{ .Result }}
<pre><code>{{ .Result }}
</pre></code>
{{end}}
<details><summary>Details (Click me)</summary>
<pre><code> {{ .Body }}
<pre><code>{{ .Body }}
</pre></code></details>
3 changes: 3 additions & 0 deletions terraform/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const (
{{end}}
<details><summary>Details (Click me)</summary>
<pre><code>{{ .Body }}
</code></pre></details>
`
Expand Down Expand Up @@ -54,6 +55,7 @@ const (
{{end}}
<details><summary>Details (Click me)</summary>
<pre><code>{{ .Body }}
</code></pre></details>
`
Expand All @@ -70,6 +72,7 @@ const (
{{end}}
<details><summary>Details (Click me)</summary>
<pre><code>{{ .Body }}
</code></pre></details>
`
Expand Down
12 changes: 12 additions & 0 deletions terraform/template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ func TestDefaultTemplateExecute(t *testing.T) {
<details><summary>Details (Click me)</summary>
<pre><code>
</code></pre></details>
`,
Expand All @@ -39,6 +40,7 @@ message
<details><summary>Details (Click me)</summary>
<pre><code>
</code></pre></details>
`,
Expand All @@ -59,6 +61,7 @@ b
<details><summary>Details (Click me)</summary>
<pre><code>c
</code></pre></details>
`,
Expand All @@ -80,6 +83,7 @@ b
<details><summary>Details (Click me)</summary>
<pre><code>c
</code></pre></details>
`,
Expand Down Expand Up @@ -220,6 +224,7 @@ func TestPlanTemplateExecute(t *testing.T) {
<details><summary>Details (Click me)</summary>
<pre><code>
</code></pre></details>
`,
Expand All @@ -243,6 +248,7 @@ message
<details><summary>Details (Click me)</summary>
<pre><code>body
</code></pre></details>
`,
Expand All @@ -263,6 +269,7 @@ message
<details><summary>Details (Click me)</summary>
<pre><code>body
</code></pre></details>
`,
Expand All @@ -283,6 +290,7 @@ message
<details><summary>Details (Click me)</summary>
<pre><code>body
</code></pre></details>
`,
Expand Down Expand Up @@ -328,6 +336,7 @@ func TestApplyTemplateExecute(t *testing.T) {
<details><summary>Details (Click me)</summary>
<pre><code>
</code></pre></details>
`,
Expand All @@ -351,6 +360,7 @@ message
<details><summary>Details (Click me)</summary>
<pre><code>body
</code></pre></details>
`,
Expand All @@ -371,6 +381,7 @@ message
<details><summary>Details (Click me)</summary>
<pre><code>body
</code></pre></details>
`,
Expand All @@ -391,6 +402,7 @@ message
<details><summary>Details (Click me)</summary>
<pre><code>body
</code></pre></details>
`,
Expand Down

0 comments on commit 442f620

Please sign in to comment.