3e34fe3bc9
Now slides can have ids and arbitrary data attributes, and a whitelist of valid attributes no longer needs to be maintained.
28 lines
No EOL
919 B
HTML
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 -}} |