first commit
This commit is contained in:
4
themes/reveal-hugo/layouts/shortcodes/frag.html
Normal file
4
themes/reveal-hugo/layouts/shortcodes/frag.html
Normal file
@@ -0,0 +1,4 @@
|
||||
<span class='fragment {{ .Get "class" }}'
|
||||
{{ with .Get "index" }}data-fragment-index='{{ . }}'{{ end }}>
|
||||
{{ .Get "c" }}
|
||||
</span>
|
||||
4
themes/reveal-hugo/layouts/shortcodes/fragment.html
Normal file
4
themes/reveal-hugo/layouts/shortcodes/fragment.html
Normal file
@@ -0,0 +1,4 @@
|
||||
{{/* Render .Inner before processing the shortcode. */}}
|
||||
{{ $_hugo_config := `{ "version": 1 }` }}
|
||||
<span class='fragment {{ .Get "class" }}' {{ with .Get "index" }}data-fragment-index='{{ . }}'{{ end }}>{{ .Inner }}</span>
|
||||
|
||||
8
themes/reveal-hugo/layouts/shortcodes/markdown.html
Normal file
8
themes/reveal-hugo/layouts/shortcodes/markdown.html
Normal file
@@ -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>
|
||||
31
themes/reveal-hugo/layouts/shortcodes/math.html
Normal file
31
themes/reveal-hugo/layouts/shortcodes/math.html
Normal file
@@ -0,0 +1,31 @@
|
||||
{{ $math := "" -}}
|
||||
|
||||
{{ with .Get "inline" -}}
|
||||
{{/* Error checking */ -}}
|
||||
{{ if $.Inner -}}
|
||||
{{ errorf "%s: shortcode math with parameter 'inline' must not have inner content declared" $.Page.File.Path -}}
|
||||
{{ end -}}
|
||||
{{ if ne ( printf "%T" . ) "string" -}}
|
||||
{{ errorf "%s: shortcode math: parameter 'inline' must be a string" $.Page.File.Path -}}
|
||||
{{ end -}}
|
||||
{{ $math = . -}}
|
||||
{{ else -}}
|
||||
{{ with $.Get 0 -}}
|
||||
{{ if $.Inner -}}
|
||||
{{ errorf "%s: shortcode math for inline content must not have inner content declared" $.Page.File.Path -}}
|
||||
{{ end -}}
|
||||
{{ $math = $.Get 0 -}}
|
||||
{{ else }}
|
||||
{{ if .IsNamedParams}}
|
||||
{{ errorf "%s: shortcode math: Invalid named parameter(s) (%v) detected. Only named parameter 'inline' is allowed." $.Page.File.Path .Params -}}
|
||||
{{ end }}
|
||||
{{ end -}}
|
||||
{{ end -}}
|
||||
|
||||
{{ if eq $math "" -}}
|
||||
<p>$${{- .Inner | safeHTML }}$$</p>
|
||||
{{ else -}}
|
||||
${{- $math | safeHTML }}$
|
||||
{{ end -}}
|
||||
|
||||
{{ .Page.Store.Set "hasMath" true }}
|
||||
4
themes/reveal-hugo/layouts/shortcodes/mermaid.html
Normal file
4
themes/reveal-hugo/layouts/shortcodes/mermaid.html
Normal file
@@ -0,0 +1,4 @@
|
||||
<div class="mermaid">
|
||||
{{- .Inner | safeHTML }}
|
||||
</div>
|
||||
{{ .Page.Store.Set "hasMermaid" true }}
|
||||
4
themes/reveal-hugo/layouts/shortcodes/note.html
Normal file
4
themes/reveal-hugo/layouts/shortcodes/note.html
Normal file
@@ -0,0 +1,4 @@
|
||||
{{/* Markdown is not rendered inside <aside> tags! So we use the following */}}
|
||||
{{/* config which causes .Inner to be rendered before processing the shortcode. */}}
|
||||
{{ $_hugo_config := `{ "version": 1 }` }}
|
||||
<aside class="notes">{{ .Inner }}</aside>
|
||||
5
themes/reveal-hugo/layouts/shortcodes/section.html
Normal file
5
themes/reveal-hugo/layouts/shortcodes/section.html
Normal file
@@ -0,0 +1,5 @@
|
||||
{{/* Render .Inner before processing the shortcode. */}}
|
||||
{{ $_hugo_config := `{ "version": 1 }` }}
|
||||
<section data-shortcode-section>
|
||||
{{ .Inner }}
|
||||
</section>
|
||||
63
themes/reveal-hugo/layouts/shortcodes/slide.html
Normal file
63
themes/reveal-hugo/layouts/shortcodes/slide.html
Normal file
@@ -0,0 +1,63 @@
|
||||
{{- $scratch := .Scratch -}}
|
||||
{{- $scratch.Set "slides" slice -}}
|
||||
{{- $content := .Get "content" -}}
|
||||
{{- if $content -}}
|
||||
{{- $lookup := split $content "." }}
|
||||
{{ $markdownContent := .Page.Site.Data }}
|
||||
{{- range $dataPath := $lookup -}}
|
||||
{{- $markdownContent = index $markdownContent $dataPath -}}
|
||||
{{- end -}}
|
||||
{{- $html := $markdownContent | markdownify -}}
|
||||
{{- $html := replace $html "<hr>" "<hr />" -}}
|
||||
{{- $slides := split $html "<hr />" -}}
|
||||
{{- range $slides -}}
|
||||
{{- $scratch.Add "slides" . -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- $scratch.Add "slides" "" -}}
|
||||
{{- end -}}
|
||||
{{- $params := . -}}
|
||||
{{- $noPrefix := slice "id" "class" -}}
|
||||
{{- $noOutput := slice "content" "template" -}}
|
||||
{{- $template := $params.Get "template" -}}
|
||||
{{- if $template -}}
|
||||
{{- $scratch.Add "templateParams" slice -}}
|
||||
{{- with $.Site.Params.reveal_hugo.templates -}}
|
||||
{{- $scratch.Add "templateParams" . -}}
|
||||
{{- end -}}
|
||||
{{- if ne $.Page.File.LogicalName "_index.md" -}}
|
||||
{{- $scratch.Add "templateParams" ($.Site.GetPage $.Page.Section).Params.reveal_hugo.templates -}}
|
||||
{{- end -}}
|
||||
{{- with $.Page.Params.reveal_hugo.templates -}}
|
||||
{{- $scratch.Add "templateParams" . -}}
|
||||
{{- end -}}
|
||||
{{- $scratch.Add "templateParams" (slice $.Page.Params.reveal_hugo.templates) -}}
|
||||
{{- $templateParams := $scratch.Get "templateParams" }}
|
||||
{{- range $templateParams -}}
|
||||
{{- if (ne . nil) -}}
|
||||
{{- range $key, $value := (index . $template) -}}
|
||||
{{- $scratch.SetInMap "template" $key $value | safeHTMLAttr -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- range $sindex, $svalue := $scratch.Get "slides" }}
|
||||
<section data-noprocess data-shortcode-slide
|
||||
{{- if $template -}}
|
||||
{{- 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 -}}>
|
||||
{{ $svalue | safeHTML }}
|
||||
{{- if ne $sindex (sub (len ($scratch.Get "slides")) 1) -}}
|
||||
</section>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
Reference in New Issue
Block a user