From 8f53c999e524d6b4e5ff912c83c7be0ca9d36e62 Mon Sep 17 00:00:00 2001 From: Dillon Date: Mon, 18 May 2020 21:30:33 +0800 Subject: [PATCH] chore: refactor some code --- layouts/_default/single.html | 2 +- layouts/_default/summary.html | 2 +- layouts/index.html | 2 +- layouts/index.json | 2 +- layouts/index.rss.xml | 2 +- layouts/partials/assets.html | 80 +++++++++++----------- layouts/partials/comment.html | 16 ++--- layouts/partials/function/content.html | 8 +-- layouts/partials/function/id.html | 8 +-- layouts/partials/header.html | 4 +- layouts/partials/home/profile.html | 2 +- layouts/partials/plugin/compatibility.html | 4 +- layouts/partials/rss/item.html | 18 ++--- layouts/partials/scratch/script.html | 6 +- layouts/partials/scratch/style.html | 6 +- layouts/posts/rss.xml | 2 +- layouts/posts/single.html | 4 +- layouts/shortcodes/echarts.html | 2 +- layouts/shortcodes/mapbox.html | 2 +- layouts/shortcodes/mermaid.html | 2 +- layouts/shortcodes/style.html | 2 +- layouts/shortcodes/typeit.html | 2 +- layouts/taxonomy/rss.xml | 2 +- 23 files changed, 90 insertions(+), 90 deletions(-) diff --git a/layouts/_default/single.html b/layouts/_default/single.html index c14337b4..a34e22bd 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -15,7 +15,7 @@ {{- /* Content */ -}}
- {{- dict "content" .Content "ruby" $params.ruby "fraction" $params.fraction "fontawesome" $params.fontawesome | partial "function/content.html" | safeHTML -}} + {{- dict "Content" .Content "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" | safeHTML -}}
{{- /* Comment */ -}} diff --git a/layouts/_default/summary.html b/layouts/_default/summary.html index da1e8195..f869a9ad 100644 --- a/layouts/_default/summary.html +++ b/layouts/_default/summary.html @@ -44,7 +44,7 @@ {{- /* Summary content */ -}}
{{- with .Summary -}} - {{- dict "content" . "ruby" $params.ruby "fraction" $params.fraction "fontawesome" $params.fontawesome | partial "function/content.html" | safeHTML -}} + {{- dict "Content" . "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" | safeHTML -}} {{- else -}} {{- .Description | safeHTML -}} {{- end -}} diff --git a/layouts/index.html b/layouts/index.html index eabc90cf..44dd92a4 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -13,7 +13,7 @@ {{- if .Content -}}
- {{- dict "content" .Content "ruby" $params.ruby "fraction" $params.fraction "fontawesome" $params.fontawesome | partial "function/content.html" | safeHTML -}} + {{- dict "Content" .Content "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" | safeHTML -}}
{{- end -}} diff --git a/layouts/index.json b/layouts/index.json index c78a51f9..4e810391 100644 --- a/layouts/index.json +++ b/layouts/index.json @@ -18,7 +18,7 @@ {{- end -}} {{- $params := .Params | merge $.Site.Params.page -}} {{/* Extended Markdown syntax */}} - {{- $content := dict "content" .Content "ruby" $params.ruby "fraction" $params.fraction "fontawesome" $params.fontawesome | partial "function/content.html" -}} + {{- $content := dict "Content" .Content "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" -}} {{/* Remove line number for code */}} {{- $content = $content | replaceRE ` *\d*\n?` "" -}} {{- range $i, $contenti := split $content "

" .Permalink .MediaType | safeHTML }} {{ end }} {{- range where .Site.RegularPages "Type" "posts" | first (.Site.Params.home.rss | default 10) -}} - {{- dict "page" . "site" .Site | partial "rss/item.html" -}} + {{- dict "Page" . "Site" .Site | partial "rss/item.html" -}} {{- end -}} diff --git a/layouts/partials/assets.html b/layouts/partials/assets.html index 96b27b36..45707b2d 100644 --- a/layouts/partials/assets.html +++ b/layouts/partials/assets.html @@ -5,56 +5,56 @@ {{- /* Smooth Scroll */ -}} {{- $source := $cdn.smoothScrollJS | default "lib/smooth-scroll/smooth-scroll.min.js" -}} -{{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" .Scratch "data" | partial "scratch/script.html" -}} +{{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} {{- /* Search */ -}} {{- if .Site.Params.search | and .Site.Params.search.enable -}} {{- $search := .Site.Params.search -}} {{- $source := $cdn.autocompleteJS | default "lib/autocomplete/autocomplete.min.js" -}} - {{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" .Scratch "data" | partial "scratch/script.html" -}} + {{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} {{- $config = dict "maxResultLength" $search.maxResultLength "snippetLength" $search.snippetLength "highlightTag" $search.highlightTag "noResultsFound" (T "noResultsFound") | dict "search" | merge $config -}} {{- if eq $search.type "lunr" -}} {{- with .Site.Home.OutputFormats.Get "json" -}} {{- $config = dict "type" "lunr" "lunrIndexURL" .RelPermalink | dict "search" | merge $config -}} {{- end -}} {{- $source := $cdn.lunrJS | default "lib/lunr/lunr.min.js" -}} - {{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" .Scratch "data" | partial "scratch/script.html" -}} + {{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} {{- if T "lunrLanguageLib" -}} {{- $config = T "lunrLanguageCode" | dict "lunrLanguageCode" | dict "search" | merge $config -}} {{- with T "lunrSegmentitLib" -}} {{- $config = dict "lunrSegmentitURL" (resources.Get .).RelPermalink | dict "search" | merge $config -}} {{- end -}} - {{- dict "source" "lib/lunr/lunr.stemmer.support.js" "minify" true "fingerprint" $fingerprint | dict "scratch" .Scratch "data" | partial "scratch/script.html" -}} - {{- dict "source" (T "lunrLanguageLib") "minify" true "fingerprint" $fingerprint | dict "scratch" .Scratch "data" | partial "scratch/script.html" -}} + {{- dict "source" "lib/lunr/lunr.stemmer.support.js" "minify" true "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} + {{- dict "source" (T "lunrLanguageLib") "minify" true "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} {{- end -}} {{- else if eq $search.type "algolia" -}} {{- $source := $cdn.algoliasearchJS | default "lib/algoliasearch/algoliasearch-lite.umd.min.js" -}} - {{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" .Scratch "data" | partial "scratch/script.html" -}} + {{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} {{- $config = dict "type" "algolia" "algoliaIndex" $search.algolia.index "algoliaAppID" $search.algolia.appID "algoliaSearchKey" $search.algolia.searchKey | dict "search" | merge $config -}} {{- end -}} {{- end -}} {{- /* lazysizes */ -}} {{- $source := $cdn.lazysizesJS | default "lib/lazysizes/lazysizes.min.js" -}} -{{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" .Scratch "data" | partial "scratch/script.html" -}} +{{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} {{- /* twemoji */ -}} {{- if $params.twemoji -}} {{- $source := $cdn.twemojiJS | default "lib/twemoji/twemoji.min.js" -}} - {{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" .Scratch "data" | partial "scratch/script.html" -}} + {{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} {{- $config = dict "twemoji" true | merge $config -}} {{- end -}} {{- /* lightgallery.js */ -}} {{- if $params.lightgallery -}} {{- $source := $cdn.lightgalleryCSS | default "lib/lightgallery/lightgallery.min.css" -}} - {{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" .Scratch "data" | partial "scratch/style.html" -}} + {{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}} {{- $source := $cdn.lightgalleryJS | default "lib/lightgallery/lightgallery.min.js" -}} - {{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" .Scratch "data" | partial "scratch/script.html" -}} + {{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} {{- $source := $cdn.lightgalleryThumbnailJS | default "lib/lightgallery/lg-thumbnail.min.js" -}} - {{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" .Scratch "data" | partial "scratch/script.html" -}} + {{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} {{- $source := $cdn.lightgalleryZoomJS | default "lib/lightgallery/lg-zoom.min.js" -}} - {{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" .Scratch "data" | partial "scratch/script.html" -}} + {{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} {{- $config = dict "selector" ".lightgallery" "speed" 400 "hideBarsDelay" 2000 "thumbnail" true "exThumbImage" "data-thumbnail" "thumbWidth" 80 "thumbContHeight" 80 "actualSize" false | dict "lightGallery" | merge $config -}} {{- $styleArr := (.Scratch.Get "this").styleArr | default slice -}} {{- $styleArr | append ".lg-toolbar .lg-icon::after { color: #999; }" | .Scratch.SetInMap "this" "styleArr" -}} @@ -66,21 +66,21 @@ {{- /* clipboard.js */ -}} {{- if ne $code.copy false -}} {{- $source := $cdn.clipboardJS | default "lib/clipboard/clipboard.min.js" -}} - {{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" .Scratch "data" | partial "scratch/script.html" -}} + {{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} {{- $config = T "copyToClipboard" | dict "copyTitle" | dict "code" | merge $config -}} {{- end -}} {{- /* Sharer.js */ -}} {{- if $params.share.enable -}} {{- $source := $cdn.sharerJS | default "lib/sharer/sharer.min.js" -}} - {{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" .Scratch "data" | partial "scratch/script.html" -}} + {{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} {{- end -}} {{- /* TypeIt */ -}} {{- with (.Scratch.Get "this").typeitMap -}} {{- $typeit := $.Site.Params.typeit -}} {{- $source := $cdn.typeitJS | default "lib/typeit/typeit.min.js" -}} - {{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}} + {{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" $.Scratch "Data" | partial "scratch/script.html" -}} {{- $config = dict "speed" $typeit.speed "cursorSpeed" $typeit.cursorSpeed "cursorChar" $typeit.cursorChar "duration" $typeit.duration "data" . | dict "typeit" | merge $config -}} {{- end -}} @@ -93,20 +93,20 @@ {{- end -}} {{- if $math.enable -}} {{- $source := $cdn.katexCSS | default "lib/katex/katex.min.css" -}} - {{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" .Scratch "data" | partial "scratch/style.html" -}} + {{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}} {{- $source := $cdn.katexJS | default "lib/katex/katex.min.js" -}} - {{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" .Scratch "data" | partial "scratch/script.html" -}} + {{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} {{- $source := $cdn.katexAutoRenderJS | default "lib/katex/auto-render.min.js" -}} - {{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" .Scratch "data" | partial "scratch/script.html" -}} + {{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} {{- if $math.copyTex -}} {{- $source := $cdn.katexCopyTexCSS | default "lib/katex/copy-tex.min.css" -}} - {{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" .Scratch "data" | partial "scratch/style.html" -}} + {{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}} {{- $source := $cdn.katexCopyTexJS | default "lib/katex/copy-tex.min.js" -}} - {{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" .Scratch "data" | partial "scratch/script.html" -}} + {{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} {{- end -}} {{- if $math.mhchem -}} {{- $source := $cdn.katexMhchemJS | default "lib/katex/mhchem.min.js" -}} - {{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" .Scratch "data" | partial "scratch/script.html" -}} + {{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} {{- end -}} {{- $delimiters := slice (dict "left" "$$" "right" "$$" "display" true) (dict "left" "\\[" "right" "\\]" "display" true) -}} {{- if and $math.blockLeftDelimiter $math.blockRightDelimiter -}} @@ -122,26 +122,26 @@ {{- /* mermaid */ -}} {{- if (.Scratch.Get "this").mermaid -}} {{- $source := $cdn.mermaidJS | default "lib/mermaid/mermaid.min.js" -}} - {{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" .Scratch "data" | partial "scratch/script.html" -}} + {{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} {{- $options := dict "targetPath" "lib/mermaid/mermaid.min.css" "enableSourceMap" true -}} - {{- dict "source" "lib/mermaid/mermaid.scss" "toCSS" $options "fingerprint" $fingerprint | dict "scratch" .Scratch "data" | partial "scratch/style.html" -}} + {{- dict "source" "lib/mermaid/mermaid.scss" "toCSS" $options "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}} {{- end -}} {{- /* ECharts */ -}} {{- if (.Scratch.Get "this").echarts -}} {{- $source := $cdn.echartsJS | default "lib/echarts/echarts.min.js" -}} - {{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" .Scratch "data" | partial "scratch/script.html" -}} + {{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} {{- $source := $cdn.echartsMacaronsJS | default "lib/echarts/macarons.js" -}} - {{- dict "source" $source "minify" true "fingerprint" $fingerprint | dict "scratch" .Scratch "data" | partial "scratch/script.html" -}} + {{- dict "source" $source "minify" true "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} {{- end -}} {{- /* Mapbox GL */ -}} {{- if (.Scratch.Get "this").mapbox -}} {{- $source := $cdn.mapboxGLCSS | default "lib/mapbox-gl/mapbox-gl.min.css" -}} - {{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" .Scratch "data" | partial "scratch/style.html" -}} + {{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}} {{- $source := $cdn.mapboxGLJS | default "lib/mapbox-gl/mapbox-gl.min.js" -}} - {{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" .Scratch "data" | partial "scratch/script.html" -}} - {{- dict "source" "lib/mapbox-gl/mapbox-gl-language.js" "minify" true "fingerprint" $fingerprint | dict "scratch" .Scratch "data" | partial "scratch/script.html" -}} + {{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} + {{- dict "source" "lib/mapbox-gl/mapbox-gl-language.js" "minify" true "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} {{- $config = dict "accessToken" $params.mapbox.accessToken "RTLTextPlugin" "https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.0/mapbox-gl-rtl-text.js" | dict "mapbox" | merge $config -}} {{- end -}} @@ -149,23 +149,23 @@ {{- if (.Scratch.Get "this").music -}} {{- /* APlayer */ -}} {{- $source := $cdn.aplayerCSS | default "lib/aplayer/APlayer.min.css" -}} - {{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" .Scratch "data" | partial "scratch/style.html" -}} + {{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}} {{- $options := dict "targetPath" "lib/aplayer/dark.min.css" "enableSourceMap" true -}} - {{- dict "source" "lib/aplayer/dark.scss" "toCSS" $options "fingerprint" $fingerprint | dict "scratch" .Scratch "data" | partial "scratch/style.html" -}} + {{- dict "source" "lib/aplayer/dark.scss" "toCSS" $options "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}} {{- $source := $cdn.aplayerJS | default "lib/aplayer/APlayer.min.js" -}} - {{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" .Scratch "data" | partial "scratch/script.html" -}} + {{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} {{- /* MetingJS */ -}} {{- $source := $cdn.metingJS | default "lib/meting/Meting.min.js" -}} - {{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" .Scratch "data" | partial "scratch/script.html" -}} + {{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} {{- end -}} {{- /* Cookie Consent */ -}} {{- if .Site.Params.cookieconsent | and .Site.Params.cookieconsent.enable -}} {{- $source := $cdn.cookieconsentCSS | default "lib/cookieconsent/cookieconsent.min.css" -}} - {{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" .Scratch "data" | partial "scratch/style.html" -}} + {{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}} {{- $source := $cdn.cookieconsentJS | default "lib/cookieconsent/cookieconsent.min.js" -}} - {{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" .Scratch "data" | partial "scratch/script.html" -}} + {{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} {{- $cookieconsentConfig := dict "popup" (dict "background" "#1aa3ff") "button" (dict "background" "#f0f0f0") | dict "theme" "edgeless" "palette" -}} {{- $cookieconsentConfig = .Site.Params.cookieconsent | merge $cookieconsentConfig -}} {{- $cookieconsentConfig = dict "message" ($cookieconsentConfig.content.message | default (T "cookieconsentMessage")) "dismiss" ($cookieconsentConfig.content.dismiss | default (T "cookieconsentDismiss")) "link" ($cookieconsentConfig.content.link | default (T "cookieconsentLink")) | dict "content" | merge $cookieconsentConfig -}} @@ -173,26 +173,26 @@ {{- end -}} {{- range $params.library.css -}} - {{- dict "source" . "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/style.html" -}} + {{- dict "source" . "fingerprint" $fingerprint | dict "Scratch" $.Scratch "Data" | partial "scratch/style.html" -}} {{- end -}} {{- range $params.library.js -}} - {{- dict "source" . "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}} + {{- dict "source" . "fingerprint" $fingerprint | dict "Scratch" $.Scratch "Data" | partial "scratch/script.html" -}} {{- end -}} {{- with (.Scratch.Get "this").styleArr -}} - {{- delimit . "" | dict "content" | dict "scratch" $.Scratch "data" | partial "scratch/style.html" -}} + {{- delimit . "" | dict "content" | dict "Scratch" $.Scratch "Data" | partial "scratch/style.html" -}} {{- end -}} {{- /* Config script */ -}} -{{- $config | jsonify | printf "window.config=%s;" | dict "content" | dict "scratch" .Scratch "data" | partial "scratch/script.html" -}} +{{- $config | jsonify | printf "window.config=%s;" | dict "content" | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} {{- /* Theme script */ -}} -{{- dict "source" "js/theme.min.js" "fingerprint" $fingerprint | dict "scratch" .Scratch "data" | partial "scratch/script.html" -}} +{{- dict "source" "js/theme.min.js" "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} {{- $_ := (resources.Get "js/theme.min.js.map").RelPermalink -}} {{- with (.Scratch.Get "this").scriptArr -}} - {{- delimit . "\n" | dict "content" | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}} + {{- delimit . "\n" | dict "content" | dict "Scratch" $.Scratch "Data" | partial "scratch/script.html" -}} {{- end -}} {{- range (.Scratch.Get "this").style -}} diff --git a/layouts/partials/comment.html b/layouts/partials/comment.html index 5bba1c3d..12397692 100644 --- a/layouts/partials/comment.html +++ b/layouts/partials/comment.html @@ -10,7 +10,7 @@ {{- if $disqus.enable -}}
{{- $source := printf "https://%v.disqus.com/embed.js" $disqus.shortname -}} - {{- dict "source" $source "defer" true | dict "scratch" .Scratch "data" | partial "scratch/script.html" -}} + {{- dict "source" $source "defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} @@ -21,9 +21,9 @@ {{- if $gitalk.enable -}}
{{- $source := $cdn.gitalkCSS | default "lib/gitalk/gitalk.css" -}} - {{- dict "source" $source "minify" true "fingerprint" $fingerprint | dict "scratch" .Scratch "data" | partial "scratch/style.html" -}} + {{- dict "source" $source "minify" true "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}} {{- $source := $cdn.gitalkJS | default "lib/gitalk/gitalk.min.js" -}} - {{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" .Scratch "data" | partial "scratch/script.html" -}} + {{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} {{- $commentConfig = dict "id" .Date "title" .Title "clientID" $gitalk.clientId "clientSecret" $gitalk.clientSecret "repo" $gitalk.repo "owner" $gitalk.owner "admin" (slice $gitalk.owner) | dict "gitalk" | merge $commentConfig -}}

{{- $source := printf "https://connect.facebook.net/%v/sdk.js#xfbml=1&version=v5.0&appId=%v&autoLogAppEvents=1" ($facebook.languageCode | default (T "facebookLanguageCode")) $facebook.appId -}} - {{- dict "source" $source "defer" true | dict "scratch" .Scratch "data" | partial "scratch/script.html" -}} + {{- dict "source" $source "defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} @@ -95,7 +95,7 @@ {{- if $telegram.outlined -}} {{- $attr = printf `%v data-outlined="1"` $attr -}} {{- end -}} - {{- dict "source" "https://comments.app/js/widget.js?2" "defer" true "attr" $attr | dict "scratch" .Scratch "data" | partial "scratch/script.html" -}} + {{- dict "source" "https://comments.app/js/widget.js?2" "defer" true "attr" $attr | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} @@ -105,7 +105,7 @@ {{- $commento := $comment.commento | default dict -}} {{- if $commento.enable -}}
- {{- dict "source" "https://cdn.commento.io/js/commento.js" "defer" true | dict "scratch" .Scratch "data" | partial "scratch/script.html" -}} + {{- dict "source" "https://cdn.commento.io/js/commento.js" "defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} diff --git a/layouts/partials/function/content.html b/layouts/partials/function/content.html index fa75ae41..f1d7ce81 100644 --- a/layouts/partials/function/content.html +++ b/layouts/partials/function/content.html @@ -1,14 +1,14 @@ -{{- $content := .content -}} +{{- $content := .Content -}} -{{- if .ruby -}} +{{- if .Ruby -}} {{- $content = partial "function/ruby.html" $content -}} {{- end -}} -{{- if .fraction -}} +{{- if .Fraction -}} {{- $content = partial "function/fraction.html" $content -}} {{- end -}} -{{- if .fontawesome -}} +{{- if .Fontawesome -}} {{- $content = partial "function/fontawesome.html" $content -}} {{- end -}} diff --git a/layouts/partials/function/id.html b/layouts/partials/function/id.html index 7e0d0f96..e84ef9c2 100644 --- a/layouts/partials/function/id.html +++ b/layouts/partials/function/id.html @@ -1,8 +1,8 @@ {{- /* ID */ -}} -{{- $count := (.scratch.Get "this").count | default 1 -}} +{{- $count := (.Scratch.Get "this").count | default 1 -}} {{- $id := printf "id-%d" $count -}} -{{- $count | add 1 | .scratch.SetInMap "this" "count" -}} -{{- with .content -}} - {{- dict $id . | dict "data" | dict "config" | merge ($.scratch.Get "this") | $.scratch.Set "this" -}} +{{- $count | add 1 | .Scratch.SetInMap "this" "count" -}} +{{- with .Content -}} + {{- dict $id . | dict "data" | dict "config" | merge ($.Scratch.Get "this") | $.Scratch.Set "this" -}} {{- end -}} {{- return $id -}} diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 55dd4893..fff4e18b 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -11,7 +11,7 @@ {{ . | safeHTML }} {{- end -}} {{- if .typeit -}} - {{- $id := dict "content" .name "scratch" $.Scratch | partial "function/id.html" -}} + {{- $id := dict "Content" .name "Scratch" $.Scratch | partial "function/id.html" -}} {{- dict $id (slice $id) | dict "typeitMap" | merge ($.Scratch.Get "this") | $.Scratch.Set "this" -}} {{- else -}} @@ -95,7 +95,7 @@ {{ . | safeHTML }} {{- end -}} {{- if .typeit -}} - {{- $id := dict "content" .name "scratch" $.Scratch | partial "function/id.html" -}} + {{- $id := dict "Content" .name "Scratch" $.Scratch | partial "function/id.html" -}} {{- dict $id (slice $id) | dict "typeitMap" | merge ($.Scratch.Get "this") | $.Scratch.Set "this" -}} {{- else -}} diff --git a/layouts/partials/home/profile.html b/layouts/partials/home/profile.html index e3bd2d49..ef8afcf0 100644 --- a/layouts/partials/home/profile.html +++ b/layouts/partials/home/profile.html @@ -30,7 +30,7 @@ {{- with $profile.subtitle -}}

{{- if $profile.typeit -}} - {{- $id := dict "content" . "scratch" $.Scratch | partial "function/id.html" -}} + {{- $id := dict "Content" . "Scratch" $.Scratch | partial "function/id.html" -}}
{{- dict $id (slice $id) | dict "typeitMap" | merge ($.Scratch.Get "this") | $.Scratch.Set "this" -}} {{- else -}} diff --git a/layouts/partials/plugin/compatibility.html b/layouts/partials/plugin/compatibility.html index 7dd3bb65..bc134383 100644 --- a/layouts/partials/plugin/compatibility.html +++ b/layouts/partials/plugin/compatibility.html @@ -11,12 +11,12 @@ {{- end -}} {{- end -}} {{- with $features | uniq -}} - {{- delimit . "%2C" | printf "https://polyfill.io/v3/polyfill.min.js?features=%v" | dict "source" | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}} + {{- delimit . "%2C" | printf "https://polyfill.io/v3/polyfill.min.js?features=%v" | dict "source" | dict "Scratch" $.Scratch "Data" | partial "scratch/script.html" -}} {{- end -}} {{- end -}} {{- /* object-fit-images */ -}} {{- if $compatibility.objectFit -}} {{- $source := $cdn.objectFitImagesJS | default "lib/object-fit-images/ofi.min.js" -}} - {{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" .Scratch "data" | partial "scratch/script.html" -}} + {{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} {{- end -}} diff --git a/layouts/partials/rss/item.html b/layouts/partials/rss/item.html index 82d3bbaf..28256b49 100644 --- a/layouts/partials/rss/item.html +++ b/layouts/partials/rss/item.html @@ -1,19 +1,19 @@ -{{- $params := .page.Params | merge .site.Params.page | merge (dict "author" .site.Author.name) -}} +{{- $params := .Page.Params | merge .Site.Params.Page | merge (dict "author" .Site.Author.name) -}} - {{- .page.Title -}} + {{- .Page.Title -}} - {{- .page.Permalink -}} + {{- .Page.Permalink -}} - {{- .page.Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" -}} + {{- .Page.Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" -}} {{- .params.author | default (T "author") -}} - {{- .page.Permalink -}} + {{- .Page.Permalink -}} {{- " {{- end -}} - {{- $content := .page.Description -}} + {{- $content := .Page.Description -}} {{- if $params.rssFullText -}} - {{- $content = dict "content" .page.Content "ruby" $params.ruby "fraction" $params.fraction "fontawesome" $params.fontawesome | partial "function/content.html" -}} + {{- $content = dict "Content" .Page.Content "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" -}} {{- else -}} - {{- with .page.Summary -}} - {{- $content = dict "content" . "ruby" $params.ruby "fraction" $params.fraction "fontawesome" $params.fontawesome | partial "function/content.html" -}} + {{- with .Page.Summary -}} + {{- $content = dict "Content" . "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" -}} {{- end -}} {{- end -}} {{- $content | replaceRE `]*>.*` "" | replaceRE `]*( /)?>` "" | safeHTML -}} diff --git a/layouts/partials/scratch/script.html b/layouts/partials/scratch/script.html index 6665ff2c..480ad2f5 100644 --- a/layouts/partials/scratch/script.html +++ b/layouts/partials/scratch/script.html @@ -1,4 +1,4 @@ -{{- $this := .scratch.Get "this" -}} +{{- $this := .Scratch.Get "this" -}} {{- $script := $this.script | default slice -}} -{{- $script = $script | append (slice .data) -}} -{{- .scratch.SetInMap "this" "script" $script -}} +{{- $script = $script | append (slice .Data) -}} +{{- .Scratch.SetInMap "this" "script" $script -}} diff --git a/layouts/partials/scratch/style.html b/layouts/partials/scratch/style.html index 380c7388..8989ce1d 100644 --- a/layouts/partials/scratch/style.html +++ b/layouts/partials/scratch/style.html @@ -1,4 +1,4 @@ -{{- $this := .scratch.Get "this" -}} +{{- $this := .Scratch.Get "this" -}} {{- $style := $this.style | default slice -}} -{{- $style = $style | append (slice .data) -}} -{{- .scratch.SetInMap "this" "style" $style -}} +{{- $style = $style | append (slice .Data) -}} +{{- .Scratch.SetInMap "this" "style" $style -}} diff --git a/layouts/posts/rss.xml b/layouts/posts/rss.xml index 674570c8..454cdec4 100644 --- a/layouts/posts/rss.xml +++ b/layouts/posts/rss.xml @@ -35,7 +35,7 @@ {{- end -}} {{- range .Pages | first (.Site.Params.section.rss | default 10) -}} - {{- dict "page" . "site" .Site | partial "rss/item.html" -}} + {{- dict "Page" . "Site" .Site | partial "rss/item.html" -}} {{- end -}} diff --git a/layouts/posts/single.html b/layouts/posts/single.html index feeefaab..814d37cd 100644 --- a/layouts/posts/single.html +++ b/layouts/posts/single.html @@ -78,14 +78,14 @@
- {{- dict "content" .TableOfContents "ruby" $params.ruby "fraction" $params.fraction "fontawesome" $params.fontawesome | partial "function/content.html" | safeHTML -}} + {{- dict "Content" .TableOfContents "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" | safeHTML -}}
{{- end -}} {{- /* Content */ -}}
- {{- dict "content" .Content "ruby" $params.ruby "fraction" $params.fraction "fontawesome" $params.fontawesome | partial "function/content.html" | safeHTML -}} + {{- dict "Content" .Content "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" | safeHTML -}}
{{- /* Footer */ -}} diff --git a/layouts/shortcodes/echarts.html b/layouts/shortcodes/echarts.html index 7e9023b1..f13be360 100644 --- a/layouts/shortcodes/echarts.html +++ b/layouts/shortcodes/echarts.html @@ -1,5 +1,5 @@ {{- $content := .Inner | transform.Unmarshal | jsonify -}} -{{- $id := dict "content" $content "scratch" .Page.Scratch | partial "function/id.html" -}} +{{- $id := dict "Content" $content "Scratch" .Page.Scratch | partial "function/id.html" -}} {{- $width := cond .IsNamedParams (.Get "width") (.Get 0) | default "100%" -}} {{- $height := cond .IsNamedParams (.Get "height") (.Get 1) | default "30rem" -}}
diff --git a/layouts/shortcodes/mapbox.html b/layouts/shortcodes/mapbox.html index 1104c5fa..516d3703 100644 --- a/layouts/shortcodes/mapbox.html +++ b/layouts/shortcodes/mapbox.html @@ -28,6 +28,6 @@ {{- end -}} {{- $darkStyle = $darkStyle | default $lightStyle -}} {{- $options := dict "lng" $lng "lat" $lat "zoom" $zoom "marked" $marked "lightStyle" $lightStyle "darkStyle" $darkStyle "geolocate" $geolocate "navigation" $navigation "scale" $scale "fullscreen" $fullscreen -}} -{{- $id := dict "content" $options "scratch" .Page.Scratch | partial "function/id.html" -}} +{{- $id := dict "Content" $options "Scratch" .Page.Scratch | partial "function/id.html" -}}
{{- .Page.Scratch.SetInMap "this" "mapbox" true -}} diff --git a/layouts/shortcodes/mermaid.html b/layouts/shortcodes/mermaid.html index 89daa54f..e96ead70 100644 --- a/layouts/shortcodes/mermaid.html +++ b/layouts/shortcodes/mermaid.html @@ -1,3 +1,3 @@ -{{- $id := dict "content" (trim .Inner "\n") "scratch" .Page.Scratch | partial "function/id.html" -}} +{{- $id := dict "Content" (trim .Inner "\n") "Scratch" .Page.Scratch | partial "function/id.html" -}}
{{- .Page.Scratch.SetInMap "this" "mermaid" true -}} diff --git a/layouts/shortcodes/style.html b/layouts/shortcodes/style.html index b1b3f8d2..0ac49197 100644 --- a/layouts/shortcodes/style.html +++ b/layouts/shortcodes/style.html @@ -1,5 +1,5 @@ {{- $content := .Inner | .Page.RenderString -}} -{{- $id := dict "scratch" .Page.Scratch | partial "function/id.html" -}} +{{- $id := dict "Scratch" .Page.Scratch | partial "function/id.html" -}} {{- $tag := .Get 1 | default "div" -}} {{- printf `<%v id="%v">%v` $tag $id $content $tag | safeHTML -}} diff --git a/layouts/shortcodes/typeit.html b/layouts/shortcodes/typeit.html index a3d7da5c..1d2ea012 100644 --- a/layouts/shortcodes/typeit.html +++ b/layouts/shortcodes/typeit.html @@ -19,7 +19,7 @@ {{- end -}} {{- /* trim the newline */ -}} -{{- $id := dict "content" $content "scratch" .Page.Scratch | partial "function/id.html" -}} +{{- $id := dict "Content" $content "Scratch" .Page.Scratch | partial "function/id.html" -}} {{- $key := .Get "group" | string | default $id -}} {{- $typeitMap := (.Page.Scratch.Get "this").typeitMap | default dict -}} {{- $group := index $typeitMap $key -}} diff --git a/layouts/taxonomy/rss.xml b/layouts/taxonomy/rss.xml index 362c5206..a597e569 100644 --- a/layouts/taxonomy/rss.xml +++ b/layouts/taxonomy/rss.xml @@ -35,7 +35,7 @@ {{- end -}} {{- range .Pages | first (.Site.Params.list.rss | default 10) -}} - {{- dict "page" . "site" .Site | partial "rss/item.html" -}} + {{- dict "Page" . "Site" .Site | partial "rss/item.html" -}} {{- end -}}