diff --git a/README.md b/README.md index d61726b..07faf19 100644 --- a/README.md +++ b/README.md @@ -103,22 +103,24 @@ terraform: {{ .Title }} [CI link]( {{ .Link }} ) {{ .Message }} {{if .Result}} -
{{ .Result }} +
{{end}}{{ .Result }}
apply: template: | {{ .Title }} {{ .Message }} {{if .Result}} -Details (Click me)
-{{ .Body }} + +
{{ .Body }}
{{ .Result }} +
{{end}}{{ .Result }}
``` @@ -152,22 +154,24 @@ terraform: {{ .Title }} [CI link]( {{ .Link }} ) {{ .Message }} {{if .Result}} -Details (Click me)
-{{ .Body }} + +
{{ .Body }}
{{ .Result }} +
{{end}}{{ .Result }}
apply: template: | {{ .Title }} {{ .Message }} {{if .Result}} -Details (Click me)
-{{ .Body }} + +
{{ .Body }}
{{ .Result }} +
{{end}}{{ .Result }}
``` diff --git a/config/config_test.go b/config/config_test.go index ecda5dd..da37a6a 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -50,7 +50,7 @@ func TestLoadFile(t *testing.T) { Template: "", }, Plan: Plan{ - Template: "{{ .Title }}\n{{ .Message }}\n{{if .Result}}\nDetails (Click me)
-{{ .Body }} + +
{{ .Body }}
\n{{end}}\n{{ .Result }}\n
\n", + Template: "{{ .Title }}\n{{ .Message }}\n{{if .Result}}\nDetails (Click me)
\n{{ .Body }}\n
\n{{end}}\n{{ .Result }}\n
\n", }, Apply: Apply{ Template: "", @@ -90,7 +90,7 @@ func TestLoadFile(t *testing.T) { Template: "", }, Plan: Plan{ - Template: "{{ .Title }}\n{{ .Message }}\n{{if .Result}}\nDetails (Click me)
\n\n{{ .Body }}\n
\n{{end}}\n{{ .Result }}\n
\n", + Template: "{{ .Title }}\n{{ .Message }}\n{{if .Result}}\nDetails (Click me)
\n{{ .Body }}\n
\n{{end}}\n{{ .Result }}\n
\n", }, Apply: Apply{ Template: "", diff --git a/example.tfnotify.yaml b/example.tfnotify.yaml index b124dcc..867d263 100644 --- a/example.tfnotify.yaml +++ b/example.tfnotify.yaml @@ -11,9 +11,10 @@ terraform: {{ .Title }} {{ .Message }} {{if .Result}} -Details (Click me)
\n\n{{ .Body }}\n
{{ .Result }} +
{{end}}{{ .Result }}
diff --git a/terraform/template.go b/terraform/template.go index 6c10c0c..ca92f51 100644 --- a/terraform/template.go +++ b/terraform/template.go @@ -27,6 +27,7 @@ const ( {{end}}Details (Click me)
-{{ .Body }} + +
{{ .Body }}
` @@ -54,6 +55,7 @@ const ( {{end}}Details (Click me)
+{{ .Body }}
` @@ -70,6 +72,7 @@ const ( {{end}}Details (Click me)
+{{ .Body }}
` diff --git a/terraform/template_test.go b/terraform/template_test.go index a6b6461..d093047 100644 --- a/terraform/template_test.go +++ b/terraform/template_test.go @@ -22,6 +22,7 @@ func TestDefaultTemplateExecute(t *testing.T) {Details (Click me)
+{{ .Body }}
`, @@ -39,6 +40,7 @@ messageDetails (Click me)
+
`, @@ -59,6 +61,7 @@ bDetails (Click me)
+
`, @@ -80,6 +83,7 @@ bDetails (Click me)
+c
`, @@ -220,6 +224,7 @@ func TestPlanTemplateExecute(t *testing.T) {Details (Click me)
+c
`, @@ -243,6 +248,7 @@ messageDetails (Click me)
+
`, @@ -263,6 +269,7 @@ messageDetails (Click me)
+body
`, @@ -283,6 +290,7 @@ messageDetails (Click me)
+body
`, @@ -328,6 +336,7 @@ func TestApplyTemplateExecute(t *testing.T) {Details (Click me)
+body
`, @@ -351,6 +360,7 @@ messageDetails (Click me)
+
`, @@ -371,6 +381,7 @@ messageDetails (Click me)
+body
`, @@ -391,6 +402,7 @@ messageDetails (Click me)
+body
`,Details (Click me)
+body