Omphaloskepsis-2/layouts/shortcodes/chart.html

28 lines
1.1 KiB
HTML
Raw Normal View History

2023-10-03 12:08:35 +00:00
{{- if ( not ( .Get "longdesc" ) ) -}}
{{- erroridf "a11y-chart-longdesc" "No longdesc found for chart '%q' (%q)" ( .Get "chart-id" ) .Page.File.Path -}}
{{- end -}}
2024-04-02 19:36:21 +00:00
<figure class="article__figure figure figure--chart{{ with .Get "class" }} {{ . }}{{ end }}" role="group">
2023-08-22 10:14:33 +00:00
{{- with .Get "chart-id" -}}
2024-07-23 08:08:36 +00:00
<div class="chart-container">
<canvas class="chart" id="{{ . }}">
You must enable Javascript to view this chart.
</canvas>
</div>
2023-08-22 10:14:33 +00:00
{{- end -}}
{{- with .Get "chart-id-2" -}}
2024-07-23 08:08:36 +00:00
<div class="chart-container">
<canvas class="chart" id="{{ . }}">
You must enable Javascript to view this chart.
</canvas>
</div>
2023-08-22 10:14:33 +00:00
{{- end -}}
{{- if or ( .Get "caption" ) ( .Get "title" ) -}}
2024-04-02 19:36:21 +00:00
<figcaption class="figure__caption{{ if not ( or ( .Get "caption" ) ( .Get "title" ) ) }} figure__caption--no-height{{ end }}">
{{- with .Get "title" -}}<h4 class="figcaption__title">{{ . | markdownify | safeHTML }}</h4>{{- end -}}
{{- with .Get "caption" -}}<p class="figcaption__caption">{{ . | markdownify | safeHTML }}</p>{{- end -}}
</figcaption>
2023-08-22 10:14:33 +00:00
{{- end -}}
</figure>