fix(srcatch): fix srcatch bugs

This commit is contained in:
Dillon
2020-02-27 20:14:40 +08:00
parent 0dc5feb7f3
commit ae81e3767e
32 changed files with 370 additions and 210 deletions

View File

@@ -75,3 +75,46 @@ a {
} }
} }
} }
#dynamic-to-top {
display: none;
overflow: hidden;
width: auto;
z-index: 90;
position: fixed;
bottom: 2rem;
right: 2rem;
top: auto;
left: auto;
font-family: sans-serif;
font-size: 1rem;
color: #fff;
text-decoration: none;
font-weight: bold;
padding: 1rem 1rem;
border: 1px solid $global-border-color;
background: #222;
outline: none;
&:hover {
background: #000;
cursor: pointer;
}
&:active {
background: #000;
outline: none;
}
&:focus, &:hover {
outline: none;
}
span {
display: block;
overflow: hidden;
width: .875rem;
height: .75rem;
background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAKCAYAAACE2W/HAAAACXBIWXMAAArwAAAK8AFCrDSYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/N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tLQAAAABJRU5ErkJggg==') no-repeat center center;
}
.dark-theme &{
border: 1px solid $global-border-color-dark;
}
}

View File

@@ -188,7 +188,7 @@
img { img {
display: block; display: block;
max-width: 90%; max-width: 96%;
height: auto; height: auto;
margin: 0 auto; margin: 0 auto;
overflow: hidden; overflow: hidden;

View File

@@ -10,47 +10,3 @@
} }
} }
} }
.dynamic-to-top {
display: none;
overflow: hidden;
width: auto;
z-index: 90;
position: fixed;
bottom: 2rem;
right: 2rem;
top: auto;
left: auto;
font-family: sans-serif;
font-size: 1rem;
color: #fff;
text-decoration: none;
text-shadow: 0 1px 0 #333;
font-weight: bold;
padding: 1rem 1rem;
border: 1px solid $global-border-color;
background: #222;
&:hover {
background: #000;
cursor: pointer;
}
&:active {
background: #000;
outline: none;
}
outline: none;
&:focus, &:hover {
outline: none;
}
span {
display: block;
overflow: hidden;
width: .875rem;
height: .75rem;
background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAKCAYAAACE2W/HAAAACXBIWXMAAArwAAAK8AFCrDSYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors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XOuAUqgdM41IYQ+P5NSCpjZkitADRTZTwqgznUzWzCzZaMc9dbNbGEYhuuOclQB1OM43gBO/N/5MQAeMwpyB1MtLQAAAABJRU5ErkJggg==') no-repeat center center;
}
.dark-theme &{
border: 1px solid $global-border-color-dark;
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,11 +1,15 @@
.mermaid { .page .mermaid {
width: 100%; width: 100%;
margin: 3% auto; margin: 3% auto;
text-align: center; text-align: center;
& > svg {
max-width: 100%;
}
@import "themes/neutral/index"; @import "themes/neutral/index";
.dark-theme & { .dark-theme & {
@import "themes/dark/index"; @import "themes/darker/index";
} }
} }

View File

@@ -0,0 +1,62 @@
$mainBkg: #BDD5EA;
$secondBkg: #6D6D65;
$mainContrastColor: lightgrey;
$darkTextColor: #323D47;
$lineColor: $mainContrastColor;
$border1: #81B1DB;
$border2: rgba(255, 255, 255, 0.25);
$arrowheadColor: $mainContrastColor;
/* Flowchart variables */
$nodeBkg: $mainBkg;
$nodeBorder: purple;
$clusterBkg: $secondBkg;
$clusterBorder: $border2;
$defaultLinkColor: $lineColor;
$titleColor: #F9FFFE;
$edgeLabelBackground: #e8e8e8;
/* Sequence Diagram variables */
$actorBorder: $border1;
$actorBkg: $mainBkg;
$actorTextColor: black;
$actorLineColor: $mainContrastColor;
$signalColor: $mainContrastColor;
$signalTextColor: $mainContrastColor;
$labelBoxBkgColor: $actorBkg;
$labelBoxBorderColor: $actorBorder;
$labelTextColor: $darkTextColor;
$loopTextColor: $mainContrastColor;
$noteBorderColor: $border2;
$noteBkgColor: #fff5ad;
$activationBorderColor: #666;
$activationBkgColor: #f4f4f4;
$sequenceNumberColor: white;
/* Gantt chart variables */
$sectionBkgColor: rgba(255, 255, 255, 0.3);
$altSectionBkgColor: white;
$sectionBkgColor2: #EAE8B9;
$taskBorderColor: rgba(255, 255, 255, 0.5);
$taskBkgColor: $mainBkg;
$taskTextColor: $darkTextColor;
$taskTextLightColor: $mainContrastColor;
$taskTextOutsideColor: $taskTextLightColor;
$taskTextClickableColor: #003163;
$activeTaskBorderColor: rgba(255, 255, 255, 0.5);
$activeTaskBkgColor: #81B1DB;
$gridColor: $mainContrastColor;
$doneTaskBkgColor: $mainContrastColor;
$doneTaskBorderColor: grey;
$critBorderColor: #E83737;
$critBkgColor: #E83737;
$taskTextDarkColor: $darkTextColor;
$todayLineColor: #DB5757;
/* state colors */
$labelColor: black;
@import '../mermaid';

View File

@@ -289,11 +289,11 @@ func main() {
### 4.5 表格 ### 4.5 表格
```markdown ```markdown
| _颜色_ | 水果 | 蔬菜 | | _颜色_ | 水果 | 蔬菜 |
| ---------- |:---------------:| -----------:| | ----------- |:-------------:| ---------- -:|
| 红色 | *苹果* | 辣椒 | | 红色 | *苹果* | 辣椒 |
| ~~橙色~~ | 橘子 | **胡萝卜** | | ~~橙色~~ | 橘子 | **胡萝卜** |
| 绿色 | ~~***梨子***~~ | 菠菜 | | 绿色 | ~~***梨子***~~ | 菠菜 |
``` ```
| _颜色_ | 水果 | 蔬菜 | | _颜色_ | 水果 | 蔬菜 |

View File

@@ -27,9 +27,9 @@ Hugo ships with several [Built-in Shortcodes](https://gohugo.io/content-manageme
--- ---
## Instagram Simple Shortcode ## Instagram Shortcode
{{< instagram_simple BGvuInzyFAe hidecaption >}} {{< instagram BGvuInzyFAe hidecaption >}}
<br> <br>
@@ -43,9 +43,9 @@ Hugo ships with several [Built-in Shortcodes](https://gohugo.io/content-manageme
--- ---
## Twitter Simple Shortcode ## Twitter Shortcode
{{< twitter_simple 1085870671291310081 >}} {{< twitter 1085870671291310081 >}}
<br> <br>

View File

@@ -0,0 +1,105 @@
---
title: "Test Mermaid"
date: 2020-02-27T15:41:42+08:00
lastmod: 2020-02-27T15:41:42+08:00
draft: true
author: ""
authorLink: ""
description: ""
license: ""
tags: []
categories: []
hiddenFromHomePage: false
featuredImage: ""
featuredImagePreview: ""
toc: false
autoCollapseToc: true
lightgallery: true
math: false
comment: true
---
<!--more-->
## Flow
{{< mermaid >}}
graph TD
A[Hard] -->|Text| B(Round)
B --> C{Decision}
C -->|One| D[Result 1]
C -->|Two| E[Result 2]
{{< /mermaid >}}
## Sequence
{{< mermaid >}}
sequenceDiagram
Alice->>John: Hello John, how are you?
loop Healthcheck
John->>John: Fight against hypochondria
end
Note right of John: Rational thoughts!
John-->>Alice: Great!
John->>Bob: How about you?
Bob-->>John: Jolly good!
{{< /mermaid >}}
## Gantt
{{< mermaid >}}
gantt
title A Gantt Diagram
dateFormat YYYY-MM-DD
section Section
A task :a1, 2014-01-01, 30d
Another task :after a1 , 20d
section Another
Task in sec :2014-01-12 , 12d
another task : 24d
{{< /mermaid >}}
## Class
{{< mermaid >}}
classDiagram
Class01 <|-- AveryLongClass : Cool
<<interface>> Class01
Class09 --> C2 : Where am i?
Class09 --* C3
Class09 --|> Class07
Class07 : equals()
Class07 : Object[] elementData
Class01 : size()
Class01 : int chimp
Class01 : int gorilla
class Class10 {
<<service>>
int id
size()
}
{{< /mermaid >}}
## State
{{< mermaid >}}
stateDiagram
[*] --> Still
Still --> [*]
Still --> Moving
Moving --> Still
Moving --> Crash
Crash --> [*]
{{< /mermaid >}}
## Pie
{{< mermaid >}}
pie
"Dogs" : 386
"Cats" : 85
"Rats" : 15
{{< /mermaid >}}

View File

@@ -20,10 +20,9 @@ autoCollapseToc: true
lightgallery: true lightgallery: true
math: true math: true
comment: false comment: false
dev: true
--- ---
## & :(fas fa-rocket): This is a test page ## :(fas fa-rocket): This is a test page
[https://www.aol.com/article/entertainment/2020/02/10/oscars-viewership-hits-new-low-with-236-million-viewers/23923047/](https://www.aol.com/article/entertainment/2020/02/10/oscars-viewership-hits-new-low-with-236-million-viewers/23923047/) [https://www.aol.com/article/entertainment/2020/02/10/oscars-viewership-hits-new-low-with-236-million-viewers/23923047/](https://www.aol.com/article/entertainment/2020/02/10/oscars-viewership-hits-new-low-with-236-million-viewers/23923047/)
@@ -131,44 +130,47 @@ _Blog.chroma = function () {
## Test ECharts ## Test ECharts
{{< dev/echarts >}} {{< echarts >}}
title : { title:
text: '某站点用户访问来源', text: 某站点用户访问来源
subtext: '纯属虚构', subtext: 纯属虚构
x:'center' x: center
}, tooltip:
tooltip : { trigger: item
trigger: 'item', formatter: '{a} <br/>{b} : {c} ({d}%)'
formatter: "{a} <br/>{b} : {c} ({d}%)" legend:
}, orient: vertical
legend: { left: left
orient: 'vertical', data:
left: 'left', - 直接访问
data: ['直接访问','邮件营销','联盟广告','视频广告','搜索引擎'] - 邮件营销
}, - 联盟广告
series : [ - 视频广告
{ - 搜索引擎
name: '访问来源', series:
type: 'pie', - name: 访问来源
radius : '55%', type: pie
center: ['50%', '60%'], radius: 55%
data:[ center:
{value:335, name:'直接访问'}, - 50%
{value:310, name:'邮件营销'}, - 60%
{value:234, name:'联盟广告'}, data:
{value:135, name:'视频广告'}, - value: 335
{value:1548, name:'搜索引擎'} name: 直接访问
], - value: 310
itemStyle: { name: 邮件营销
emphasis: { - value: 234
shadowBlur: 10, name: 联盟广告
shadowOffsetX: 0, - value: 135
shadowColor: 'rgba(0, 0, 0, 0.5)' name: 视频广告
} - value: 1548
} name: 搜索引擎
} itemStyle:
] emphasis:
{{< /dev/echarts >}} shadowBlur: 10
shadowOffsetX: 0
shadowColor: 'rgba(0, 0, 0, 0.5)'
{{< /echarts >}}
## Test Mermaid ## Test Mermaid

View File

@@ -1,6 +1,6 @@
<figure> <figure>
{{- $lightgallery := ne .Page.Site.Params.page.lightgallery false | and (ne .Page.Params.lightgallery false) -}} {{- $lightgallery := ne .Page.Site.Params.page.lightgallery false | and (ne .Page.Params.lightgallery false) -}}
{{- partial "plugin/image.html" (dict "src" .Destination "title" .Title "description" .Text "lightgallery" $lightgallery "context" .Page) -}} {{- partial "plugin/image.html" (dict "src" .Destination "title" .Title "description" .Text "lightgallery" $lightgallery "scratch" (.Page.Scratch.Get "scratch")) -}}
{{- with (.Title | default .Text) -}} {{- with (.Title | default .Text) -}}
<figcaption class="image-caption"> <figcaption class="image-caption">
{{- . | safeHTML -}} {{- . | safeHTML -}}

View File

@@ -58,7 +58,7 @@
<span>&nbsp;</span> <span>&nbsp;</span>
</a> </a>
{{- /* Load script */ -}} {{- /* Load JavaScript scripts and CSS */ -}}
{{- partial "script.html" . -}} {{- partial "assets.html" . -}}
</body> </body>
</html> </html>

View File

@@ -1,9 +1,11 @@
{{- $scratch := .Scratch.Get "scratch" -}}
<article class="single summary" itemscope itemtype="http://schema.org/Article"> <article class="single summary" itemscope itemtype="http://schema.org/Article">
{{- /* Featured image */ -}} {{- /* Featured image */ -}}
{{- with .Params.featuredImage -}} {{- with .Params.featuredImage -}}
<div class="featured-image-preview"> <div class="featured-image-preview">
{{- $image := $.Params.featuredImagePreview | default . -}} {{- $image := $.Params.featuredImagePreview | default . -}}
{{- partial "plugin/image.html" (dict "src" $image "description" $.Description "context" $) -}} {{- partial "plugin/image.html" (dict "src" $image "description" $.Description "scratch" $scratch) -}}
</div> </div>
{{- end -}} {{- end -}}

View File

@@ -146,7 +146,7 @@
{{- end -}} {{- end -}}
{{- /* mermaid */ -}} {{- /* mermaid */ -}}
{{- with $scratch.Get "mermaidMap" -}} {{- with $scratch.Get "mermaidArr" -}}
{{- with $CDN.mermaidJS -}} {{- with $CDN.mermaidJS -}}
{{- slice . | $scratch.Add "scriptCDN" -}} {{- slice . | $scratch.Add "scriptCDN" -}}
{{- else -}} {{- else -}}
@@ -154,7 +154,24 @@
{{- end -}} {{- end -}}
{{- slice "lib/mermaid/mermaid.scss" | $scratch.Add "linkLocal" -}} {{- slice "lib/mermaid/mermaid.scss" | $scratch.Add "linkLocal" -}}
<script> <script>
window.mermaidMap = {{ jsonify . | safeJS }}; window.mermaidArr = {{ jsonify . | safeJS }};
</script>
{{- end -}}
{{- /* ECharts */ -}}
{{- with $scratch.Get "echartsArr" -}}
{{- with $CDN.echartsJS -}}
{{- slice . | $scratch.Add "scriptCDN" -}}
{{- else -}}
{{- slice "lib/echarts/echarts.min.js" | $scratch.Add "scriptLocal" -}}
{{- end -}}
{{- with $CDN.echartsMacaronsJS -}}
{{- slice . | $scratch.Add "scriptCDN" -}}
{{- else -}}
{{- slice "lib/echarts/macarons.js" | $scratch.Add "scriptLocal" -}}
{{- end -}}
<script>
window.echartsArr = {{ jsonify . | safeJS }};
</script> </script>
{{- end -}} {{- end -}}
@@ -181,28 +198,14 @@
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- /* dev feature */ -}} {{- /* Dev feature */ -}}
{{- if .Params.dev -}} {{- if .Params.dev -}}
{{- /* ECharts */ -}} {{- end -}}
{{- with $scratch.Get "echartsMap" -}}
{{- with $CDN.echartsJS -}} {{- with $scratch.Get "contentMap" -}}
{{- slice . | $scratch.Add "scriptCDN" -}} <script>
{{- else -}} window.contentMap = {{ jsonify . | safeJS }};
{{- slice "lib/echarts/echarts.min.js" | $scratch.Add "scriptLocal" -}} </script>
{{- end -}}
{{- with $CDN.echartsMacaronsJS -}}
{{- slice . | $scratch.Add "scriptCDN" -}}
{{- else -}}
{{- slice "lib/echarts/macarons.js" | $scratch.Add "scriptLocal" -}}
{{- end -}}
<script>
window.echartsMap = {
{{- range $key, $var := . -}}
{{- $key }}: {{ $var | safeJS -}},
{{- end -}}
};
</script>
{{- end -}}
{{- end -}} {{- end -}}
{{- /* Theme script */ -}} {{- /* Theme script */ -}}

View File

@@ -0,0 +1,6 @@
{{- /* ID */ -}}
{{- /* Content -> unique ID */ -}}
{{- /* shuffle md5 as id */ -}}
{{- $id := delimit (split (md5 now.Unix) "" | shuffle | first 6) "" | printf "id-%s" -}}
{{- .scratch.SetInMap "contentMap" $id .content -}}
{{- return $id -}}

View File

@@ -8,7 +8,7 @@
{{- with $avatar -}} {{- with $avatar -}}
<div class="home-avatar"> <div class="home-avatar">
<a href="/posts"> <a href="/posts">
{{- partial "plugin/image.html" (dict "src-s" . "title" "avatar" "description" (T "home") "context" $) -}} {{- partial "plugin/image.html" (dict "src_s" . "title" "avatar" "description" (T "home") "scratch" $scratch) -}}
</a> </a>
</div> </div>
{{- end -}} {{- end -}}
@@ -16,11 +16,8 @@
{{- with .Site.Params.home.profile.subtitle -}} {{- with .Site.Params.home.profile.subtitle -}}
<h2 class="home-description"> <h2 class="home-description">
{{- if $.Site.Params.home.profile.typeit -}} {{- if $.Site.Params.home.profile.typeit -}}
{{- $id := md5 . | printf "tp-%s" -}} {{- $id := partial "function/id.html" (dict "content" . "scratch" $scratch) -}}
<div id={{ printf "r%s" $id }} hidden=true> <div id="{{ $id }}" class="typeit"></div>
{{- . -}}
</div>
<div id={{ $id }} class="typeit"></div>
{{- $scratch.SetInMap "typeitMap" $id (slice $id) -}} {{- $scratch.SetInMap "typeitMap" $id (slice $id) -}}
{{- else -}} {{- else -}}
{{- . -}} {{- . -}}

View File

@@ -1,6 +1,5 @@
{{- $type := index . "type" | default "fa" -}} {{- $type := .type | default "fa" -}}
{{- $classList := split (index . "class") " " -}} {{- $classList := split .class " " -}}
{{- $context := index . "context" -}}
{{- /* Fork Awesome */ -}} {{- /* Fork Awesome */ -}}
{{- if eq $type "fo" -}} {{- if eq $type "fo" -}}
{{- $newClassList := slice -}} {{- $newClassList := slice -}}
@@ -12,13 +11,11 @@
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- $classList = $newClassList -}} {{- $classList = $newClassList -}}
{{- $scratch := $context.Scratch.Get "scratch" -}} {{- .scratch.Set "forkawesome" true -}}
{{- $scratch.Set "forkawesome" true -}}
{{- /* default is Font Awesome */ -}} {{- /* default is Font Awesome */ -}}
{{- /* Others */ -}} {{- /* Others */ -}}
{{- else if ne $type "fa" -}} {{- else if ne $type "fa" -}}
{{- $scratch := $context.Scratch.Get "scratch" -}} {{- .scratch.Set "iconfont" true -}}
{{- $scratch.Set "iconfont" true -}}
{{- end -}} {{- end -}}
<i class="{{ delimit $classList ` ` }}"></i> <i class="{{ delimit $classList ` ` }}"></i>

View File

@@ -1,34 +1,29 @@
{{- /* lazysizes and lightgallery.js */ -}} {{- /* lazysizes and lightgallery.js */ -}}
{{- $src := index . "src" -}} {{- $small := .src_s | default .src -}}
{{- $small := index . "src-s" | default $src -}} {{- $large := .src_l | default .src -}}
{{- $large := index . "src-l" | default $src -}}
{{- $title := index . "title" -}}
{{- $description := index . "description" -}}
{{- $context := index . "context" -}}
{{- $scratch := $context.Scratch.Get "scratch" -}}
{{- $loading := resources.Get "svg/loading.svg" | minify -}} {{- $loading := resources.Get "svg/loading.svg" | minify -}}
{{- if not (index . "src") | and (index . "src-s") -}} {{- if not .src | and .src_s -}}
{{- $loading = resources.Get "svg/loading.small.svg" | minify -}} {{- $loading = resources.Get "svg/loading.small.svg" | minify -}}
{{- end -}} {{- end -}}
{{- if index . "lightgallery" -}} {{- if .lightgallery -}}
<a class="lightgallery" href="{{ $large | safeURL }}" title="{{ $description }}" data-thumbnail="{{ $small | safeURL }}"{{ if $title }} data-sub-html="<h2>{{ $title }}</h2><p>{{ $description }}</p>"{{ end }}> <a class="lightgallery" href="{{ $large | safeURL }}" title="{{ .description }}" data-thumbnail="{{ $small | safeURL }}"{{ if .title }} data-sub-html="<h2>{{ .title }}</h2><p>{{ .description }}</p>"{{ end }}>
<img <img
class="lazyload" class="lazyload"
src="{{ $loading.RelPermalink | safeURL }}" src="{{ $loading.RelPermalink | safeURL }}"
data-sizes="auto" data-sizes="auto"
data-srcset="{{ $small | safeURL }}, {{ $src | safeURL }} 1.5x, {{ $large | safeURL }} 2x" data-srcset="{{ $small | safeURL }}, {{ .src | safeURL }} 1.5x, {{ $large | safeURL }} 2x"
data-src="{{ $src | safeURL }}" data-src="{{ .src | safeURL }}"
alt="{{ $title | default $description }}" /> alt="{{ .title | default .description }}" />
</a> </a>
{{- $scratch.Set "lightgallery" true -}} {{- .scratch.Set "lightgallery" true -}}
{{- else -}} {{- else -}}
<img <img
class="lazyload" class="lazyload"
src="{{ $loading.RelPermalink | safeURL }}" src="{{ $loading.RelPermalink | safeURL }}"
data-sizes="auto" data-sizes="auto"
data-srcset="{{ $small | safeURL }}, {{ $src | safeURL }} 1.5x, {{ $large | safeURL }} 2x" data-srcset="{{ $small | safeURL }}, {{ .src | safeURL }} 1.5x, {{ $large | safeURL }} 2x"
data-src="{{ $src | safeURL }}" data-src="{{ .src | safeURL }}"
alt="{{ $title | default $description }}" alt="{{ .title | default .description }}"
title="{{ $description }}" /> title="{{ .description }}" />
{{- end -}} {{- end -}}
{{- $scratch.Set "lazysizes" true -}} {{- .scratch.Set "lazysizes" true -}}

View File

@@ -1,9 +1,8 @@
{{- $href := index . "href" -}} <a href="{{ .href | safeURL }}"{{ with .title }} title="{{ . }}"{{ end }}{{ if strings.HasPrefix .href "http" }} target="_blank"{{ end }} rel="noopener noreffer{{ with .rel }} {{ . }}{{ end }}">
<a href="{{ $href | safeURL }}"{{ with index . "title" }} title="{{ . }}"{{ end }}{{ if strings.HasPrefix $href "http" }} target="_blank"{{ end }} rel="noopener noreffer{{ with index . `rel` }} {{ . }}{{ end }}"> {{- with .icon -}}
{{- with index . "icon" -}}
{{- partial "plugin/icon.html" . -}} {{- partial "plugin/icon.html" . -}}
{{- end -}} {{- end -}}
{{- with index . "content" -}} {{- with .content -}}
{{- . | safeHTML -}} {{- . | safeHTML -}}
{{- end -}} {{- end -}}
</a> </a>

View File

@@ -97,7 +97,7 @@
{{- /* 014: Instapaper */ -}} {{- /* 014: Instapaper */ -}}
{{- if .Params.Share.Instapaper | default .Site.Params.Share.Instapaper | eq true -}} {{- if .Params.Share.Instapaper | default .Site.Params.Share.Instapaper | eq true -}}
<a href="javascript:void(0);" title="{{ T `share` }} Instapaper" data-sharer="instapaper" data-url="{{ .Permalink }}" data-title="{{ .Title }}" data-description="{{ .Description }}"> <a href="javascript:void(0);" title="{{ T `share` }} Instapaper" data-sharer="instapaper" data-url="{{ .Permalink }}" data-title="{{ .Title }}" data-description="{{ .Description }}">
{{- partial "plugin/icon.html" (dict "class" "loveit it-instapaper-fill" "type" "other" "context" .) -}} {{- partial "plugin/icon.html" (dict "class" "loveit it-instapaper-fill" "type" "other" "scratch" $scratch) -}}
</a> </a>
{{- end -}} {{- end -}}
@@ -146,7 +146,7 @@
{{- /* 021: Myspace */ -}} {{- /* 021: Myspace */ -}}
{{- if .Params.Share.Myspace | default .Site.Params.Share.Myspace | eq true -}} {{- if .Params.Share.Myspace | default .Site.Params.Share.Myspace | eq true -}}
<a href="javascript:void(0);" title="{{ T `share` }} Myspace" data-sharer="myspace" data-url="{{ .Permalink }}" data-title="{{ .Title }}" data-description="{{ .Description }}"> <a href="javascript:void(0);" title="{{ T `share` }} Myspace" data-sharer="myspace" data-url="{{ .Permalink }}" data-title="{{ .Title }}" data-description="{{ .Description }}">
{{- partial "plugin/icon.html" (dict "class" "loveit it-myspace-fill" "type" "other" "context" .) -}} {{- partial "plugin/icon.html" (dict "class" "loveit it-myspace-fill" "type" "other" "scratch" $scratch) -}}
</a> </a>
{{- end -}} {{- end -}}
@@ -160,7 +160,7 @@
{{- /* 023: 百度 */ -}} {{- /* 023: 百度 */ -}}
{{- if .Params.Share.Baidu | default .Site.Params.Share.Baidu | eq true -}} {{- if .Params.Share.Baidu | default .Site.Params.Share.Baidu | eq true -}}
<a href="javascript:void(0);" title="{{ T `share` }} 百度" data-sharer="baidu" data-url="{{ .Permalink }}" data-title="{{ .Title }}"> <a href="javascript:void(0);" title="{{ T `share` }} 百度" data-sharer="baidu" data-url="{{ .Permalink }}" data-title="{{ .Title }}">
{{- partial "plugin/icon.html" (dict "class" "loveit it-baidu-fill" "type" "other" "context" .) -}} {{- partial "plugin/icon.html" (dict "class" "loveit it-baidu-fill" "type" "other" "scratch" $scratch) -}}
</a> </a>
{{- end -}} {{- end -}}

View File

@@ -1,3 +1,5 @@
{{- $scratch := .Scratch.Get "scratch" -}}
{{- /* 001: Github */ -}} {{- /* 001: Github */ -}}
{{- with .Site.Params.Social.Github -}} {{- with .Site.Params.Social.Github -}}
{{- $options := dict "href" (printf "https://github.com/%s" .) "title" "GitHub" "rel" "me" -}} {{- $options := dict "href" (printf "https://github.com/%s" .) "title" "GitHub" "rel" "me" -}}
@@ -302,7 +304,7 @@
{{- /* 044: 知乎 */ -}} {{- /* 044: 知乎 */ -}}
{{- with .Site.Params.Social.Zhihu -}} {{- with .Site.Params.Social.Zhihu -}}
{{- $options := dict "href" (printf "https://www.zhihu.com/people/%s" .) "title" "知乎" "rel" "me" -}} {{- $options := dict "href" (printf "https://www.zhihu.com/people/%s" .) "title" "知乎" "rel" "me" -}}
{{- $options = dict "icon" (dict "class" "loveit it-zhihu-line" "type" "other" "context" $) | merge $options -}} {{- $options = dict "icon" (dict "class" "loveit it-zhihu-line" "type" "other" "scratch" $scratch) | merge $options -}}
{{- partial "plugin/link.html" $options -}} {{- partial "plugin/link.html" $options -}}
{{- end -}} {{- end -}}
@@ -394,28 +396,28 @@
{{- /* 055: Gitea */ -}} {{- /* 055: Gitea */ -}}
{{- with .Site.Params.Social.Gitea -}} {{- with .Site.Params.Social.Gitea -}}
{{- $options := dict "href" . "title" "Gitea" "rel" "me" -}} {{- $options := dict "href" . "title" "Gitea" "rel" "me" -}}
{{- $options = dict "icon" (dict "class" "fa fa-gitea fa-fw" "type" "fo" "context" $) | merge $options -}} {{- $options = dict "icon" (dict "class" "fa fa-gitea fa-fw" "type" "fo" "scratch" $scratch) | merge $options -}}
{{- partial "plugin/link.html" $options -}} {{- partial "plugin/link.html" $options -}}
{{- end -}} {{- end -}}
{{- /* 056: XMPP */ -}} {{- /* 056: XMPP */ -}}
{{- with .Site.Params.Social.XMPP -}} {{- with .Site.Params.Social.XMPP -}}
{{- $options := dict "href" (printf "xmpp:%s" .) "title" "XMPP" "rel" "me" -}} {{- $options := dict "href" (printf "xmpp:%s" .) "title" "XMPP" "rel" "me" -}}
{{- $options = dict "icon" (dict "class" "fa fa-xmpp fa-fw" "type" "fo" "context" $) | merge $options -}} {{- $options = dict "icon" (dict "class" "fa fa-xmpp fa-fw" "type" "fo" "scratch" $scratch) | merge $options -}}
{{- partial "plugin/link.html" $options -}} {{- partial "plugin/link.html" $options -}}
{{- end -}} {{- end -}}
{{- /* 057: Matrix */ -}} {{- /* 057: Matrix */ -}}
{{- with .Site.Params.Social.Matrix -}} {{- with .Site.Params.Social.Matrix -}}
{{- $options := dict "href" (printf "https://matrix.to/#/%s" .) "title" "Matrix" "rel" "me" -}} {{- $options := dict "href" (printf "https://matrix.to/#/%s" .) "title" "Matrix" "rel" "me" -}}
{{- $options = dict "icon" (dict "class" "fa fa-matrix-org fa-fw" "type" "fo" "context" $) | merge $options -}} {{- $options = dict "icon" (dict "class" "fa fa-matrix-org fa-fw" "type" "fo" "scratch" $scratch) | merge $options -}}
{{- partial "plugin/link.html" $options -}} {{- partial "plugin/link.html" $options -}}
{{- end -}} {{- end -}}
{{- /* 058: bilibili */ -}} {{- /* 058: bilibili */ -}}
{{- with .Site.Params.Social.Bilibili -}} {{- with .Site.Params.Social.Bilibili -}}
{{- $options := dict "href" (printf "https://space.bilibili.com/%s" .) "title" "bilibili" "rel" "me" -}} {{- $options := dict "href" (printf "https://space.bilibili.com/%s" .) "title" "bilibili" "rel" "me" -}}
{{- $options = dict "icon" (dict "class" "loveit it-bilibili-fill" "type" "other" "context" $) | merge $options -}} {{- $options = dict "icon" (dict "class" "loveit it-bilibili-fill" "type" "other" "scratch" $scratch) | merge $options -}}
{{- partial "plugin/link.html" $options -}} {{- partial "plugin/link.html" $options -}}
{{- end -}} {{- end -}}

View File

@@ -47,7 +47,7 @@
{{- /* Featured image */ -}} {{- /* Featured image */ -}}
{{- with .Params.featuredImage -}} {{- with .Params.featuredImage -}}
<div class="featured-image"> <div class="featured-image">
{{- partial "plugin/image.html" (dict "src" . "description" $.Description "context" $) -}} {{- partial "plugin/image.html" (dict "src" . "description" $.Description "scratch" $scratch) -}}
</div> </div>
{{- end -}} {{- end -}}

View File

@@ -1,6 +0,0 @@
{{- $scratch := .Page.Scratch.Get "scratch" -}}
{{- /* shuffle md5 as id */ -}}
{{- $id := delimit (split (md5 .Inner) "" | shuffle) "" | printf "echarts-%s" -}}
<div class="echarts" id="{{ $id }}"></div>
{{- $scratch.SetInMap "echartsMap" $id (printf "{%s}" .Inner) -}}

View File

@@ -0,0 +1,6 @@
{{- $scratch := .Page.Scratch.Get "scratch" -}}
{{- $content := .Inner | transform.Unmarshal | jsonify -}}
{{- $id := partial "function/id.html" (dict "content" $content "scratch" $scratch) -}}
<div class="echarts" id="{{ $id }}"></div>
{{- slice $id | $scratch.Add "echartsArr" -}}

View File

@@ -1,6 +1,5 @@
{{- $scratch := .Page.Scratch.Get "scratch" -}} {{- $scratch := .Page.Scratch.Get "scratch" -}}
{{- /* shuffle md5 as id */ -}} {{- $id := partial "function/id.html" (dict "content" (trim .Inner "\n") "scratch" $scratch) -}}
{{- $id := delimit (split (md5 .Inner) "" | shuffle) "" | printf "mermaid-%s" -}}
<div class="mermaid" id="{{ $id }}"></div> <div class="mermaid" id="{{ $id }}"></div>
{{- $scratch.SetInMap "mermaidMap" $id (trim .Inner "\n") -}} {{- slice $id | $scratch.Add "mermaidArr" -}}

View File

@@ -1,16 +1,12 @@
{{- $scratch := .Page.Scratch.Get "scratch" -}} {{- $scratch := .Page.Scratch.Get "scratch" -}}
{{- /* only the trailing newline is retained */ -}} {{- /* only the trailing newline is retained */ -}}
{{- $content := replaceRE `(?s)^\n*(.*?)\n*$` "$1\n" .Inner | .Page.RenderString -}} {{- $content := replaceRE `(?s)^\n*(.*?)\n*$` "$1\n" .Inner | .Page.RenderString | chomp -}}
{{- /* shuffle md5 as id */ -}} {{- $id := partial "function/id.html" (dict "content" $content "scratch" $scratch) -}}
{{- $id := delimit (split (md5 $content) "" | shuffle) "" | printf "typeit-%s" -}}
<div class={{ .Get "class" | default "typeit" }}> <div class={{ .Get "class" | default "typeit" }}>
{{- /* raw html content */ -}} {{- /* raw html content */ -}}
{{- if .Get "raw" -}} {{- if .Get "raw" -}}
<div id={{ printf "r%s" $id }} hidden=true>
{{- $content | safeHTML -}}
</div>
<div id={{ $id }}></div> <div id={{ $id }}></div>
{{- else if .Get "code" -}} {{- else if .Get "code" -}}
{{- /* highlight code content without line number */ -}} {{- /* highlight code content without line number */ -}}
@@ -23,16 +19,9 @@
{{- $content = replaceRE ` ` "&nbsp;" $content | replaceRE `(<\w+)&nbsp;` "$1 " | replaceRE `\n` "<br />" -}} {{- $content = replaceRE ` ` "&nbsp;" $content | replaceRE `(<\w+)&nbsp;` "$1 " | replaceRE `\n` "<br />" -}}
{{- /* fix "<br />" location error which is a bug of Typeit HTML parser */ -}} {{- /* fix "<br />" location error which is a bug of Typeit HTML parser */ -}}
{{- $content = replaceRE `<br /></span>` "</span><br />" $content -}} {{- $content = replaceRE `<br /></span>` "</span><br />" $content -}}
<div id={{ printf "r%s" $id }} hidden=true>
{{- $content | safeHTML -}}
</div>
<div class="highlight" id={{ $id }}></div> <div class="highlight" id={{ $id }}></div>
{{- else -}} {{- else -}}
{{- $tag := .Get "tag" | default "p" -}} {{- $tag := .Get "tag" | default "p" -}}
{{- $content = $content | chomp -}}
<div id={{ printf "r%s" $id }} hidden=true>
{{- $content | safeHTML -}}
</div>
{{- printf "<%s id=%s></%s>" $tag $id $tag | safeHTML -}} {{- printf "<%s id=%s></%s>" $tag $id $tag | safeHTML -}}
{{- end -}} {{- end -}}

View File

@@ -1 +1 @@
{"Target":"css/style.min.0c871a59eda3563babe70ccf804244063ca3f833552e8ca99ccd9c802d6d67f0.css","MediaType":"text/css","Data":{"Integrity":"sha256-DIcaWe2jVjur5wzPgEJEBjyj+DNVLoypnM2cgC1tZ/A="}} {"Target":"css/style.min.5313a7cd528e285a82280f60228e0e2501181a5445bde1bc99d7c7dbdb7a4767.css","MediaType":"text/css","Data":{"Integrity":"sha256-UxOnzVKOKFqCKA9gIo4OJQEYGlRFveG8mdfH29t6R2c="}}

View File

@@ -1 +1 @@
{"Target":"lib/mermaid/mermaid.6094c0b431ca63173ab925fcceb838ae3b251b0b0fc0d3974c6ae78ae3c0bc2d.css","MediaType":"text/css","Data":{"Integrity":"sha256-YJTAtDHKYxc6uSX8zrg4rjslGwsPwNOXTGrniuPAvC0="}} {"Target":"lib/mermaid/mermaid.828bd139deac55c048b4d9ed77d849196aada4a0ea2268d7c59946e8d71665b7.css","MediaType":"text/css","Data":{"Integrity":"sha256-govROd6sVcBItNntd9hJGWqtpKDqImjXxZlG6NcWZbc="}}

View File

@@ -171,29 +171,27 @@
} }
initMermaid() { initMermaid() {
if (window.mermaidMap) { if (window.mermaidArr) {
mermaid.initialize({startOnLoad: false, theme: null}); mermaid.initialize({startOnLoad: false, theme: 'null'});
Object.keys(window.mermaidMap).forEach((id) => { this.util.forEach(window.mermaidArr, (id) => {
const element = document.getElementById(id); const element = document.getElementById(id);
mermaid.mermaidAPI.render("d" + id, window.mermaidMap[id], (svgCode) => { mermaid.mermaidAPI.render('svg-' + id, window.contentMap[id], (svgCode) => {
element.innerHTML = svgCode; element.innerHTML = svgCode;
const svg = element.firstChild;
svg.style.width = "100%"
}, element); }, element);
}); });
} }
} }
initEcharts() { initEcharts() {
if (window.echartsMap) { if (window.echartsArr) {
this._echartsArr = this._echartsArr || []; this._echartsArr = this._echartsArr || [];
for (let i = 0; i < this._echartsArr.length; i++) { for (let i = 0; i < this._echartsArr.length; i++) {
this._echartsArr[i].dispose(); this._echartsArr[i].dispose();
} }
this._echartsArr = []; this._echartsArr = [];
Object.keys(window.echartsMap).forEach((id) => { this.util.forEach(window.echartsArr, (id) => {
const chart = echarts.init(document.getElementById(id), window.isDark ? 'dark' : 'macarons', {renderer: 'svg'}); const chart = echarts.init(document.getElementById(id), window.isDark ? 'dark' : 'macarons', {renderer: 'svg'});
chart.setOption(window.echartsMap[id]); chart.setOption(JSON.parse(window.contentMap[id]));
this._echartsArr.push(chart); this._echartsArr.push(chart);
}); });
this._echartsOnResize = this._echartsOnResize || (() => { this._echartsOnResize = this._echartsOnResize || (() => {
@@ -210,15 +208,15 @@
for (let i = 0; i < window.typeitArr.length; i++) { for (let i = 0; i < window.typeitArr.length; i++) {
const group = window.typeitArr[i]; const group = window.typeitArr[i];
(function typeone(i) { (function typeone(i) {
const content = document.getElementById(`r${group[i]}`).innerHTML; const id = group[i];
if (i === group.length - 1) { if (i === group.length - 1) {
new TypeIt(`#${group[i]}`, { new TypeIt(`#${id}`, {
strings: content, strings: window.contentMap[id],
}).go(); }).go();
return; return;
} }
let instance = new TypeIt(`#${group[i]}`, { let instance = new TypeIt(`#${id}`, {
strings: content, strings: window.contentMap[id],
afterComplete: () => { afterComplete: () => {
instance.destroy(); instance.destroy();
typeone(i + 1); typeone(i + 1);
@@ -291,6 +289,7 @@
this.initMenuMobile(); this.initMenuMobile();
this.initToc(); this.initToc();
this.initSmoothScroll(); this.initSmoothScroll();
this.initMermaid()
}, 100); }, 100);
} }
}, false); }, false);