mirror of
https://github.com/yuzu-emu/shared-bulma-theme.git
synced 2024-12-23 00:35:34 +00:00
Merge the gifv shortcode into imgs, auto-detecting the file type
This commit is contained in:
parent
f43500bf0f
commit
02ded1c5a9
|
@ -1,19 +0,0 @@
|
||||||
<!-- Usage: gifv "url|title" "url2|title" -->
|
|
||||||
<div class="columns">
|
|
||||||
{{ range $param := .Params }}
|
|
||||||
<!-- gifv -->
|
|
||||||
{{ $items := split $param "|" }}
|
|
||||||
{{ $src := (index $items 0) }}
|
|
||||||
{{ $title := (index $items 1) }}
|
|
||||||
<div class="column">
|
|
||||||
<video preload="auto" autoplay="autoplay" muted="muted" loop="loop" webkit-playsinline="">
|
|
||||||
<source src="{{ $src }}" type="video/mp4">
|
|
||||||
Your browser doesn't support mp4 video. :(
|
|
||||||
</video>
|
|
||||||
|
|
||||||
{{ if $title }}
|
|
||||||
<p class="has-text-centered is-italic has-text-grey-light">{{ $title }}</p>
|
|
||||||
{{ end }}
|
|
||||||
</div>
|
|
||||||
{{ end }}
|
|
||||||
</div>
|
|
|
@ -4,13 +4,22 @@
|
||||||
{{ $items := split $param "|" }}
|
{{ $items := split $param "|" }}
|
||||||
{{ $src := (index $items 0) }}
|
{{ $src := (index $items 0) }}
|
||||||
{{ $title := (index $items 1) }}
|
{{ $title := (index $items 1) }}
|
||||||
|
{{ $split_src := split $src "." }}
|
||||||
|
{{ $extension := index $split_src (sub (len $split_src) 1) }}
|
||||||
<div class="column">
|
<div class="column">
|
||||||
<a href="{{ $src }}" title="{{ $title }}">
|
{{ if eq $extension "mp4" }}
|
||||||
<img src="{{ $src }}" alt="{{ $title }}">
|
<video preload="auto" autoplay="autoplay" muted="muted" loop="loop" webkit-playsinline="">
|
||||||
</a>
|
<source src="{{ $src }}" type="video/mp4">
|
||||||
|
Your browser doesn't support mp4 video. :(
|
||||||
|
</video>
|
||||||
|
{{ else }}
|
||||||
|
<a href="{{ $src }}" title="{{ $title }}">
|
||||||
|
<img src="{{ $src }}" alt="{{ $title }}">
|
||||||
|
</a>
|
||||||
|
{{ end }}
|
||||||
{{ if $title }}
|
{{ if $title }}
|
||||||
<p class="has-text-centered is-italic has-text-grey-light">{{ $title }}</p>
|
<p class="has-text-centered is-italic has-text-grey-light">{{ $title }}</p>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</div>
|
</div>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue