supporting video media

This commit is contained in:
2017-09-12 14:56:13 -05:00
parent ff1033dfb4
commit acbfdbe8eb
8 changed files with 370 additions and 218 deletions
+12 -3
View File
@@ -1,8 +1,17 @@
{{ $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 -}}
><a href="/media/{{ .Get "filename"}}" target="_blank"><img src="/media/
{{- with .Get "width"}}{{.}}{{else}}100{{end}}x{{with .Get "height"}}{{.}}{{else}}{{end}}/{{ .Get "filename" -}}"
{{ 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>