mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2025-12-31 01:10:20 -06:00
Move conditional for deprecation Link into go template
Signed-off-by: Christian Richter <crichter@owncloud.com>
This commit is contained in:
@@ -16,12 +16,12 @@ import (
|
||||
{{- end}})
|
||||
|
||||
type ConfigField struct {
|
||||
EnvVars []string
|
||||
DefaultValue string
|
||||
Type string
|
||||
Description string
|
||||
VersionInfo string
|
||||
IsDeprecated bool
|
||||
EnvVars []string
|
||||
DefaultValue string
|
||||
Type string
|
||||
Description string
|
||||
VersionInfo string
|
||||
DeprecationLink string
|
||||
}
|
||||
|
||||
type DeprecationField struct {
|
||||
@@ -103,7 +103,7 @@ func GetAnnotatedVariables(s interface{}) ([]ConfigField, []DeprecationField) {
|
||||
default:
|
||||
desc := field.Tag.Get("desc")
|
||||
env, ok := field.Tag.Lookup("env")
|
||||
isDeprecated := false
|
||||
deprecationLink := ""
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
@@ -115,7 +115,7 @@ func GetAnnotatedVariables(s interface{}) ([]ConfigField, []DeprecationField) {
|
||||
removalVersion != "" ||
|
||||
deprecationInfo != "" ||
|
||||
deprecationReplacement != "" {
|
||||
isDeprecated = true
|
||||
deprecationLink = "xref:deprecation-note[Deprecation Note]"
|
||||
}
|
||||
v := fmt.Sprintf("%v", value.Interface())
|
||||
td := strings.Split(env, ";")
|
||||
@@ -131,13 +131,13 @@ func GetAnnotatedVariables(s interface{}) ([]ConfigField, []DeprecationField) {
|
||||
}
|
||||
fields = append(fields,
|
||||
ConfigField{
|
||||
EnvVars: td,
|
||||
DefaultValue: v,
|
||||
Description: desc,
|
||||
Type: typeName,
|
||||
IsDeprecated: isDeprecated,
|
||||
EnvVars: td,
|
||||
DefaultValue: v,
|
||||
Description: desc,
|
||||
Type: typeName,
|
||||
DeprecationLink: deprecationLink,
|
||||
})
|
||||
if isDeprecated {
|
||||
if deprecationLink != "" {
|
||||
deprecations = append(deprecations,
|
||||
DeprecationField{
|
||||
DeprecationVersion: deprecationVersion,
|
||||
|
||||
5
docs/templates/ADOC.tmpl
vendored
5
docs/templates/ADOC.tmpl
vendored
@@ -38,10 +38,7 @@ a| {{- range $i, $value := .EnvVars }}{{- if $i }} +
|
||||
{{ end -}}
|
||||
`{{- $value }}`
|
||||
{{- end }} +
|
||||
:is-deprecated: {{ .IsDeprecated }}
|
||||
ifeval::[{is-deprecated} == true]
|
||||
xref:deprecation-note[Deprecation Note]
|
||||
endif::[]
|
||||
{{ .DeprecationLink }}
|
||||
a| [subs=-attributes]
|
||||
++{{.Type}} ++
|
||||
a| [subs=-attributes]
|
||||
|
||||
Reference in New Issue
Block a user