1
1
Fork 0
mirror of https://github.com/mcuadros/ascode synced 2024-05-08 16:46:18 +02:00

doc: template, index on package

This commit is contained in:
Máximo Cuadros 2020-03-23 04:35:12 +01:00
parent 63e4823473
commit a2fcf6a480
No known key found for this signature in database
GPG Key ID: 17A5DFEDC735AE4B

View File

@ -42,6 +42,30 @@
{{- end -}}
{{- end -}}
{{- define "indexFunctionName" -}}
{{- $receiver := "" -}}
{{ if ne .Receiver "types" -}}{{ $receiver = printf "<i>%s</i>." .Receiver }}{{- end -}}
{{- $name := printf "def <b>%s</b>" (index (split .Signature "(") 0) -}}
{{- $anchor := printf "def %s<b>%s</b>" $receiver (index (split .Signature "(") 0) -}}
* [{{ $name }}({{ (index (split .Signature "(") 1) }}](#{{ sanitizeAnchor $anchor }})
{{- end -}}
{{- define "index" -}}
## Index
{{ range .Functions }}
{{ template "indexFunctionName" . }}
{{- end -}}
{{ range .Types -}}
{{ $name := printf "type <b>%s</b>" .Name }}
* [{{ $name }}](#{{ sanitizeAnchor $name }})
{{- range .Methods }}
{{ template "indexFunctionName" . -}}
{{- end -}}
{{- end }}
{{ end -}}
{{- range . -}}
---
@ -50,6 +74,9 @@ title: '{{ .Path }}'
{{ if ne .Description "" }}{{ .Description }}{{ end }}
{{ template "index" . }}
{{- if gt (len .Functions) 0 }}
## Functions
{{ range .Functions -}}
@ -62,7 +89,7 @@ title: '{{ .Path }}'
{{ range .Types -}}
### <b>{{ .Name }}</b>
### type <b>{{ .Name }}</b>
{{ if ne .Description "" }}{{ .Description }}{{ end -}}
{{ if gt (len .Fields) 0 }}