Doc codegen tweaks & cleanup
This commit is contained in:
@@ -8,37 +8,44 @@
|
||||
// - {{ .Source }}
|
||||
{{- end }}
|
||||
|
||||
= Resources and events
|
||||
{{- range .Definitions }}
|
||||
{{- range .Resources }}
|
||||
|
||||
= {{ .ResourceString }}
|
||||
== {{ .ResourceString }}
|
||||
|
||||
== Events
|
||||
=== Events
|
||||
|
||||
.Events:
|
||||
{{- if .BeforeAfter }}
|
||||
.Before/after events:
|
||||
{{- range $ba := .BeforeAfter }}
|
||||
* `before('{{ $ba }}')`
|
||||
{{- end }}
|
||||
{{- range $ba := .BeforeAfter }}
|
||||
* `after('{{ $ba }}')`
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{ if .On -}}
|
||||
.On events:
|
||||
{{- range $on := .On }}
|
||||
* `on('{{ $on }}')`
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
== Argument properties
|
||||
=== Exec arguments
|
||||
|
||||
.Argument properties:
|
||||
[%header, cols=3*]
|
||||
|===
|
||||
|Name|Type|Immutable
|
||||
|Name|Type|Mutable
|
||||
{{- range $p := .Properties }}
|
||||
| `{{ $p.Name }}`
|
||||
| `{{ $p.Type }}`
|
||||
{{- if $p.Immutable }}
|
||||
| yes
|
||||
{{ else }}
|
||||
| no
|
||||
{{ else }}
|
||||
| yes
|
||||
{{ end -}}
|
||||
|
||||
{{ end -}}
|
||||
|
||||
@@ -8,26 +8,22 @@
|
||||
// - {{ .Source }}
|
||||
{{- end }}
|
||||
|
||||
|
||||
= ENV options
|
||||
{{ range .Definitions }}
|
||||
|
||||
= {{ .Docs.Title }}
|
||||
|
||||
== {{ .Docs.Title }}
|
||||
{{ if .Docs.Intro }}
|
||||
{{ .Docs.Intro }}
|
||||
{{ end }}
|
||||
{{- range .Properties }}
|
||||
=== *{{ toUpper .Env }}* `{{ .Type }}`
|
||||
|
||||
{{ range .Properties }}
|
||||
|
||||
== *{{ toUpper .Env }}* `{{ .Type }}`
|
||||
|
||||
{{ if .Default }}
|
||||
{{ if or .Default .Description -}}
|
||||
{{ if .Default -}}
|
||||
Default::
|
||||
`{{ .Default }}`
|
||||
`{{ .Default }}`
|
||||
{{ end -}}
|
||||
{{ if .Description }}
|
||||
{{ if .Description -}}
|
||||
Description::
|
||||
{{ .Description }}
|
||||
{{ end -}}
|
||||
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ .Description }}
|
||||
{{ end -}}{{ end -}}
|
||||
{{ end }}{{ end }}
|
||||
@@ -14,7 +14,7 @@ import (
|
||||
|
||||
func Proc() {
|
||||
const (
|
||||
docPathOptions = "/dev-ops-guide/server-configuration"
|
||||
docGenBase = "/partials/generated"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -117,7 +117,7 @@ func Proc() {
|
||||
}()
|
||||
|
||||
if len(docPath) > 0 {
|
||||
docPath = strings.TrimRight(docPath, "/") + "/src/modules/ROOT/pages"
|
||||
docPath = strings.TrimRight(docPath, "/") + "/src/modules/ROOT"
|
||||
if i, err := os.Stat(docPath); err != nil {
|
||||
handleError(err)
|
||||
} else if !i.IsDir() {
|
||||
@@ -193,7 +193,7 @@ func Proc() {
|
||||
err = genEvents(tpls, eventDefs...)
|
||||
}
|
||||
if genDocs && err == nil {
|
||||
err = genEventsDocs(tpls, docPath+docPathOptions, eventDefs...)
|
||||
err = genEventsDocs(tpls, docPath+docGenBase, eventDefs...)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -237,7 +237,7 @@ func Proc() {
|
||||
}
|
||||
|
||||
if genDocs && err == nil {
|
||||
err = genOptionsDocs(tpls, docPath+docPathOptions, optionDefs...)
|
||||
err = genOptionsDocs(tpls, docPath+docGenBase, optionDefs...)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -211,7 +211,7 @@ func genEventsDocs(tpl *template.Template, docsPath string, dd ...*eventsDef) (e
|
||||
dst string
|
||||
)
|
||||
|
||||
dst = path.Join(docsPath, "events_env_variables.gen.adoc")
|
||||
dst = path.Join(docsPath, "resource-events.gen.adoc")
|
||||
return plainTemplate(dst, tplEventsAdoc, map[string]interface{}{
|
||||
"Definitions": dd,
|
||||
})
|
||||
|
||||
@@ -144,7 +144,7 @@ func genOptionsDocs(tpl *template.Template, docsPath string, dd ...*optionsDef)
|
||||
dst string
|
||||
)
|
||||
|
||||
dst = path.Join(docsPath, "option_env_variables_gen.adoc")
|
||||
dst = path.Join(docsPath, "env-options.gen.adoc")
|
||||
return plainTemplate(dst, tplOptionsAdoc, map[string]interface{}{
|
||||
"Definitions": dd,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user