mirror of
https://github.com/matrix-org/matrix-spec
synced 2026-02-21 13:33:44 +01:00
A big change for template paths landed in Hugo 0.146.0. In `layouts`, we: - remove `_default` and move everything in it directly under `layouts` - rename `partials` and `shortcodes` to `_partials` and `_shortcodes` - adapt to Hugo and docsy changes about the render-heading hook. We don't need a copy of the heading self-link template now that it is defined as a partial. - update `docs/baseof.html` to match a change upstream - split `docs/changelog.html` because it doesn't work for the section page anymore. We create a `changelog-index` layout for this. Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
56 lines
1.6 KiB
HTML
56 lines
1.6 KiB
HTML
{{/*
|
|
|
|
Render an HTTP API, given:
|
|
|
|
* `api_data`: the OpenAPI data
|
|
* `base_url`: the base URL: that is, the part we glue onto the front
|
|
of each value in `paths` to get a complete URL.
|
|
* `anchor_base`: an optional prefix for the HTML IDs generated by
|
|
this template.
|
|
|
|
This template replaces the old {{*_http_api}} template.
|
|
|
|
*/}}
|
|
|
|
{{ $api_data := index .api_data }}
|
|
{{ $base_url := .base_url }}
|
|
{{ $anchor_base := .anchor_base }}
|
|
|
|
{{ range $path_name, $path_data := $api_data.paths }}
|
|
|
|
{{ $endpoint := delimit (slice $base_url $path_name ) "" }}
|
|
|
|
{{/* note that a `paths` entry can be a $ref */}}
|
|
|
|
{{ $params := dict "endpoint" $endpoint }}
|
|
|
|
{{ with $path_data.get }}
|
|
|
|
{{ $operation_params := merge $params (dict "method" "GET" "operation_data" . "anchor_base" $anchor_base) }}
|
|
{{ partial "openapi/render-operation" $operation_params }}
|
|
|
|
{{ end }}
|
|
|
|
{{ with $path_data.post }}
|
|
|
|
{{ $operation_params := merge $params (dict "method" "POST" "operation_data" . "anchor_base" $anchor_base) }}
|
|
{{ partial "openapi/render-operation" $operation_params }}
|
|
|
|
{{ end }}
|
|
|
|
{{ with $path_data.put }}
|
|
|
|
{{ $operation_params := merge $params (dict "method" "PUT" "operation_data" . "anchor_base" $anchor_base) }}
|
|
{{ partial "openapi/render-operation" $operation_params }}
|
|
|
|
{{ end }}
|
|
|
|
{{ with $path_data.delete }}
|
|
|
|
{{ $operation_params := merge $params (dict "method" "DELETE" "operation_data" . "anchor_base" $anchor_base) }}
|
|
{{ partial "openapi/render-operation" $operation_params }}
|
|
|
|
{{ end }}
|
|
|
|
{{ end }}
|