Merge branch 'master' into pr/dclimber/635

# Conflicts:
#	exampleSite/config.toml
#	layouts/partials/plugin/analytics.html
This commit is contained in:
Dillon
2022-06-04 22:47:19 +08:00
2660 changed files with 17816 additions and 24389 deletions

View File

@@ -7,7 +7,7 @@
<h1 id="error-emoji"></h1>
<p class="error-text">
{{- T "pageNotFoundText" -}}&nbsp;
<a href="javascript:void(0);" title="{{ T `back` }}" onclick="window.history.back();"><i class="far fa-hand-point-left fa-fw"></i></a>
<a href="javascript:void(0);" title="{{ T `back` }}" onclick="window.history.back();"><i class="far fa-hand-point-left fa-fw" aria-hidden="true"></i></a>
</p>
</div>
<script type="text/javascript">

View File

@@ -1,10 +1,10 @@
{{- if .Title -}}
<figure>
{{- dict "Src" .Destination "Title" .Text "Caption" .Title "Linked" true "Resources" .Page.Resources | partial "plugin/image.html" -}}
{{- dict "Src" .Destination "Title" .Text "Caption" .Title "Linked" true "Resources" .Page.Resources | partial "plugin/img.html" -}}
<figcaption class="image-caption">
{{- .Title | safeHTML -}}
</figcaption>
</figure>
{{- else -}}
{{- dict "Src" .Destination "Title" .Text "Resources" .Page.Resources | partial "plugin/image.html" -}}
{{- dict "Src" .Destination "Title" .Text "Resources" .Page.Resources | partial "plugin/img.html" -}}
{{- end -}}

View File

@@ -3,4 +3,4 @@
{{- $destination = .RelPermalink -}}
{{- end -}}
{{- $options := dict "Destination" $destination "Title" .Title "Content" .Text -}}
{{- partial "plugin/link.html" $options -}}
{{- partial "plugin/a.html" $options -}}

View File

@@ -6,16 +6,13 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="noodp" />
<meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
<title>
{{- block "title" . }}{{ .Site.Title }}{{ end -}}
</title>
<title>{{ block "title" . }}{{ .Site.Title }}{{ end }}</title>
{{- partial "head/meta.html" . -}}
{{- partial "head/link.html" . -}}
{{- partial "head/seo.html" . -}}
</head>
<body header-desktop="{{ .Site.Params.header.desktopMode }}" header-mobile="{{ .Site.Params.header.mobileMode }}">
<body data-header-desktop="{{ .Site.Params.header.desktopMode }}" data-header-mobile="{{ .Site.Params.header.mobileMode }}">
{{- /* Check theme isDark before body rendering */ -}}
{{- $theme := .Site.Params.defaulttheme -}}
<script type="text/javascript">(window.localStorage && localStorage.getItem('theme') ? localStorage.getItem('theme') === 'dark' : ('{{ $theme }}' === 'auto' ? window.matchMedia('(prefers-color-scheme: dark)').matches : '{{ $theme }}' === 'dark')) && document.body.setAttribute('theme', 'dark');</script>
@@ -36,12 +33,12 @@
<div id="fixed-buttons">
{{- /* top button */ -}}
<a href="#" id="back-to-top" class="fixed-button" title="{{ T `backToTop` }}">
<i class="fas fa-arrow-up fa-fw"></i>
<i class="fas fa-arrow-up fa-fw" aria-hidden="true"></i>
</a>
{{- /* comment button */ -}}
<a href="#" id="view-comments" class="fixed-button" title="{{ T `viewComments` }}">
<i class="fas fa-comment fa-fw"></i>
<i class="fas fa-comment fa-fw" aria-hidden="true"></i>
</a>
</div>

View File

@@ -5,7 +5,7 @@
{{- define "content" -}}
<div class="page archive">
{{- /* Title */ -}}
<h2 class="single-title animated pulse faster">
<h2 class="single-title animate__animated animate__pulse animate__faster">
{{- .Params.Title | default (T .Section) | default .Section | dict "Some" | T "allSome" -}}
</h2>
@@ -22,7 +22,7 @@
{{- range .Pages -}}
<article class="archive-item">
<a href="{{ .RelPermalink }}" class="archive-item-link">
{{- .Title -}}
{{- .Title | emojify -}}
</a>
<span class="archive-item-date">
{{- $.Site.Params.section.dateFormat | default "01-02" | .Date.Format -}}

View File

@@ -4,7 +4,7 @@
{{- $params := .Scratch.Get "params" -}}
<div class="page single special">
{{- /* Title */ -}}
<h1 class="single-title animated pulse faster">
<h1 class="single-title animate__animated animate__pulse animate__faster">
{{- .Title -}}
</h1>

View File

@@ -12,14 +12,14 @@
{{- with $image -}}
<div class="featured-image-preview">
<a href="{{ $.RelPermalink }}">
{{- dict "Src" . "Title" $.Description "Resources" $.Resources | partial "plugin/image.html" -}}
{{- dict "Src" . "Title" $.Description "Resources" $.Resources | partial "plugin/img.html" -}}
</a>
</div>
{{- end -}}
{{- /* Title */ -}}
<h1 class="single-title" itemprop="name headline">
<a href="{{ .RelPermalink }}">{{ .Title }}</a>
<a href="{{ .RelPermalink }}">{{ .Title | emojify }}</a>
</h1>
{{- /* Meta */ -}}
@@ -28,7 +28,7 @@
{{- $authorLink := $params.authorlink | default .Site.Author.link | default .Site.Home.RelPermalink -}}
<span class="post-author">
{{- $options := dict "Class" "author" "Destination" $authorLink "Title" "Author" "Rel" "author" "Icon" (dict "Class" "fas fa-user-circle fa-fw") "Content" $author -}}
{{- partial "plugin/link.html" $options -}}
{{- partial "plugin/a.html" $options -}}
</span>
{{- with .Site.Params.dateFormat | default "2006-01-02" | .PublishDate.Format -}}
@@ -40,7 +40,7 @@
{{- $categories := slice -}}
{{- range .Params.categories -}}
{{- $category := partialCached "function/path.html" . . | printf "/categories/%v" | $.Site.GetPage -}}
{{- $categories = $categories | append (printf `<a href="%v"><i class="far fa-folder fa-fw"></i>%v</a>` $category.RelPermalink $category.Title) -}}
{{- $categories = $categories | append (printf `<a href="%v"><i class="far fa-folder fa-fw" aria-hidden="true"></i>%v</a>` $category.RelPermalink $category.Title) -}}
{{- end -}}
{{- with delimit $categories "&nbsp;" -}}
&nbsp;<span class="post-category">
@@ -63,7 +63,7 @@
<a href="{{ .RelPermalink }}">{{ T "readMore" }}</a>
{{- with .Params.tags -}}
<div class="post-tags">
<i class="fas fa-tags fa-fw"></i>&nbsp;
<i class="fas fa-tags fa-fw" aria-hidden="true"></i>&nbsp;
{{- range $index, $value := . -}}
{{- if gt $index 0 }},&nbsp;{{ end -}}
{{- $tag := partialCached "function/path.html" $value $value | printf "/tags/%v" | $.Site.GetPage -}}

View File

@@ -3,7 +3,7 @@
{{- $profile := .Site.Params.home.profile -}}
{{- $posts := .Site.Params.home.posts -}}
<div class="page home"{{ if ne $posts.enable false }} posts{{ end }}>
<div class="page home"{{ if ne $posts.enable false }} data-home="posts"{{ end }}>
{{- /* Profile */ -}}
{{- if ne $profile.enable false -}}
{{- partial "home/profile.html" . -}}

View File

@@ -3,10 +3,6 @@
{{- $fingerprint := .Scratch.Get "fingerprint" -}}
{{- $config := (.Scratch.Get "this").config -}}
{{- /* 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" -}}
{{- /* Search */ -}}
{{- if .Site.Params.search | and .Site.Params.search.enable -}}
{{- $search := .Site.Params.search -}}
@@ -45,17 +41,17 @@
{{- $config = dict "twemoji" true | merge $config -}}
{{- end -}}
{{- /* lightgallery.js */ -}}
{{- /* lightgallery */ -}}
{{- 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" -}}
{{- $source := $cdn.lightgalleryJS | default "lib/lightgallery/lightgallery.min.js" -}}
{{- 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/plugins/lg-thumbnail.min.js" -}}
{{- 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/plugins/lg-zoom.min.js" -}}
{{- 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 "lightgallery" true | merge $config -}}
{{- end -}}
{{- $code := $params.code | default dict -}}
@@ -77,7 +73,7 @@
{{- /* TypeIt */ -}}
{{- with (.Scratch.Get "this").typeitMap -}}
{{- $typeit := $.Site.Params.typeit -}}
{{- $source := $cdn.typeitJS | default "lib/typeit/typeit.min.js" -}}
{{- $source := $cdn.typeitJS | default "lib/typeit/index.umd.js" -}}
{{- 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 -}}
@@ -94,19 +90,27 @@
{{- 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" -}}
{{- $source := $cdn.katexAutoRenderJS | default "lib/katex/auto-render.min.js" -}}
{{- $source := $cdn.katexAutoRenderJS | default "lib/katex/contrib/auto-render.min.js" -}}
{{- 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" -}}
{{- $source := $cdn.katexCopyTexCSS | default "lib/katex/contrib/copy-tex.min.css" -}}
{{- 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/contrib/copy-tex.min.js" -}}
{{- 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" -}}
{{- $source := $cdn.katexMhchemJS | default "lib/katex/contrib/mhchem.min.js" -}}
{{- 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) -}}
{{- $delimiters = $delimiters | append (dict "left" "\\begin{equation}" "right" "\\end{equation}" "display" true) -}}
{{- $delimiters = $delimiters | append (dict "left" "\\begin{equation*}" "right" "\\end{equation*}" "display" true) -}}
{{- $delimiters = $delimiters | append (dict "left" "\\begin{align}" "right" "\\end{align}" "display" true) -}}
{{- $delimiters = $delimiters | append (dict "left" "\\begin{align*}" "right" "\\end{align*}" "display" true) -}}
{{- $delimiters = $delimiters | append (dict "left" "\\begin{alignat}" "right" "\\end{alignat}" "display" true) -}}
{{- $delimiters = $delimiters | append (dict "left" "\\begin{alignat*}" "right" "\\end{alignat*}" "display" true) -}}
{{- $delimiters = $delimiters | append (dict "left" "\\begin{gather}" "right" "\\end{gather}" "display" true) -}}
{{- $delimiters = $delimiters | append (dict "left" "\\begin{CD}" "right" "\\end{CD}" "display" true) -}}
{{- if and $math.blockLeftDelimiter $math.blockRightDelimiter -}}
{{- $delimiters = $delimiters | append (dict "left" $math.blockLeftDelimiter "right" $math.blockRightDelimiter "display" true) -}}
{{- end -}}
@@ -121,16 +125,16 @@
{{- 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" -}}
{{- $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" -}}
{{- $_ := (resources.Get "lib/mermaid/mermaid.min.js.map").RelPermalink -}}
{{- 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" -}}
{{- $source := $cdn.echartsMacaronsJS | default "lib/echarts/macarons.js" -}}
{{- dict "Source" $source "Minify" true "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- $lightTheme := resources.Get "lib/echarts/theme/light.yml" | transform.Unmarshal -}}
{{- $darkTheme := resources.Get "lib/echarts/theme/dark.yml" | transform.Unmarshal -}}
{{- $config = dict "lightTheme" $lightTheme "darkTheme" $darkTheme | dict "echarts" | merge $config -}}
{{- end -}}
{{- /* Mapbox GL */ -}}
@@ -189,8 +193,7 @@
{{- $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" -}}
{{- $_ := (resources.Get "js/theme.min.js.map").RelPermalink -}}
{{- dict "Source" "js/theme.js" "Minify" true "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- with (.Scratch.Get "this").scriptArr -}}
{{- delimit . "\n" | dict "Content" | dict "Scratch" $.Scratch "Data" | partial "scratch/script.html" -}}

View File

@@ -51,7 +51,7 @@
{{- with $valine.serverURLs -}}
{{- $commentConfig = dict "serverURLs" . | dict "valine" | merge $commentConfig -}}
{{- end -}}
{{- $commentConfig = $valine.emoji | default "google.yml" | printf "data/emoji/%v" | resources.Get | transform.Unmarshal | dict "valine" | merge $commentConfig -}}
{{- $commentConfig = $valine.emoji | default "google.yml" | printf "lib/valine/emoji/%v" | resources.Get | transform.Unmarshal | dict "valine" | merge $commentConfig -}}
<noscript>
Please enable JavaScript to view the comments powered by <a href="https://valine.js.org/">Valine</a>.
</noscript>
@@ -77,51 +77,73 @@
{{- /* Telegram Comments System */ -}}
{{- $telegram := $comment.telegram | default dict -}}
{{- if $telegram.enable -}}
<div id="telegram-comments" class="comment"></div>
{{- $attr := printf `data-comments-app-website="%v"` $telegram.siteID -}}
{{- $attr = printf `%v data-limit="%v"` $attr ($telegram.limit | default 5) -}}
{{- with $telegram.height -}}
{{- $attr = printf `%v data-height="%v"` $attr . -}}
{{- end -}}
{{- with $telegram.color -}}
{{- $attr = printf `%v data-color="%v"` $attr . -}}
{{- end -}}
{{- if $telegram.colorful -}}
{{- $attr = printf `%v data-colorful="1"` $attr -}}
{{- end -}}
{{- if $telegram.dislikes -}}
{{- $attr = printf `%v data-dislikes="1"` $attr -}}
{{- end -}}
{{- 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" -}}
<noscript>
Please enable JavaScript to view the comments powered by <a href="https://comments.app/">Telegram Comments</a>.
</noscript>
<div id="telegram-comments" class="comment">
{{- $attr := printf `data-comments-app-website="%v"` $telegram.siteID -}}
{{- $attr = printf `%v data-limit="%v"` $attr ($telegram.limit | default 5) -}}
{{- with $telegram.height -}}
{{- $attr = printf `%v data-height="%v"` $attr . -}}
{{- end -}}
{{- with $telegram.color -}}
{{- $attr = printf `%v data-color="%v"` $attr . -}}
{{- end -}}
{{- if $telegram.colorful -}}
{{- $attr = printf `%v data-colorful="1"` $attr -}}
{{- end -}}
{{- if $telegram.dislikes -}}
{{- $attr = printf `%v data-dislikes="1"` $attr -}}
{{- end -}}
{{- if $telegram.outlined -}}
{{- $attr = printf `%v data-outlined="1"` $attr -}}
{{- end -}}
{{- dict "Source" "https://comments.app/js/widget.js?3" "Defer" true "Attr" $attr | partial "plugin/script.html" -}}
<noscript>
Please enable JavaScript to view the comments powered by <a href="https://comments.app/">Telegram Comments</a>.
</noscript>
</div>
{{- end -}}
{{- /* Commento Comment System */ -}}
{{- $commento := $comment.commento | default dict -}}
{{- if $commento.enable -}}
<div id="commento"></div>
<div id="commento" class="comment"></div>
{{- dict "Source" "https://cdn.commento.io/js/commento.js" "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
<noscript>
Please enable JavaScript to view the comments powered by <a href="https://commento.io/">Commento</a>.
</noscript>
{{- end -}}
{{- /* Utterances Comment System */ -}}
{{- /* utterances Comment System */ -}}
{{- $utterances := $comment.utterances | default dict -}}
{{- if $utterances.enable -}}
<div id="utterances"></div>
<div id="utterances" class="comment"></div>
{{- $commentConfig = dict "repo" $utterances.repo | dict "utterances" | merge $commentConfig -}}
{{- $commentConfig = $utterances.issueTerm | default "pathname" | dict "issueTerm" | dict "utterances" | merge $commentConfig -}}
{{- $commentConfig = dict "label" $utterances.label | dict "utterances" | merge $commentConfig -}}
{{- $commentConfig = $utterances.lightTheme | default "github-light" | dict "lightTheme" | dict "utterances" | merge $commentConfig -}}
{{- $commentConfig = $utterances.darkTheme | default "github-dark" | dict "darkTheme" | dict "utterances" | merge $commentConfig -}}
<noscript>
Please enable JavaScript to view the comments powered by <a href="https://utteranc.es/">Utterances</a>.
Please enable JavaScript to view the comments powered by <a href="https://utteranc.es/">utterances</a>.
</noscript>
{{- end -}}
{{- /* giscus Comment System */ -}}
{{- $giscus := $comment.giscus | default dict -}}
{{- if $giscus.enable -}}
<div id="giscus" class="comment"></div>
{{- $commentConfig = dict "repo" $giscus.repo | dict "giscus" | merge $commentConfig -}}
{{- $commentConfig = dict "repoId" $giscus.repoId | dict "giscus" | merge $commentConfig -}}
{{- $commentConfig = dict "category" $giscus.category | dict "giscus" | merge $commentConfig -}}
{{- $commentConfig = dict "categoryId" $giscus.categoryId | dict "giscus" | merge $commentConfig -}}
{{- $commentConfig = $giscus.lang | default (T "valineLang") | dict "lang" | dict "giscus" | merge $commentConfig -}}
{{- $commentConfig = $giscus.mapping | default "pathname" | dict "mapping" | dict "giscus" | merge $commentConfig -}}
{{- $commentConfig = $giscus.reactionsEnabled | default "1" | dict "reactionsEnabled" | dict "giscus" | merge $commentConfig -}}
{{- $commentConfig = $giscus.emitMetadata | default "0" | dict "emitMetadata" | dict "giscus" | merge $commentConfig -}}
{{- $commentConfig = $giscus.inputPosition | default "bottom" | dict "inputPosition" | dict "giscus" | merge $commentConfig -}}
{{- $commentConfig = $giscus.lazyLoading | default false | dict "lazyLoading" | dict "giscus" | merge $commentConfig -}}
{{- $commentConfig = $giscus.lightTheme | default "github-light" | dict "lightTheme" | dict "giscus" | merge $commentConfig -}}
{{- $commentConfig = $giscus.darkTheme | default "github-dark" | dict "darkTheme" | dict "giscus" | merge $commentConfig -}}
<noscript>
Please enable JavaScript to view the comments powered by <a href="https://giscus.app">Giscus</a>.
</noscript>
{{- end -}}
</div>

View File

@@ -12,15 +12,15 @@
{{- if ne .Site.Params.footer.hugo false -}}
<div class="footer-line">
{{- $hugo := printf `<a href="https://gohugo.io/" target="_blank" rel="noopener noreffer" title="Hugo %v">Hugo</a>` hugo.Version -}}
{{- $theme := .Scratch.Get "version" | printf `<a href="https://github.com/dillonzq/LoveIt" target="_blank" rel="noopener noreffer" title="LoveIt %v"><i class="far fa-kiss-wink-heart fa-fw"></i> LoveIt</a>` -}}
{{- $theme := .Scratch.Get "version" | printf `<a href="https://github.com/dillonzq/LoveIt" target="_blank" rel="noopener noreffer" title="LoveIt %v"><i class="far fa-kiss-wink-heart fa-fw" aria-hidden="true"></i> LoveIt</a>` -}}
{{- dict "Hugo" $hugo "Theme" $theme | T "poweredBySome" | safeHTML }}
</div>
{{- end -}}
<div class="footer-line">
<div class="footer-line" itemscope itemtype="http://schema.org/CreativeWork">
{{- /* Copyright year */ -}}
{{- if ne .Site.Params.footer.copyright false -}}
<i class="far fa-copyright fa-fw"></i>
<i class="far fa-copyright fa-fw" aria-hidden="true"></i>
{{- with .Site.Params.footer.since -}}
<span itemprop="copyrightYear">
{{- if lt . now.Year }}{{ . }} - {{ end }}{{ now.Year -}}

View File

@@ -1,9 +1,9 @@
{{- /* Checkbox unchecked */ -}}
{{- $old := `<input disabled="" type="checkbox">` -}}
{{- $new := `<i class="far fa-square fa-fw"></i>` -}}
{{- $new := `<i class="far fa-square fa-fw" aria-hidden="true"></i>` -}}
{{- $content := replace . $old $new -}}
{{- /* Checkbox checked */ -}}
{{- $old = `<input checked="" disabled="" type="checkbox">` -}}
{{- $new = `<i class="far fa-check-square fa-fw"></i>` -}}
{{- $new = `<i class="far fa-check-square fa-fw" aria-hidden="true"></i>` -}}
{{- return replace $content $old $new -}}

View File

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

View File

@@ -1,5 +1,5 @@
{{- /* Font Awesome */ -}}
{{- /* :(far fa-circle): -> <i class="far fa-circle fa-fw"></i> */ -}}
{{- /* :(far fa-circle): -> <i class="far fa-circle fa-fw" aria-hidden="true"></i> */ -}}
{{- $REin := ` (:\([\w- ]+?\):)` -}}
{{- $REout := `&nbsp;$1` -}}
@@ -10,5 +10,5 @@
{{- $content = replaceRE $REin $REout . -}}
{{- $REin = `:\(([\w- ]+?)\):` -}}
{{- $REout = `<i class="$1"></i>` -}}
{{- $REout = `<i class="$1" aria-hidden="true"></i>` -}}
{{- return replaceRE $REin $REout $content -}}

View File

@@ -29,23 +29,18 @@
<link rel="feed" href="{{ .RelPermalink }}" type="application/rss+xml" title="{{ $.Site.Title }}">
{{- end -}}
{{- /* normalize.css */ -}}
{{- $source := $cdn.normalizeCSS | default "lib/normalize/normalize.min.css" -}}
{{- $style := dict "Source" $source "Fingerprint" $fingerprint -}}
{{- partial "plugin/style.html" $style -}}
{{- /* style.min.css */ -}}
{{- $style := dict "Source" "css/style.scss" "Fingerprint" $fingerprint -}}
{{- $options := dict "targetPath" "css/style.min.css" "enableSourceMap" true -}}
{{- $style = dict "Context" . "ToCSS" $options | merge $style -}}
{{- partial "plugin/style.html" $style -}}
{{- $options := dict "Source" "css/style.scss" "Fingerprint" $fingerprint -}}
{{- $toCSS := dict "targetPath" "css/style.min.css" "enableSourceMap" true -}}
{{- $options = dict "Context" . "ToCSS" $toCSS | merge $options -}}
{{- partial "plugin/style.html" $options -}}
{{- /* Font Awesome */ -}}
{{- $source := $cdn.fontawesomeFreeCSS | default "lib/fontawesome-free/all.min.css" -}}
{{- $style := dict "Source" $source "Fingerprint" $fingerprint -}}
{{- partial "plugin/style.html" $style -}}
{{- $options := dict "Source" $source "Fingerprint" $fingerprint "Preload" true -}}
{{- partial "plugin/style.html" $options -}}
{{- /* Animate.css */ -}}
{{- $source := $cdn.animateCSS | default "lib/animate/animate.min.css" -}}
{{- $style := dict "Source" $source "Fingerprint" $fingerprint -}}
{{- partial "plugin/style.html" $style -}}
{{- $options := dict "Source" $source "Fingerprint" $fingerprint "Preload" true -}}
{{- partial "plugin/style.html" $options -}}

View File

@@ -5,7 +5,7 @@
<a href="{{ .Site.Home.RelPermalink }}" title="{{ .Site.Title }}">
{{- with .Site.Params.header.title -}}
{{- with .logo -}}
{{- dict "Src" . "Class" "logo" | partial "plugin/image.html" -}}
{{- dict "Src" . "Class" "logo" | partial "plugin/img.html" -}}
{{- end -}}
{{- with .pre -}}
<span class="header-title-pre">{{ . | safeHTML }}</span>
@@ -42,7 +42,7 @@
{{- if .Site.IsMultiLingual -}}
<a href="javascript:void(0);" class="menu-item language" title="{{ T "selectLanguage" }}">
{{- .Language.LanguageName -}}
<i class="fas fa-chevron-right fa-fw"></i>
<i class="fas fa-chevron-right fa-fw" aria-hidden="true"></i>
<select class="language-select" id="language-select-desktop" onchange="location = this.value;">
{{- if eq .Kind "404" -}}
{{- /* https://github.com/dillonzq/LoveIt/issues/378 */ -}}
@@ -66,18 +66,18 @@
<span class="menu-item search" id="search-desktop">
<input type="text" placeholder="{{ .Site.Params.search.placeholder | default (T `searchPlaceholder`) }}" id="search-input-desktop">
<a href="javascript:void(0);" class="search-button search-toggle" id="search-toggle-desktop" title="{{ T `search` }}">
<i class="fas fa-search fa-fw"></i>
<i class="fas fa-search fa-fw" aria-hidden="true"></i>
</a>
<a href="javascript:void(0);" class="search-button search-clear" id="search-clear-desktop" title="{{ T `clear` }}">
<i class="fas fa-times-circle fa-fw"></i>
<i class="fas fa-times-circle fa-fw" aria-hidden="true"></i>
</a>
<span class="search-button search-loading" id="search-loading-desktop">
<i class="fas fa-spinner fa-fw fa-spin"></i>
<i class="fas fa-spinner fa-fw fa-spin" aria-hidden="true"></i>
</span>
</span>
{{- end -}}
<a href="javascript:void(0);" class="menu-item theme-switch" title="{{ T "switchTheme" }}">
<i class="fas fa-adjust fa-fw"></i>
<i class="fas fa-adjust fa-fw" aria-hidden="true"></i>
</a>
</div>
</div>
@@ -92,7 +92,7 @@
<a href="{{ .Site.Home.RelPermalink }}" title="{{ .Site.Title }}">
{{- with .Site.Params.header.title -}}
{{- with .logo -}}
{{- dict "Src" . "Class" "logo" | partial "plugin/image.html" -}}
{{- dict "Src" . "Class" "logo" | partial "plugin/img.html" -}}
{{- end -}}
{{- with .pre -}}
<span class="header-title-pre">{{ . | safeHTML }}</span>
@@ -122,13 +122,13 @@
<div class="search mobile" id="search-mobile">
<input type="text" placeholder="{{ .Site.Params.search.placeholder | default (T `searchPlaceholder`) }}" id="search-input-mobile">
<a href="javascript:void(0);" class="search-button search-toggle" id="search-toggle-mobile" title="{{ T `search` }}">
<i class="fas fa-search fa-fw"></i>
<i class="fas fa-search fa-fw" aria-hidden="true"></i>
</a>
<a href="javascript:void(0);" class="search-button search-clear" id="search-clear-mobile" title="{{ T `clear` }}">
<i class="fas fa-times-circle fa-fw"></i>
<i class="fas fa-times-circle fa-fw" aria-hidden="true"></i>
</a>
<span class="search-button search-loading" id="search-loading-mobile">
<i class="fas fa-spinner fa-fw fa-spin"></i>
<i class="fas fa-spinner fa-fw fa-spin" aria-hidden="true"></i>
</span>
</div>
<a href="javascript:void(0);" class="search-cancel" id="search-cancel-mobile">
@@ -147,12 +147,12 @@
</a>
{{- end -}}
<a href="javascript:void(0);" class="menu-item theme-switch" title="{{ T "switchTheme" }}">
<i class="fas fa-adjust fa-fw"></i>
<i class="fas fa-adjust fa-fw" aria-hidden="true"></i>
</a>
{{- if .Site.IsMultiLingual -}}
<a href="javascript:void(0);" class="menu-item" title="{{ T "selectLanguage" }}">
{{- .Language.LanguageName -}}
<i class="fas fa-chevron-right fa-fw"></i>
<i class="fas fa-chevron-right fa-fw" aria-hidden="true"></i>
<select class="language-select" onchange="location = this.value;">
{{- if eq .Kind "404" -}}
{{- /* https://github.com/dillonzq/LoveIt/issues/378 */ -}}
@@ -175,9 +175,12 @@
</div>
</div>
</header>
<div class="search-dropdown desktop">
<div id="search-dropdown-desktop"></div>
</div>
<div class="search-dropdown mobile">
<div id="search-dropdown-mobile"></div>
</div>
{{- if .Site.Params.search.enable -}}
<div class="search-dropdown desktop">
<div id="search-dropdown-desktop"></div>
</div>
<div class="search-dropdown mobile">
<div id="search-dropdown-mobile"></div>
</div>
{{- end -}}

View File

@@ -13,10 +13,10 @@
{{- $url = .RelPermalink -}}
{{- end -}}
<a href="{{ $url }}"{{ with .Title | default .Name }} title="{{ . }}"{{ end }}{{ if (urls.Parse $url).Host }} rel="noopener noreffer" target="_blank"{{ end }}>
{{- dict "Src" $avatar | partial "plugin/image.html" -}}
{{- dict "Src" $avatar | partial "plugin/img.html" -}}
</a>
{{- else -}}
{{- dict "Src" $avatar | partial "plugin/image.html" -}}
{{- dict "Src" $avatar | partial "plugin/img.html" -}}
{{- end -}}
</div>
{{- end -}}
@@ -28,15 +28,15 @@
{{- end -}}
{{- with $profile.subtitle -}}
<h2 class="home-subtitle">
<div class="home-subtitle">
{{- if $profile.typeit -}}
{{- $id := dict "Content" . "Scratch" $.Scratch | partial "function/id.html" -}}
<div id="{{ $id }}" class="typeit"></div>
{{- dict $id (slice $id) | dict "typeitMap" | merge ($.Scratch.Get "this") | $.Scratch.Set "this" -}}
{{- else -}}
{{- . -}}
{{- . | safeHTML -}}
{{- end -}}
</h2>
</div>
{{- end -}}
{{- if $profile.social -}}

View File

@@ -1,14 +1,4 @@
{{- .Scratch.Set "version" "0.2.10" -}}
{{- /* LoveIt theme version detection */ -}}
{{- $VERSION := "0.2.X" -}}
{{- if eq .Site .Sites.First -}}
{{- if not .Site.Params.version -}}
{{- errorf "Configuration Error 配置文件错误\n\nYou haven't configured the LoveIt version param correctly yet. See https://hugoloveit.com/theme-documentation-basics/#basic-configuration\n你还没有正确配置 LoveIt 的版本参数. 参考 https://hugoloveit.com/zh-cn/theme-documentation-basics/#basic-configuration\n" -}}
{{- else if ne .Site.Params.version $VERSION -}}
{{- errorf (printf "Compatibility Error 兼容性错误\n\n%v -> %v:\nYou have an incompatible update. See https://github.com/dillonzq/LoveIt/releases\n你进行了一次不兼容的更新. 参考 https://github.com/dillonzq/LoveIt/releases\n" .Site.Params.version $VERSION) -}}
{{- end -}}
{{- end -}}
{{- .Scratch.Set "version" "0.2.11" -}}
{{- $params := .Params | merge .Site.Params.page -}}

View File

@@ -20,8 +20,13 @@
{{- dict "Source" ($analytics.fathom.server | default "cdn.usefathom.com" | printf "https://%v/tracker.js") "Async" true "Attr" "id=fathom-script" | partial "plugin/script.html" -}}
{{- end -}}
{{- /* Yandex Metrika */ -}}
{{- with $analytics.yandexMetrika.id -}}
{{- /* Plausible Analytics */ -}}
{{- with $analytics.plausible.dataDomain -}}
{{- dict "Source" "https://plausible.io/js/plausible.js" "Async" true "Defer" true "Attr" ($analytics.plausible.dataDomain | printf `data-domain="%v"`) | partial "plugin/script.html" -}}
{{- end -}}
{{- /* Yandex Metrica */ -}}
{{- with $analytics.yandexMetrica.id -}}
<script type="text/javascript" >
(function(m,e,t,r,i,k,a){m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)};
m[i].l=1*new Date();k=e.createElement(t),a=e.getElementsByTagName(t)[0],k.async=1,k.src=r,a.parentNode.insertBefore(k,a)})
@@ -34,5 +39,4 @@
});
</script>
<noscript><div><img src="https://mc.yandex.ru/watch/{{ . }}" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
{{- end -}}
{{- end -}}

View File

@@ -1,5 +1,5 @@
{{- with .Class -}}
<i class="{{ . }}"></i>
<i class="{{ . }}" aria-hidden="true"></i>
{{- else -}}
{{- $src := .Src -}}
{{- with .Simpleicons -}}
@@ -9,5 +9,5 @@
{{- if (urls.Parse $src).Host | not -}}
{{- $src = (resources.Get $src | minify).RelPermalink -}}
{{- end -}}
<i data-svg-src="{{ $src }}"></i>
<i data-svg-src="{{ $src }}" aria-hidden="true"></i>
{{- end -}}

View File

@@ -1,7 +1,11 @@
{{- /* lazysizes and lightgallery.js */ -}}
{{- /* lazysizes and lightgallery */ -}}
{{- $src := .Src -}}
{{- with dict "Path" .Src "Resources" .Resources | partial "function/resource.html" -}}
{{- $width := .Width -}}
{{- $height := .Height -}}
{{- with dict "Path" $src "Resources" .Resources | partial "function/resource.html" -}}
{{- $src = .RelPermalink -}}
{{- $width = $width | default .Width -}}
{{- $height = $height | default .Height -}}
{{- end -}}
{{- $small := .SrcSmall | default $src -}}
@@ -21,18 +25,22 @@
<img
class="lazyload{{ with .Class }} {{ . }}{{ end }}"
src="{{ $loading.RelPermalink }}"
data-src="{{ .Src | safeURL }}"
data-srcset="{{ $small | safeURL }}, {{ .Src | safeURL }} 1.5x, {{ $large | safeURL }} 2x"
data-src="{{ $src | safeURL }}"
data-srcset="{{ $small | safeURL }}, {{ $src | safeURL }} 1.5x, {{ $large | safeURL }} 2x"
data-sizes="auto"
alt="{{ $alt }}"{{ with .Height }} height="{{ . }}"{{ end }}{{ with .Width }} width="{{ . }}"{{ end }} />
alt="{{ $alt }}"
{{- with $width }} width="{{ . }}"{{ end }}
{{- with $height }} height="{{ . }}"{{ end }} />
</a>
{{- else -}}
<img
class="lazyload{{ with .Class }} {{ . }}{{ end }}"
src="{{ $loading.RelPermalink }}"
data-src="{{ .Src | safeURL }}"
data-srcset="{{ $small | safeURL }}, {{ .Src | safeURL }} 1.5x, {{ $large | safeURL }} 2x"
data-src="{{ $src | safeURL }}"
data-srcset="{{ $small | safeURL }}, {{ $src | safeURL }} 1.5x, {{ $large | safeURL }} 2x"
data-sizes="auto"
alt="{{ $alt }}"
title="{{ .Title | default $alt }}"{{ with .Height }} height="{{ . }}"{{ end }}{{ with .Width }} width="{{ . }}"{{ end }} />
title="{{ .Title | default $alt }}"
{{- with $width }} width="{{ . }}"{{ end }}
{{- with $height }} height="{{ . }}"{{ end }} />
{{- end -}}

View File

@@ -1,25 +1,41 @@
{{- if .Content -}}
<script type="text/javascript">
{{- .Content | safeJS -}}
</script>
{{- else if strings.HasPrefix .Source "<script" -}}
{{- safeHTML .Source -}}
{{- with .Content -}}
<script type="text/javascript">{{ . | safeJS }}</script>
{{- else -}}
{{- $src := .Source -}}
{{- $integrity := .Integrity -}}
{{- if (urls.Parse $src).Host | not -}}
{{- $resource := resources.Get $src -}}
{{- with .Template -}}
{{- $resource = $resource | resources.ExecuteAsTemplate . $.Context -}}
{{- if strings.HasPrefix .Source "<script" -}}
{{- safeHTML .Source -}}
{{- else -}}
{{- $src := .Source -}}
{{- $integrity := .Integrity -}}
{{- if (urls.Parse $src).Host | not -}}
{{- $resource := resources.Get $src -}}
{{- with .Template -}}
{{- $resource = $resource | resources.ExecuteAsTemplate . $.Context -}}
{{- end -}}
{{- if .Minify -}}
{{- $resource = $resource | minify -}}
{{- end -}}
{{- with .Fingerprint -}}
{{- $resource = $resource | fingerprint . -}}
{{- $integrity = $resource.Data.Integrity -}}
{{- end -}}
{{- $src = $resource.RelPermalink -}}
{{- end -}}
{{- if .Minify -}}
{{- $resource = $resource | minify -}}
{{- $attrs := printf `src="%v"` $src -}}
{{- if .Crossorigin -}}
{{- $attrs = ` crossorigin="anonymous"` | add $attrs -}}
{{- end -}}
{{- with .Fingerprint -}}
{{- $resource = $resource | fingerprint . -}}
{{- $integrity = $resource.Data.Integrity -}}
{{- with $integrity -}}
{{- $attrs = printf ` integrity="%v"` . | add $attrs -}}
{{- end -}}
{{- $src = $resource.RelPermalink -}}
{{- if .Async -}}
{{- $attrs = " async" | add $attrs -}}
{{- end -}}
{{- if .Defer -}}
{{- $attrs = " defer" | add $attrs -}}
{{- end -}}
{{- with .Attr -}}
{{- $attrs = add " " . | add $attrs -}}
{{- end -}}
<script type="text/javascript" {{ $attrs | safeHTMLAttr }}></script>
{{- end -}}
<script type="text/javascript" src="{{ $src }}"{{ if .Crossorigin }} crossorigin="anonymous"{{ end }}{{ with $integrity }} integrity="{{ . }}"{{ end }}{{ if .Async }} async{{ end }}{{ if .Defer }} defer{{ end }}{{ with .Attr }} {{ . | safeHTMLAttr }}{{ end }}></script>
{{- end -}}

View File

@@ -106,91 +106,63 @@
</a>
{{- end -}}
{{- /* 016: Digg */ -}}
{{- if $share.Digg -}}
<a href="javascript:void(0);" title="{{ T `shareOn` }} Digg" data-sharer="digg" data-url="{{ .Permalink }}">
{{- dict "Class" "fab fa-digg fa-fw" | partial "plugin/icon.html" -}}
</a>
{{- end -}}
{{- /* 017: StumbleUpon */ -}}
{{- if $share.Stumbleupon -}}
<a href="javascript:void(0);" title="{{ T `shareOn` }} StumbleUpon" data-sharer="stumbleupon" data-url="{{ .Permalink }}" data-title="{{ .Title }}">
{{- dict "Class" "fab fa-stumbleupon fa-fw" | partial "plugin/icon.html" -}}
</a>
{{- end -}}
{{- /* 018: Flipboard */ -}}
{{- /* 016: Flipboard */ -}}
{{- if $share.Flipboard -}}
<a href="javascript:void(0);" title="{{ T `shareOn` }} Flipboard" data-sharer="flipboard" data-url="{{ .Permalink }}" data-title="{{ .Title }}">
{{- dict "Class" "fab fa-flipboard fa-fw" | partial "plugin/icon.html" -}}
</a>
{{- end -}}
{{- /* 019: 微博 */ -}}
{{- /* 017: 微博 */ -}}
{{- if $share.Weibo -}}
<a href="javascript:void(0);" title="{{ T `shareOn` }} 微博" data-sharer="weibo" data-url="{{ .Permalink }}" data-title="{{ .Title }}"{{ with .Params.featuredImage }} data-image="{{ . }}"{{ end }}{{ with .Site.Params.Social.Weibo }} data-ralateuid="{{ . }}"{{ end }}>
{{- dict "Class" "fab fa-weibo fa-fw" | partial "plugin/icon.html" -}}
</a>
{{- end -}}
{{- /* 020: 人人 */ -}}
{{- if $share.Renren -}}
<a href="javascript:void(0);" title="{{ T `shareOn` }} 人人" data-sharer="renren" data-url="{{ .Permalink }}">
{{- dict "Class" "fab fa-renren fa-fw" | partial "plugin/icon.html" -}}
</a>
{{- end -}}
{{- /* 021: Myspace */ -}}
{{- if $share.Myspace -}}
<a href="javascript:void(0);" title="{{ T `shareOn` }} Myspace" data-sharer="myspace" data-url="{{ .Permalink }}" data-title="{{ .Title }}" data-description="{{ .Description }}">
{{- dict "Simpleicons" "myspace" "Prefix" (.Scratch.Get "cdn" | default dict).simpleIconsPrefix | partial "plugin/icon.html" -}}
</a>
{{- end -}}
{{- /* 022: Blogger */ -}}
{{- /* 018: Blogger */ -}}
{{- if $share.Blogger -}}
<a href="javascript:void(0);" title="{{ T `shareOn` }} Blogger" data-sharer="blogger" data-url="{{ .Permalink }}" data-title="{{ .Title }}" data-description="{{ .Description }}">
{{- dict "Class" "fab fa-blogger fa-fw" | partial "plugin/icon.html" -}}
</a>
{{- end -}}
{{- /* 023: 百度 */ -}}
{{- /* 019: 百度 */ -}}
{{- if $share.Baidu -}}
<a href="javascript:void(0);" title="{{ T `shareOn` }} 百度" data-sharer="baidu" data-url="{{ .Permalink }}" data-title="{{ .Title }}">
{{- dict "Simpleicons" "baidu" "Prefix" (.Scratch.Get "cdn" | default dict).simpleIconsPrefix | partial "plugin/icon.html" -}}
</a>
{{- end -}}
{{- /* 024: OK.RU */ -}}
{{- /* 020: OK.RU */ -}}
{{- if $share.Odnoklassniki -}}
<a href="javascript:void(0);" title="{{ T `shareOn` }} OK.RU" data-sharer="okru" data-url="{{ .Permalink }}" data-title="{{ .Title }}">
{{- dict "Class" "fab fa-odnoklassniki fa-fw" | partial "plugin/icon.html" -}}
</a>
{{- end -}}
{{- /* 025: Evernote */ -}}
{{- /* 021: Evernote */ -}}
{{- if $share.Evernote -}}
<a href="javascript:void(0);" title="{{ T `shareOn` }} Evernote" data-sharer="evernote" data-url="{{ .Permalink }}" data-title="{{ .Title }}">
{{- dict "Class" "fab fa-evernote fa-fw" | partial "plugin/icon.html" -}}
</a>
{{- end -}}
{{- /* 026: Skype */ -}}
{{- /* 022: Skype */ -}}
{{- if $share.Skype -}}
<a href="javascript:void(0);" title="{{ T `shareOn` }} Skype" data-sharer="skype" data-url="{{ .Permalink }}" data-title="{{ .Title }}">
{{- dict "Class" "fab fa-skype fa-fw" | partial "plugin/icon.html" -}}
</a>
{{- end -}}
{{- /* 027: Trello */ -}}
{{- /* 023: Trello */ -}}
{{- if $share.Trello -}}
<a href="javascript:void(0);" title="{{ T `shareOn` }} Trello" data-sharer="trello" data-url="{{ .Permalink }}" data-title="{{ .Title }}" data-description="{{ .Description }}">
{{- dict "Class" "fab fa-trello fa-fw" | partial "plugin/icon.html" -}}
</a>
{{- end -}}
{{- /* 028: Mix */ -}}
{{- /* 024: Mix */ -}}
{{- if $share.Mix -}}
<a href="//mix.com/add?url={{ .Permalink }}&amp;description={{ .Title }}" target="_blank" title="{{ T `shareOn` }} Mix">
{{- dict "Class" "fab fa-mix fa-fw" | partial "plugin/icon.html" -}}

View File

@@ -8,4 +8,4 @@
{{- end -}}
{{- $destination = printf (string $template) .Id -}}
{{- end -}}
{{- dict "Destination" $destination "Rel" "me" | merge . | partial "plugin/link.html" -}}
{{- dict "Destination" $destination "Rel" "me" | merge . | partial "plugin/a.html" -}}

View File

@@ -27,5 +27,20 @@
{{- end -}}
{{- $href = $resource.RelPermalink -}}
{{- end -}}
<link rel="stylesheet" href="{{ $href }}"{{ if .Crossorigin }} crossorigin="anonymous"{{ end }}{{ with $integrity }} integrity="{{ . }}"{{ end }}{{ with .Attr }} {{ . | safeHTMLAttr }}{{ end }}>
{{- $attrs := printf `href="%v"` $href -}}
{{- if .Crossorigin -}}
{{- $attrs = ` crossorigin="anonymous"` | add $attrs -}}
{{- end -}}
{{- with $integrity -}}
{{- $attrs = printf ` integrity="%v"` . | add $attrs -}}
{{- end -}}
{{- with .Attr -}}
{{- $attrs = add " " . | add $attrs -}}
{{- end -}}
{{- if .Preload -}}
<link rel="preload" {{ $attrs | safeHTMLAttr }} as="style" onload="this.onload=null;this.rel='stylesheet'">
<noscript><link rel="stylesheet" {{ $attrs | safeHTMLAttr }}></noscript>
{{- else -}}
<link rel="stylesheet" {{ $attrs | safeHTMLAttr }}>
{{- end -}}
{{- end -}}

View File

@@ -10,7 +10,7 @@
{{- .Page.Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" -}}
</pubDate>
<author>
{{- .params.author | default (T "author") -}}
{{- $params.author | default (T "author") -}}
</author>
<guid>
{{- .Page.Permalink -}}
@@ -33,4 +33,4 @@
{{- $content | replaceRE `<figure[^>]*>.*</figure>` "" | replaceRE `<img[^>]*( /)?>` "" | safeHTML -}}
{{- "]]>" | safeHTML -}}
</description>
</item>
</item>

View File

@@ -10,20 +10,20 @@
{{- if $.Site.Params.gitRepo -}}
{{- with $.GitInfo -}}
&nbsp;<a class="git-hash" href="{{ printf `%v/commit/%v` $.Site.Params.gitRepo .Hash }}" target="_blank" title="commit by {{ .AuthorName }}({{ .AuthorEmail }}) {{ .Hash }}: {{ .Subject }}">
<i class="fas fa-hashtag fa-fw"></i>{{- .AbbreviatedHash -}}
<i class="fas fa-hashtag fa-fw" aria-hidden="true"></i>{{- .AbbreviatedHash -}}
</a>
{{- end -}}
{{- end -}}
{{- end -}}
</span>
</div>
{{- with $params.license | string -}}
<div class="post-info-license">
{{- with $params.license | string -}}
<span>
{{- . | safeHTML -}}
</span>
{{- end -}}
<span>
{{- . | safeHTML -}}
</span>
</div>
{{- end -}}
</div>
<div class="post-info-line">
<div class="post-info-md">
@@ -48,7 +48,7 @@
<div class="post-info-more">
<section class="post-tags">
{{- with .Params.tags -}}
<i class="fas fa-tags fa-fw"></i>&nbsp;
<i class="fas fa-tags fa-fw" aria-hidden="true"></i>&nbsp;
{{- range $index, $value := . -}}
{{- if gt $index 0 }},&nbsp;{{ end -}}
{{- $tag := partialCached "function/path.html" $value $value | printf "/tags/%v" | $.Site.GetPage -}}
@@ -62,11 +62,24 @@
</div>
<div class="post-nav">
{{- if .PrevInSection -}}
<a href="{{ .PrevInSection.RelPermalink }}" class="prev" rel="prev" title="{{ .PrevInSection.Title }}"><i class="fas fa-angle-left fa-fw"></i>{{ .PrevInSection.Title }}</a>
{{- $prevPage := false -}}
{{- $nextPage := false -}}
{{- if or (.Params.prev) (.Params.next) -}}
{{- with .Params.prev -}}
{{- $prevPage = $.Site.GetPage . -}}
{{- end -}}
{{- with .Params.next -}}
{{- $nextPage = $.Site.GetPage . -}}
{{- end -}}
{{- else -}}
{{- $prevPage = .PrevInSection -}}
{{- $nextPage = .NextInSection -}}
{{- end -}}
{{ if .NextInSection }}
<a href="{{ .NextInSection.RelPermalink }}" class="next" rel="next" title="{{ .NextInSection.Title }}">{{ .NextInSection.Title }}<i class="fas fa-angle-right fa-fw"></i></a>
{{- with $prevPage -}}
<a href="{{ .RelPermalink }}" class="prev" rel="prev" title="{{ .Title }}"><i class="fas fa-angle-left fa-fw" aria-hidden="true"></i>{{ .Title | emojify }}</a>
{{- end -}}
{{ with $nextPage }}
<a href="{{ .RelPermalink }}" class="next" rel="next" title="{{ .Title }}">{{ .Title | emojify }}<i class="fas fa-angle-right fa-fw" aria-hidden="true"></i></a>
{{- end -}}
</div>
</div>

View File

@@ -20,7 +20,7 @@
<article class="page single">
{{- /* Title */ -}}
<h1 class="single-title animated flipInX">{{ .Title }}</h1>
<h1 class="single-title animate__animated animate__flipInX">{{ .Title | emojify }}</h1>
{{- /* Subtitle */ -}}
{{- with $params.subtitle -}}
@@ -34,13 +34,13 @@
{{- $authorLink := $params.authorlink | default .Site.Author.link | default .Site.Home.RelPermalink -}}
<span class="post-author">
{{- $options := dict "Class" "author" "Destination" $authorLink "Title" "Author" "Rel" "author" "Icon" (dict "Class" "fas fa-user-circle fa-fw") "Content" $author -}}
{{- partial "plugin/link.html" $options -}}
{{- partial "plugin/a.html" $options -}}
</span>
{{- $categories := slice -}}
{{- range .Params.categories -}}
{{- $category := partialCached "function/path.html" . . | printf "/categories/%v" | $.Site.GetPage -}}
{{- $categories = $categories | append (printf `<a href="%v"><i class="far fa-folder fa-fw"></i>%v</a>` $category.RelPermalink $category.Title) -}}
{{- $categories = $categories | append (printf `<a href="%v"><i class="far fa-folder fa-fw" aria-hidden="true"></i>%v</a>` $category.RelPermalink $category.Title) -}}
{{- end -}}
{{- with delimit $categories "&nbsp;" -}}
&nbsp;<span class="post-category">
@@ -50,14 +50,14 @@
</div>
<div class="post-meta-line">
{{- with .Site.Params.dateformat | default "2006-01-02" | .PublishDate.Format -}}
<i class="far fa-calendar-alt fa-fw"></i>&nbsp;<time datetime="{{ . }}">{{ . }}</time>&nbsp;
<i class="far fa-calendar-alt fa-fw" aria-hidden="true"></i>&nbsp;<time datetime="{{ . }}">{{ . }}</time>&nbsp;
{{- end -}}
<i class="fas fa-pencil-alt fa-fw"></i>&nbsp;{{ T "wordCount" .WordCount }}&nbsp;
<i class="far fa-clock fa-fw"></i>&nbsp;{{ T "readingTime" .ReadingTime }}&nbsp;
<i class="fas fa-pencil-alt fa-fw" aria-hidden="true"></i>&nbsp;{{ T "wordCount" .WordCount }}&nbsp;
<i class="far fa-clock fa-fw" aria-hidden="true"></i>&nbsp;{{ T "readingTime" .ReadingTime }}&nbsp;
{{- $comment := .Scratch.Get "comment" | default dict -}}
{{- if $comment.enable | and $comment.valine.enable | and $comment.valine.visitor -}}
<span id="{{ .RelPermalink }}" class="leancloud_visitors" data-flag-title="{{ .Title }}">
<i class="far fa-eye fa-fw"></i>&nbsp;<span class=leancloud-visitors-count></span>&nbsp;{{ T "views" }}
<i class="far fa-eye fa-fw" aria-hidden="true"></i>&nbsp;<span class=leancloud-visitors-count></span>&nbsp;{{ T "views" }}
</span>&nbsp;
{{- end -}}
</div>
@@ -70,16 +70,16 @@
{{- end -}}
{{- with $image -}}
<div class="featured-image">
{{- dict "Src" . "Title" $.Description "Resources" $.Resources | partial "plugin/image.html" -}}
{{- dict "Src" . "Title" $.Description "Resources" $.Resources | partial "plugin/img.html" -}}
</div>
{{- end -}}
{{- /* Static TOC */ -}}
{{- if ne $toc.enable false -}}
<div class="details toc" id="toc-static" kept="{{ if $toc.keepStatic }}true{{ end }}">
<div class="details toc" id="toc-static" data-kept="{{ if $toc.keepStatic }}true{{ end }}">
<div class="details-summary toc-title">
<span>{{ T "contents" }}</span>
<span><i class="details-icon fas fa-angle-right"></i></span>
<span><i class="details-icon fas fa-angle-right" aria-hidden="true"></i></span>
</div>
<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 -}}

View File

@@ -18,7 +18,7 @@
{{- $type := .Get "type" | default "note" -}}
<div class="details admonition {{ $type }}{{ if .Get `open` | ne false }} open{{ end }}">
<div class="details-summary admonition-title">
<i class="icon {{ index $iconMap $type | default (index $iconMap "note") }}"></i>{{ .Get "title" | default (T $type) }}<i class="details-icon {{ $iconDetails }}"></i>
<i class="icon {{ index $iconMap $type | default (index $iconMap "note") }}" aria-hidden="true"></i>{{ .Get "title" | default (T $type) }}<i class="details-icon {{ $iconDetails }}" aria-hidden="true"></i>
</div>
<div class="details-content">
<div class="admonition-content">
@@ -30,7 +30,7 @@
{{- $type := .Get 0 | default "note" -}}
<div class="details admonition {{ $type }}{{ if .Get 2 | ne false }} open{{ end }}">
<div class="details-summary admonition-title">
<i class="icon {{ index $iconMap $type | default (index $iconMap "note") }}"></i>{{ .Get 1 | default (T $type) }}<i class="details-icon {{ $iconDetails }}"></i>
<i class="icon {{ index $iconMap $type | default (index $iconMap "note") }}" aria-hidden="true"></i>{{ .Get 1 | default (T $type) }}<i class="details-icon {{ $iconDetails }}" aria-hidden="true"></i>
</div>
<div class="details-content">
<div class="admonition-content">

View File

@@ -19,11 +19,11 @@
{{- with $caption -}}
<figure{{ with cond $.IsNamedParams ($.Get "class") "" }} class="{{ . }}"{{ end }}>
{{- partial "plugin/image.html" $options -}}
{{- partial "plugin/img.html" $options -}}
<figcaption class="image-caption">
{{- . | safeHTML -}}
</figcaption>
</figure>
{{- else -}}
{{- partial "plugin/image.html" $options -}}
{{- partial "plugin/img.html" $options -}}
{{- end -}}

View File

@@ -12,4 +12,4 @@
{{- $options = dict "Content" (.Get 1 | default (.Get 0)) | merge $options -}}
{{- $options = dict "Title" (.Get 2) | merge $options -}}
{{- end -}}
{{- partial "plugin/link.html" $options -}}
{{- partial "plugin/a.html" $options -}}

View File

@@ -0,0 +1,2 @@
{{- $id := dict "Content" .Inner "Scratch" .Page.Scratch | partial "function/id.html" -}}
<data id="{{ $id }}" data-raw></data>

View File

@@ -1,18 +1,21 @@
{{- $content := trim .Inner "\n" -}}
{{- $classList := .Get "class" | slice -}}
{{- $classList := slice -}}
{{- with .Get "class" -}}
{{- $classList = $classList | append . -}}
{{- end -}}
{{- $tag := .Get "tag" | default "div" -}}
{{- with .Get "code" -}}
{{- if .Get "code" -}}
{{- /* highlight code content without line number */ -}}
{{- $content = highlight $content . "linenos=false" -}}
{{- $content = highlight $content (.Get "code") "lineNos=false, noClasses=false" -}}
{{- /* delete outer label */ -}}
{{- $content = replaceRE `<div class="highlight"><pre class="chroma"><code[^<>]*>(?s)(.*)</code></pre></div>` "$1" $content -}}
{{- /* parsing markdown links */ -}}
{{- $content = replaceRE `(<span[^<>]*>)([^<>]*)\[([^<>]+)\]\(([^<>]+)\)([^<>]*)(</span>)` "$1$2$6<a href=$4>$3</a>$1$5$6" $content -}}
{{- /* replace " " to "&nbsp;" and replace "\n" to "<br />" */ -}}
{{- $content = replaceRE ` ` "&nbsp;" $content | replaceRE `(<\w+)&nbsp;` "$1 " | replaceRE `\n` "<br />" -}}
{{- /* fix "<br />" location error which is a bug of Typeit HTML parser */ -}}
{{- $content = replaceRE `<br /></span>` "</span><br />" $content -}}
{{- $content = replaceRE `.*<code[^<>]*>(?s)(.*)</code>.*` "$1" $content -}}
{{- if .Get "code-link" -}}
{{- /* parsing code links */ -}}
{{- $content = replaceRE `(<span[^<>]*>)([^<>]*)\[([^<>]+)\]\(([^<>]+)\)([^<>]*)(</span>)` "$1$2$6<a href=\"$4\">$3</a>$1$5$6" $content -}}
{{- end -}}
{{- /* split multiline string */ -}}
{{- $content = split $content "\n" -}}
{{- $classList = $classList | append "highlight" -}}
{{- else -}}
{{- $content = $content | .Page.RenderString -}}
@@ -26,6 +29,11 @@
{{- $group = $group | default slice | append $id -}}
{{- dict $key $group | merge $typeitMap | .Page.Scratch.SetInMap "this" "typeitMap" -}}
{{- $attrs := printf `id="%v"` $id -}}
{{- with $classList -}}
{{- $attrs = delimit $classList " " | printf `%v class="%v"` $attrs -}}
{{- end -}}
<div class="typeit">
{{- printf `<%v id="%v" class="%v"></%v>` $tag $id (delimit $classList " ") $tag | safeHTML -}}
{{- printf `<%v %v></%v>` $tag $attrs $tag | safeHTML -}}
</div>

View File

@@ -9,5 +9,5 @@
{{- $resource = $resource | resources.ExecuteAsTemplate $path (dict "version" $version "label" $label "color" $color) | minify -}}
{{- $alt := printf "LoveIt %v | %v" $label $version -}}
<a href="{{ $url }}" rel="noopener noreffer" target="_blank">
{{- dict "Src" $resource.RelPermalink "Alt" $alt "Class" "version" | partial "plugin/image.html" -}}
{{- dict "Src" $resource.RelPermalink "Alt" $alt "Class" "version" | partial "plugin/img.html" -}}
</a>

View File

@@ -5,12 +5,12 @@
{{- define "content" -}}
<div class="page archive">
{{- /* Title */ -}}
<h2 class="single-title animated pulse faster">
<h2 class="single-title animate__animated animate__pulse animate__faster">
{{- $taxonomy := .Data.Singular -}}
{{- if eq $taxonomy "category" -}}
<i class="far fa-folder-open fa-fw"></i>&nbsp;{{ .Title }}
<i class="far fa-folder-open fa-fw" aria-hidden="true"></i>&nbsp;{{ .Title }}
{{- else if eq $taxonomy "tag" -}}
<i class="fas fa-tag fa-fw"></i>&nbsp;{{ .Title }}
<i class="fas fa-tag fa-fw" aria-hidden="true"></i>&nbsp;{{ .Title }}
{{- else -}}
{{- printf "%v - %v" (T $taxonomy | default $taxonomy) .Title -}}
{{- end -}}
@@ -29,7 +29,7 @@
{{- range .Pages -}}
<article class="archive-item">
<a href="{{ .RelPermalink }}" class="archive-item-link">
{{- .Title -}}
{{- .Title | emojify -}}
</a>
<span class="archive-item-date">
{{- $.Site.Params.list.dateFormat | default "01-02" | .Date.Format -}}

View File

@@ -9,7 +9,7 @@
<div class="page archive">
{{- /* Title */ -}}
<h2 class="single-title animated pulse faster">
<h2 class="single-title animate__animated animate__pulse animate__faster">
{{- .Params.Title | default (T $taxonomies) | default $taxonomies | dict "Some" | T "allSome" -}}
</h2>
@@ -24,13 +24,13 @@
<div class="card-item-wrapper">
<h3 class="card-item-title">
<a href="{{ .RelPermalink }}">
<i class="far fa-folder fa-fw"></i>&nbsp;{{ .Page.Title }}
<i class="far fa-folder fa-fw" aria-hidden="true"></i>&nbsp;{{ .Page.Title }}
</a>
</h3>
{{- range first 5 $pages -}}
<article class="archive-item">
<a href="{{ .RelPermalink }}" class="archive-item-link">
{{- .Title -}}
{{- .Title | emojify -}}
</a>
</article>
{{- end -}}