add extension name to adoc template

Signed-off-by: Christian Richter <crichter@owncloud.com>
This commit is contained in:
Christian Richter
2022-05-04 12:22:13 +02:00
parent 6f5b60861a
commit 4e0e19dfc7
2 changed files with 13 additions and 3 deletions

View File

@@ -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)
}
}

View File

@@ -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}}