From 8975d413efb9127b799c04002d2d62b627055e7a Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Fri, 19 Jul 2024 09:08:57 +0200 Subject: [PATCH] add IntroductionVersion to adoc output Signed-off-by: Christian Richter --- docs/helpers/templates/adoc-generator.go.tmpl | 29 +++++++++++-------- docs/templates/ADOC.tmpl | 3 ++ 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/docs/helpers/templates/adoc-generator.go.tmpl b/docs/helpers/templates/adoc-generator.go.tmpl index 74e185c56..a15108520 100644 --- a/docs/helpers/templates/adoc-generator.go.tmpl +++ b/docs/helpers/templates/adoc-generator.go.tmpl @@ -19,12 +19,13 @@ import ( // ConfigField is the representation of one configuration field type ConfigField struct { - EnvVars []string - DefaultValue string - Type string - Description string - VersionInfo string - DeprecationLink string + EnvVars []string + DefaultValue string + IntroductionVersion string + Type string + Description string + VersionInfo string + DeprecationLink string } // DeprecationField holds information about deprecation @@ -37,11 +38,12 @@ type DeprecationField struct { // EnvVar holds information about one envvar type EnvVar struct { - Name string - DefaultValue string - Type string - Description string - Services []string + Name string + IntroductionVersion string + DefaultValue string + Type string + Description string + Services []string } type templateData struct { @@ -103,6 +105,7 @@ func main() { } else { all[e] = EnvVar{ Name: e, + IntroductionVersion: f.IntroductionVersion, Description: f.Description, Type: f.Type, DefaultValue: f.DefaultValue, @@ -153,7 +156,7 @@ func main() { "Description": env.Description, "DefaultValue": env.DefaultValue, "Type": env.Type, - }) + }) } } @@ -198,6 +201,7 @@ func GetAnnotatedVariables(s interface{}, timestamp string) ([]ConfigField, []De if !ok { continue } + introductionVersion, _ := field.Tag.Lookup("introductionVersion") deprecationVersion, _ := field.Tag.Lookup("deprecationVersion") removalVersion, _ := field.Tag.Lookup("removalVersion") deprecationInfo, _ := field.Tag.Lookup("deprecationInfo") @@ -223,6 +227,7 @@ func GetAnnotatedVariables(s interface{}, timestamp string) ([]ConfigField, []De fields = append(fields, ConfigField{ EnvVars: td, + IntroductionVersion: introductionVersion, DefaultValue: v, Description: desc, Type: typeName, diff --git a/docs/templates/ADOC.tmpl b/docs/templates/ADOC.tmpl index 99d692132..a9b7278d4 100644 --- a/docs/templates/ADOC.tmpl +++ b/docs/templates/ADOC.tmpl @@ -34,6 +34,7 @@ endif::[] [width="100%",cols="~,~,~,~",options="header"] |=== | Name +| IV | Type | Default Value | Description @@ -46,6 +47,8 @@ a| {{- range $i, $value := .EnvVars }}{{- if $i }} + {{- end }} + {{ .DeprecationLink }} a| [subs=-attributes] +++{{.IntroductionVersion}} ++ +a| [subs=-attributes] ++{{.Type}} ++ a| [subs=-attributes] ++{{.DefaultValue}} ++