matrix-spec/layouts/_shortcodes/event.html
Kévin Commaille f7f641aae7
Move and update layouts
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>
2025-06-09 10:44:27 +02:00

34 lines
1.5 KiB
HTML

{{/*
This template is used to render an event.
It takes the following parameters:
* `event` (required): the name of a schema file under "data/event-schemas/schema".
The file extension is omitted. For example:
{{% event event="m.accepted_terms" %}}
* `desired_example_name` (optional): the name of the example file to use under
"data/event-schemas/examples", without the file extension. If omitted
defaults to the example file with the same name as the `event` parameter, and
(if the name does not contain a "$"), all examples that begin with the name
given by the `event` parameter followed by a "$". For example, if the
`event` parameter is "m.foo", then by default it will include the "m.foo"
example along with any examples starting with "m.foo$".
* `title` (optional): the title to use for the event. Defaults to the name
given in the `event` parameter.
This template replaces the old {{*_event}} template.
*/}}
{{ $event_data := index .Site.Data "event-schemas" "schema" .Params.event }}
{{ $path := delimit (slice "event-schemas/schema" .Params.event) "/" }}
{{ $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" .Params.event "event_data" $event_data "desired_example_name" .Params.desired_example_name "title" .Params.title)}}