You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

17 lines
685 B

{{ $filename := .Get "filename" -}}
{{ $ext := substr $filename (sub (len $filename) 4) }}
<p
{{ if eq (.Get "align") "left" }}class="leftimg"{{else if (.Get "align") "right"}}class="rightimg"{{end }}>
{{ if eq $ext ".mp4" }}
<video src="/media/
{{- with .Get "width"}}{{.}}{{else}}100{{end}}x{{with .Get "height"}}{{.}}{{else}}{{end}}/{{ $filename -}}"
controls allowfullscreen
></video>
{{ else }}
<a href="/media/{{ $filename }}" target="_blank"><img src="/media/
{{- with .Get "width"}}{{.}}{{else}}100{{end}}x{{with .Get "height"}}{{.}}{{else}}{{end}}/{{ $filename -}}"
{{ with .Get "caption" }}title="{{.}}"{{end}}
{{ with .Get "caption" }}alt="{{.}}"{{end}}
/></a>
{{end}}
</p>