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.
matrix-spec/layouts/shortcodes/event-group.html

34 lines
1014 B
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" }}
{{ $events := index .Site.Data "event-schemas" "schema" }}
{{ $group_name := .Params.group_name }}
{{ range $event_name, $event_data := $events }}
{{ $prefix := substr $event_name 0 (len $group_name) }}
{{ if eq $prefix $group_name }}
{{ $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 }}
{{ end }}