diff options
author | RCJacH <RCJacH@outlook.com> | 2019-08-10 13:58:34 +0300 |
---|---|---|
committer | RCJacH <RCJacH@outlook.com> | 2019-08-10 14:15:01 +0300 |
commit | 4f41551dfada7b8965962e55f106eb8aaffcc14c (patch) | |
tree | 7b9b5558753722c627872a4ff42b6f159ca5ec7a | |
parent | 95a4377cf15fc923ad229b5a88e0177298761e13 (diff) |
+ section class assignment
-rw-r--r-- | layouts/partials/slides.html | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/layouts/partials/slides.html b/layouts/partials/slides.html index 563464a..9fe1b05 100644 --- a/layouts/partials/slides.html +++ b/layouts/partials/slides.html @@ -10,6 +10,7 @@ <!-- Split the processed content by <hr /> tag --> {{- range $elem_val := split $content "<hr />" -}} <!-- Initialize Scratch Content --> + {{- $.Scratch.Delete "sectionClass" -}} {{- $.Scratch.Delete "contentClass" -}} {{- $.Scratch.Delete "secondaryClass" -}} {{- $.Scratch.Delete "slideID" -}} @@ -23,6 +24,7 @@ <!-- Get slide properties from first line with HTML comment --> {{- $first := index (findRE "<!--[ ]?: (.+) -->" $elem_val 1) 0 -}} {{- with $first -}} + {{- $.Scratch.Set "sectionClass" (replace (index (findRE " ([a-zA-Z1-9]|-|_)+" $first) 0) " " "") -}} {{- $.Scratch.Set "contentClass" (replace (delimit (findRE " [.][^. ]+" $first) " ") " ." "") -}} {{- $.Scratch.Set "secondaryClass" (replace (delimit (findRE " [.][.][^. ]+" $first) " ") " .." "") -}} {{- $.Scratch.Set "slideID" (replace (delimit (findRE " #[^ ]+" $first) "-") " #" "") -}} @@ -58,7 +60,7 @@ <!-- hr with two dashes --> {{- $elem_val := replaceRE "[\n]*<p>–</p>[\n]*" "<hr />" $elem_val }} - <section id="{{- if $.Scratch.Get "slideID" }}{{ $.Scratch.Get "slideID" }}{{ else -}}slide{{- $.Scratch.Get "slideIDGlobal" -}}{{- end -}}"{{- with (or ($.Scratch.Get "slideClass") ($.Scratch.Get "slideClassGlobal")) }} class="{{- . -}}"{{- end -}}> + <section{{- with $.Scratch.Get "sectionClass" }} class="{{- . -}}"{{- end }} id="{{- if $.Scratch.Get "slideID" }}{{ $.Scratch.Get "slideID" }}{{ else -}}slide{{- $.Scratch.Get "slideIDGlobal" -}}{{- end -}}"{{- with (or ($.Scratch.Get "slideClass") ($.Scratch.Get "slideClassGlobal")) }} class="{{- . -}}"{{- end -}}> {{- with $.Scratch.Get "bgImage" }} <span class="background{{- with $.Scratch.Get "bgPos" -}}-{{- . -}}{{- end -}} {{- if in ($.Scratch.Get "bgType") "d"}} dark{{- end -}} |