diff options
author | tdro <tdro@noreply.example.com> | 2022-05-12 02:02:01 -0400 |
---|---|---|
committer | tdro <tdro@noreply.example.com> | 2022-05-12 02:02:01 -0400 |
commit | 20d86839bc6fb9876a20280c8840d5524d949113 (patch) | |
tree | 74794d5cb4b3185ba005df1ffc3a5064d2f17bbe /themes | |
parent | 5497ae76b715f3c1dd3353d2df609ccdfcff18a1 (diff) | |
download | canory-20d86839bc6fb9876a20280c8840d5524d949113.tar.gz canory-20d86839bc6fb9876a20280c8840d5524d949113.tar.bz2 canory-20d86839bc6fb9876a20280c8840d5524d949113.zip |
themes/default/layouts/shortcodes/video: Splice source
themes/default/layouts/shortcodes/audio.html: Sync no support text
Diffstat (limited to 'themes')
-rw-r--r-- | themes/default/layouts/shortcodes/audio.html | 2 | ||||
-rw-r--r-- | themes/default/layouts/shortcodes/video.html | 28 |
2 files changed, 19 insertions, 11 deletions
diff --git a/themes/default/layouts/shortcodes/audio.html b/themes/default/layouts/shortcodes/audio.html index 4df2f51..5727a49 100644 --- a/themes/default/layouts/shortcodes/audio.html +++ b/themes/default/layouts/shortcodes/audio.html @@ -10,7 +10,7 @@ <figcaption>{{ $caption }}</figcaption> <audio controls {{ $controls | safeHTMLAttr }} src="{{ $src }}"> <p> - Your browser doesn't support HTML5 <code>audio</code>. Here is a + Your browser does not support HTML5 <code>audio</code>. Here is a <a href="{{ $src }}">link to the audio file</a> instead. </p> </audio> diff --git a/themes/default/layouts/shortcodes/video.html b/themes/default/layouts/shortcodes/video.html index 7c0c95f..306c326 100644 --- a/themes/default/layouts/shortcodes/video.html +++ b/themes/default/layouts/shortcodes/video.html @@ -1,6 +1,6 @@ {{- $source := default - "https://raw.githubusercontent.com/benhosmer/HTML5-Test-Videos/9a6c2db46472454c634963cbeb0900fd37901fac/big_buck_bunny" + "https://raw.githubusercontent.com/benhosmer/HTML5-Test-Videos/9a6c2db46472454c634963cbeb0900fd37901fac/big_buck_bunny.mp4" (.Get "source" | default (.Get 0)) -}} {{- $poster := default "" (.Get "poster" | default (.Get 1)) -}} @@ -13,6 +13,12 @@ {{- $start := default "" (.Get "start" | default (.Get 8)) -}} {{- $end := default "" (.Get "end" | default (.Get 9)) -}} +{{- $path := path.Dir $source -}} +{{- $base := split (path.Base $source) "." -}} +{{- $name := index (first (sub (len $base) 1) $base) 0 -}} +{{- $mime := path.Ext $source -}} +{{- $source = print $path "/" $name -}} + <video-container> <video title="{{ $title }}" @@ -20,17 +26,19 @@ poster="{{ $poster }}" width="{{ $width }}" height="{{ $height }}" - controls {{ $controls | safeHTMLAttr }}> - <source src="{{ $source }}.mp4#t={{ $start }},{{ $end }}" type="video/mp4"> + controls="{{ $controls | safeHTMLAttr }}"> + <source src="{{ $source}}{{ $mime }}#t={{ $start }},{{ $end }}" type="video/{{ $mime }}"> + <source src="{{ $source }}.mp4#t={{ $start}},{{ $end }}" type="video/mp4"> <source src="{{ $source }}.webm#t={{ $start }},{{ $end }}" type="video/webm"> - <source src="{{ $source }}.flv#t={{ $start }},{{ $end }}" type="video/flv"> - <source src="{{ $source }}.ogv#t={{ $start }},{{ $end }}" type="video/ogv"> + <source src="{{ $source }}.flv#t={{ $start }},{{ $end }}" type="video/flv"> + <source src="{{ $source }}.ogv#t={{ $start }},{{ $end }}" type="video/ogv"> <p> - Sorry, your browser doesn't support embedded videos. Here is a - <a href="{{ $source }}.mp4#t={{ $start }},{{ $end }}"> - link to the video - </a> instead. + Sorry, your browser does not support embedded videos. Here is a + <a href="{{ $source }}{{ $mime }}#t={{ $start }},{{ $end }}">link to the video</a> instead. </p> </video> - <figcaption>{{ $caption | markdownify }}</figcaption> + <figcaption> + {{ $caption | markdownify }}: + {{ print "[Link](" $source $mime ")" | markdownify }} + </figcaption> </video-container> |