Code clean up, Prepare for reveal.js

This commit is contained in:
zzossig 2019-12-01 20:58:24 +09:00
parent 0c438e806c
commit b1a0dc31db
23 changed files with 873 additions and 905 deletions

View File

@ -297,8 +297,7 @@ commento = false
dataAttrs = "" # "data-isso='https://isso.example.com' data-isso-require-author='true'"
[marketing]
google_analytics = ""
google_tag_manager = ""
googleAnalytics = ""
[socialOptions] # if set, social icons will show up.
email = "mailto:your@email.com"

View File

@ -83,6 +83,24 @@
# reveal.js
[reveal.plugin.markdown]
sri = "sha256-Q226SEjQWoH6UcW77wOUeSd7GoqxW0RLceOPPB3zU5E="
url = "https://cdn.jsdelivr.net/npm/reveal.js@3.8.0/plugin/markdown/markdown.js"
[reveal.plugin.marked]
sri = "sha256-ypJ65b+4BwdfsQtz1URdUBhJ9L5ijdovxTOdG+x5hsE="
url = "https://cdn.jsdelivr.net/npm/reveal.js@3.8.0/plugin/markdown/marked.js"
# lunr languages
[js.stemmer]
code = "stemmer"

View File

@ -20,14 +20,7 @@ pygmentsUseClasses = true
pygmentsCodefencesGuessSyntax = true
[outputs]
home = ["HTML", "RSS", "JSON", "WebAppManifest"]
[mediaTypes."application/manifest+json"]
suffixes = ["webmanifest"]
[outputFormats.WebAppManifest]
mediaType = "application/manifest+json"
rel = "manifest"
home = ["HTML", "RSS", "JSON"]
[taxonomies]
category = "categories"

View File

@ -93,8 +93,7 @@ commento = false
dataAttrs = "" # "data-isso='https://isso.example.com' data-isso-require-author='true'"
[marketing]
google_analytics = ""
google_tag_manager = ""
googleAnalytics = ""
[socialOptions]
email = "mailto:your@email.com"

View File

@ -1,2 +1,2 @@
<div id="commento"></div>
<script defer src="https://cdn.commento.io/js/commento.js"></script>
<script defer src="https://cdn.commento.io/js/commento.js" crossorigin="anonymous"></script>

View File

@ -1,6 +1,6 @@
{{- $scriptSrc := .Site.Params.isso.scriptSrc -}}
{{- $dataAttrs := .Site.Params.isso.dataAttrs -}}
<script src='{{ $scriptSrc }}' {{- with $dataAttrs }} {{ . | safeHTMLAttr }} {{- end -}}></script>
<script src='{{ $scriptSrc }}' {{- with $dataAttrs }} {{ . | safeHTMLAttr }} {{- end -}} crossorigin="anonymous"></script>
<section id='isso-thread'></section>

View File

@ -1,2 +1,2 @@
{{ partial "marketing/google_analytics" . }}
{{ partial "marketing/google_tag_manager" . }}
{{ template "_internal/google_analytics.html" . }}
{{ template "_internal/google_analytics_async.html" . }}

View File

@ -36,8 +36,8 @@
{{ $js := .Site.Data.lib.js }}
{{ $css := .Site.Data.lib.css }}
{{ printf "<link rel=\"stylesheet\" href=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\">" $css.swiper.url $css.swiper.sri | safeHTML }}
{{ printf "<script src=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\" title=\"swiper\"></script>" $js.swiper.url $js.swiper.sri | safeHTML }}
<link rel="stylesheet" href="{{ $css.swiper.url }}" integrity="{{ $css.swiper.sri }}" crossorigin="anonymous">
<script src="{{ $js.swiper.url }}" integrity="{{ $js.swiper.sri }}" crossorigin="anonymous"></script>
<script>
{{ $swiper := .Site.Data.swiper }}

View File

@ -1,6 +0,0 @@
{{ $ga := .Site.Params.marketing.google_analytics | default "" }}
{{ $gtm := .Site.Params.marketing.google_tag_manager | default "" }}
{{ if (in (slice (getenv "HUGO_ENV") hugo.Environment) "production") | and $ga | and (not $gtm) }}
{{ template "_internal/google_analytics_async.html" . }}
{{ end }}

View File

@ -1,9 +0,0 @@
{{ if (in (slice (getenv "HUGO_ENV") hugo.Environment) "production") | and site.Params.marketing.google_tag_manager }}
<script>
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','{{site.Params.marketing.google_tag_manager}}');
</script>
{{ end }}

View File

@ -10,13 +10,13 @@
<script defer src="{{ $zzo.RelPermalink }}"></script>
{{ $lazysizes := resources.Get "js/lazysizes.min.js" | resources.Fingerprint }}
<script defer src="{{ $lazysizes.RelPermalink }}"></script>
{{ $photoSwipe := resources.Get "js/photoswipe.min.js" | resources.Fingerprint }}
{{ $photoSwipe := resources.Get "lib/photoswipe/photoswipe.min.js" | resources.Fingerprint }}
<script defer src="{{ $photoSwipe.RelPermalink }}"></script>
{{ $photoSwipeUi := resources.Get "js/photoswipe-ui-default.min.js" | resources.Fingerprint }}
{{ $photoSwipeUi := resources.Get "lib/photoswipe/photoswipe-ui-default.min.js" | resources.Fingerprint }}
<script defer src="{{ $photoSwipeUi.RelPermalink }}"></script>
{{ $photoSwipeStyle := resources.Get "css/photoswipe/photoswipe.css" | resources.Minify }}
{{ $photoSwipeStyle := resources.Get "lib/photoswipe/photoswipe.css" | resources.Minify }}
<link rel="stylesheet" href="{{ $photoSwipeStyle.RelPermalink }}">
{{ $photoSwipeSkin := resources.Get "css/photoswipe/custom-skin.css" | resources.Minify }}
{{ $photoSwipeSkin := resources.Get "lib/photoswipe/custom-skin.css" | resources.Minify }}
<link rel="stylesheet" href="{{ $photoSwipeSkin.RelPermalink }}">
<script>

View File

@ -1,24 +1,16 @@
{{ $reveal_style := resources.Get "css/reveal/reveal.css" | resources.Minify| resources.Fingerprint }}
{{ $reveal := .Site.Data.lib.reveal }}
{{ $reveal_style := resources.Get "lib/reveal/reveal.css" | resources.Minify| resources.Fingerprint }}
<link rel="stylesheet" href="{{ $reveal_style.RelPermalink }}">
<div class="reveal">
<div class="slides">
<section data-markdown>
<script type="text/template">
<!-- .slide: data-background="#ff0000" -->
Markdown content
</script>
</section>
<section>Single Horizontal Slide</section>
<section>
<section>Vertical Slide 1</section>
<section>Vertical Slide 2</section>
</section>
</div>
</div>
{{ $reveal_script := resources.Get "js/reveal.js" | resources.Minify | resources.Fingerprint }}
{{ $reveal_script := resources.Get "lib/reveal/reveal.js" | resources.Minify | resources.Fingerprint }}
<script defer src="{{ $reveal_script.RelPermalink }}"></script>
{{ if in .Params.Plugins "markdown" }}
<script defer src="{{ $reveal.plugin.marked.url }}" integrity="{{ $reveal.plugin.marked.sri }}" crossorigin="anonymous"></script>
<script defer src="{{ $reveal.plugin.markdown.url }}" integrity="{{ $reveal.plugin.markdown.sri }}" crossorigin="anonymous"></script>
{{ end }}
<script>
window.onload = function() {
Reveal.initialize();

View File

@ -13,13 +13,13 @@
<script defer src="{{ $zzo.RelPermalink }}"></script>
{{ if $.Param "enablePhotoSwipe" }}
{{ $photoSwipe := resources.Get `js/photoswipe.min.js` | resources.Fingerprint }}
{{ $photoSwipe := resources.Get "lib/photoswipe/photoswipe.min.js" | resources.Fingerprint }}
<script defer src="{{ $photoSwipe.RelPermalink }}"></script>
{{ $photoSwipeUi := resources.Get `js/photoswipe-ui-default.min.js` | resources.Fingerprint }}
{{ $photoSwipeUi := resources.Get "lib/photoswipe/photoswipe-ui-default.min.js" | resources.Fingerprint }}
<script defer src="{{ $photoSwipeUi.RelPermalink }}"></script>
{{ $photoSwipeStyle := resources.Get "css/photoswipe/photoswipe.css" | resources.Minify }}
{{ $photoSwipeStyle := resources.Get "lib/photoswipe/photoswipe.css" | resources.Minify }}
<link rel="stylesheet" href="{{ $photoSwipeStyle.RelPermalink }}">
{{ $photoSwipeSkin := resources.Get "css/photoswipe/custom-skin.css" | resources.Minify }}
{{ $photoSwipeSkin := resources.Get "lib/photoswipe/custom-skin.css" | resources.Minify }}
<link rel="stylesheet" href="{{ $photoSwipeSkin.RelPermalink }}">
{{ end }}
@ -29,44 +29,44 @@
{{ end }}
{{ if in .Params.Libraries "mermaid" }}
<script defer src="{{ $js.mermaid.url }}" integrity="{{ $js.mermaid.sri }}" crossorigin="anonymous" title="mermaid"></script>
<script defer src="{{ $js.mermaid.url }}" integrity="{{ $js.mermaid.sri }}" crossorigin="anonymous"></script>
{{ end }}
{{ if in .Params.Libraries "katex" }}
<link rel="stylesheet" href="{{ $css.katex.url }}" integrity="{{$css.katex.sri }}" crossorigin="anonymous">
<script defer src="{{ $js.katex.url }}" integrity="{{ $js.katex.sri }}" crossorigin="anonymous" title="katex"></script>
<script defer src="{{ $js.katex_auto_render.url }}" integrity="{{ $js.katex_auto_render.sri }}" crossorigin="anonymous" title="katex"></script>
<script defer src="{{ $js.katex.url }}" integrity="{{ $js.katex.sri }}" crossorigin="anonymous"></script>
<script defer src="{{ $js.katex_auto_render.url }}" integrity="{{ $js.katex_auto_render.sri }}" crossorigin="anonymous"></script>
{{ end }}
{{ if in .Params.Libraries "flowchartjs" }}
<script defer src="{{ $js.raphael.url }}" integrity="{{ $js.raphael.sri }}" crossorigin="anonymous" title="raphael"></script>
<script defer src="{{ $js.flowchartjs.url }}" integrity="{{ $js.flowchartjs.sri }}" crossorigin="anonymous" title="flowchartjs"></script>
<script defer src="{{ $js.raphael.url }}" integrity="{{ $js.raphael.sri }}" crossorigin="anonymous"></script>
<script defer src="{{ $js.flowchartjs.url }}" integrity="{{ $js.flowchartjs.sri }}" crossorigin="anonymous"></script>
{{ end }}
{{ if in .Params.Libraries "mathjax" }}
<script defer src="{{ $js.mathjax.url }}" integrity="{{ $js.mathjax.sri }}" crossorigin="anonymous" title="mathjax"></script>
<script defer src="{{ $js.mathjax.url }}" integrity="{{ $js.mathjax.sri }}" crossorigin="anonymous"></script>
{{ end }}
{{ if in .Params.Libraries "msc" }}
<script defer src="{{ $js.webfont.url }}" crossorigin="anonymous" title="webfont"></script>
<script defer src="{{ $js.snap_svg.url }}" crossorigin="anonymous" title="snap_svg"></script>
<script defer src="{{ $js.lodash.url }}" integrity="{{ $js.lodash.sri }}" crossorigin="anonymous" title="lodash"></script>
<script defer src="{{ $js.sequence_diagram.url }}" integrity="{{ $js.sequence_diagram.sri }}" crossorigin="anonymous" title="sequence_diagram"></script>
<script defer src="{{ $js.webfont.url }}"></script>
<script defer src="{{ $js.snap_svg.url }}"></script>
<script defer src="{{ $js.lodash.url }}" integrity="{{ $js.lodash.sri }}" crossorigin="anonymous"></script>
<script defer src="{{ $js.sequence_diagram.url }}" integrity="{{ $js.sequence_diagram.sri }}" crossorigin="anonymous"></script>
<link rel="stylesheet" href="{{ $css.sequence_diagram.url }}" integrity="{{ $css.sequence_diagram.sri }}" crossorigin="anonymous">
{{ end }}
{{ if in .Params.Libraries "chart" }}
<script defer src="{{ $js.chart.url }}" integrity="{{ $js.chart.sri }}" crossorigin="anonymous" title="chart"></script>
<script defer src="{{ $js.chart.url }}" integrity="{{ $js.chart.sri }}" crossorigin="anonymous"></script>
{{ end }}
{{ if in .Params.Libraries "wavedrom" }}
<script defer src="{{ $js.wavedrom.url }}" integrity="{{ $js.wavedrom.sri }}" crossorigin="anonymous" title="wavedrom"></script>
<script defer src="{{ $js.wavedrom_skin.url }}" integrity="{{ $js.wavedrom_skin.sri }}" crossorigin="anonymous" title="wavedrom_skin"></script>
<script defer src="{{ $js.wavedrom.url }}" integrity="{{ $js.wavedrom.sri }}" crossorigin="anonymous"></script>
<script defer src="{{ $js.wavedrom_skin.url }}" integrity="{{ $js.wavedrom_skin.sri }}" crossorigin="anonymous"></script>
{{ end }}
{{ if in .Params.Libraries "viz" }}
<script defer src="{{ $js.viz.url }}" crossorigin="anonymous" title="viz"></script>
<script defer src="{{ $js.viz_render.url }}" integrity="{{ $js.viz_render.sri }}" crossorigin="anonymous" title="viz_render"></script>
<script defer src="{{ $js.viz.url }}" crossorigin="anonymous"></script>
<script defer src="{{ $js.viz_render.url }}" integrity="{{ $js.viz_render.sri }}" crossorigin="anonymous"></script>
{{ end }}

View File

@ -15,15 +15,15 @@
<script defer src="{{ $lunr.RelPermalink }}"></script>
{{ $stemmer := .Site.Data.lib.js.stemmer }}
{{ printf "<script defer src=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\" title=\"%s\"></script>" $stemmer.url $stemmer.sri $stemmer.code | safeHTML }}
<script defer src="{{ $stemmer.url }}" integrity="{{ $stemmer.sri }}" crossorigin="anonymous"></script>
{{ $multi := .Site.Data.lib.js.multi_language }}
{{ printf "<script defer src=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\" title=\"%s\"></script>" $multi.url $multi.sri $multi.code | safeHTML }}
<script defer src="{{ $multi.url }}" integrity="{{ $multi.sri }}" crossorigin="anonymous"></script>
{{ $searchLanguages := .Site.Params.searchLanguages }}
{{ range .Site.Data.lib.lunr }}
{{ if in $searchLanguages .code }}
{{ printf "<script defer src=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\" title=\"%s\"></script>" .url .sri .code | safeHTML }}
<script defer src="{{ .url }}" integrity="{{ .sri }}" crossorigin="anonymous"></script>
{{ end }}
{{ end }}

View File

@ -1,33 +0,0 @@
{{ define "main" }}
<header class="header">
<h3 class="h3 terms__title">
{{ .Title }}
</h3>
<div>
{{ .Content }}
</div>
</header>
</span>
<main class="main">
<div class="pt">
<div class="pt__row">
{{ $paginator := .Paginate (where .Pages "Type" "pt") }}
{{ range $paginator.Pages }}
<div class="pt__column">
<a href="{{ .Permalink }}">
<div class="pt__card">
{{ printf "%#v" .Title }}
</div>
</a>
</div>
{{ end }}
</div>
</div>
<div class="grow"></div>
{{ partial "pagination/pagination" . }}
<div class="hide">
{{ partial "search/site-search" . }}
</div>
{{ partial "script/list-script" . }}
</main>
{{ end }}

View File

@ -1 +1,16 @@
<div class="reveal">
<div class="slides">
<section data-markdown>
<textarea data-template>
{{ .Content }}
</textarea>
</section>
<section>Single Horizontal Slide</section>
<section>
<section>Vertical Slide 1</section>
<section>Vertical Slide 2</section>
</section>
</div>
</div>
{{ partial "script/pt-script" . }}