From ad823cc4d72edbab10f0dadf99b30df91c3f7c50 Mon Sep 17 00:00:00 2001 From: Dimitar Trendafilov Date: Sun, 16 Aug 2020 08:38:04 +0300 Subject: Squashed 'website/themes/reveal-hugo/' content from commit ff9f389 git-subtree-dir: website/themes/reveal-hugo git-subtree-split: ff9f389743ae2fe5c5cc6101455db0616e8548e2 --- layouts/shortcodes/slide.html | 63 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 layouts/shortcodes/slide.html (limited to 'layouts/shortcodes/slide.html') diff --git a/layouts/shortcodes/slide.html b/layouts/shortcodes/slide.html new file mode 100644 index 0000000..0016326 --- /dev/null +++ b/layouts/shortcodes/slide.html @@ -0,0 +1,63 @@ +{{- $scratch := .Scratch -}} +{{- $scratch.Set "slides" slice -}} +{{- $content := .Get "content" -}} +{{- if $content -}} + {{- $lookup := split $content "." }} + {{ $markdownContent := .Page.Site.Data }} + {{- range $dataPath := $lookup -}} + {{- $markdownContent = index $markdownContent $dataPath -}} + {{- end -}} + {{- $html := $markdownContent | markdownify -}} + {{- $html := replace $html "
" "
" -}} + {{- $slides := split $html "
" -}} + {{- range $slides -}} + {{- $scratch.Add "slides" . -}} + {{- end -}} +{{- else -}} + {{- $scratch.Add "slides" "" -}} +{{- end -}} +{{- $params := . -}} +{{- $noPrefix := slice "id" "class" -}} +{{- $noOutput := slice "content" "template" -}} +{{- $template := $params.Get "template" -}} +{{- if $template -}} + {{- $scratch.Add "templateParams" slice -}} + {{- with $.Site.Params.reveal_hugo.templates -}} + {{- $scratch.Add "templateParams" . -}} + {{- end -}} + {{- if ne $.Page.File.LogicalName "_index.md" -}} + {{- $scratch.Add "templateParams" ($.Site.GetPage $.Page.Section).Params.reveal_hugo.templates -}} + {{- end -}} + {{- with $.Page.Params.reveal_hugo.templates -}} + {{- $scratch.Add "templateParams" . -}} + {{- end -}} + {{- $scratch.Add "templateParams" (slice $.Page.Params.reveal_hugo.templates) -}} + {{- $templateParams := $scratch.Get "templateParams" }} + {{- range $templateParams -}} + {{- if (ne . nil) -}} + {{- range $key, $value := (index . $template) -}} + {{- $scratch.SetInMap "template" $key $value | safeHTMLAttr -}} + {{- end -}} + {{- end -}} + {{- end -}} +{{- end -}} +{{- range $sindex, $svalue := $scratch.Get "slides" }} +
+ {{ $svalue | safeHTML }} +{{- if ne $sindex (sub (len ($scratch.Get "slides")) 1) -}} +
+{{- end -}} +{{- end -}} -- cgit v1.3.1-26-gb76a