mirror of
https://github.com/matrix-org/matrix-spec
synced 2026-04-21 10:24:08 +02:00
Compare commits
No commits in common. "715e66fa00a6fa4e90ef1d55185fe9648527bdda" and "42a1bc370f4c2892dca5fc164657237866e2cc4e" have entirely different histories.
715e66fa00
...
42a1bc370f
|
|
@ -278,17 +278,11 @@ Custom SCSS for the Matrix spec
|
||||||
.endpoint-list a {
|
.endpoint-list a {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
color: inherit;
|
color: inherit;
|
||||||
padding: 0.05rem 0.25rem;
|
|
||||||
border-radius: 0.2rem;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
background-color: $secondary-background;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.endpoint-list .http-api-method {
|
.endpoint-list .http-api-method {
|
||||||
margin-right: 0.35rem;
|
|
||||||
font-weight: $font-weight-bold;
|
font-weight: $font-weight-bold;
|
||||||
|
margin-right: 0.35rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.endpoint-path {
|
.endpoint-path {
|
||||||
|
|
@ -301,18 +295,6 @@ Custom SCSS for the Matrix spec
|
||||||
font-weight: $font-weight-bold;
|
font-weight: $font-weight-bold;
|
||||||
margin-left: 0.35rem;
|
margin-left: 0.35rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.endpoint-module {
|
|
||||||
&:not(:first-child) {
|
|
||||||
margin-top: 0.75rem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.endpoint-module-title {
|
|
||||||
// font-weight: $font-weight-bold;
|
|
||||||
font-size: 1.20rem;
|
|
||||||
margin-bottom: 0.35rem;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.page-description {
|
.page-description {
|
||||||
|
|
|
||||||
|
|
@ -1,39 +0,0 @@
|
||||||
account_data: "Client Config"
|
|
||||||
admin: "Server Administration"
|
|
||||||
content_repo: "Content repository"
|
|
||||||
device_management: "Device Management"
|
|
||||||
dm: "Direct Messaging"
|
|
||||||
end_to_end_encryption: "End-to-End Encryption"
|
|
||||||
event_annotations: "Event annotations and reactions"
|
|
||||||
event_context: "Event Context"
|
|
||||||
event_replacements: "Event replacements"
|
|
||||||
guest_access: "Guest Access"
|
|
||||||
history_visibility: "Room History Visibility"
|
|
||||||
ignore_users: "Ignoring Users"
|
|
||||||
instant_messaging: "Instant Messaging"
|
|
||||||
mentions: "User and room mentions"
|
|
||||||
moderation_policies: "Moderation policy lists"
|
|
||||||
openid: "OpenID"
|
|
||||||
presence: "Presence"
|
|
||||||
push: "Push Notifications"
|
|
||||||
read_markers: "Read and unread markers"
|
|
||||||
receipts: "Receipts"
|
|
||||||
reference_relations: "Reference relations"
|
|
||||||
report_content: "Reporting Content"
|
|
||||||
rich_replies: "Rich replies"
|
|
||||||
room_previews: "Room Previews"
|
|
||||||
room_upgrades: "Room Upgrades"
|
|
||||||
search: "Server Side Search"
|
|
||||||
secrets: "Secrets"
|
|
||||||
send_to_device: "Send-to-Device messaging"
|
|
||||||
server_acls: "Server Access Control Lists (ACLs) for rooms"
|
|
||||||
server_notices: "Server Notices"
|
|
||||||
spaces: "Spaces"
|
|
||||||
sso_login: "SSO client login/authentication"
|
|
||||||
stickers: "Sticker Messages"
|
|
||||||
tags: "Room Tagging"
|
|
||||||
third_party_invites: "Third-party invites"
|
|
||||||
third_party_networks: "Third-party Networks"
|
|
||||||
threading: "Threading"
|
|
||||||
typing_notifications: "Typing Notifications"
|
|
||||||
voip_events: "Voice over IP"
|
|
||||||
|
|
@ -13,30 +13,17 @@
|
||||||
<div class="endpoints-toc mb-4">
|
<div class="endpoints-toc mb-4">
|
||||||
<details>
|
<details>
|
||||||
<summary>List of Endpoints</summary>
|
<summary>List of Endpoints</summary>
|
||||||
{{/* Sort by module to group visually */}}
|
<ul class="endpoint-list">
|
||||||
{{ $sorted := sort $endpoints "module" }}
|
{{ range $endpoints }}
|
||||||
{{ $current := "" }}
|
<li>
|
||||||
{{ range $sorted }}
|
<a href="#{{ .anchor }}">
|
||||||
{{ $mod := .module }}
|
<span class="http-api-method">{{ .method }}</span>
|
||||||
{{/* Set a title for the base endpoints */}}
|
<span class="endpoint-path">{{ .endpoint }}</span>
|
||||||
{{ if not $mod }}{{ $mod = "Required" }}{{ end }}
|
{{ if .deprecated }}<span class="endpoint-deprecated">(deprecated)</span>{{ end }}
|
||||||
{{ if ne $mod $current }}
|
</a>
|
||||||
{{ if $current }}</ul></div>{{ end }}
|
</li>
|
||||||
<div class="endpoint-module">
|
|
||||||
<div class="endpoint-module-title">{{ $mod }}</div>
|
|
||||||
<ul class="endpoint-list">
|
|
||||||
{{ $current = $mod }}
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ $key := printf "%s|%s" .method .anchor }}
|
</ul>
|
||||||
<li>
|
|
||||||
<a href="#{{ .anchor }}">
|
|
||||||
<span class="http-api-method">{{ .method }}</span>
|
|
||||||
<span class="endpoint-path">{{ .endpoint }}</span>
|
|
||||||
{{ if .deprecated }}<span class="endpoint-deprecated">(deprecated)</span>{{ end }}
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
{{ end }}
|
|
||||||
{{ if $current }}</ul></div>{{ end }}
|
|
||||||
</details>
|
</details>
|
||||||
</div>
|
</div>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,6 @@
|
||||||
{{ $base_url := .base_url }}
|
{{ $base_url := .base_url }}
|
||||||
{{ $anchor_base := .anchor_base }}
|
{{ $anchor_base := .anchor_base }}
|
||||||
{{ $page := .page }}
|
{{ $page := .page }}
|
||||||
{{ $module := .module }}
|
|
||||||
|
|
||||||
{{ range $path_name, $path_data := $api_data.paths }}
|
{{ range $path_name, $path_data := $api_data.paths }}
|
||||||
|
|
||||||
|
|
@ -28,28 +27,28 @@
|
||||||
|
|
||||||
{{ with $path_data.get }}
|
{{ with $path_data.get }}
|
||||||
|
|
||||||
{{ $operation_params := merge $params (dict "method" "GET" "operation_data" . "anchor_base" $anchor_base "page" $page "module" $module) }}
|
{{ $operation_params := merge $params (dict "method" "GET" "operation_data" . "anchor_base" $anchor_base "page" $page) }}
|
||||||
{{ partial "openapi/render-operation" $operation_params }}
|
{{ partial "openapi/render-operation" $operation_params }}
|
||||||
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ with $path_data.post }}
|
{{ with $path_data.post }}
|
||||||
|
|
||||||
{{ $operation_params := merge $params (dict "method" "POST" "operation_data" . "anchor_base" $anchor_base "page" $page "module" $module) }}
|
{{ $operation_params := merge $params (dict "method" "POST" "operation_data" . "anchor_base" $anchor_base "page" $page) }}
|
||||||
{{ partial "openapi/render-operation" $operation_params }}
|
{{ partial "openapi/render-operation" $operation_params }}
|
||||||
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ with $path_data.put }}
|
{{ with $path_data.put }}
|
||||||
|
|
||||||
{{ $operation_params := merge $params (dict "method" "PUT" "operation_data" . "anchor_base" $anchor_base "page" $page "module" $module) }}
|
{{ $operation_params := merge $params (dict "method" "PUT" "operation_data" . "anchor_base" $anchor_base "page" $page) }}
|
||||||
{{ partial "openapi/render-operation" $operation_params }}
|
{{ partial "openapi/render-operation" $operation_params }}
|
||||||
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ with $path_data.delete }}
|
{{ with $path_data.delete }}
|
||||||
|
|
||||||
{{ $operation_params := merge $params (dict "method" "DELETE" "operation_data" . "anchor_base" $anchor_base "page" $page "module" $module) }}
|
{{ $operation_params := merge $params (dict "method" "DELETE" "operation_data" . "anchor_base" $anchor_base "page" $page) }}
|
||||||
{{ partial "openapi/render-operation" $operation_params }}
|
{{ partial "openapi/render-operation" $operation_params }}
|
||||||
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,6 @@
|
||||||
{{ $endpoint := .endpoint }}
|
{{ $endpoint := .endpoint }}
|
||||||
{{ $operation_data := .operation_data }}
|
{{ $operation_data := .operation_data }}
|
||||||
{{ $page := .page }}
|
{{ $page := .page }}
|
||||||
{{ $module := .module }}
|
|
||||||
|
|
||||||
{{ $anchor := "" }}
|
{{ $anchor := "" }}
|
||||||
{{ if .anchor_base }}
|
{{ if .anchor_base }}
|
||||||
|
|
@ -34,22 +33,11 @@
|
||||||
{{/* Collect endpoints for the on-page endpoints TOC */}}
|
{{/* Collect endpoints for the on-page endpoints TOC */}}
|
||||||
{{ if $page }}
|
{{ if $page }}
|
||||||
{{/* Store each endpoint's metadata in a scratch variable */}}
|
{{/* Store each endpoint's metadata in a scratch variable */}}
|
||||||
{{ $entry := dict "anchor" $anchor "method" $method "endpoint" $endpoint "summary" $operation_data.summary "deprecated" $operation_data.deprecated "module" $module }}
|
{{ $entry := dict "anchor" $anchor "method" $method "endpoint" $endpoint "summary" $operation_data.summary "deprecated" $operation_data.deprecated }}
|
||||||
{{ if not ($page.Scratch.Get "api_endpoints_seen") }}
|
|
||||||
{{ $page.Scratch.Set "api_endpoints_seen" dict }}
|
|
||||||
{{ end }}
|
|
||||||
{{/* Keep a map of seen endpoints. This is necessary as this partial may be
|
|
||||||
rendered multiple times for the same endpoint (e.g. in the TOC and
|
|
||||||
in the main content), leading to duplicates. */}}
|
|
||||||
{{ $seen := $page.Scratch.Get "api_endpoints_seen" }}
|
|
||||||
{{ $key := printf "%s|%s" $method $endpoint }}
|
|
||||||
{{ if not (index $seen $key) }}
|
|
||||||
{{ if not (reflect.IsSlice ($page.Scratch.Get "api_endpoints")) }}
|
{{ if not (reflect.IsSlice ($page.Scratch.Get "api_endpoints")) }}
|
||||||
{{ $page.Scratch.Set "api_endpoints" (slice) }}
|
{{ $page.Scratch.Set "api_endpoints" (slice) }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ $page.Scratch.Add "api_endpoints" (slice $entry) }}
|
{{ $page.Scratch.Add "api_endpoints" (slice $entry) }}
|
||||||
{{ $page.Scratch.SetInMap "api_endpoints_seen" $key true }}
|
|
||||||
{{ end }}
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
<section class="rendered-data">
|
<section class="rendered-data">
|
||||||
|
|
|
||||||
|
|
@ -11,34 +11,6 @@
|
||||||
|
|
||||||
{{ with .Site.GetPage "client-server-api/modules" }}
|
{{ with .Site.GetPage "client-server-api/modules" }}
|
||||||
{{ with .Resources.GetMatch (printf "%s%s" $name ".md") }}
|
{{ with .Resources.GetMatch (printf "%s%s" $name ".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 */}}
|
|
||||||
{{ $display := $.Get "title" }}
|
|
||||||
{{ if not $display }}
|
|
||||||
{{ $display = index $.Site.Data.cs_modules $name }}
|
|
||||||
{{ end }}
|
|
||||||
{{ if not $display }}
|
|
||||||
{{ $display = $name }}
|
|
||||||
{{ end }}
|
|
||||||
{{ .Scratch.Set "endpoint_module" $display }}
|
|
||||||
|
|
||||||
{{ .RenderShortcodes }}
|
{{ .RenderShortcodes }}
|
||||||
|
|
||||||
{{/* 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 }}
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
|
||||||
|
|
@ -23,13 +23,6 @@
|
||||||
{{ $api := .Params.api}}
|
{{ $api := .Params.api}}
|
||||||
{{ $anchor_base := .Params.anchor_base}}
|
{{ $anchor_base := .Params.anchor_base}}
|
||||||
|
|
||||||
{{/* Allow an outer page to collect endpoints (used for modules). */}}
|
|
||||||
{{ $target_page := .Page }}
|
|
||||||
{{ with .Page.Scratch.Get "endpoint_page" }}
|
|
||||||
{{ $target_page = . }}
|
|
||||||
{{ end }}
|
|
||||||
{{ $module_name := .Page.Scratch.Get "endpoint_module" }}
|
|
||||||
|
|
||||||
{{ $api_data := index .Site.Data.api .Params.spec .Params.api }}
|
{{ $api_data := index .Site.Data.api .Params.spec .Params.api }}
|
||||||
{{ $base_url := (index $api_data.servers 0).variables.basePath.default }}
|
{{ $base_url := (index $api_data.servers 0).variables.basePath.default }}
|
||||||
{{ $path := delimit (slice "api" $spec $api) "/" }}
|
{{ $path := delimit (slice "api" $spec $api) "/" }}
|
||||||
|
|
@ -37,4 +30,4 @@
|
||||||
{{ $api_data = partial "json-schema/resolve-refs" (dict "schema" $api_data "path" $path) }}
|
{{ $api_data = partial "json-schema/resolve-refs" (dict "schema" $api_data "path" $path) }}
|
||||||
{{ $api_data = partial "json-schema/resolve-allof" $api_data }}
|
{{ $api_data = partial "json-schema/resolve-allof" $api_data }}
|
||||||
|
|
||||||
{{ partial "openapi/render-api" (dict "api_data" $api_data "base_url" $base_url "anchor_base" $anchor_base "page" $target_page "module" $module_name) }}
|
{{ partial "openapi/render-api" (dict "api_data" $api_data "base_url" $base_url "anchor_base" $anchor_base "page" .Page) }}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue