You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1.2 KiB
HTML
38 lines
1.2 KiB
HTML
{{/*
|
|
|
|
This template is used to render a group of events starting with a given prefix.
|
|
|
|
It expects to be passed a `group_name` parameter. For example:
|
|
|
|
{{% event-group group_name="m.call" %}}
|
|
|
|
The template will then render all events whose schema starts with the given name.
|
|
|
|
This template replaces the old {{*_events}} template.
|
|
|
|
*/}}
|
|
|
|
{{ $base_path := "event-schemas/schema" }}
|
|
|
|
{{ $group_name := .Params.group_name }}
|
|
|
|
{{/* Filter events and prepare them for sorting */}}
|
|
{{ $events := slice }}
|
|
{{ range $event_name, $event_data := index .Site.Data "event-schemas" "schema" }}
|
|
{{ $prefix := substr $event_name 0 (len $group_name) }}
|
|
{{ if eq $prefix $group_name }}
|
|
{{ $events = $events | append (dict "event_name" $event_name "event_data" $event_data) }}
|
|
{{ end }}
|
|
{{ end }}
|
|
|
|
{{/* Render the events sorted by x-weight */}}
|
|
{{ range sort $events "event_data.x-weight" }}
|
|
|
|
{{ $path := delimit (slice $base_path .event_name) "/" }}
|
|
{{ $event_data := partial "json-schema/resolve-refs" (dict "schema" .event_data "path" $path) }}
|
|
{{ $event_data := partial "json-schema/resolve-allof" $event_data }}
|
|
|
|
{{ partial "events/render-event" (dict "event_name" .event_name "event_data" $event_data)}}
|
|
|
|
{{ end }}
|