uci-hugo-doc/layouts/shortcodes/propertylist.html

50 lines
1.7 KiB
HTML
Raw Permalink Normal View History

2022-06-11 08:46:13 -07:00
{{- $name := .Get "name" -}}
{{- if .Site.Data.properties }}
<dl class="gdoc-props">
{{- with (index .Site.Data.properties (split $name ".")) }}
{{- range $key, $value := .properties }}
<dt class="flex flex-wrap align-center gdoc-props__meta">
<span class="gdoc-props__title">{{ $key }}</span>
{{- if $value.required }}
<span class="gdoc-props__tag warning">{{ i18n "propertylist_required" | lower }}</span>
{{ else }}
<span class="gdoc-props__tag tip">{{ i18n "propertylist_optional" | lower }}</span>
{{- end }}
{{- with $value.type }}
<span class="gdoc-props__tag note">{{ . }}</span>
{{- end }}
{{- with $value.tags }}
{{- $tags := . }}
{{- if reflect.IsMap $tags }}
{{- $tags = (index $tags $.Site.Language.Lang) }}
{{- end }}
{{- range $tags }}
<span class="gdoc-props__tag">{{ . }}</span>
{{- end }}
{{- end }}
</dt>
<dd>
<div class="gdoc-props__description">
{{- with $value.description }}
{{- $desc := . }}
{{- if reflect.IsMap $desc }}
{{- $desc = (index $desc $.Site.Language.Lang) }}
{{- end }}
{{ $desc | $.Page.RenderString }}
{{ end }}
</div>
<div class="gdoc-props__default">
{{- with default "none" ($value.defaultValue | string) }}
<span>{{ i18n "propertylist_default" | title }}:</span>
<span>{{ . }}</span>
{{- end }}
</div>
</dd>
{{- end }}
{{- end }}
</dl>
{{- end }}