diff --git a/data.go b/data.go index 944d89b..24c1fce 100644 --- a/data.go +++ b/data.go @@ -63,6 +63,7 @@ func NewData(ctx context.Context, url, token string, num int) *Data { } funcMap := map[string]any{ "OrderedBy": OrderedBy, + "Reverse": sort.Reverse, } data.tmpl = template.Must(template.New("index").Funcs(funcMap).ParseFS(content, "*.tmpl")) @@ -284,6 +285,11 @@ func (d *Data) VersionsByDate() VersionsByDate { return VersionsByDate(d.Project.Versions) } +func (d VersionsByDate) Sort() VersionsByDate { + sort.Sort(d) + return d +} + func (d *Data) Categories() (cs []string) { d.mux.RLock() defer d.mux.RUnlock() diff --git a/table.tmpl b/table.tmpl index cffda85..17dddc7 100644 --- a/table.tmpl +++ b/table.tmpl @@ -91,30 +91,27 @@ details[open].issue { {{- $top := . -}} {{- $features := .Features -}} {{- $issues := .Issues -}} - {{- $versions := .VersionsByDate -}} + {{- $versions := .VersionsByDate.Sort -}} - {{- range $vname := $top.TargetVersions }} - {{- with $version := $versions.Get . }} + {{- range $version := $versions }} {{- end}} - {{- end}} {{- range $cat := $top.Categories }} - {{- range $tar := $top.TargetVersions }} - {{- with $version := $versions.Get . }} - {{ end }} + {{ end }} {{- end}}
- {{ $vname }} ({{ $version.Timestamp.Format "02 Jan 06"}}) + {{ $version.Name }} ({{ $version.Timestamp.Format "02 Jan 06"}})
{{ $version.Description }}
{{ . }}
{{ with $features.ByCategoryAndTarget $cat $tar }} + {{- range $version := $versions }} +
{{ with $features.ByCategoryAndTarget $cat $version.Name }}
{{ $l := len .}}{{ if lt 1 $l }}{{ $l }} features{{ else }}1 feature{{ end }}
@@ -133,7 +130,7 @@ details[open].issue { {{- end}}
{{- end }} - {{- with $issues.ByCategoryAndTarget $cat $tar }} + {{- with $issues.ByCategoryAndTarget $cat $version.Name }}
{{ $l := len .}}{{ if lt 1 $l }}{{ $l }} issues{{ else }}1 issue{{ end }}
@@ -147,7 +144,7 @@ details[open].issue { {{- end}}
{{ end -}} -