Merge pull request #303 from dillonzq/develop

This commit is contained in:
Dillon 2020-05-01 23:56:01 +08:00 committed by GitHub
commit e3d774fb65
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
42 changed files with 184 additions and 175 deletions

View file

@ -56,7 +56,8 @@
@include overflow-wrap(break-word);
box-sizing: border-box;
top: if($header-normal-mode-desktop, 5rem, 10rem);
left: $MAX_LENGTH;
left: 0;
visibility: hidden;
@include blur;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -125,6 +125,8 @@ enableEmoji = true
snippetLength = 30
# HTML tag name of the highlight part in results
highlightTag = "em"
# whether to use the absolute URL based on the baseURL in search index
absoluteURL = false
[languages.en.params.search.algolia]
index = "index.en"
appID = "PASDMWALPK"
@ -321,6 +323,8 @@ enableEmoji = true
snippetLength = 50
# 搜索结果中高亮部分的 HTML 标签
highlightTag = "em"
# 是否在搜索索引中使用基于 baseURL 的绝对路径
absoluteURL = false
[languages.zh-cn.params.search.algolia]
index = "index.zh-cn"
appID = "PASDMWALPK"
@ -513,6 +517,8 @@ enableEmoji = true
snippetLength = 30
# HTML tag name of the highlight part in results
highlightTag = "em"
# whether to use the absolute URL based on the baseURL in search index
absoluteURL = false
[languages.fr.params.search.algolia]
index = "index.fr"
appID = "PASDMWALPK"
@ -729,6 +735,9 @@ enableEmoji = true
# whether to show link to Raw Markdown content of the content
# 是否显示原始 Markdown 文档内容的链接
linkToMarkdown = true
# whether to show the full text content in RSS
# 是否在 RSS 中显示全文内容
rssFullText = false
# Table of the contents config
# 目录配置
[params.page.toc]

View file

@ -8,7 +8,7 @@ author: "Dillon"
authorLink: "https://dillonzq.com"
description: "This article shows the basic Markdown syntax and format."
tags: ["Markdown"]
tags: ["Markdown", "HTML"]
categories: ["Markdown"]
featuredImage: "/images/basic-markdown-syntax/featured-image.png"

View file

@ -8,7 +8,7 @@ author: "Dillon"
authorLink: "https://dillonzq.com"
description: "Cet article présente la syntaxe et le format de base de Markdown."
tags: ["Markdown"]
tags: ["Markdown", "HTML"]
categories: ["Markdown"]
featuredImage: "/images/basic-markdown-syntax/featured-image.png"

View file

@ -8,7 +8,7 @@ author: "Dillon"
authorLink: "https://dillonzq.com"
description: "这篇文章展示了基本的 Markdown 语法和格式."
tags: ["Markdown"]
tags: ["Markdown", "HTML"]
categories: ["Markdown"]
featuredImage: "/images/basic-markdown-syntax/featured-image.png"

View file

@ -231,6 +231,8 @@ Please open the code block below to view the complete sample configuration :(far
snippetLength = 30
# {{< version 0.2.1 >}} HTML tag name of the highlight part in results
highlightTag = "em"
# {{< version 0.2.4 >}} whether to use the absolute URL based on the baseURL in search index
absoluteURL = false
[params.search.algolia]
index = ""
appID = ""
@ -401,6 +403,8 @@ Please open the code block below to view the complete sample configuration :(far
fontawesome = true
# whether to show link to Raw Markdown content of the content
linkToMarkdown = true
# {{< version 0.2.4 >}} whether to show the full text content in RSS
rssFullText = false
# {{< version 0.2.0 >}} Table of the contents config
[params.page.toc]
# whether to enable the table of the contents
@ -985,6 +989,8 @@ Here is the search configuration in your [site configuration](#site-configuratio
snippetLength = 30
# {{< version 0.2.1 >}} HTML tag name of the highlight part in results
highlightTag = "em"
# {{< version 0.2.4 >}} whether to use the absolute URL based on the baseURL in search index
absoluteURL = false
[params.search.algolia]
index = ""
appID = ""

View file

@ -236,6 +236,8 @@ Please open the code block below to view the complete sample configuration :(far
snippetLength = 30
# {{< version 0.2.1 >}} HTML tag name of the highlight part in results
highlightTag = "em"
# {{< version 0.2.4 >}} whether to use the absolute URL based on the baseURL in search index
absoluteURL = false
[params.search.algolia]
index = ""
appID = ""
@ -406,6 +408,8 @@ Please open the code block below to view the complete sample configuration :(far
fontawesome = true
# whether to show link to Raw Markdown content of the content
linkToMarkdown = true
# {{< version 0.2.4 >}} whether to show the full text content in RSS
rssFullText = false
# {{< version 0.2.0 >}} Table of the contents config
[params.page.toc]
# whether to enable the table of the contents
@ -990,6 +994,8 @@ Here is the search configuration in your [site configuration](#site-configuratio
snippetLength = 30
# {{< version 0.2.1 >}} HTML tag name of the highlight part in results
highlightTag = "em"
# {{< version 0.2.4 >}} whether to use the absolute URL based on the baseURL in search index
absoluteURL = false
[params.search.algolia]
index = ""
appID = ""

View file

@ -234,6 +234,8 @@ hugo
snippetLength = 50
# {{< version 0.2.1 >}} 搜索结果中高亮部分的 HTML 标签
highlightTag = "em"
# {{< version 0.2.4 >}} 是否在搜索索引中使用基于 baseURL 的绝对路径
absoluteURL = false
[params.search.algolia]
index = ""
appID = ""
@ -404,6 +406,8 @@ hugo
fontawesome = true
# 是否在文章页面显示原始 Markdown 文档链接
linkToMarkdown = true
# {{< version 0.2.4 >}} 是否在 RSS 中显示全文内容
rssFullText = false
# {{< version 0.2.0 >}} 目录配置
[params.page.toc]
# 是否使用目录
@ -990,6 +994,8 @@ defaultContentLanguage = "zh-cn"
snippetLength = 50
# {{< version 0.2.1 >}} 搜索结果中高亮部分的 HTML 标签
highlightTag = "em"
# {{< version 0.2.4 >}} 是否在搜索索引中使用基于 baseURL 的绝对路径
absoluteURL = false
[params.search.algolia]
index = ""
appID = ""

View file

@ -68,6 +68,7 @@ ruby: true
fraction: true
fontawesome: true
linkToMarkdown: true
rssFullText: false
toc:
enable: true
@ -112,7 +113,8 @@ comment:
* **ruby**: {{< version 0.2.0 >}} if `true`, the content will enable the [ruby extended syntax](#ruby).
* **fraction**: {{< version 0.2.0 >}} if `true`, the content will enable the [fraction extended syntax](#fraction).
* **fontawesome**: {{< version 0.2.0 >}} if `true`, the content will enable the [Font Awesome extended syntax](#fontawesome).
* **linkToMarkdown**: if `true`, the footer of the content will show the link to the orignal Markdown file.
* **linkToMarkdown**: if `true`, the footer of the content will be shown the link to the orignal Markdown file.
* **rssFullText**: {{< version 0.2.4 >}} if `true`, the full text content will be shown in RSS.
* **toc**: {{< version 0.2.0 changed >}} the same as the `params.page.toc` part in the [site configuration](../theme-documentation-basics#site-configuration).
* **code**: {{< version 0.2.0 >}} the same as the `params.page.code` part in the [site configuration](../theme-documentation-basics#site-configuration).

View file

@ -73,6 +73,7 @@ ruby: true
fraction: true
fontawesome: true
linkToMarkdown: true
rssFullText: false
toc:
enable: true
@ -117,7 +118,8 @@ comment:
* **ruby**: {{< version 0.2.0 >}} if `true`, the content will enable the [ruby extended syntax](#ruby).
* **fraction**: {{< version 0.2.0 >}} if `true`, the content will enable the [fraction extended syntax](#fraction).
* **fontawesome**: {{< version 0.2.0 >}} if `true`, the content will enable the [Font Awesome extended syntax](#fontawesome).
* **linkToMarkdown**: if `true`, the footer of the content will show the link to the orignal Markdown file.
* **linkToMarkdown**: if `true`, the footer of the content will be shown the link to the orignal Markdown file.
* **rssFullText**: {{< version 0.2.4 >}} if `true`, the full text content will be shown in RSS.
* **toc**: {{< version 0.2.0 changed >}} the same as the `params.page.toc` part in the [site configuration](../theme-documentation-basics#site-configuration).
* **code**: {{< version 0.2.0 >}} the same as the `params.page.code` part in the [site configuration](../theme-documentation-basics#site-configuration).

View file

@ -68,6 +68,7 @@ ruby: true
fraction: true
fontawesome: true
linkToMarkdown: true
rssFullText: false
toc:
enable: true
@ -113,6 +114,7 @@ comment:
* **fraction**: {{< version 0.2.0 >}} 如果设为 `true`, 这篇文章会使用 [分数扩展语法](#fraction).
* **fontawesome**: {{< version 0.2.0 >}} 如果设为 `true`, 这篇文章会使用 [Font Awesome 扩展语法](#fontawesome).
* **linkToMarkdown**: 如果设为 `true`, 内容的页脚将显示指向原始 Markdown 文件的链接.
* **rssFullText**: {{< version 0.2.4 >}} 如果设为 `true`, 在 RSS 中将会显示全文内容.
* **toc**: {{< version 0.2.0 changed >}} 和 [网站配置](../theme-documentation-basics#site-configuration) 中的 `params.page.toc` 部分相同.
* **code**: {{< version 0.2.0 >}} 和 [网站配置](../theme-documentation-basics#site-configuration) 中的 `params.page.code` 部分相同.

View file

@ -1,5 +1,5 @@
{{- define "title" }}
{{- T "pageNotFound" | printf "404 %s" }} | {{ .Site.Title -}}
{{- T "pageNotFound" | printf "404 %s" }} - {{ .Site.Title -}}
{{- end -}}
{{- define "content" -}}

View file

@ -1,10 +1,10 @@
{{- with .Title -}}
<figure>
{{- partial "plugin/image.html" (dict "src" $.Destination "alt" $.Text "caption" . "linked" true) -}}
{{- dict "src" $.Destination "alt" $.Text "caption" . "linked" true | partial "plugin/image.html" -}}
<figcaption class="image-caption">
{{- . | safeHTML -}}
</figcaption>
</figure>
{{- else -}}
{{- partial "plugin/image.html" (dict "src" .Destination "alt" .Text) -}}
{{- dict "src" .Destination "alt" .Text | partial "plugin/image.html" -}}
{{- end -}}

View file

@ -10,7 +10,7 @@
{{- end -}}
{{- $params := .Params | merge .Site.Params.page -}}
{{- .Scratch.Set "version" "0.2.3" -}}
{{- .Scratch.Set "version" "0.2.4" -}}
{{- if eq hugo.Environment "production" -}}
{{- .Scratch.Set "cdn" .Site.Params.cdn -}}

View file

@ -1,5 +1,5 @@
{{- define "title" }}
{{- .Params.Title | default (T .Section) | default .Section | printf (T "allSome") }} | {{ .Site.Title -}}
{{- .Params.Title | default (T .Section) | default .Section | printf (T "allSome") }} - {{ .Site.Title -}}
{{- end -}}
{{- define "content" -}}

View file

@ -1,4 +1,4 @@
{{- define "title" }}{{ .Title }} | {{ .Site.Title }}{{ end -}}
{{- define "title" }}{{ .Title }} - {{ .Site.Title }}{{ end -}}
{{- define "content" -}}
{{- $params := .Scratch.Get "params" -}}

View file

@ -5,7 +5,7 @@
<div class="featured-image-preview">
<a href="{{ $.RelPermalink }}">
{{- $image := $params.featuredimagepreview | default . -}}
{{- partial "plugin/image.html" (dict "src" $image "alt" $.Description "large" true) -}}
{{- dict "src" $image "alt" $.Description "large" true | partial "plugin/image.html" -}}
</a>
</div>
{{- end -}}

View file

@ -1,41 +1,46 @@
{{- $index := slice -}}
{{- $pages := .Site.RegularPages -}}
{{- if .Site.Params.page.hiddenFromSearch -}}
{{- $pages = where $pages "Params.hiddenfromsearch" false -}}
{{- else -}}
{{- $pages = where $pages "Params.hiddenfromsearch" "!=" true -}}
{{- end -}}
{{- range $pages -}}
{{- $uri := .RelPermalink -}}
{{- $meta := dict "uri" $uri "title" .Title "tags" .Params.tags "categories" .Params.categories -}}
{{- $meta = .PublishDate.Format ($.Site.Params.dateFormat | default "2006-01-02") | dict "date" | merge $meta -}}
{{- with .Description -}}
{{- $index = $index | append (dict "content" . "objectID" $uri | merge $meta) -}}
{{- if .Site.Params.search -}}
{{- $index := slice -}}
{{- $pages := .Site.RegularPages -}}
{{- if .Site.Params.page.hiddenFromSearch -}}
{{- $pages = where $pages "Params.hiddenfromsearch" false -}}
{{- else -}}
{{- $pages = where $pages "Params.hiddenfromsearch" "!=" true -}}
{{- end -}}
{{- $params := .Params | merge $.Site.Params.page -}}
{{/* Extended Markdown syntax */}}
{{- $content := dict "content" .Content "ruby" $params.ruby "fraction" $params.fraction "fontawesome" $params.fontawesome | partial "function/content.html" -}}
{{/* Remove line number for code */}}
{{- $content = $content | replaceRE `<span class="lnt?"> *\d*\n?</span>` "" -}}
{{- range $i, $contenti := split $content "<h2 id=" -}}
{{- if gt $i 0 -}}
{{- $contenti = printf "<h2 id=%s" $contenti -}}
{{- range $pages -}}
{{- $uri := .RelPermalink -}}
{{- if $.Site.Params.search.absoluteURL -}}
{{- $uri = .Permalink -}}
{{- end -}}
{{- range $j, $contentj := split $contenti "<h3 id=" -}}
{{- if gt $j 0 -}}
{{- $contentj = printf "<h3 id=%s" $contentj -}}
{{- $meta := dict "uri" $uri "title" .Title "tags" .Params.tags "categories" .Params.categories -}}
{{- $meta = .PublishDate.Format ($.Site.Params.dateFormat | default "2006-01-02") | dict "date" | merge $meta -}}
{{- with .Description -}}
{{- $index = $index | append (dict "content" . "objectID" $uri | merge $meta) -}}
{{- end -}}
{{- $params := .Params | merge $.Site.Params.page -}}
{{/* Extended Markdown syntax */}}
{{- $content := dict "content" .Content "ruby" $params.ruby "fraction" $params.fraction "fontawesome" $params.fontawesome | partial "function/content.html" -}}
{{/* Remove line number for code */}}
{{- $content = $content | replaceRE `<span class="lnt?"> *\d*\n?</span>` "" -}}
{{- range $i, $contenti := split $content "<h2 id=" -}}
{{- if gt $i 0 -}}
{{- $contenti = printf "<h2 id=%s" $contenti -}}
{{- end -}}
{{/* Plainify, unescape and remove (\n, \t) */}}
{{- $contentj = $contentj | plainify | htmlUnescape | replaceRE `[\n\t ]+` " " -}}
{{- if gt $.Site.Params.search.contentLength 0 -}}
{{- $contentj = substr $contentj 0 $.Site.Params.search.contentLength -}}
{{- end -}}
{{- if $contentj | and (ne $contentj " ") -}}
{{- $one := printf "%s:%d:%d" $uri $i $j | dict "content" $contentj "objectID" | merge $meta -}}
{{- $index = $index | append $one -}}
{{- range $j, $contentj := split $contenti "<h3 id=" -}}
{{- if gt $j 0 -}}
{{- $contentj = printf "<h3 id=%s" $contentj -}}
{{- end -}}
{{/* Plainify, unescape and remove (\n, \t) */}}
{{- $contentj = $contentj | plainify | htmlUnescape | replaceRE `[\n\t ]+` " " -}}
{{- if gt $.Site.Params.search.contentLength 0 -}}
{{- $contentj = substr $contentj 0 $.Site.Params.search.contentLength -}}
{{- end -}}
{{- if $contentj | and (ne $contentj " ") -}}
{{- $one := printf "%s:%d:%d" $uri $i $j | dict "content" $contentj "objectID" | merge $meta -}}
{{- $index = $index | append $one -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- $index | jsonify | safeJS -}}
{{- $index | jsonify | safeJS -}}
{{- end -}}

View file

@ -35,30 +35,7 @@
{{- end -}}
<atom:link href="{{ .Permalink }}" rel="self" type="application/rss+xml" />
{{- range where .Site.RegularPages "Type" "posts" | first (.Site.Params.home.rss | default 10) -}}
<item>
<title>
{{- .Title -}}
</title>
<link>
{{- .Permalink -}}
</link>
<pubDate>
{{- .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" -}}
</pubDate>
<author>
{{- .Params.author | default $.Site.Author.name | default (T "author") -}}
</author>
<guid>
{{- .Permalink -}}
</guid>
<description>
{{- with .Summary -}}
{{- dict "content" . "ruby" true "fraction" true "fontawesome" true | partial "function/content.html" | plainify -}}
{{- else -}}
{{- .Description | plainify -}}
{{- end -}}
</description>
</item>
{{- dict "page" . "site" .Site | partial "rss/item.html" -}}
{{- end -}}
</channel>
</rss>

View file

@ -182,7 +182,7 @@
</script>
{{- /* Polyfill.io */ -}}
{{- partial "plugin/script.html" (dict "source" "https://polyfill.io/v3/polyfill.min.js?features=Element.prototype.closest%2CrequestAnimationFrame%2CCustomEvent%2CPromise%2CObject.entries%2CObject.assign%2CObject.values%2Cfetch%2CElement.prototype.after%2CArray.prototype.fill%2CIntersectionObserver%2CArray.from%2CArray.prototype.find%2CMath.sign") -}}
{{- dict "source" "https://polyfill.io/v3/polyfill.min.js?features=Element.prototype.closest%2CrequestAnimationFrame%2CCustomEvent%2CPromise%2CObject.entries%2CObject.assign%2CObject.values%2Cfetch%2CElement.prototype.after%2CArray.prototype.fill%2CIntersectionObserver%2CArray.from%2CArray.prototype.find%2CMath.sign" | partial "plugin/script.html" -}}
{{- range (.Scratch.Get "this").script -}}
{{- partial "plugin/script.html" . -}}

View file

@ -5,7 +5,7 @@
<a href="{{ .Site.Home.RelPermalink }}" title="{{ .Site.Title }}">
{{- with .Site.Params.header.title -}}
{{- with .logo -}}
{{- partial "plugin/image.html" (dict "src" . "alt" $.Site.Title "class" "logo") -}}
{{- dict "src" . "alt" $.Site.Title "class" "logo" | partial "plugin/image.html" -}}
{{- end -}}
{{- with .pre -}}
<span class="header-title-pre">{{ . | safeHTML }}</span>
@ -83,7 +83,7 @@
<a href="{{ .Site.Home.RelPermalink }}" title="{{ .Site.Title }}">
{{- with .Site.Params.header.title -}}
{{- with .logo -}}
{{- partial "plugin/image.html" (dict "src" . "alt" $.Site.Title "class" "logo") -}}
{{- dict "src" . "alt" $.Site.Title "class" "logo" | partial "plugin/image.html" -}}
{{- end -}}
{{- with .pre -}}
<span class="header-title-pre">{{ . | safeHTML }}</span>

View file

@ -6,7 +6,7 @@
{{- with $avatar -}}
<div class="home-avatar">
<a href="/posts" title="{{ T `home` }}">
{{- partial "plugin/image.html" (dict "src" . "alt" (T "home")) -}}
{{- dict "src" . "alt" (T "home") | partial "plugin/image.html" -}}
</a>
</div>
{{- end -}}
@ -14,7 +14,7 @@
{{- with .Site.Params.home.profile.subtitle -}}
<h2 class="home-subtitle">
{{- if $.Site.Params.home.profile.typeit -}}
{{- $id := partial "function/id.html" (dict "content" . "scratch" $.Scratch) -}}
{{- $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 -}}

View file

@ -8,9 +8,9 @@
<img
class="lazyload{{ with .class }} {{ . }}{{ end }}"
src="{{ $loading.RelPermalink }}"
data-sizes="auto"
data-srcset="{{ $small | relURL }}, {{ .src | relURL }} 1.5x, {{ $large | relURL }} 2x"
data-src="{{ .src | relURL }}"
data-srcset="{{ $small | relURL }}, {{ .src | relURL }} 1.5x, {{ $large | relURL }} 2x"
data-sizes="auto"
alt="{{ $alt }}"{{ with .height }} height="{{ . }}"{{ end }}{{ with .width }} width="{{ . }}"{{ end }} />
</a>
{{- else -}}
@ -20,9 +20,9 @@
<img
class="lazyload{{ with .class }} {{ . }}{{ end }}"
src="{{ $loading.RelPermalink }}"
data-sizes="auto"
data-srcset="{{ $small | relURL }}, {{ .src | relURL }} 1.5x, {{ $large | relURL }} 2x"
data-src="{{ .src | relURL }}"
data-srcset="{{ $small | relURL }}, {{ .src | relURL }} 1.5x, {{ $large | relURL }} 2x"
data-sizes="auto"
alt="{{ $alt }}"
title="{{ .title | default $alt }}"{{ with .height }} height="{{ . }}"{{ end }}{{ with .width }} width="{{ . }}"{{ end }} />
{{- end -}}

View file

@ -4,196 +4,196 @@
{{- /* 001: Twitter */ -}}
{{- if $share.Twitter -}}
<a href="javascript:void(0);" title="{{ T `shareOn` }} Twitter" data-sharer="twitter" data-url="{{ .Permalink }}" data-title="{{ .Title }}"{{ with .Site.Params.Social.Twitter }} data-via="{{ . }}"{{ end }}{{ with .Params.tags }} data-hashtags="{{ delimit . `,` }}"{{ end }}>
{{- partial "plugin/icon.html" (dict "class" "fab fa-twitter fa-fw") -}}
{{- dict "class" "fab fa-twitter fa-fw" | partial "plugin/icon.html" -}}
</a>
{{- end -}}
{{- /* 002: Facebook */ -}}
{{- if $share.Facebook -}}
<a href="javascript:void(0);" title="{{ T `shareOn` }} Facebook" data-sharer="facebook" data-url="{{ .Permalink }}"{{ with .Params.tags }} data-hashtag="{{ index . 0 }}"{{ end }}>
{{- partial "plugin/icon.html" (dict "class" "fab fa-facebook-square fa-fw") -}}
{{- dict "class" "fab fa-facebook-square fa-fw" | partial "plugin/icon.html" -}}
</a>
{{- end -}}
{{- /* 003: Linkedin */ -}}
{{- if $share.Linkedin -}}
<a href="javascript:void(0);" title="{{ T `shareOn` }} Linkedin" data-sharer="linkedin" data-url="{{ .Permalink }}">
{{- partial "plugin/icon.html" (dict "class" "fab fa-linkedin fa-fw") -}}
{{- dict "class" "fab fa-linkedin fa-fw" | partial "plugin/icon.html" -}}
</a>
{{- end -}}
{{- /* 004: WhatsApp */ -}}
{{- if $share.Whatsapp -}}
<a href="javascript:void(0);" title="{{ T `shareOn` }} WhatsApp" data-sharer="whatsapp" data-url="{{ .Permalink }}" data-title="{{ .Title }}" data-web>
{{- partial "plugin/icon.html" (dict "class" "fab fa-whatsapp fa-fw") -}}
{{- dict "class" "fab fa-whatsapp fa-fw" | partial "plugin/icon.html" -}}
</a>
{{- end -}}
{{- /* 005: Viber */ -}}
{{- if $share.Viber -}}
<a href="javascript:void(0);" title="{{ T `shareOn` }} Viber" data-sharer="viber" data-url="{{ .Permalink }}" data-title="{{ .Title }}">
{{- partial "plugin/icon.html" (dict "class" "fab fa-viber fa-fw") -}}
{{- dict "class" "fab fa-viber fa-fw" | partial "plugin/icon.html" -}}
</a>
{{- end -}}
{{- /* 006: Pinterest */ -}}
{{- if $share.Pinterest -}}
<a href="javascript:void(0);" title="{{ T `shareOn` }} Pinterest" data-sharer="pinterest" data-url="{{ .Permalink }}"{{ with .Description }} data-description="{{ . }}"{{ end }}{{ with .Params.featuredImage }} data-image="{{ . }}"{{ end }}>
{{- partial "plugin/icon.html" (dict "class" "fab fa-pinterest fa-fw") -}}
{{- dict "class" "fab fa-pinterest fa-fw" | partial "plugin/icon.html" -}}
</a>
{{- end -}}
{{- /* 007: Tumblr */ -}}
{{- if $share.Tumblr -}}
<a href="javascript:void(0);" title="{{ T `shareOn` }} Tumblr" data-sharer="tumblr" data-url="{{ .Permalink }}" data-title="{{ .Title }}"{{ with .Description }} data-caption="{{ . }}"{{ end }}{{ with .Params.tags }} data-tags="{{ delimit . `,` }}"{{ end }}>
{{- partial "plugin/icon.html" (dict "class" "fab fa-tumblr fa-fw") -}}
{{- dict "class" "fab fa-tumblr fa-fw" | partial "plugin/icon.html" -}}
</a>
{{- end -}}
{{- /* 008: Hacker News */ -}}
{{- if $share.Hackernews -}}
<a href="javascript:void(0);" title="{{ T `shareOn` }} Hacker News" data-sharer="hackernews" data-url="{{ .Permalink }}" data-title="{{ .Title }}">
{{- partial "plugin/icon.html" (dict "class" "fab fa-hacker-news fa-fw") -}}
{{- dict "class" "fab fa-hacker-news fa-fw" | partial "plugin/icon.html" -}}
</a>
{{- end -}}
{{- /* 009: Reddit */ -}}
{{- if $share.Reddit -}}
<a href="javascript:void(0);" title="{{ T `shareOn` }} Reddit" data-sharer="reddit" data-url="{{ .Permalink }}">
{{- partial "plugin/icon.html" (dict "class" "fab fa-reddit fa-fw") -}}
{{- dict "class" "fab fa-reddit fa-fw" | partial "plugin/icon.html" -}}
</a>
{{- end -}}
{{- /* 010: VK */ -}}
{{- if $share.VK -}}
<a href="javascript:void(0);" title="{{ T `shareOn` }} VK" data-sharer="vk" data-url="{{ .Permalink }}" data-title="{{ .Title }}"{{ with .Description }} data-caption="{{ . }}"{{ end }}{{ with .Params.featuredImage }} data-image="{{ . }}"{{ end }}>
{{- partial "plugin/icon.html" (dict "class" "fab fa-vk fa-fw") -}}
{{- dict "class" "fab fa-vk fa-fw" | partial "plugin/icon.html" -}}
</a>
{{- end -}}
{{- /* 011: Buffer */ -}}
{{- if $share.Buffer -}}
<a href="javascript:void(0);" title="{{ T `shareOn` }} Buffer" data-sharer="buffer" data-url="{{ .Permalink }}" data-title="{{ .Title }}"{{ with .Site.Params.Social.Twitter }} data-via="{{ . }}"{{ end }}{{ with .Params.featuredImage }} data-picture="{{ . }}"{{ end }}>
{{- partial "plugin/icon.html" (dict "class" "fab fa-buffer fa-fw") -}}
{{- dict "class" "fab fa-buffer fa-fw" | partial "plugin/icon.html" -}}
</a>
{{- end -}}
{{- /* 012: Xing */ -}}
{{- if $share.Xing -}}
<a href="javascript:void(0);" title="{{ T `shareOn` }} Xing" data-sharer="xing" data-url="{{ .Permalink }}" data-title="{{ .Title }}">
{{- partial "plugin/icon.html" (dict "class" "fab fa-xing fa-fw") -}}
{{- dict "class" "fab fa-xing fa-fw" | partial "plugin/icon.html" -}}
</a>
{{- end -}}
{{- /* 013: Line */ -}}
{{- if $share.Line -}}
<a href="javascript:void(0);" title="{{ T `shareOn` }} Line" data-sharer="line" data-url="{{ .Permalink }}" data-title="{{ .Title }}">
{{- partial "plugin/icon.html" (dict "class" "fab fa-line fa-fw") -}}
{{- dict "class" "fab fa-line fa-fw" | partial "plugin/icon.html" -}}
</a>
{{- end -}}
{{- /* 014: Instapaper */ -}}
{{- if $share.Instapaper -}}
<a href="javascript:void(0);" title="{{ T `shareOn` }} Instapaper" data-sharer="instapaper" data-url="{{ .Permalink }}" data-title="{{ .Title }}" data-description="{{ .Description }}">
{{- partial "plugin/icon.html" (dict "simpleicons" "instapaper" "prefix" (.Scratch.Get "cdn" | default dict).simpleIconsPrefix) -}}
{{- dict "simpleicons" "instapaper" "prefix" (.Scratch.Get "cdn" | default dict).simpleIconsPrefix | partial "plugin/icon.html" -}}
</a>
{{- end -}}
{{- /* 015: Pocket */ -}}
{{- if $share.Pocket -}}
<a href="javascript:void(0);" title="{{ T `shareOn` }} Pocket" data-sharer="pocket" data-url="{{ .Permalink }}">
{{- partial "plugin/icon.html" (dict "class" "fab fa-get-pocket fa-fw") -}}
{{- dict "class" "fab fa-get-pocket fa-fw" | partial "plugin/icon.html" -}}
</a>
{{- end -}}
{{- /* 016: Digg */ -}}
{{- if $share.Digg -}}
<a href="javascript:void(0);" title="{{ T `shareOn` }} Digg" data-sharer="digg" data-url="{{ .Permalink }}">
{{- partial "plugin/icon.html" (dict "class" "fab fa-digg fa-fw") -}}
{{- 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 }}">
{{- partial "plugin/icon.html" (dict "class" "fab fa-stumbleupon fa-fw") -}}
{{- dict "class" "fab fa-stumbleupon fa-fw" | partial "plugin/icon.html" -}}
</a>
{{- end -}}
{{- /* 018: Flipboard */ -}}
{{- if $share.Flipboard -}}
<a href="javascript:void(0);" title="{{ T `shareOn` }} Flipboard" data-sharer="flipboard" data-url="{{ .Permalink }}" data-title="{{ .Title }}">
{{- partial "plugin/icon.html" (dict "class" "fab fa-flipboard fa-fw") -}}
{{- dict "class" "fab fa-flipboard fa-fw" | partial "plugin/icon.html" -}}
</a>
{{- end -}}
{{- /* 019: 微博 */ -}}
{{- 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 }}>
{{- partial "plugin/icon.html" (dict "class" "fab fa-weibo fa-fw") -}}
{{- 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 }}">
{{- partial "plugin/icon.html" (dict "class" "fab fa-renren fa-fw") -}}
{{- 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 }}">
{{- partial "plugin/icon.html" (dict "simpleicons" "myspace" "prefix" (.Scratch.Get "cdn" | default dict).simpleIconsPrefix) -}}
{{- dict "simpleicons" "myspace" "prefix" (.Scratch.Get "cdn" | default dict).simpleIconsPrefix | partial "plugin/icon.html" -}}
</a>
{{- end -}}
{{- /* 022: 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 }}">
{{- partial "plugin/icon.html" (dict "class" "fab fa-blogger fa-fw") -}}
{{- dict "class" "fab fa-blogger fa-fw" | partial "plugin/icon.html" -}}
</a>
{{- end -}}
{{- /* 023: 百度 */ -}}
{{- if $share.Baidu -}}
<a href="javascript:void(0);" title="{{ T `shareOn` }} 百度" data-sharer="baidu" data-url="{{ .Permalink }}" data-title="{{ .Title }}">
{{- partial "plugin/icon.html" (dict "simpleicons" "baidu" "prefix" (.Scratch.Get "cdn" | default dict).simpleIconsPrefix) -}}
{{- dict "simpleicons" "baidu" "prefix" (.Scratch.Get "cdn" | default dict).simpleIconsPrefix | partial "plugin/icon.html" -}}
</a>
{{- end -}}
{{- /* 024: OK.RU */ -}}
{{- if $share.Odnoklassniki -}}
<a href="javascript:void(0);" title="{{ T `shareOn` }} OK.RU" data-sharer="okru" data-url="{{ .Permalink }}" data-title="{{ .Title }}">
{{- partial "plugin/icon.html" (dict "class" "fab fa-odnoklassniki fa-fw") -}}
{{- dict "class" "fab fa-odnoklassniki fa-fw" | partial "plugin/icon.html" -}}
</a>
{{- end -}}
{{- /* 025: Evernote */ -}}
{{- if $share.Evernote -}}
<a href="javascript:void(0);" title="{{ T `shareOn` }} Evernote" data-sharer="evernote" data-url="{{ .Permalink }}" data-title="{{ .Title }}">
{{- partial "plugin/icon.html" (dict "class" "fab fa-evernote fa-fw") -}}
{{- dict "class" "fab fa-evernote fa-fw" | partial "plugin/icon.html" -}}
</a>
{{- end -}}
{{- /* 026: Skype */ -}}
{{- if $share.Skype -}}
<a href="javascript:void(0);" title="{{ T `shareOn` }} Skype" data-sharer="skype" data-url="{{ .Permalink }}" data-title="{{ .Title }}">
{{- partial "plugin/icon.html" (dict "class" "fab fa-skype fa-fw") -}}
{{- dict "class" "fab fa-skype fa-fw" | partial "plugin/icon.html" -}}
</a>
{{- end -}}
{{- /* 027: 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 }}">
{{- partial "plugin/icon.html" (dict "class" "fab fa-trello fa-fw") -}}
{{- dict "class" "fab fa-trello fa-fw" | partial "plugin/icon.html" -}}
</a>
{{- end -}}
{{- /* 028: Mix */ -}}
{{- if $share.Mix -}}
<a href="//mix.com/add?url={{ .Permalink }}&amp;description={{ .Title }}" target="_blank" title="{{ T `shareOn` }} Mix">
{{- partial "plugin/icon.html" (dict "class" "fab fa-mix fa-fw") -}}
{{- dict "class" "fab fa-mix fa-fw" | partial "plugin/icon.html" -}}
</a>
{{- end -}}
{{- end -}}

View file

@ -0,0 +1,36 @@
{{- $params := .page.Params | merge .site.Params.page | merge (dict "author" .site.Author.name) -}}
<item>
<title>
{{- .page.Title -}}
</title>
<link>
{{- .page.Permalink -}}
</link>
<pubDate>
{{- .page.Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" -}}
</pubDate>
<author>
{{- .params.author | default (T "author") -}}
</author>
<guid>
{{- .page.Permalink -}}
</guid>
<description>
{{- "<![CDATA[" | safeHTML -}}
{{- with $params.featuredimage -}}
<div class="featured-image">
<img src="{{ . | relURL }}" referrerpolicy="no-referrer">
</div>
{{- end -}}
{{- $content := .page.Description -}}
{{- if $params.rssFullText -}}
{{- $content = dict "content" .page.Content "ruby" $params.ruby "fraction" $params.fraction "fontawesome" $params.fontawesome | partial "function/content.html" -}}
{{- else -}}
{{- with .page.Summary -}}
{{- $content = dict "content" . "ruby" $params.ruby "fraction" $params.fraction "fontawesome" $params.fontawesome | partial "function/content.html" -}}
{{- end -}}
{{- end -}}
{{- $content | replaceRE `<figure[^>]*>.*</figure>` "" | replaceRE `<img[^>]*( /)?>` "" | safeHTML -}}
{{- "]]>" | safeHTML -}}
</description>
</item>

View file

@ -1,7 +1,7 @@
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
<channel>
<title>
{{- .Params.Title | default (T .Section) | default .Section | printf (T "allSome") }} | {{ .Site.Title -}}
{{- .Params.Title | default (T .Section) | default .Section | printf (T "allSome") }} - {{ .Site.Title -}}
</title>
<link>
{{- .Permalink -}}
@ -35,30 +35,7 @@
{{- end -}}
<atom:link href="{{ .Permalink }}" rel="self" type="application/rss+xml" />
{{- range .Pages | first (.Site.Params.section.rss | default 10) -}}
<item>
<title>
{{- .Title -}}
</title>
<link>
{{- .Permalink -}}
</link>
<pubDate>
{{- .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" -}}
</pubDate>
<author>
{{- .Params.author | default $.Site.Author.name | default (T "author") -}}
</author>
<guid>
{{- .Permalink -}}
</guid>
<description>
{{- with .Summary -}}
{{- dict "content" . "ruby" true "fraction" true "fontawesome" true | partial "function/content.html" | plainify -}}
{{- else -}}
{{- .Description | plainify -}}
{{- end -}}
</description>
</item>
{{- dict "page" . "site" .Site | partial "rss/item.html" -}}
{{- end -}}
</channel>
</rss>

View file

@ -1,4 +1,4 @@
{{- define "title" }}{{ .Title }} | {{ .Site.Title }}{{ end -}}
{{- define "title" }}{{ .Title }} - {{ .Site.Title }}{{ end -}}
{{- define "content" -}}
{{- $params := .Scratch.Get "params" -}}
@ -61,7 +61,7 @@
{{- /* Featured image */ -}}
{{- with $params.featuredimage -}}
<div class="featured-image">
{{- partial "plugin/image.html" (dict "src" . "alt" $.Description "large" true) -}}
{{- dict "src" . "alt" $.Description "large" true | partial "plugin/image.html" -}}
</div>
{{- end -}}

View file

@ -1,5 +1,5 @@
{{- $content := .Inner | transform.Unmarshal | jsonify -}}
{{- $id := partial "function/id.html" (dict "content" $content "scratch" .Page.Scratch) -}}
{{- $id := dict "content" $content "scratch" .Page.Scratch | partial "function/id.html" -}}
{{- $width := cond .IsNamedParams (.Get "width") (.Get 0) | default "100%" -}}
{{- $height := cond .IsNamedParams (.Get "height") (.Get 1) | default "30rem" -}}
<div class="echarts" id="{{ $id }}" style="width: {{ $width }}; height: {{ $height }};"></div>

View file

@ -28,6 +28,6 @@
{{- end -}}
{{- $darkStyle = $darkStyle | default $lightStyle -}}
{{- $options := dict "lng" $lng "lat" $lat "zoom" $zoom "marked" $marked "lightStyle" $lightStyle "darkStyle" $darkStyle "geolocate" $geolocate "navigation" $navigation "scale" $scale "fullscreen" $fullscreen -}}
{{- $id := partial "function/id.html" (dict "content" $options "scratch" .Page.Scratch) -}}
{{- $id := dict "content" $options "scratch" .Page.Scratch | partial "function/id.html" -}}
<div class="mapbox" id="{{ $id }}" style="width: {{ $width }}; height: {{ $height }};"></div>
{{- .Page.Scratch.SetInMap "this" "mapbox" true -}}

View file

@ -1,3 +1,3 @@
{{- $id := partial "function/id.html" (dict "content" (trim .Inner "\n") "scratch" .Page.Scratch) -}}
{{- $id := dict "content" (trim .Inner "\n") "scratch" .Page.Scratch | partial "function/id.html" -}}
<div class="mermaid" id="{{ $id }}"></div>
{{- .Page.Scratch.SetInMap "this" "mermaid" true -}}

View file

@ -1,5 +1,5 @@
{{- $content := .Inner | .Page.RenderString -}}
{{- $id := partial "function/id.html" (dict "content" $content) -}}
{{- $id := dict "content" $content | partial "function/id.html" -}}
{{- $tag := .Get 1 | default "div" -}}
{{- printf `<%s id="%s">%s</%s>` $tag $id $content $tag | safeHTML -}}

View file

@ -20,7 +20,7 @@
{{- /* trim the newline */ -}}
{{- $content = trim $content "\n" -}}
{{- $id := partial "function/id.html" (dict "content" $content "scratch" .Page.Scratch) -}}
{{- $id := dict "content" $content "scratch" .Page.Scratch | partial "function/id.html" -}}
{{- $key := .Get "group" | string | default $id -}}
{{- $typeitMap := (.Page.Scratch.Get "this").typeitMap | default dict -}}
{{- $group := index $typeitMap $key -}}

View file

@ -8,4 +8,6 @@
{{- $res := resources.Get "svg/version.template.svg" -}}
{{- $res = $res | resources.ExecuteAsTemplate $path (dict "version" $version "label" $label "color" $color) | minify -}}
{{- $alt := printf "LoveIt %s | %s" $label $version -}}
<a href="{{ $url }}" rel="noopener noreffer" target="_blank">{{ partial "plugin/image.html" (dict "src" $res.RelPermalink "alt" $alt "class" "version") }}</a>
<a href="{{ $url }}" rel="noopener noreffer" target="_blank">
{{- dict "src" $res.RelPermalink "alt" $alt "class" "version" | partial "plugin/image.html" -}}
</a>

View file

@ -1,5 +1,5 @@
{{- define "title" -}}
{{- .Title }} | {{ T .Data.Singular | default .Data.Singular }} | {{ .Site.Title -}}
{{- .Title }} - {{ T .Data.Singular | default .Data.Singular }} - {{ .Site.Title -}}
{{- end -}}
{{- define "content" -}}

View file

@ -1,13 +1,13 @@
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
<channel>
<title>
{{- .Params.Title }} | {{ T .Data.Singular | default .Data.Singular }} | {{ .Site.Title -}}
{{- .Title }} - {{ T .Data.Singular | default .Data.Singular }} - {{ .Site.Title -}}
</title>
<link>
{{- .Permalink -}}
</link>
<description>
{{- .Params.Title }} | {{ T .Data.Singular | default .Data.Singular }} | {{ .Site.Title -}}
{{- .Title }} - {{ T .Data.Singular | default .Data.Singular }} - {{ .Site.Title -}}
</description>
<generator>Hugo -- gohugo.io</generator>
{{- with .Site.LanguageCode -}}
@ -35,30 +35,7 @@
{{- end -}}
<atom:link href="{{ .Permalink }}" rel="self" type="application/rss+xml" />
{{- range .Pages | first (.Site.Params.list.rss | default 10) -}}
<item>
<title>
{{- .Title -}}
</title>
<link>
{{- .Permalink -}}
</link>
<pubDate>
{{- .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" -}}
</pubDate>
<author>
{{- .Params.author | default $.Site.Author.name | default (T "author") -}}
</author>
<guid>
{{- .Permalink -}}
</guid>
<description>
{{- with .Summary -}}
{{- dict "content" . "ruby" true "fraction" true "fontawesome" true | partial "function/content.html" | plainify -}}
{{- else -}}
{{- .Description | plainify -}}
{{- end -}}
</description>
</item>
{{- dict "page" . "site" .Site | partial "rss/item.html" -}}
{{- end -}}
</channel>
</rss>

View file

@ -1,5 +1,5 @@
{{- define "title" -}}
{{- .Title | default (T .Data.Plural) | default .Data.Plural }} | {{ .Site.Title -}}
{{- .Params.Title | default (T .Data.Plural) | default .Data.Plural | printf (T "allSome") }} - {{ .Site.Title -}}
{{- end -}}
{{- define "content" -}}
@ -10,7 +10,7 @@
<div class="page archive">
{{- /* Title */ -}}
<h2 class="single-title animated pulse faster">
{{- T "all" }}{{ T $taxonomies | default $taxonomies -}}
{{- .Params.Title | default (T $taxonomies) | default $taxonomies | printf (T "allSome") -}}
</h2>
{{- /* Categories Page */ -}}

View file

@ -413,6 +413,7 @@ class Theme {
const rect = $page.getBoundingClientRect();
$toc.style.left = `${rect.left + rect.width + 20}px`;
$toc.style.maxWidth = `${$page.getBoundingClientRect().left - 20}px`;
$toc.style.visibility = 'visible';
const $tocLinkElements = $tocCore.querySelectorAll('a:first-child');
const $tocLiElements = $tocCore.getElementsByTagName('li');
const $headerLinkElements = document.getElementsByClassName('headerLink');