mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-01-05 19:59:37 -06:00
improve template and sort results
Signed-off-by: jkoberg <jkoberg@owncloud.com>
This commit is contained in:
@@ -9,10 +9,12 @@ import (
|
||||
"regexp"
|
||||
"strings"
|
||||
"text/template"
|
||||
"sort"
|
||||
|
||||
{{- range $key, $value := .}}
|
||||
pkg{{$key}} "{{$value}}"
|
||||
{{- end}})
|
||||
{{- end}}
|
||||
)
|
||||
|
||||
// ConfigField is the representation of one configuration field
|
||||
type ConfigField struct {
|
||||
@@ -83,6 +85,9 @@ func main() {
|
||||
for _, e := range f.EnvVars {
|
||||
if env, ok := all[e]; ok {
|
||||
env.Services = append(env.Services, service)
|
||||
sort.Slice(env.Services, func(i, j int) bool {
|
||||
return env.Services[i] < env.Services[j]
|
||||
})
|
||||
all[e] = env
|
||||
} else {
|
||||
all[e] = EnvVar{
|
||||
@@ -130,6 +135,11 @@ func main() {
|
||||
}
|
||||
}
|
||||
|
||||
// sort
|
||||
sort.Slice(tmplValues, func(i, j int) bool {
|
||||
return tmplValues[i]["Name"].(string) < tmplValues[j]["Name"].(string)
|
||||
})
|
||||
|
||||
glc, err := os.ReadFile("../../docs/templates/ADOC_global.tmpl")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
||||
11
docs/templates/ADOC_global.tmpl
vendored
11
docs/templates/ADOC_global.tmpl
vendored
@@ -1,6 +1,9 @@
|
||||
// collected through docs/helpers/adoc-generator.go.tmpl
|
||||
|
||||
[.landscape]
|
||||
[caption=]
|
||||
.Environment variables with global scope available in multiple services
|
||||
[width="100%",cols="~,~,~,~,~",options="header"]
|
||||
[width="100%",cols="30%,25%,~,~,~",options="header"]
|
||||
|===
|
||||
| Name
|
||||
| Services
|
||||
@@ -12,9 +15,9 @@
|
||||
|
||||
a| `{{ .Name }}`
|
||||
|
||||
a| [subs=-attributes]
|
||||
a| [subs=attributes+]
|
||||
{{- range .Services}}
|
||||
xref:{s-path}/{{ . }}.adoc[{{ . }}] +
|
||||
* xref:{s-path}/{{ . }}.adoc[{{ . }}] +
|
||||
{{- end }}
|
||||
|
||||
a| [subs=-attributes]
|
||||
@@ -24,7 +27,7 @@ a| [subs=-attributes]
|
||||
++{{ .DefaultValue }} ++
|
||||
|
||||
a| [subs=-attributes]
|
||||
++{{ .Description }} ++
|
||||
{{ .Description }}
|
||||
|
||||
{{- end }}
|
||||
|===
|
||||
|
||||
Reference in New Issue
Block a user