Clean up slide shortcode
Fixes a bug outputting junk into the HTML tag as a result of Scratch calls and avoid reprocessing a section that only need to be processed once
This commit is contained in:
parent
f6a1568da1
commit
37fcc0c158
1 changed files with 21 additions and 19 deletions
|
@ -14,8 +14,6 @@
|
||||||
{{- $params := . -}}
|
{{- $params := . -}}
|
||||||
{{- $noPrefix := slice "id" "class" -}}
|
{{- $noPrefix := slice "id" "class" -}}
|
||||||
{{- $noOutput := slice "content" "template" -}}
|
{{- $noOutput := slice "content" "template" -}}
|
||||||
{{- range $sindex, $svalue := $scratch.Get "slides" }}
|
|
||||||
<section data-noprocess data-shortcode-slide
|
|
||||||
{{- $template := $params.Get "template" -}}
|
{{- $template := $params.Get "template" -}}
|
||||||
{{- if $template -}}
|
{{- if $template -}}
|
||||||
{{- $scratch.Add "templateParams" (slice $.Site.Params.reveal_hugo.templates) -}}
|
{{- $scratch.Add "templateParams" (slice $.Site.Params.reveal_hugo.templates) -}}
|
||||||
|
@ -30,6 +28,10 @@
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- range $sindex, $svalue := $scratch.Get "slides" }}
|
||||||
|
<section data-noprocess data-shortcode-slide
|
||||||
|
{{- if $template -}}
|
||||||
{{- range $key, $value := ($scratch.Get "template") }}
|
{{- range $key, $value := ($scratch.Get "template") }}
|
||||||
{{- $attrName := cond (in $noPrefix $key) $key (delimit (slice "data" $key) "-") }}
|
{{- $attrName := cond (in $noPrefix $key) $key (delimit (slice "data" $key) "-") }}
|
||||||
{{ $attrName | safeHTMLAttr }}="{{ $value }}"
|
{{ $attrName | safeHTMLAttr }}="{{ $value }}"
|
||||||
|
|
Loading…
Reference in a new issue