From 7964493de9c97f91b88cec747a5ba39db007a332 Mon Sep 17 00:00:00 2001 From: Bartosz Majsak Date: Thu, 4 Mar 2021 10:04:26 +0100 Subject: [PATCH] fix: aligns section headers for better readability in the generated docs --- pkg/cmd/generate/templates.go | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/pkg/cmd/generate/templates.go b/pkg/cmd/generate/templates.go index ea87529..d937c9c 100644 --- a/pkg/cmd/generate/templates.go +++ b/pkg/cmd/generate/templates.go @@ -49,26 +49,19 @@ func Contains(s []string, es ...string) bool { } const ChangeSection = `{{- if .PullRequests -}} -#### {{ .Title }} +##### {{ .Title }} {{range $pr := .PullRequests -}} * {{$pr.Title}} ([#{{$pr.Number}}]({{$pr.Permalink}})), by [@{{$pr.Author}}](https://github.com/{{$pr.Author}}) {{ end -}} {{- end -}}` -const ChangeSectionAdoc = `{{- if .PullRequests -}} -==== {{ .Title }} -{{range $pr := .PullRequests -}} - * {{$pr.Title}} ({{$pr.Permalink}}[#{{$pr.Number}}]), by https://github.com/{{$pr.Author}}[@{{$pr.Author}}] -{{ end -}} -{{- end -}}` - const Default = ` {{- range $areaName, $areaLabel := .Areas -}} {{- $bugs := (withLabels $.PullRequests "kind/bug" $areaLabel) -}} {{- $features := (withLabels $.PullRequests "kind/enhancement" $areaLabel) -}} {{- if or $bugs $features -}} -### {{ $areaName }} +#### {{ $areaName }} {{ template "section" (combine $features "New features") }} {{ template "section" (combine $bugs "Bugs") }} @@ -77,7 +70,7 @@ const Default = ` {{- with $prs := (withLabels .PullRequests "dependencies") -}} {{- if $prs -}} -## Latest dependencies update +### Latest dependencies update {{range $pr := $prs }} * {{$pr.Title}} ([#{{$pr.Number}}]({{$pr.Permalink}})) {{- end -}} @@ -85,13 +78,20 @@ const Default = ` {{- end }} ` +const ChangeSectionAdoc = `{{- if .PullRequests -}} +===== {{ .Title }} +{{range $pr := .PullRequests -}} + * {{$pr.Title}} ({{$pr.Permalink}}[#{{$pr.Number}}]), by https://github.com/{{$pr.Author}}[@{{$pr.Author}}] +{{ end -}} +{{- end -}}` + const DefaultAdoc = ` {{- range $areaName, $areaLabel := .Areas -}} {{- $bugs := (withLabels $.PullRequests "kind/bug" $areaLabel) -}} {{- $features := (withLabels $.PullRequests "kind/enhancement" $areaLabel) -}} {{- if or $bugs $features -}} -=== {{ $areaName }} +==== {{ $areaName }} {{ template "section" (combine $features "New features") }} {{ template "section" (combine $bugs "Bugs") }} @@ -100,7 +100,7 @@ const DefaultAdoc = ` {{- with $prs := (withLabels .PullRequests "dependencies") -}} {{- if $prs -}} -== Latest dependencies update +=== Latest dependencies update {{range $pr := $prs }} * {{$pr.Title}} ({{$pr.Permalink}}[#{{$pr.Number}}]), by https://github.com/{{$pr.Author}}[@{{$pr.Author}}] {{- end -}}