Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/capnfabs/paperesque.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabian Tamp <fabian.tamp@gmail.com>2021-05-15 20:30:33 +0300
committerFabian Tamp <fabian.tamp@gmail.com>2021-05-15 20:30:33 +0300
commitcb6b0f8f2418cda257b1b5b6f224965349952f97 (patch)
tree7177fb7718c9de1a18ec03031d084e37e2786e56
parent5644f0d85b0cfe1aeea341e102d5238a004e535a (diff)
Add vidfigure and vidloop
-rw-r--r--layouts/shortcodes/vidfigure.html31
-rw-r--r--layouts/shortcodes/vidloop.html36
2 files changed, 67 insertions, 0 deletions
diff --git a/layouts/shortcodes/vidfigure.html b/layouts/shortcodes/vidfigure.html
new file mode 100644
index 0000000..4a18210
--- /dev/null
+++ b/layouts/shortcodes/vidfigure.html
@@ -0,0 +1,31 @@
+{{- /* Below is a copy paste of https://github.com/gohugoio/hugo/blob/master/tpl/tplimpl/embedded/templates/shortcodes/figure.html from Hugo commit aba2647c152ffff927f42523b77ee6651630cd67, with the img tag replaced with a video */ -}}
+{{- /* Note that it presently uses `markdownify` instead of $.Page.RenderString for consistency with Hugo's `figure` shortcode. */ -}}
+<figure{{ with .Get "class" }} class="{{ . }}"{{ end }}>
+ {{- if .Get "link" -}}
+ <a href="{{ .Get "link" }}"{{ with .Get "target" }} target="{{ . }}"{{ end }}{{ with .Get "rel" }} rel="{{ . }}"{{ end }}>
+ {{- end }}
+ <video controls playsinline src='{{ .Get "src" }}'
+ {{- if or (.Get "alt") (.Get "caption") -}}
+ alt="{{ with .Get "alt" }}{{ . }}{{ else }}{{ .Get "caption" | markdownify| plainify }}{{ end }}"
+ {{- end -}}
+ {{- with .Get "width" }} width="{{ . }}"{{ end -}}
+ {{- with .Get "height" }} height="{{ . }}"{{ end -}}
+
+ ></video>
+ {{- if .Get "link" }}</a>{{ end -}}
+ {{- if or (or (.Get "title") (.Get "caption")) (.Get "attr") }}
+ <figcaption>
+ {{ with (.Get "title") -}}
+ <h4>{{ . }}</h4>
+ {{- end -}}
+ {{- if or (.Get "caption") (.Get "attr") -}}<p>
+ {{- .Get "caption" | markdownify -}}
+ {{- with .Get "attrlink" }}
+ <a href="{{ . }}">
+ {{- end -}}
+ {{- .Get "attr" | markdownify -}}
+ {{- if .Get "attrlink" }}</a>{{ end }}</p>
+ {{- end }}
+ </figcaption>
+ {{- end }}
+</figure>
diff --git a/layouts/shortcodes/vidloop.html b/layouts/shortcodes/vidloop.html
new file mode 100644
index 0000000..e9166fa
--- /dev/null
+++ b/layouts/shortcodes/vidloop.html
@@ -0,0 +1,36 @@
+{{- /* Below is a copy paste of https://github.com/gohugoio/hugo/blob/master/tpl/tplimpl/embedded/templates/shortcodes/figure.html from Hugo commit aba2647c152ffff927f42523b77ee6651630cd67, with the img tag replaced with a video */ -}}
+{{- /* Note that it presently uses `markdownify` instead of $.Page.RenderString for consistency with Hugo's `figure` shortcode. */ -}}
+<figure{{ with .Get "class" }} class="{{ . }}"{{ end }}>
+ {{- if .Get "link" -}}
+ <a href="{{ .Get "link" }}"{{ with .Get "target" }} target="{{ . }}"{{ end }}{{ with .Get "rel" }} rel="{{ . }}"{{ end }}>
+ {{- end }}
+ <video muted autoplay loop playsinline src='{{ .Get "src" }}'
+ {{- if or (.Get "alt") (.Get "caption") -}}
+ alt="{{ with .Get "alt" }}{{ . }}{{ else }}{{ .Get "caption" | markdownify| plainify }}{{ end }}"
+ {{- end -}}
+ {{- with .Get "width" }} width="{{ . }}"{{ end -}}
+ {{- with .Get "height" }} height="{{ . }}"{{ end -}}
+
+ ></video>
+ {{- if .Get "link" }}</a>{{ end -}}
+ {{- if or (or (.Get "title") (.Get "caption")) (.Get "attr") }}
+ <figcaption>
+ {{ with (.Get "title") -}}
+ <h4>{{ . }}</h4>
+ {{- end -}}
+ {{- if or (.Get "caption") (.Get "attr") -}}<p>
+ {{- .Get "caption" | markdownify -}}
+ {{- if .Get "attr" }}
+ (
+ {{- with .Get "attrlink" -}}
+ <a href="{{ . }}">
+ {{- end -}}
+ {{- .Get "attr" | markdownify -}}
+ {{- if .Get "attrlink" }}</a>{{ end -}}
+ )
+ {{- end -}}
+ </p>
+ {{- end }}
+ </figcaption>
+ {{- end }}
+</figure>