Improve logic for detecting whether shortcode has content inside
This commit is contained in:
parent
f8a8c06266
commit
52eec0fd6a
|
@ -1,9 +1,10 @@
|
||||||
{{- .Scratch.Set "slides" slice -}}
|
{{- .Scratch.Set "slides" slice -}}
|
||||||
{{- if trim .Inner "\n" -}}
|
{{- if len .Inner -}}
|
||||||
{{- .Scratch.Add "slides" .Inner -}}
|
{{- .Scratch.Add "slides" .Inner -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- if .Get "content" -}}
|
{{- $content := .Get "content" -}}
|
||||||
{{- $lookup := split (.Get "content") "." -}}
|
{{- if $content -}}
|
||||||
|
{{- $lookup := split $content "." }}
|
||||||
{{- $html := index .Page.Site.Data (index $lookup 0) (index $lookup 1) | markdownify -}}
|
{{- $html := index .Page.Site.Data (index $lookup 0) (index $lookup 1) | markdownify -}}
|
||||||
{{- $slides := split $html "<hr />" -}}
|
{{- $slides := split $html "<hr />" -}}
|
||||||
{{- $scratch := .Scratch -}}
|
{{- $scratch := .Scratch -}}
|
||||||
|
@ -13,8 +14,8 @@
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- $attributes := slice "background-color" "background-image" "background-size" "background-position" "background-repeat" "transition" "transition-speed" "background-iframe" "background-interactive" "background-video" "background-video-loop" "background-video-muted" -}}
|
{{- $attributes := slice "background-color" "background-image" "background-size" "background-position" "background-repeat" "transition" "transition-speed" "background-iframe" "background-interactive" "background-video" "background-video-loop" "background-video-muted" -}}
|
||||||
{{- $params := . -}}
|
{{- $params := . -}}
|
||||||
{{- range .Scratch.Get "slides" -}}
|
{{- range .Scratch.Get "slides" }}
|
||||||
<section data-noprocess
|
<section data-noprocess data-shortcode-slide
|
||||||
{{- range $attribute := $attributes -}}
|
{{- range $attribute := $attributes -}}
|
||||||
{{- with $params.Get $attribute }} data-{{ $attribute | safeHTMLAttr }}="{{ . }}"{{ end -}}
|
{{- with $params.Get $attribute }} data-{{ $attribute | safeHTMLAttr }}="{{ . }}"{{ end -}}
|
||||||
{{- end -}}>
|
{{- end -}}>
|
||||||
|
|
Loading…
Reference in New Issue