Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify markdown template to add request example links #65

Merged
merged 1 commit into from
Jan 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 37 additions & 6 deletions assets/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,51 @@
@{{- .Data.Info.Description -}}@
@{{ end }}@

<!--- Request items indices -->
## Indices
@{{ range $index, $c := .Data.Collections }}@
<!--- Table of contents -->
@{{- $numCollections := len .Data.Collections}}@
<!--- If we have only one grouop/collection, then no need for the "ungrouped" heading -->
@{{- if eq $numCollections 1 }}@
@{{- range $index, $c := .Data.Collections -}}@
@{{- range $i, $item := $c.Items }}@
1. [@{{ $item.Name | trim }}@](#@{{ merge $i $item.Name | trim | glink | glinkInc }}@)
@{{- range $ri, $response := $item.Responses }}@
@{{- $riRoman := ($ri | addOne | roman) }}@
1. [@{{ $response.Name | trim }}@](#@{{ (print $riRoman ". Example Request: " $response.Name) | trim | glink | glinkInc }}@)
@{{- /* End iterate responses for the request */}}@
@{{- end }}@
@{{- /* End iterate requests in the collection */}}@
@{{- end }}@
@{{- /* End iterate collections */}}@
@{{- end }}@
@{{- /* End if we have more than one collection */}}@
@{{- end }}@

<!--- If we have more than one group/collection, then display each group name heading -->
@{{- if gt $numCollections 1 }}@
@{{- range $index, $c := .Data.Collections }}@
* [@{{ $c.Name | trim }}@](#@{{ $c.Name | trim | glink }}@)
@{{ range $i, $item := $c.Items }}@
* [@{{ $item.Name | trim }}@](#@{{ merge $i $item.Name | trim | glink | glinkInc }}@)
@{{- range $i, $item := $c.Items }}@
1. [@{{ $item.Name | trim }}@](#@{{ merge $i $item.Name | trim | glink | glinkInc }}@)
@{{- range $ri, $response := $item.Responses }}@
@{{- $riRoman := ($ri | addOne | roman) }}@
* [@{{ $response.Name | trim }}@](#@{{ (print $riRoman ". Example Request: " $response.Name) | trim | glink | glinkInc }}@)
@{{- /* End iterate responses for the request */}}@
@{{- end }}@
@{{- /* End iterate requests in the collection */}}@
@{{- end }}@
@{{- /* End iterate collections */}}@
@{{- end }}@
@{{- /* End if we have more than one collection */}}@
@{{- end }}@
@{{ end }}@

--------
<!--- Iterate main collection -->

@{{ range $di, $d := .Data.Collections }}@
<!--- Only show the collection name if there is more than the "ungrouped" collection -->
@{{ if gt $numCollections 1 }}@
## @{{ $d.Name | trim }}@
@{{ end }}@
@{{ $d.Description }}@

<!--- Iterate collection items -->
Expand Down
24 changes: 12 additions & 12 deletions assets_bin/assets.go

Large diffs are not rendered by default.