1
0
Fork 0
mirror of https://git.sr.ht/~ashkeel/strimertul-website synced 2024-11-21 21:22:21 +00:00

dictionary support

This commit is contained in:
Ash Keel 2023-02-18 01:27:11 +01:00
parent 59a0b97cbe
commit 73ea620b98
No known key found for this signature in database
GPG key ID: BAD8D93E7314ED3E
2 changed files with 30 additions and 5 deletions

View file

@ -4,12 +4,23 @@
{{ with $.name }}
<div class="nameblock"><span class="name">{{ . }}</span>:</div>
{{ end }}
arrayOf [
{{ if (eq $.kind "array") }}
<span class="kind {{ $.kind }}">arrayOf</span> [
{{ template "schema" . }}
]
{{ end }}
{{ if (eq $.kind "dictionary") }}
<span class="kind {{ $.kind }}">dictionary</span>
<div class="dict">
<
<span class="key">
<span class="kind {{ $.key.kind }}">{{ $.key.name }}</span></span
>, <span class="element">{{ template "schema" . }}</span>>
</div>
{{ end }}
{{ else }}
{{ if (eq .name .kind) }}
<span class="kind">{{ .kind }}</span>
<span class="kind {{ $.kind }}">{{ .kind }}</span>
{{ else }}
{{ with .name }}
<div class="nameblock">
@ -20,7 +31,7 @@
{{ end }}:
</div>
{{ end }}
<span class="kind">{{ .kind }}</span>
<span class="kind {{ $.kind }}">{{ .kind }}</span>
{{ end }}
{{ with .keys }}
{

View file

@ -78,6 +78,11 @@
.nameblock {
display: none;
}
.kind.array,
.kind.object,
.kind.dictionary {
color: $grass12;
}
li {
list-style-type: none;
& > code > .nameblock {
@ -90,6 +95,15 @@
}
}
}
.dict {
display: inline;
.key {
display: inline;
}
.element {
display: inline;
}
}
ul {
padding: 0;
margin: 0;