From 550bfb6367983bf81dbbcca04047ee8540ab7c72 Mon Sep 17 00:00:00 2001 From: BBaoVanC Date: Sat, 30 Oct 2021 00:23:49 -0500 Subject: [PATCH] Add a few new shortcodes --- layouts/partials/remote_figure.html | 27 +++++++++++++++++++++++++++ layouts/shortcodes/image.html | 13 +++++++++++++ layouts/shortcodes/video.html | 13 +++++++++++++ 3 files changed, 53 insertions(+) create mode 100644 layouts/partials/remote_figure.html create mode 100644 layouts/shortcodes/image.html create mode 100644 layouts/shortcodes/video.html diff --git a/layouts/partials/remote_figure.html b/layouts/partials/remote_figure.html new file mode 100644 index 0000000..1a61823 --- /dev/null +++ b/layouts/partials/remote_figure.html @@ -0,0 +1,27 @@ +{{ $hidecaption := index . "hidecaption" }} +{{ $type := index . "type" }} +{{ $src := index . "src" }} +{{ $alt := index . "alt" }} + +{{ if index . "border" }} +
+{{ else }} +
+{{ end }} + {{ if eq $type "image" }} + {{ $alt }} + {{ else if eq $type "video" }} + + {{ end }} + + {{ if not $hidecaption }} + {{ with $alt }} +
+ {{ . | markdownify }} +
+ {{ end }} + {{ end }} +
diff --git a/layouts/shortcodes/image.html b/layouts/shortcodes/image.html new file mode 100644 index 0000000..e442c1e --- /dev/null +++ b/layouts/shortcodes/image.html @@ -0,0 +1,13 @@ +{{ $border := false }} +{{ if .Get "border" }} +{{ $border = true }} +{{ end }} + +{{ $hidecaption := false }} +{{ if .Get "hidecaption" }} +{{ $hidecaption = true }} +{{ end }} + +

+ {{ partial "remote_figure.html" (dict "src" (.Get "src") "border" $border "hidecaption" $hidecaption "type" "image" "alt" (.Get "alt")) }} +

diff --git a/layouts/shortcodes/video.html b/layouts/shortcodes/video.html new file mode 100644 index 0000000..1f18685 --- /dev/null +++ b/layouts/shortcodes/video.html @@ -0,0 +1,13 @@ +{{ $border := false }} +{{ if .Get "border" }} +{{ $border = true }} +{{ end }} + +{{ $hidecaption := false }} +{{ if .Get "hidecaption" }} +{{ $hidecaption = true }} +{{ end }} + +

+ {{ partial "remote_figure.html" (dict "src" (.Get "src") "border" $border "hidecaption" $hidecaption "type" "video" "alt" (.Get "alt")) }} +