Skip to content

Commit

Permalink
templates: update to gomarkdoc v1.1.0
Browse files Browse the repository at this point in the history
It uses a new parser and has changed some functions as well.

Signed-off-by: Roman Khimov <[email protected]>
  • Loading branch information
roman-khimov committed Jan 31, 2024
1 parent faedb9e commit 188e9eb
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 23 deletions.
16 changes: 9 additions & 7 deletions templates/contracts-doc.tmpl
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
{{- range .Blocks -}}
{{- if eq .Kind "paragraph" -}}
{{- paragraph .Text -}}
{{- else if eq .Kind "code" -}}
{{- codeBlock "" .Text -}}
{{- else if eq .Kind "header" -}}
{{- header (add .Level 1) .Text -}}
{{- range (iter .Blocks) -}}
{{- "\n" -}}
{{- if eq .Entry.Kind "paragraph" -}}
{{- template "text" .Entry.Spans -}}
{{- else if eq .Entry.Kind "code" -}}
{{- codeBlock "" (include "text" .Entry.Spans) -}}
{{- else if eq .Entry.Kind "header" -}}
{{- header (add .Entry.Level 1) (include "text" .Entry.Spans) -}}
{{- end -}}
{{- "\n" -}}
{{- end -}}
7 changes: 3 additions & 4 deletions templates/contracts-func.tmpl
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{{- .Name | rawHeader (add .Level 3) -}}
{{.Name | rawHeader (add .Level 3)}}

{{- codeBlock "go" .Signature -}}

{{- template "doc" .Doc -}}
{{codeBlock "go" .Signature}}
{{template "doc" .Doc -}}

{{- range .Examples -}}
{{- template "example" . -}}
Expand Down
22 changes: 10 additions & 12 deletions templates/contracts-package.tmpl
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
{{- if eq .Name "main" -}}
{{- header .Level .Dirname -}}
{{- else -}}
{{- .Name | printf "%s contract" | header (add .Level 2) -}}
{{- end -}}
{{if eq .Name "main"}}
{{- header .Level .Dirname}}
{{else}}
{{- .Name | printf "%s contract" | header (add .Level 2)}}
{{end}}

{{- template "doc" .Doc -}}
{{template "doc" .Doc}}

{{- range .Examples -}}
{{- template "example" . -}}
{{- end -}}

{{- header (add .Level 3) "Contract methods" -}}

{{- range .Funcs -}}
{{- template "func" . -}}
{{- end}}
{{header (add .Level 3) "Contract methods"}}
{{range .Funcs -}}
{{- "\n"}}{{template "func" .}}
{{- end -}}

0 comments on commit 188e9eb

Please sign in to comment.