themen-hugo-35c3-reveal/layouts/shortcodes/slide.html
dzello 3e34fe3bc9 Pass through all slide shortcode params to section
Now slides can have ids and arbitrary data attributes, and a whitelist of valid attributes no longer needs to be maintained.
2018-07-22 18:25:48 +02:00

28 lines
No EOL
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 -}}