Website Summary Files Commits Branches @commit @diff @stats
path: root / website / layouts / shortcodes / slide.html
diff options
context:
space:
mode:
Commit3245f1f1404785d92c21eb381c08dee5a4be6bb7 (patch)
Author
 Dimitar Trendafilov <dimitar@coherent-labs.com>
2018-09-04 09:08:41 +0300
Committer
 Dimitar Trendafilov <dimitar@coherent-labs.com>
2018-09-04 09:08:41 +0300
Files3c245582fb5a2a9eaf8518f7272c03a6aaa2f635 /website/layouts/shortcodes/slide.html
IPL-3245f1f1404785d92c21eb381c08dee5a4be6bb7.tar
IPL-3245f1f1404785d92c21eb381c08dee5a4be6bb7.tar.gz
IPL-3245f1f1404785d92c21eb381c08dee5a4be6bb7.zip
Parentae12c0a482298e4da9b816137ceb6131c7d4b9e4 (diff)
Moved site to website folder
1 files changed, 48 insertions, 0 deletions
-rw-r--r--website/layouts/shortcodes/slide.html48
diff --git a/website/layouts/shortcodes/slide.html b/website/layouts/shortcodes/slide.html
new file mode 100644
index 0000000..7bb41ec
--- /dev/null
+++ b/website/layouts/shortcodes/slide.html
@@ -0,0 +1,48 @@
+{{- $scratch := .Scratch -}}
+{{- $scratch.Set "slides" slice -}}
+{{- if len .Inner -}}
+ {{- $scratch.Add "slides" .Inner -}}
+{{- end -}}
+{{- $content := .Get "content" -}}
+{{- if $content -}}
+ {{- $lookup := split $content "." }}
+ {{- $html := index .Page.Site.Data (index $lookup 0) (index $lookup 1) | markdownify -}}
+ {{- $slides := split $html "<hr />" -}}
+ {{- range $slides -}}
+ {{- $scratch.Add "slides" . -}}
+ {{- end -}}
+{{- end -}}
+{{- $params := . -}}
+{{- $noPrefix := slice "id" "class" -}}
+{{- $noOutput := slice "content" "template" -}}
+{{- range $scratch.Get "slides" }}
+<section data-noprocess data-shortcode-slide
+ {{- $template := $params.Get "template" -}}
+ {{- if $template -}}
+ {{- $scratch.Add "templateParams" (slice $.Site.Params.reveal_hugo.templates) -}}
+ {{- if ne $.Page.File.LogicalName "_index.md" -}}
+ {{- $scratch.Add "templateParams" (slice ($.Site.GetPage $.Page.Section).Params.reveal_hugo.templates) -}}
+ {{- end -}}
+ {{- $scratch.Add "templateParams" (slice $.Page.Params.reveal_hugo.templates) -}}
+ {{- range ($scratch.Get "templateParams") -}}
+ {{- if (ne . nil) -}}
+ {{- range $key, $value := (index . $template) -}}
+ {{- $scratch.SetInMap "template" $key $value | safeHTMLAttr -}}
+ {{- end -}}
+ {{- end -}}
+ {{- end -}}
+ {{- range $key, $value := ($scratch.Get "template") }}
+ {{- $attrName := cond (in $noPrefix $key) $key (delimit (slice "data" $key) "-") }}
+ {{ $attrName | safeHTMLAttr }}="{{ $value }}"
+ {{- end }}
+ data-template="{{ $template }}"
+ {{- end -}}
+ {{- range $key, $value := $.Params -}}
+ {{- if not (in $noOutput $key) -}}
+ {{- $attrName := cond (in $noPrefix $key) $key (delimit (slice "data" $key) "-") }}
+ {{ $attrName | safeHTMLAttr }}="{{ $value }}"
+ {{- end -}}
+ {{- end -}}>
+ {{ . | safeHTML }}
+</section>
+{{- end -}} \ No newline at end of file