diff --git a/4_generator/generate.go b/4_generator/generate.go index e4df86cf..6977b406 100644 --- a/4_generator/generate.go +++ b/4_generator/generate.go @@ -104,7 +104,6 @@ func Generate(g *client.GitClient, contexts []*transformer.TemplateContext, form t := template.New(ctx.Version) t.Funcs(template.FuncMap{ - "stringsJoin": strings.Join, "unescape": func(s string) template.HTML { return template.HTML(s) }, diff --git a/4_generator/template/default.tpl b/4_generator/template/default.tpl index c62996c4..a8b30608 100644 --- a/4_generator/template/default.tpl +++ b/4_generator/template/default.tpl @@ -2,7 +2,7 @@ {{- define "body" -}} {{range . -}} -- {{if .Field.Header.Scope }}**{{ unescape .Field.Header.Scope }}**: {{ end }}{{ unescape .Field.Header.Subject }}({{ hashURL .Hash}}) (thanks @{{ unescape .Author.Name }}){{if .Field.Footer }} {{if .Field.Footer.Closes }}, Closes: {{ stringsJoin .Field.Footer.Closes "," }} {{- end }} {{- end}} +- {{if .Field.Header.Scope }}**{{ unescape .Field.Header.Scope }}**: {{ end }}{{ unescape .Field.Header.Subject }}({{ hashURL .Hash}}) (thanks @{{ unescape .Author.Name }}){{if .Field.Footer }} {{if .Field.Footer.Closes }}, Closes: {{ .Field.Footer.Closes }} {{- end }} {{- end}} {{ end }} {{- end -}} diff --git a/4_generator/template/full.tpl b/4_generator/template/full.tpl index 6396da4e..fbcbb10e 100644 --- a/4_generator/template/full.tpl +++ b/4_generator/template/full.tpl @@ -2,7 +2,7 @@ {{- define "body" -}} {{range . -}} -- {{if .Field.Header.Scope }}**{{ unescape .Field.Header.Scope }}**: {{ end }}{{ unescape .Field.Header.Subject }}({{ hashURL .Hash}}) (thanks @{{ unescape .Author.Name }}){{if .Field.Footer }} {{if .Field.Footer.Closes }}, Closes: {{ stringsJoin .Field.Footer.Closes "," }} {{- end }} {{- end}} +- {{if .Field.Header.Scope }}**{{ unescape .Field.Header.Scope }}**: {{ end }}{{ unescape .Field.Header.Subject }}({{ hashURL .Hash}}) (thanks @{{ unescape .Author.Name }}){{if .Field.Footer }} {{if .Field.Footer.Closes }}, Closes: {{ .Field.Footer.Closes }} {{- end }} {{- end}} {{ end }} {{- end -}} diff --git a/4_generator/template/simple.tpl b/4_generator/template/simple.tpl index 2b458980..60d5252e 100644 --- a/4_generator/template/simple.tpl +++ b/4_generator/template/simple.tpl @@ -2,7 +2,7 @@ {{- define "body" -}} {{range . -}} -- {{if .Field.Header.Scope }}**{{ unescape .Field.Header.Scope }}**: {{ end }}{{ unescape .Field.Header.Subject }}({{ hashURL .Hash}}) {{if .Field.Footer }} {{if .Field.Footer.Closes }}, Closes: {{ stringsJoin .Field.Footer.Closes "," }} {{- end }} {{- end}} +- {{if .Field.Header.Scope }}**{{ unescape .Field.Header.Scope }}**: {{ end }}{{ unescape .Field.Header.Subject }}({{ hashURL .Hash}}) {{if .Field.Footer }} {{if .Field.Footer.Closes }}, Closes: {{ .Field.Footer.Closes }} {{- end }} {{- end}} {{ end }} {{- end -}} diff --git a/CUSTOM_TEMPLATE.md b/CUSTOM_TEMPLATE.md index 1832cdb5..5826ee6c 100644 --- a/CUSTOM_TEMPLATE.md +++ b/CUSTOM_TEMPLATE.md @@ -32,7 +32,6 @@ There are 3 parts in Context 1. **unescape(text string)**: unescape the string 2. **hashURL(commitHashString string)**: Add URL to commit - 3. **stringsJoin(arr []string)**: Join string source code: @@ -79,7 +78,7 @@ type BreakingChange struct { type Footer struct { BreakingChange *BreakingChange - Closes []string + Closes string } diff --git a/internal/commit/parser/parser.go b/internal/commit/parser/parser.go index 526b9f87..0c3042b4 100644 --- a/internal/commit/parser/parser.go +++ b/internal/commit/parser/parser.go @@ -19,7 +19,7 @@ type BreakingChange struct { type Footer struct { BreakingChange *BreakingChange - Closes []string + Closes string } /* @@ -126,7 +126,7 @@ func Parser(message string) *Message { for i, issue := range issues { issues[i] = strings.TrimRight(strings.TrimSpace(issue), ".") } - m.Footer.Closes = issues + m.Footer.Closes = strings.Join(issues, ", ") continue } else if len(breakingChangeFooterMatchers) != 0 { isBreakingChangeBlock = true diff --git a/release.tpl b/release.tpl index c1a0235d..91071cf2 100644 --- a/release.tpl +++ b/release.tpl @@ -1,6 +1,6 @@ {{- define "body" -}} {{range . -}} -- {{if .Field.Header.Scope }}**{{ unescape .Field.Header.Scope }}**: {{ end }}{{ unescape .Field.Header.Subject }}({{ hashURL .Hash}}) (thanks @{{ unescape .Author.Name }}){{if .Field.Footer }} {{if .Field.Footer.Closes }}, Closes: {{ stringsJoin .Field.Footer.Closes "," }} {{- end }} {{- end}} +- {{if .Field.Header.Scope }}**{{ unescape .Field.Header.Scope }}**: {{ end }}{{ unescape .Field.Header.Subject }}({{ hashURL .Hash}}) (thanks @{{ unescape .Author.Name }}){{if .Field.Footer }} {{if .Field.Footer.Closes }}, Closes: {{ .Field.Footer.Closes }} {{- end }} {{- end}} {{ end }} {{- end -}}