themen-hugo-35c3-reveal/layouts/shortcodes/slide.html

28 lines
919 B
HTML

{{- .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 />" -}}
{{- $scratch := .Scratch -}}
{{- range $slides -}}
{{- $scratch.Add "slides" . -}}
{{- end -}}
{{- end -}}
{{- $params := . -}}
{{- $noPrefix := slice "id" -}}
{{- $noOutput := slice "content" -}}
{{- range .Scratch.Get "slides" }}
<section data-noprocess data-shortcode-slide
{{- 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 -}}