Add templates used to render data
This commit is contained in:
parent
06983e1eb1
commit
5f45a897ef
17 changed files with 990 additions and 0 deletions
45
layouts/shortcodes/event-fields.html
Normal file
45
layouts/shortcodes/event-fields.html
Normal file
|
@ -0,0 +1,45 @@
|
|||
{{/*
|
||||
|
||||
This template is used to render the fields that all basic events and room events
|
||||
must or may contain.
|
||||
|
||||
It expects to be passed an `event_type` parameter, is the name of a file under
|
||||
/data/event-schemas/core-event-schema. The file extension is omitted. For example:
|
||||
|
||||
{{% event-fields event_type="room_event" %}}
|
||||
|
||||
This template replaces the old {{common_event_fields}} and {{common_room_event_fields}} templates.
|
||||
|
||||
*/}}
|
||||
|
||||
{{ $event := index .Site.Data "event-schemas" "schema" "core-event-schema" .Params.event_type }}
|
||||
{{ $path := "event-schemas/schema/core-event-schema" }}
|
||||
|
||||
{{ $event = partial "json-schema/resolve-refs" (dict "schema" $event "path" $path) }}
|
||||
{{ $event := partial "json-schema/resolve-allof" $event }}
|
||||
|
||||
<section class="rendered-data event">
|
||||
|
||||
<details {{ if not .Site.Params.ui.rendered_data_collapsed }}open{{ end }}>
|
||||
<summary>
|
||||
|
||||
<h1>
|
||||
<code>{{ humanize $event.title }}</code>
|
||||
</h1>
|
||||
|
||||
<hr/>
|
||||
|
||||
{{ $event.description | markdownify }}
|
||||
|
||||
</summary>
|
||||
|
||||
{{ $event = merge $event (dict "title" "") }}
|
||||
|
||||
{{ $additional_types := partial "json-schema/resolve-additional-types" $event }}
|
||||
{{ range $additional_types }}
|
||||
{{ partial "openapi/render-object-table" (dict "caption" .title "properties" .properties "required" .required) }}
|
||||
{{end}}
|
||||
|
||||
</details>
|
||||
|
||||
</section>
|
Loading…
Add table
Add a link
Reference in a new issue