diff options
Moved site to website folder
13 files changed, 187 insertions, 0 deletions
| -rw-r--r-- | website/layouts/_default/baseof.reveal.html | 87 | ||||
| -rw-r--r-- | website/layouts/_default/index.reveal.html | 3 | ||||
| -rw-r--r-- | website/layouts/_default/list.reveal.html | 3 | ||||
| -rw-r--r-- | website/layouts/_default/single.reveal.html | 0 | ||||
| -rw-r--r-- | website/layouts/partials/reveal-hugo/body.html | 1 | ||||
| -rw-r--r-- | website/layouts/partials/reveal-hugo/head.html | 1 | ||||
| -rw-r--r-- | website/layouts/partials/reveal-hugo/slides.html | 24 | ||||
| -rw-r--r-- | website/layouts/shortcodes/frag.html | 4 | ||||
| -rw-r--r-- | website/layouts/shortcodes/fragment.html | 4 | ||||
| -rw-r--r-- | website/layouts/shortcodes/markdown.html | 8 | ||||
| -rw-r--r-- | website/layouts/shortcodes/note.html | 1 | ||||
| -rw-r--r-- | website/layouts/shortcodes/section.html | 3 | ||||
| -rw-r--r-- | website/layouts/shortcodes/slide.html | 48 |
diff --git a/website/layouts/_default/baseof.reveal.html b/website/layouts/_default/baseof.reveal.html new file mode 100644 index 0000000..1e3868b --- /dev/null +++ b/website/layouts/_default/baseof.reveal.html @@ -0,0 +1,87 @@ +<!doctype html> +{{- $reveal_cdn := "https://cdnjs.cloudflare.com/ajax/libs/reveal.js/3.6.0" -}} +{{- $highlight_cdn := "https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0" -}} +<html lang="en"> + <head> + <meta charset="utf-8"> + <title>{{ or .Page.Title .Site.Title }}</title> + <meta name="description" content="{{ or .Page.Params.Description .Site.Params.Description }}"> + <meta name="author" content="{{ .Site.Author.name }}"> + <meta name="apple-mobile-web-app-capable" content="yes"> + <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"> + <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> + <link rel="stylesheet" href="{{ $reveal_cdn }}/css/reveal.min.css"> + <!-- Theme used for presentation --> + {{- $theme := or .Page.Params.reveal_hugo.theme .Site.Params.reveal_hugo.theme .Site.Data.reveal_hugo.defaults.theme "black" -}} + {{- $custom_theme := or .Page.Params.reveal_hugo.custom_theme .Site.Params.reveal_hugo.custom_theme -}} + {{- if $custom_theme -}} + <link rel="stylesheet" href="{{ $custom_theme | relURL }}" id="theme"> + {{ else -}} + <link rel="stylesheet" href="{{ $reveal_cdn }}/css/theme/{{ $theme }}.css" id="theme"> + {{- end -}} + <!-- Theme used for syntax highlighting of code --> + {{- $highlight_theme := or .Page.Params.reveal_hugo.highlight_theme .Site.Params.reveal_hugo.highlight_theme .Site.Data.reveal_hugo.defaults.highlight_theme "default" -}} + <link rel="stylesheet" href="{{ $highlight_cdn }}/styles/{{ $highlight_theme }}.min.css"> + <!-- Printing and PDF exports --> + <script> + var link = document.createElement( 'link' ); + link.rel = 'stylesheet'; + link.type = 'text/css'; + link.href = window.location.search.match( /print-pdf/gi ) ? '{{ $reveal_cdn}}/css/print/pdf.css' : '{{ $reveal_cdn }}/css/print/paper.css'; + document.getElementsByTagName( 'head' )[0].appendChild( link ); + </script> + <!--[if lt IE 9]> + <script src="https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.js"></script> + <![endif]--> + {{- partial "reveal-hugo/head" . -}} + </head> + <body> + {{- block "main" . -}}{{- end -}} + <script type="application/json" id="reveal-hugo-page-params">{{ jsonify .Page.Params.reveal_hugo | safeJS }}</script> + <script type="application/json" id="reveal-hugo-site-params">{{ jsonify .Site.Params.reveal_hugo | safeJS }}</script> + <script type="application/json" id="reveal-hugo-defaults">{{ jsonify .Site.Data.reveal_hugo.defaults | safeJS }}</script> + <script type="text/javascript"> + window.revealHugoDependencies = { + dependencies: [ + { src: '{{ $reveal_cdn }}/lib/js/classList.js', condition: function() { return !document.body.classList; } }, + { src: '{{ $reveal_cdn }}/plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } }, + { src: '{{ $reveal_cdn }}/plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } }, + { src: '{{ $reveal_cdn }}/plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } }, + { src: '{{ $reveal_cdn }}/plugin/zoom-js/zoom.js', async: true }, + // the notes plugin can't run off the CDN b/c the HTML file isn't there + { src: '{{ "reveal-hugo/plugin/notes/notes.js" | relURL }}', async: true } + ]}; + </script> + <script src="{{ $reveal_cdn }}/lib/js/head.min.js"></script> + <script src="{{ $reveal_cdn }}/js/reveal.js"></script> + <script type="text/javascript"> + // Hugo lowercases all params and Reveal.js needs camelcase + // So params in Hugo must be stored in snakecase and we camelize them here + function camelize(map) { + if (map) { + Object.keys(map).forEach(function(k) { + newK = k.replace(/(\_\w)/g, function(m) { return m[1].toUpperCase() }); + if (newK != k) { + map[newK] = map[k]; + delete map[k]; + } + }); + } + return map; + } + // pattern inspired by https://github.com/RealOrangeOne/hugo-theme-revealjs + var revealHugoPageParams = JSON.parse(document.getElementById('reveal-hugo-page-params').innerHTML); + var revealHugoSiteParams = JSON.parse(document.getElementById('reveal-hugo-site-params').innerHTML); + var revealHugoDefaults = JSON.parse(document.getElementById('reveal-hugo-defaults').innerHTML); + // See all options - https://github.com/hakimel/reveal.js#configuration + var options = Object.assign({}, + camelize(revealHugoDefaults), + camelize(revealHugoSiteParams), + camelize(revealHugoPageParams), + revealHugoDependencies); + Reveal.initialize(options); + </script> + + {{ partial "reveal-hugo/body" . }} + </body> +</html> diff --git a/website/layouts/_default/index.reveal.html b/website/layouts/_default/index.reveal.html new file mode 100644 index 0000000..8faa735 --- /dev/null +++ b/website/layouts/_default/index.reveal.html @@ -0,0 +1,3 @@ +{{ define "main" }} + {{ partial "reveal-hugo/slides" (union (slice .Page) (where .Data.Pages "Type" "home")) }} +{{ end }} diff --git a/website/layouts/_default/list.reveal.html b/website/layouts/_default/list.reveal.html new file mode 100644 index 0000000..6c3c470 --- /dev/null +++ b/website/layouts/_default/list.reveal.html @@ -0,0 +1,3 @@ +{{ define "main" }} + {{ partial "reveal-hugo/slides" (union (slice .Page) .Pages) }} +{{ end }} diff --git a/website/layouts/_default/single.reveal.html b/website/layouts/_default/single.reveal.html new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/website/layouts/_default/single.reveal.html diff --git a/website/layouts/partials/reveal-hugo/body.html b/website/layouts/partials/reveal-hugo/body.html new file mode 100644 index 0000000..f2dd4bf --- /dev/null +++ b/website/layouts/partials/reveal-hugo/body.html @@ -0,0 +1 @@ +<!-- override this partial to add content before the body tag closes -->
\ No newline at end of file diff --git a/website/layouts/partials/reveal-hugo/head.html b/website/layouts/partials/reveal-hugo/head.html new file mode 100644 index 0000000..ed1e892 --- /dev/null +++ b/website/layouts/partials/reveal-hugo/head.html @@ -0,0 +1 @@ +<!-- override this partial to add content before the head tag closes -->
\ No newline at end of file diff --git a/website/layouts/partials/reveal-hugo/slides.html b/website/layouts/partials/reveal-hugo/slides.html new file mode 100644 index 0000000..e578882 --- /dev/null +++ b/website/layouts/partials/reveal-hugo/slides.html @@ -0,0 +1,24 @@ +<div class="reveal"> + <!-- Any section element inside of this container is displayed as a slide --> + <div class="slides"> + <!-- Use the array of pages passed as a param --> + {{ range . -}} + <!-- Don't process empty content files --> + {{- if ne (len .Content) 0 -}} + <!-- Remove the <hr /> tag generated by blackfriday for footnotes --> + {{- $content := replace .Content "<div class=\"footnotes\">\n\n<hr />" "<div class=\"footnotes\">" -}} + <!-- Split the processed content by <hr /> tag --> + {{- range (split $content "<hr />") -}} + <!-- Only wrap in <section> tag if not already wrapped by shortcode --> + {{- if in . "data-noprocess" -}} +{{- . | safeHTML -}} + {{- else }} +<section> + {{- . | safeHTML }} +</section> + {{- end -}} + {{- end -}} + {{- end -}} + {{- end }} + </div> +</div>
\ No newline at end of file diff --git a/website/layouts/shortcodes/frag.html b/website/layouts/shortcodes/frag.html new file mode 100644 index 0000000..c1de8c8 --- /dev/null +++ b/website/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/website/layouts/shortcodes/fragment.html b/website/layouts/shortcodes/fragment.html new file mode 100644 index 0000000..dc41e03 --- /dev/null +++ b/website/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/website/layouts/shortcodes/markdown.html b/website/layouts/shortcodes/markdown.html new file mode 100644 index 0000000..f5effbc --- /dev/null +++ b/website/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/website/layouts/shortcodes/note.html b/website/layouts/shortcodes/note.html new file mode 100644 index 0000000..5d28fce --- /dev/null +++ b/website/layouts/shortcodes/note.html @@ -0,0 +1 @@ +<aside class="notes">{{ .Inner }}</aside>
\ No newline at end of file diff --git a/website/layouts/shortcodes/section.html b/website/layouts/shortcodes/section.html new file mode 100644 index 0000000..43611a4 --- /dev/null +++ b/website/layouts/shortcodes/section.html @@ -0,0 +1,3 @@ +<section data-shortcode-section> +{{ .Inner }} +</section>
\ No newline at end of file diff --git a/website/layouts/shortcodes/slide.html b/website/layouts/shortcodes/slide.html new file mode 100644 index 0000000..7bb41ec --- /dev/null +++ b/website/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 |
