From 4e0e19dfc7d4a6db4d036c76cf36b70e29736589 Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Wed, 4 May 2022 12:22:13 +0200 Subject: [PATCH] add extension name to adoc template Signed-off-by: Christian Richter --- docs/helpers/adoc-generator.go.tmpl | 12 +++++++++++- docs/templates/ADOC.tmpl | 4 ++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/docs/helpers/adoc-generator.go.tmpl b/docs/helpers/adoc-generator.go.tmpl index d9e1cb2433..8f63a391b2 100644 --- a/docs/helpers/adoc-generator.go.tmpl +++ b/docs/helpers/adoc-generator.go.tmpl @@ -22,6 +22,11 @@ type ConfigField struct { VersionInfo string } +type templateData struct { + ExtensionName string + Fields []ConfigField +} + func main() { fmt.Println("Generating adoc documentation for environment variables:") content, err := ioutil.ReadFile("../../docs/templates/ADOC.tmpl") @@ -52,7 +57,12 @@ m := map[string]interface{}{ log.Fatalf("Failed to create target file: %s", err) } defer targetFile.Close() - if err := tpl.Execute(targetFile, fields); err != nil { + + td := templateData{ + ExtensionName: replacer.Replace(pkg), + Fields: fields, + } + if err := tpl.Execute(targetFile, td); err != nil { log.Fatalf("Failed to execute template: %s", err) } } diff --git a/docs/templates/ADOC.tmpl b/docs/templates/ADOC.tmpl index 512248b6b2..4c01386ddb 100644 --- a/docs/templates/ADOC.tmpl +++ b/docs/templates/ADOC.tmpl @@ -1,5 +1,5 @@ [caption=] -.Environment variables for the frontend extension +.Environment variables for the {{ .ExtensionName }} extension [width="100%",cols="~,~,~,~",options="header"] |=== | Name @@ -7,7 +7,7 @@ | Default Value | Description -{{- range .}} +{{- range .Fields}} | `{{.Name}}` | {{.Type}} | {{.DefaultValue}}