{{- if ( and ( .Get "src" ) ( .Get "chart-id" ) ) -}} {{- errorf "Both chart ID and resource source defined" -}} {{- end -}} {{ $src := $.Page.Resources.GetMatch (.Get "src") }} {{ if ( and ( not $src ) ( not ( .Get "chart-id" ) ) ) }} {{- errorf "No Page Resource found for src '%q' (%q)" ( .Get "src" ) .Page.File.Path -}} {{ end }} {{ $linkedResource := $.Page.Resources.GetMatch (.Get "link") }}
{{- with .Get "chart-id" -}} You must enable Javascript to view this chart. {{- else -}} {{- if .Get "link" -}} {{- if $linkedResource }} {{ else }} {{ end }} {{- end -}} {{- if eq $src.ResourceType "image" -}} {{ . }} {{- else if eq $src.ResourceType "video" -}} {{- if eq $src.MediaType "video/ogg" -}}

Your browser doesn't support embedded audio, view the audio here.

{{- else -}} {{- end -}} {{- else if ( or ( ne $src.ResourceType "image" ) ( ne $src.ResourceType "video" ) ) -}} {{- errorf "No handling for resource of type %q" $src.ResourceType -}} {{- end -}} {{- if .Get "link" }}{{ end -}} {{- end -}} {{- if or ( .Get "caption" ) ( .Get "title" ) ( $src.Params.attr ) -}}
{{- with $src -}} {{ if .Params.attrlink -}} {{- end -}} {{- if .Params.attr -}}

{{ .Params.attr | safeHTML }}{{ with .Params.attrlicence }} {{ . | safeHTML }}{{ end }}

{{- end -}} {{- if .Params.attrlink -}}
{{- end -}} {{- end -}} {{- with .Get "title" -}}

{{ . | markdownify | safeHTML }}

{{- end -}} {{- with .Get "caption" -}}

{{ . | markdownify | safeHTML }}

{{- end -}}
{{- end -}}