diff options
| Commit | ea6082d632122e42ad118d514f87665c34ddf6c8 (patch) | |
|---|---|---|
| Author | 2018-08-29 21:02:12 +0300 | |
| Committer | 2018-08-29 21:02:12 +0300 | |
| Files | 63ecfd5f9be47a14a4eb7823bfe69bd62a5edf08 /layouts/shortcodes | |
| IPL-ea6082d632122e42ad118d514f87665c34ddf6c8.tar IPL-ea6082d632122e42ad118d514f87665c34ddf6c8.tar.gz IPL-ea6082d632122e42ad118d514f87665c34ddf6c8.zip | ||
Initial commit
- natrium: e006b529af8bee9422e4b2f8af0c6be4e8b41001
- reveal-hugo: 3bd0dbabe99e13a6c4970bbbfea12b0f084a0d1a
6 files changed, 68 insertions, 0 deletions
| -rw-r--r-- | layouts/shortcodes/frag.html | 4 | ||||
| -rw-r--r-- | layouts/shortcodes/fragment.html | 4 | ||||
| -rw-r--r-- | layouts/shortcodes/markdown.html | 8 | ||||
| -rw-r--r-- | layouts/shortcodes/note.html | 1 | ||||
| -rw-r--r-- | layouts/shortcodes/section.html | 3 | ||||
| -rw-r--r-- | layouts/shortcodes/slide.html | 48 |
diff --git a/layouts/shortcodes/frag.html b/layouts/shortcodes/frag.html new file mode 100644 index 0000000..c1de8c8 --- /dev/null +++ b/layouts/shortcodes/frag.html @@ -0,0 +1,4 @@ +<span class='fragment {{ .Get "class" }}' + {{ with .Get "index" }}data-fragment-index='{{ . }}'{{ end }}> + {{ .Get "c" }} +</span>
\ No newline at end of file diff --git a/layouts/shortcodes/fragment.html b/layouts/shortcodes/fragment.html new file mode 100644 index 0000000..dc41e03 --- /dev/null +++ b/layouts/shortcodes/fragment.html @@ -0,0 +1,4 @@ +<span class='fragment {{ .Get "class" }}' + {{ with .Get "index" }}data-fragment-index='{{ . }}'{{ end }}> + {{ .Inner }} +</span>
\ No newline at end of file diff --git a/layouts/shortcodes/markdown.html b/layouts/shortcodes/markdown.html new file mode 100644 index 0000000..f5effbc --- /dev/null +++ b/layouts/shortcodes/markdown.html @@ -0,0 +1,8 @@ +<section data-noprocess data-markdown + data-separator="^\r?\n---\r?\n$" + data-separator-vertical="^\r?\n------\r?\n$" + data-separator-notes="notes?:"> + <script type="text/template"> + {{ .Inner }} + </script> +</section>
\ No newline at end of file diff --git a/layouts/shortcodes/note.html b/layouts/shortcodes/note.html new file mode 100644 index 0000000..5d28fce --- /dev/null +++ b/layouts/shortcodes/note.html @@ -0,0 +1 @@ +<aside class="notes">{{ .Inner }}</aside>
\ No newline at end of file diff --git a/layouts/shortcodes/section.html b/layouts/shortcodes/section.html new file mode 100644 index 0000000..43611a4 --- /dev/null +++ b/layouts/shortcodes/section.html @@ -0,0 +1,3 @@ +<section data-shortcode-section> +{{ .Inner }} +</section>
\ No newline at end of file diff --git a/layouts/shortcodes/slide.html b/layouts/shortcodes/slide.html new file mode 100644 index 0000000..7bb41ec --- /dev/null +++ b/layouts/shortcodes/slide.html @@ -0,0 +1,48 @@ +{{- $scratch := .Scratch -}} +{{- $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 />" -}} + {{- range $slides -}} + {{- $scratch.Add "slides" . -}} + {{- end -}} +{{- end -}} +{{- $params := . -}} +{{- $noPrefix := slice "id" "class" -}} +{{- $noOutput := slice "content" "template" -}} +{{- range $scratch.Get "slides" }} +<section data-noprocess data-shortcode-slide + {{- $template := $params.Get "template" -}} + {{- if $template -}} + {{- $scratch.Add "templateParams" (slice $.Site.Params.reveal_hugo.templates) -}} + {{- if ne $.Page.File.LogicalName "_index.md" -}} + {{- $scratch.Add "templateParams" (slice ($.Site.GetPage $.Page.Section).Params.reveal_hugo.templates) -}} + {{- end -}} + {{- $scratch.Add "templateParams" (slice $.Page.Params.reveal_hugo.templates) -}} + {{- range ($scratch.Get "templateParams") -}} + {{- if (ne . nil) -}} + {{- range $key, $value := (index . $template) -}} + {{- $scratch.SetInMap "template" $key $value | safeHTMLAttr -}} + {{- end -}} + {{- end -}} + {{- end -}} + {{- range $key, $value := ($scratch.Get "template") }} + {{- $attrName := cond (in $noPrefix $key) $key (delimit (slice "data" $key) "-") }} + {{ $attrName | safeHTMLAttr }}="{{ $value }}" + {{- end }} + data-template="{{ $template }}" + {{- end -}} + {{- 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 -}}
\ No newline at end of file |
