2022-01-05 04:29:10 +01:00
|
|
|
{{/*
|
|
|
|
|
|
|
|
|
|
This template is used to render a Client-Server API Module. Modules are defined
|
|
|
|
|
alongside the `_index.md` for the CS API.
|
|
|
|
|
|
2025-12-18 15:59:18 +01:00
|
|
|
The following parameters are expected:
|
|
|
|
|
|
|
|
|
|
* `filename` the name of the module file to render, without extension (i.e. `spaces`).
|
|
|
|
|
* `name` the display name of the module (i.e. `Spaces`).
|
2022-01-05 04:29:10 +01:00
|
|
|
|
|
|
|
|
*/}}
|
|
|
|
|
|
|
|
|
|
{{ $name := .Params.name }}
|
2025-12-18 15:59:18 +01:00
|
|
|
{{ $filename := .Params.filename }}
|
2022-01-05 04:29:10 +01:00
|
|
|
|
2022-11-08 18:27:44 +01:00
|
|
|
{{ with .Site.GetPage "client-server-api/modules" }}
|
2025-12-18 15:59:18 +01:00
|
|
|
{{ with .Resources.GetMatch (printf "%s%s" $filename ".md") }}
|
|
|
|
|
{{/* Preserve previous scratch values so nested modules don't leak */}}
|
|
|
|
|
{{ $prevPage := .Scratch.Get "endpoint_page" }}
|
|
|
|
|
{{ $prevModule := .Scratch.Get "endpoint_module" }}
|
|
|
|
|
|
|
|
|
|
{{/* Allow endpoints rendered in the module to accumulate on the parent page */}}
|
|
|
|
|
{{ .Scratch.Set "endpoint_page" $.Page }}
|
|
|
|
|
{{/* Name the module for grouping in the endpoints list */}}
|
|
|
|
|
{{ .Scratch.Set "endpoint_module" $name }}
|
|
|
|
|
|
2024-06-11 23:24:23 +02:00
|
|
|
{{ .RenderShortcodes }}
|
2025-12-18 15:59:18 +01:00
|
|
|
|
|
|
|
|
{{/* Restore previous scratch values */}}
|
|
|
|
|
{{ if $prevPage }}
|
|
|
|
|
{{ .Scratch.Set "endpoint_page" $prevPage }}
|
|
|
|
|
{{ else }}
|
|
|
|
|
{{ .Scratch.Delete "endpoint_page" }}
|
|
|
|
|
{{ end }}
|
|
|
|
|
{{ if $prevModule }}
|
|
|
|
|
{{ .Scratch.Set "endpoint_module" $prevModule }}
|
|
|
|
|
{{ else }}
|
|
|
|
|
{{ .Scratch.Delete "endpoint_module" }}
|
|
|
|
|
{{ end }}
|
2022-11-08 18:27:44 +01:00
|
|
|
{{ end }}
|
|
|
|
|
{{ end }}
|