chore: refactor some code

This commit is contained in:
Dillon 2020-05-18 21:30:33 +08:00
parent c1016df5d6
commit 8f53c999e5
23 changed files with 90 additions and 90 deletions

View file

@ -15,7 +15,7 @@
{{- /* Content */ -}} {{- /* Content */ -}}
<div class="content" id="content"> <div class="content" id="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 -}}
</div> </div>
{{- /* Comment */ -}} {{- /* Comment */ -}}

View file

@ -44,7 +44,7 @@
{{- /* Summary content */ -}} {{- /* Summary content */ -}}
<div class="content"> <div class="content">
{{- with .Summary -}} {{- 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 -}} {{- else -}}
{{- .Description | safeHTML -}} {{- .Description | safeHTML -}}
{{- end -}} {{- end -}}

View file

@ -13,7 +13,7 @@
{{- if .Content -}} {{- if .Content -}}
<div class="single"> <div class="single">
<div class="content" id="content"> <div class="content" id="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 -}}
</div> </div>
</div> </div>
{{- end -}} {{- end -}}

View file

@ -18,7 +18,7 @@
{{- end -}} {{- end -}}
{{- $params := .Params | merge $.Site.Params.page -}} {{- $params := .Params | merge $.Site.Params.page -}}
{{/* Extended Markdown syntax */}} {{/* 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 */}} {{/* Remove line number for code */}}
{{- $content = $content | replaceRE `<span class="lnt?"> *\d*\n?</span>` "" -}} {{- $content = $content | replaceRE `<span class="lnt?"> *\d*\n?</span>` "" -}}
{{- range $i, $contenti := split $content "<h2 id=" -}} {{- range $i, $contenti := split $content "<h2 id=" -}}

View file

@ -37,7 +37,7 @@
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }} {{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
{{ end }} {{ end }}
{{- range where .Site.RegularPages "Type" "posts" | first (.Site.Params.home.rss | default 10) -}} {{- 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 -}} {{- end -}}
</channel> </channel>
</rss> </rss>

View file

@ -5,56 +5,56 @@
{{- /* Smooth Scroll */ -}} {{- /* Smooth Scroll */ -}}
{{- $source := $cdn.smoothScrollJS | default "lib/smooth-scroll/smooth-scroll.min.js" -}} {{- $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 */ -}} {{- /* Search */ -}}
{{- if .Site.Params.search | and .Site.Params.search.enable -}} {{- if .Site.Params.search | and .Site.Params.search.enable -}}
{{- $search := .Site.Params.search -}} {{- $search := .Site.Params.search -}}
{{- $source := $cdn.autocompleteJS | default "lib/autocomplete/autocomplete.min.js" -}} {{- $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 -}} {{- $config = dict "maxResultLength" $search.maxResultLength "snippetLength" $search.snippetLength "highlightTag" $search.highlightTag "noResultsFound" (T "noResultsFound") | dict "search" | merge $config -}}
{{- if eq $search.type "lunr" -}} {{- if eq $search.type "lunr" -}}
{{- with .Site.Home.OutputFormats.Get "json" -}} {{- with .Site.Home.OutputFormats.Get "json" -}}
{{- $config = dict "type" "lunr" "lunrIndexURL" .RelPermalink | dict "search" | merge $config -}} {{- $config = dict "type" "lunr" "lunrIndexURL" .RelPermalink | dict "search" | merge $config -}}
{{- end -}} {{- end -}}
{{- $source := $cdn.lunrJS | default "lib/lunr/lunr.min.js" -}} {{- $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" -}} {{- if T "lunrLanguageLib" -}}
{{- $config = T "lunrLanguageCode" | dict "lunrLanguageCode" | dict "search" | merge $config -}} {{- $config = T "lunrLanguageCode" | dict "lunrLanguageCode" | dict "search" | merge $config -}}
{{- with T "lunrSegmentitLib" -}} {{- with T "lunrSegmentitLib" -}}
{{- $config = dict "lunrSegmentitURL" (resources.Get .).RelPermalink | dict "search" | merge $config -}} {{- $config = dict "lunrSegmentitURL" (resources.Get .).RelPermalink | dict "search" | merge $config -}}
{{- end -}} {{- end -}}
{{- dict "source" "lib/lunr/lunr.stemmer.support.js" "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" -}} {{- dict "source" (T "lunrLanguageLib") "minify" true "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- end -}} {{- end -}}
{{- else if eq $search.type "algolia" -}} {{- else if eq $search.type "algolia" -}}
{{- $source := $cdn.algoliasearchJS | default "lib/algoliasearch/algoliasearch-lite.umd.min.js" -}} {{- $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 -}} {{- $config = dict "type" "algolia" "algoliaIndex" $search.algolia.index "algoliaAppID" $search.algolia.appID "algoliaSearchKey" $search.algolia.searchKey | dict "search" | merge $config -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- /* lazysizes */ -}} {{- /* lazysizes */ -}}
{{- $source := $cdn.lazysizesJS | default "lib/lazysizes/lazysizes.min.js" -}} {{- $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 */ -}} {{- /* twemoji */ -}}
{{- if $params.twemoji -}} {{- if $params.twemoji -}}
{{- $source := $cdn.twemojiJS | default "lib/twemoji/twemoji.min.js" -}} {{- $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 -}} {{- $config = dict "twemoji" true | merge $config -}}
{{- end -}} {{- end -}}
{{- /* lightgallery.js */ -}} {{- /* lightgallery.js */ -}}
{{- if $params.lightgallery -}} {{- if $params.lightgallery -}}
{{- $source := $cdn.lightgalleryCSS | default "lib/lightgallery/lightgallery.min.css" -}} {{- $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" -}} {{- $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" -}} {{- $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" -}} {{- $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 -}} {{- $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 := (.Scratch.Get "this").styleArr | default slice -}}
{{- $styleArr | append ".lg-toolbar .lg-icon::after { color: #999; }" | .Scratch.SetInMap "this" "styleArr" -}} {{- $styleArr | append ".lg-toolbar .lg-icon::after { color: #999; }" | .Scratch.SetInMap "this" "styleArr" -}}
@ -66,21 +66,21 @@
{{- /* clipboard.js */ -}} {{- /* clipboard.js */ -}}
{{- if ne $code.copy false -}} {{- if ne $code.copy false -}}
{{- $source := $cdn.clipboardJS | default "lib/clipboard/clipboard.min.js" -}} {{- $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 -}} {{- $config = T "copyToClipboard" | dict "copyTitle" | dict "code" | merge $config -}}
{{- end -}} {{- end -}}
{{- /* Sharer.js */ -}} {{- /* Sharer.js */ -}}
{{- if $params.share.enable -}} {{- if $params.share.enable -}}
{{- $source := $cdn.sharerJS | default "lib/sharer/sharer.min.js" -}} {{- $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 -}} {{- end -}}
{{- /* TypeIt */ -}} {{- /* TypeIt */ -}}
{{- with (.Scratch.Get "this").typeitMap -}} {{- with (.Scratch.Get "this").typeitMap -}}
{{- $typeit := $.Site.Params.typeit -}} {{- $typeit := $.Site.Params.typeit -}}
{{- $source := $cdn.typeitJS | default "lib/typeit/typeit.min.js" -}} {{- $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 -}} {{- $config = dict "speed" $typeit.speed "cursorSpeed" $typeit.cursorSpeed "cursorChar" $typeit.cursorChar "duration" $typeit.duration "data" . | dict "typeit" | merge $config -}}
{{- end -}} {{- end -}}
@ -93,20 +93,20 @@
{{- end -}} {{- end -}}
{{- if $math.enable -}} {{- if $math.enable -}}
{{- $source := $cdn.katexCSS | default "lib/katex/katex.min.css" -}} {{- $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" -}} {{- $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" -}} {{- $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 -}} {{- if $math.copyTex -}}
{{- $source := $cdn.katexCopyTexCSS | default "lib/katex/copy-tex.min.css" -}} {{- $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" -}} {{- $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 -}} {{- end -}}
{{- if $math.mhchem -}} {{- if $math.mhchem -}}
{{- $source := $cdn.katexMhchemJS | default "lib/katex/mhchem.min.js" -}} {{- $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 -}} {{- end -}}
{{- $delimiters := slice (dict "left" "$$" "right" "$$" "display" true) (dict "left" "\\[" "right" "\\]" "display" true) -}} {{- $delimiters := slice (dict "left" "$$" "right" "$$" "display" true) (dict "left" "\\[" "right" "\\]" "display" true) -}}
{{- if and $math.blockLeftDelimiter $math.blockRightDelimiter -}} {{- if and $math.blockLeftDelimiter $math.blockRightDelimiter -}}
@ -122,26 +122,26 @@
{{- /* mermaid */ -}} {{- /* mermaid */ -}}
{{- if (.Scratch.Get "this").mermaid -}} {{- if (.Scratch.Get "this").mermaid -}}
{{- $source := $cdn.mermaidJS | default "lib/mermaid/mermaid.min.js" -}} {{- $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 -}} {{- $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 -}} {{- end -}}
{{- /* ECharts */ -}} {{- /* ECharts */ -}}
{{- if (.Scratch.Get "this").echarts -}} {{- if (.Scratch.Get "this").echarts -}}
{{- $source := $cdn.echartsJS | default "lib/echarts/echarts.min.js" -}} {{- $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" -}} {{- $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 -}} {{- end -}}
{{- /* Mapbox GL */ -}} {{- /* Mapbox GL */ -}}
{{- if (.Scratch.Get "this").mapbox -}} {{- if (.Scratch.Get "this").mapbox -}}
{{- $source := $cdn.mapboxGLCSS | default "lib/mapbox-gl/mapbox-gl.min.css" -}} {{- $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" -}} {{- $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" $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" "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 -}} {{- $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 -}} {{- end -}}
@ -149,23 +149,23 @@
{{- if (.Scratch.Get "this").music -}} {{- if (.Scratch.Get "this").music -}}
{{- /* APlayer */ -}} {{- /* APlayer */ -}}
{{- $source := $cdn.aplayerCSS | default "lib/aplayer/APlayer.min.css" -}} {{- $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 -}} {{- $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" -}} {{- $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 */ -}} {{- /* MetingJS */ -}}
{{- $source := $cdn.metingJS | default "lib/meting/Meting.min.js" -}} {{- $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 -}} {{- end -}}
{{- /* Cookie Consent */ -}} {{- /* Cookie Consent */ -}}
{{- if .Site.Params.cookieconsent | and .Site.Params.cookieconsent.enable -}} {{- if .Site.Params.cookieconsent | and .Site.Params.cookieconsent.enable -}}
{{- $source := $cdn.cookieconsentCSS | default "lib/cookieconsent/cookieconsent.min.css" -}} {{- $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" -}} {{- $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 := dict "popup" (dict "background" "#1aa3ff") "button" (dict "background" "#f0f0f0") | dict "theme" "edgeless" "palette" -}}
{{- $cookieconsentConfig = .Site.Params.cookieconsent | merge $cookieconsentConfig -}} {{- $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 -}} {{- $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 -}} {{- end -}}
{{- range $params.library.css -}} {{- 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 -}} {{- end -}}
{{- range $params.library.js -}} {{- 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 -}} {{- end -}}
{{- with (.Scratch.Get "this").styleArr -}} {{- 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 -}} {{- end -}}
{{- /* Config script */ -}} {{- /* 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 */ -}} {{- /* 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 -}} {{- $_ := (resources.Get "js/theme.min.js.map").RelPermalink -}}
{{- with (.Scratch.Get "this").scriptArr -}} {{- 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 -}} {{- end -}}
{{- range (.Scratch.Get "this").style -}} {{- range (.Scratch.Get "this").style -}}

View file

@ -10,7 +10,7 @@
{{- if $disqus.enable -}} {{- if $disqus.enable -}}
<div id="disqus_thread" class="comment"></div> <div id="disqus_thread" class="comment"></div>
{{- $source := printf "https://%v.disqus.com/embed.js" $disqus.shortname -}} {{- $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" -}}
<noscript> <noscript>
Please enable JavaScript to view the comments powered by <a href="https://disqus.com/?ref_noscript">Disqus</a>. Please enable JavaScript to view the comments powered by <a href="https://disqus.com/?ref_noscript">Disqus</a>.
</noscript> </noscript>
@ -21,9 +21,9 @@
{{- if $gitalk.enable -}} {{- if $gitalk.enable -}}
<div id="gitalk" class="comment"></div> <div id="gitalk" class="comment"></div>
{{- $source := $cdn.gitalkCSS | default "lib/gitalk/gitalk.css" -}} {{- $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" -}} {{- $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 -}} {{- $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 -}}
<noscript> <noscript>
Please enable JavaScript to view the comments powered by <a href="https://github.com/gitalk/gitalk"></a>Gitalk</a>. Please enable JavaScript to view the comments powered by <a href="https://github.com/gitalk/gitalk"></a>Gitalk</a>.
@ -35,9 +35,9 @@
{{- if $valine.enable -}} {{- if $valine.enable -}}
<div id="valine" class="comment"></div> <div id="valine" class="comment"></div>
{{- $options := dict "targetPath" "lib/valine/valine.min.css" -}} {{- $options := dict "targetPath" "lib/valine/valine.min.css" -}}
{{- dict "source" "lib/valine/valine.scss" "toCSS" $options | dict "scratch" .Scratch "data" | partial "scratch/style.html" -}} {{- dict "source" "lib/valine/valine.scss" "toCSS" $options | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
{{- $source := $cdn.valineJS | default "lib/valine/Valine.min.js" -}} {{- $source := $cdn.valineJS | default "lib/valine/Valine.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 "el" "#valine" "appId" $valine.appId "appKey" $valine.appKey "lang" ($valine.lang | default (T "valineLang")) "visitor" $valine.visitor "recordIP" $valine.recordIP "placeholder" ($valine.placeholder | default (T "valinePlaceholder")) "highlight" (ne $valine.highlight false) "enableQQ" $valine.enableQQ | dict "valine" | merge $commentConfig -}} {{- $commentConfig = dict "el" "#valine" "appId" $valine.appId "appKey" $valine.appKey "lang" ($valine.lang | default (T "valineLang")) "visitor" $valine.visitor "recordIP" $valine.recordIP "placeholder" ($valine.placeholder | default (T "valinePlaceholder")) "highlight" (ne $valine.highlight false) "enableQQ" $valine.enableQQ | dict "valine" | merge $commentConfig -}}
{{- with $valine.avatar -}} {{- with $valine.avatar -}}
{{- $commentConfig = dict "avatar" . | dict "valine" | merge $commentConfig -}} {{- $commentConfig = dict "avatar" . | dict "valine" | merge $commentConfig -}}
@ -68,7 +68,7 @@
data-numposts="{{ $facebook.numPosts }}" data-numposts="{{ $facebook.numPosts }}"
></div> ></div>
{{- $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 -}} {{- $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" -}}
<noscript> <noscript>
Please enable JavaScript to view the comments powered by <a href="https://developers.facebook.com/docs/plugins/comments/"></a>Facebook</a>. Please enable JavaScript to view the comments powered by <a href="https://developers.facebook.com/docs/plugins/comments/"></a>Facebook</a>.
</noscript> </noscript>
@ -95,7 +95,7 @@
{{- if $telegram.outlined -}} {{- if $telegram.outlined -}}
{{- $attr = printf `%v data-outlined="1"` $attr -}} {{- $attr = printf `%v data-outlined="1"` $attr -}}
{{- end -}} {{- 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" -}}
<noscript> <noscript>
Please enable JavaScript to view the comments powered by <a href="https://comments.app/">Telegram Comments</a>. Please enable JavaScript to view the comments powered by <a href="https://comments.app/">Telegram Comments</a>.
</noscript> </noscript>
@ -105,7 +105,7 @@
{{- $commento := $comment.commento | default dict -}} {{- $commento := $comment.commento | default dict -}}
{{- if $commento.enable -}} {{- if $commento.enable -}}
<div id="commento"></div> <div id="commento"></div>
{{- 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" -}}
<noscript> <noscript>
Please enable JavaScript to view the comments powered by <a href="https://commento.io/">Commento</a>. Please enable JavaScript to view the comments powered by <a href="https://commento.io/">Commento</a>.
</noscript> </noscript>

View file

@ -1,14 +1,14 @@
{{- $content := .content -}} {{- $content := .Content -}}
{{- if .ruby -}} {{- if .Ruby -}}
{{- $content = partial "function/ruby.html" $content -}} {{- $content = partial "function/ruby.html" $content -}}
{{- end -}} {{- end -}}
{{- if .fraction -}} {{- if .Fraction -}}
{{- $content = partial "function/fraction.html" $content -}} {{- $content = partial "function/fraction.html" $content -}}
{{- end -}} {{- end -}}
{{- if .fontawesome -}} {{- if .Fontawesome -}}
{{- $content = partial "function/fontawesome.html" $content -}} {{- $content = partial "function/fontawesome.html" $content -}}
{{- end -}} {{- end -}}

View file

@ -1,8 +1,8 @@
{{- /* ID */ -}} {{- /* ID */ -}}
{{- $count := (.scratch.Get "this").count | default 1 -}} {{- $count := (.Scratch.Get "this").count | default 1 -}}
{{- $id := printf "id-%d" $count -}} {{- $id := printf "id-%d" $count -}}
{{- $count | add 1 | .scratch.SetInMap "this" "count" -}} {{- $count | add 1 | .Scratch.SetInMap "this" "count" -}}
{{- with .content -}} {{- with .Content -}}
{{- dict $id . | dict "data" | dict "config" | merge ($.scratch.Get "this") | $.scratch.Set "this" -}} {{- dict $id . | dict "data" | dict "config" | merge ($.Scratch.Get "this") | $.Scratch.Set "this" -}}
{{- end -}} {{- end -}}
{{- return $id -}} {{- return $id -}}

View file

@ -11,7 +11,7 @@
<span class="header-title-pre">{{ . | safeHTML }}</span> <span class="header-title-pre">{{ . | safeHTML }}</span>
{{- end -}} {{- end -}}
{{- if .typeit -}} {{- if .typeit -}}
{{- $id := dict "content" .name "scratch" $.Scratch | partial "function/id.html" -}} {{- $id := dict "Content" .name "Scratch" $.Scratch | partial "function/id.html" -}}
<span id="{{ $id }}" class="typeit"></span> <span id="{{ $id }}" class="typeit"></span>
{{- dict $id (slice $id) | dict "typeitMap" | merge ($.Scratch.Get "this") | $.Scratch.Set "this" -}} {{- dict $id (slice $id) | dict "typeitMap" | merge ($.Scratch.Get "this") | $.Scratch.Set "this" -}}
{{- else -}} {{- else -}}
@ -95,7 +95,7 @@
<span class="header-title-pre">{{ . | safeHTML }}</span> <span class="header-title-pre">{{ . | safeHTML }}</span>
{{- end -}} {{- end -}}
{{- if .typeit -}} {{- if .typeit -}}
{{- $id := dict "content" .name "scratch" $.Scratch | partial "function/id.html" -}} {{- $id := dict "Content" .name "Scratch" $.Scratch | partial "function/id.html" -}}
<span id="{{ $id }}" class="typeit"></span> <span id="{{ $id }}" class="typeit"></span>
{{- dict $id (slice $id) | dict "typeitMap" | merge ($.Scratch.Get "this") | $.Scratch.Set "this" -}} {{- dict $id (slice $id) | dict "typeitMap" | merge ($.Scratch.Get "this") | $.Scratch.Set "this" -}}
{{- else -}} {{- else -}}

View file

@ -30,7 +30,7 @@
{{- with $profile.subtitle -}} {{- with $profile.subtitle -}}
<h2 class="home-subtitle"> <h2 class="home-subtitle">
{{- if $profile.typeit -}} {{- if $profile.typeit -}}
{{- $id := dict "content" . "scratch" $.Scratch | partial "function/id.html" -}} {{- $id := dict "Content" . "Scratch" $.Scratch | partial "function/id.html" -}}
<div id="{{ $id }}" class="typeit"></div> <div id="{{ $id }}" class="typeit"></div>
{{- dict $id (slice $id) | dict "typeitMap" | merge ($.Scratch.Get "this") | $.Scratch.Set "this" -}} {{- dict $id (slice $id) | dict "typeitMap" | merge ($.Scratch.Get "this") | $.Scratch.Set "this" -}}
{{- else -}} {{- else -}}

View file

@ -11,12 +11,12 @@
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- with $features | uniq -}} {{- 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 -}}
{{- end -}} {{- end -}}
{{- /* object-fit-images */ -}} {{- /* object-fit-images */ -}}
{{- if $compatibility.objectFit -}} {{- if $compatibility.objectFit -}}
{{- $source := $cdn.objectFitImagesJS | default "lib/object-fit-images/ofi.min.js" -}} {{- $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 -}} {{- end -}}

View file

@ -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) -}}
<item> <item>
<title> <title>
{{- .page.Title -}} {{- .Page.Title -}}
</title> </title>
<link> <link>
{{- .page.Permalink -}} {{- .Page.Permalink -}}
</link> </link>
<pubDate> <pubDate>
{{- .page.Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" -}} {{- .Page.Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" -}}
</pubDate> </pubDate>
<author> <author>
{{- .params.author | default (T "author") -}} {{- .params.author | default (T "author") -}}
</author> </author>
<guid> <guid>
{{- .page.Permalink -}} {{- .Page.Permalink -}}
</guid> </guid>
<description> <description>
{{- "<![CDATA[" | safeHTML -}} {{- "<![CDATA[" | safeHTML -}}
@ -22,12 +22,12 @@
<img src="{{ . | relURL }}" referrerpolicy="no-referrer"> <img src="{{ . | relURL }}" referrerpolicy="no-referrer">
</div> </div>
{{- end -}} {{- end -}}
{{- $content := .page.Description -}} {{- $content := .Page.Description -}}
{{- if $params.rssFullText -}} {{- 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 -}} {{- else -}}
{{- with .page.Summary -}} {{- with .Page.Summary -}}
{{- $content = dict "content" . "ruby" $params.ruby "fraction" $params.fraction "fontawesome" $params.fontawesome | partial "function/content.html" -}} {{- $content = dict "Content" . "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- $content | replaceRE `<figure[^>]*>.*</figure>` "" | replaceRE `<img[^>]*( /)?>` "" | safeHTML -}} {{- $content | replaceRE `<figure[^>]*>.*</figure>` "" | replaceRE `<img[^>]*( /)?>` "" | safeHTML -}}

View file

@ -1,4 +1,4 @@
{{- $this := .scratch.Get "this" -}} {{- $this := .Scratch.Get "this" -}}
{{- $script := $this.script | default slice -}} {{- $script := $this.script | default slice -}}
{{- $script = $script | append (slice .data) -}} {{- $script = $script | append (slice .Data) -}}
{{- .scratch.SetInMap "this" "script" $script -}} {{- .Scratch.SetInMap "this" "script" $script -}}

View file

@ -1,4 +1,4 @@
{{- $this := .scratch.Get "this" -}} {{- $this := .Scratch.Get "this" -}}
{{- $style := $this.style | default slice -}} {{- $style := $this.style | default slice -}}
{{- $style = $style | append (slice .data) -}} {{- $style = $style | append (slice .Data) -}}
{{- .scratch.SetInMap "this" "style" $style -}} {{- .Scratch.SetInMap "this" "style" $style -}}

View file

@ -35,7 +35,7 @@
{{- end -}} {{- end -}}
<atom:link href="{{ .Permalink }}" rel="self" type="application/rss+xml" /> <atom:link href="{{ .Permalink }}" rel="self" type="application/rss+xml" />
{{- range .Pages | first (.Site.Params.section.rss | default 10) -}} {{- 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 -}} {{- end -}}
</channel> </channel>
</rss> </rss>

View file

@ -78,14 +78,14 @@
<span><i class="details-icon fas fa-angle-right"></i></span> <span><i class="details-icon fas fa-angle-right"></i></span>
</div> </div>
<div class="details-content toc-content" id="toc-content-static"> <div class="details-content toc-content" id="toc-content-static">
{{- 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 -}}
</div> </div>
</div> </div>
{{- end -}} {{- end -}}
{{- /* Content */ -}} {{- /* Content */ -}}
<div class="content" id="content"> <div class="content" id="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 -}}
</div> </div>
{{- /* Footer */ -}} {{- /* Footer */ -}}

View file

@ -1,5 +1,5 @@
{{- $content := .Inner | transform.Unmarshal | jsonify -}} {{- $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%" -}} {{- $width := cond .IsNamedParams (.Get "width") (.Get 0) | default "100%" -}}
{{- $height := cond .IsNamedParams (.Get "height") (.Get 1) | default "30rem" -}} {{- $height := cond .IsNamedParams (.Get "height") (.Get 1) | default "30rem" -}}
<div class="echarts" id="{{ $id }}" style="width: {{ $width }}; height: {{ $height }};"></div> <div class="echarts" id="{{ $id }}" style="width: {{ $width }}; height: {{ $height }};"></div>

View file

@ -28,6 +28,6 @@
{{- end -}} {{- end -}}
{{- $darkStyle = $darkStyle | default $lightStyle -}} {{- $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 -}} {{- $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" -}}
<div class="mapbox" id="{{ $id }}" style="width: {{ $width }}; height: {{ $height }};"></div> <div class="mapbox" id="{{ $id }}" style="width: {{ $width }}; height: {{ $height }};"></div>
{{- .Page.Scratch.SetInMap "this" "mapbox" true -}} {{- .Page.Scratch.SetInMap "this" "mapbox" true -}}

View file

@ -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" -}}
<div class="mermaid" id="{{ $id }}"></div> <div class="mermaid" id="{{ $id }}"></div>
{{- .Page.Scratch.SetInMap "this" "mermaid" true -}} {{- .Page.Scratch.SetInMap "this" "mermaid" true -}}

View file

@ -1,5 +1,5 @@
{{- $content := .Inner | .Page.RenderString -}} {{- $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" -}} {{- $tag := .Get 1 | default "div" -}}
{{- printf `<%v id="%v">%v</%v>` $tag $id $content $tag | safeHTML -}} {{- printf `<%v id="%v">%v</%v>` $tag $id $content $tag | safeHTML -}}

View file

@ -19,7 +19,7 @@
{{- end -}} {{- end -}}
{{- /* trim the newline */ -}} {{- /* 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 -}} {{- $key := .Get "group" | string | default $id -}}
{{- $typeitMap := (.Page.Scratch.Get "this").typeitMap | default dict -}} {{- $typeitMap := (.Page.Scratch.Get "this").typeitMap | default dict -}}
{{- $group := index $typeitMap $key -}} {{- $group := index $typeitMap $key -}}

View file

@ -35,7 +35,7 @@
{{- end -}} {{- end -}}
<atom:link href="{{ .Permalink }}" rel="self" type="application/rss+xml" /> <atom:link href="{{ .Permalink }}" rel="self" type="application/rss+xml" />
{{- range .Pages | first (.Site.Params.list.rss | default 10) -}} {{- 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 -}} {{- end -}}
</channel> </channel>
</rss> </rss>