feature(doc): complete all Chinese and English documents and fix many bugs
This commit is contained in:
@@ -16,45 +16,37 @@
|
||||
|
||||
{{- if .IsNamedParams -}}
|
||||
{{- $type := .Get "type" | default "note" -}}
|
||||
{{- if eq (.Get "details") "true" -}}
|
||||
{{- if .Get "details" -}}
|
||||
<details class="admonition {{ $type }}">
|
||||
{{- with .Get "title" -}}
|
||||
<summary class="admonition-title">
|
||||
<i class="icon {{ index $iconMap $type | default (index $iconMap "note") }}"></i>{{ . }}<i class="details {{ $iconDetails }}"></i>
|
||||
</summary>
|
||||
{{- end -}}
|
||||
<summary class="admonition-title">
|
||||
<i class="icon {{ index $iconMap $type | default (index $iconMap "note") }}"></i>{{ .Get "title" | default (T $type) }}<i class="details {{ $iconDetails }}"></i>
|
||||
</summary>
|
||||
<div class="admonition-content">
|
||||
{{- $inner -}}
|
||||
</div>
|
||||
</details>
|
||||
{{- else -}}
|
||||
<div class="admonition {{ $type }}">
|
||||
{{- with .Get "title" -}}
|
||||
<p class="admonition-title"><i class="icon {{ index $iconMap $type | default (index $iconMap "note") }}"></i>{{ . }}</p>
|
||||
{{- end -}}
|
||||
<p class="admonition-title"><i class="icon {{ index $iconMap $type | default (index $iconMap "note") }}"></i>{{ .Get "title" | default (T $type) }}</p>
|
||||
<div class="admonition-content">
|
||||
{{- $inner -}}
|
||||
</div>
|
||||
</div>
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- $type := .Get 0 -}}
|
||||
{{- if eq (.Get 2) "true" -}}
|
||||
{{- $type := .Get 0 | default "note" -}}
|
||||
{{- if .Get 2 -}}
|
||||
<details class="admonition {{ $type }}">
|
||||
{{- with .Get 1 -}}
|
||||
<summary class="admonition-title">
|
||||
<i class="icon {{ index $iconMap $type | default (index $iconMap "note") }}"></i>{{ . }}<i class="details {{ $iconDetails }}"></i>
|
||||
</summary>
|
||||
{{- end -}}
|
||||
<summary class="admonition-title">
|
||||
<i class="icon {{ index $iconMap $type | default (index $iconMap "note") }}"></i>{{ .Get 1 | default (T $type) }}<i class="details {{ $iconDetails }}"></i>
|
||||
</summary>
|
||||
<div class="admonition-content">
|
||||
{{- $inner -}}
|
||||
</div>
|
||||
</details>
|
||||
{{- else -}}
|
||||
<div class="admonition {{ $type }}">
|
||||
{{- with .Get 1 -}}
|
||||
<p class="admonition-title"><i class="icon {{ index $iconMap $type | default (index $iconMap "note") }}"></i>{{ . }}</p>
|
||||
{{- end -}}
|
||||
<p class="admonition-title"><i class="icon {{ index $iconMap $type | default (index $iconMap "note") }}"></i>{{ .Get 1 | default (T $type) }}</p>
|
||||
<div class="admonition-content">
|
||||
{{- $inner -}}
|
||||
</div>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<div class="bilibili">
|
||||
{{- if .IsNamedParams -}}
|
||||
<iframe src="//player.bilibili.com/player.html?aid={{ .Get "aid" }}&cid={{ .Get "cid" }}&page=1" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"></iframe>
|
||||
<iframe src="//player.bilibili.com/player.html?aid={{ .Get `av` }}&page={{ .Get `p` | default 1 }}" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"></iframe>
|
||||
{{- else -}}
|
||||
<iframe src="//player.bilibili.com/player.html?aid={{ .Get 0 }}&cid={{ .Get 1 }}&page=1" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"></iframe>
|
||||
<iframe src="//player.bilibili.com/player.html?aid={{ .Get 0 }}&page={{ .Get 1 | default 1 }}" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"></iframe>
|
||||
{{- end -}}
|
||||
</div>
|
||||
|
||||
@@ -2,13 +2,15 @@
|
||||
{{- $options := .Get "src" | dict "src" -}}
|
||||
{{- $options = .Get "src_s" | dict "src_s" | merge $options -}}
|
||||
{{- $options = .Get "src_l" | dict "src_l" | merge $options -}}
|
||||
{{- $options = .Get "title" | dict "title" | merge $options -}}
|
||||
{{- $options = .Get "description" | dict "description" | merge $options -}}
|
||||
{{- $title := .Get "title" | $.Page.RenderString -}}
|
||||
{{- $options = $title | dict "title" | merge $options -}}
|
||||
{{- $description := .Get "description" | $.Page.RenderString -}}
|
||||
{{- $options = $description | dict "description" | merge $options -}}
|
||||
{{- $lightgallery := ne .Page.Site.Params.page.lightgallery false | and (ne .Page.Params.lightgallery false) -}}
|
||||
{{- $options = $lightgallery | dict "lightgallery" | merge $options -}}
|
||||
{{- $options = .Page.Scratch.Get "scratch" | dict "scratch" | merge $options -}}
|
||||
{{- partial "plugin/image.html" $options -}}
|
||||
{{- with (.Get "title" | default .Get "description") -}}
|
||||
{{- with $title | default $description -}}
|
||||
<figcaption class="image-caption">
|
||||
{{- . | safeHTML -}}
|
||||
</figcaption>
|
||||
|
||||
@@ -1,14 +1,42 @@
|
||||
{{- $scratch := .Page.Scratch.Get "scratch" -}}
|
||||
|
||||
{{- if .IsNamedParams -}}
|
||||
<meting-js server="{{ .Get "server" }}" type="{{ .Get "type" }}" id="{{ .Get "id" }}" theme="#A9A9B3"
|
||||
{{- with .Get "autoplay" }} autoplay="{{ . }}"{{ end -}}
|
||||
{{- with .Get "mini" }} mini="{{ . }}"{{ end -}}
|
||||
{{- with .Get "fixed" }} fixed="{{ . }}"{{ end -}}
|
||||
{{- with .Get "list-folded" }} list-folded="{{ . }}"{{ end -}}
|
||||
{{- with .Get "list-max-height" }} list-max-height="{{ . }}"{{ end -}}
|
||||
></meting-js>
|
||||
{{- if .Get "url" -}}
|
||||
<meting-js url="{{ .Get `url` }}" name="{{ .Get `name` }}" artist="{{ .Get `artist` }}" cover="{{ .Get `cover` }}" theme="{{ .Get `theme` | default `#a9a9b3` }}"
|
||||
{{- with .Get "fixed" }} fixed="{{ . }}"{{ end -}}
|
||||
{{- with .Get "mini" }} mini="{{ . }}"{{ end -}}
|
||||
{{- with .Get "autoplay" }} autoplay="{{ . }}"{{ end -}}
|
||||
{{- with .Get "volume" }} volume="{{ . }}"{{ end -}}
|
||||
{{- with .Get "mutex" }} mutex="{{ . }}"{{ end -}}
|
||||
></meting-js>
|
||||
{{- else if .Get "auto" -}}
|
||||
<meting-js auto="{{ .Get `auto` }}" theme="{{ .Get `theme` | default `#a9a9b3` }}"
|
||||
{{- with .Get "fixed" }} fixed="{{ . }}"{{ end -}}
|
||||
{{- with .Get "mini" }} mini="{{ . }}"{{ end -}}
|
||||
{{- with .Get "autoplay" }} autoplay="{{ . }}"{{ end -}}
|
||||
{{- with .Get "loop" }} loop="{{ . }}"{{ end -}}
|
||||
{{- with .Get "order" }} order="{{ . }}"{{ end -}}
|
||||
{{- with .Get "volume" }} volume="{{ . }}"{{ end -}}
|
||||
{{- with .Get "mutex" }} mutex="{{ . }}"{{ end -}}
|
||||
{{- with .Get "list-folded" }} list-folded="{{ . }}"{{ end -}}
|
||||
{{- with .Get "list-max-height" }} list-max-height="{{ . }}"{{ end -}}
|
||||
></meting-js>
|
||||
{{- else -}}
|
||||
<meting-js server="{{ .Get `server` }}" type="{{ .Get `type` }}" id="{{ .Get `id` }}" theme="{{ .Get `theme` | default `#a9a9b3` }}"
|
||||
{{- with .Get "fixed" }} fixed="{{ . }}"{{ end -}}
|
||||
{{- with .Get "mini" }} mini="{{ . }}"{{ end -}}
|
||||
{{- with .Get "autoplay" }} autoplay="{{ . }}"{{ end -}}
|
||||
{{- with .Get "loop" }} loop="{{ . }}"{{ end -}}
|
||||
{{- with .Get "order" }} order="{{ . }}"{{ end -}}
|
||||
{{- with .Get "volume" }} volume="{{ . }}"{{ end -}}
|
||||
{{- with .Get "mutex" }} mutex="{{ . }}"{{ end -}}
|
||||
{{- with .Get "list-folded" }} list-folded="{{ . }}"{{ end -}}
|
||||
{{- with .Get "list-max-height" }} list-max-height="{{ . }}"{{ end -}}
|
||||
></meting-js>
|
||||
{{- end -}}
|
||||
{{- else if strings.HasSuffix (.Get 0) "http" -}}
|
||||
<meting-js auto="{{ .Get 0 }}" theme="#a9a9b3"></meting-js>
|
||||
{{- else -}}
|
||||
<meting-js server="{{ .Get 0 }}" type="{{ .Get 1 }}" id="{{ .Get 2 }}" theme="#A9A9B3"></meting-js>
|
||||
<meting-js server="{{ .Get 0 }}" type="{{ .Get 1 }}" id="{{ .Get 2 }}" theme="#a9a9b3"></meting-js>
|
||||
{{- end -}}
|
||||
{{- $scratch.Set "music" true -}}
|
||||
|
||||
@@ -1,32 +1,33 @@
|
||||
{{- $scratch := .Page.Scratch.Get "scratch" -}}
|
||||
|
||||
{{- /* only the trailing newline is retained */ -}}
|
||||
{{- $content := replaceRE `(?s)^\n*(.*?)\n*$` "$1\n" .Inner | .Page.RenderString | chomp -}}
|
||||
{{- $content := .Inner -}}
|
||||
{{- $classList := .Get "class" | slice -}}
|
||||
{{- $tag := .Get "tag" | default "div" -}}
|
||||
|
||||
{{- with .Get "code" -}}
|
||||
{{- /* highlight code content without line number */ -}}
|
||||
{{- $content = highlight $content . "linenos=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 " " and replace "\n" to "<br />" */ -}}
|
||||
{{- $content = replaceRE ` ` " " $content | replaceRE `(<\w+) ` "$1 " | replaceRE `\n` "<br />" -}}
|
||||
{{- /* fix "<br />" location error which is a bug of Typeit HTML parser */ -}}
|
||||
{{- $content = replaceRE `<br /></span>` "</span><br />" $content -}}
|
||||
{{- $classList = $classList | append "highlight" -}}
|
||||
{{- else -}}
|
||||
{{- $content = $content | .Page.RenderString -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* trim the newline */ -}}
|
||||
{{- $content = trim $content "\n" -}}
|
||||
{{- $id := partial "function/id.html" (dict "content" $content "scratch" $scratch) -}}
|
||||
{{- $key := .Get "group" | default $id -}}
|
||||
{{- $group := index ($scratch.Get "typeitMap" | default dict) $key -}}
|
||||
{{- $group = $group | default slice | append $id -}}
|
||||
{{- $scratch.SetInMap "typeitMap" $key $group -}}
|
||||
|
||||
<div class={{ .Get "class" | default "typeit" }}>
|
||||
{{- /* raw html content */ -}}
|
||||
{{- if .Get "raw" -}}
|
||||
<div id={{ $id }}></div>
|
||||
{{- else if .Get "code" -}}
|
||||
{{- /* highlight code content without line number */ -}}
|
||||
{{- $content = highlight $content (.Get "code") "linenos=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 " " and replace "\n" to "<br />" */ -}}
|
||||
{{- $content = replaceRE ` ` " " $content | replaceRE `(<\w+) ` "$1 " | replaceRE `\n` "<br />" -}}
|
||||
{{- /* fix "<br />" location error which is a bug of Typeit HTML parser */ -}}
|
||||
{{- $content = replaceRE `<br /></span>` "</span><br />" $content -}}
|
||||
<div class="highlight" id={{ $id }}></div>
|
||||
{{- else -}}
|
||||
{{- $tag := .Get "tag" | default "p" -}}
|
||||
{{- printf "<%s id=%s></%s>" $tag $id $tag | safeHTML -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $key := .Get "group" | default $id -}}
|
||||
{{- $group := index ($scratch.Get "typeitMap" | default dict) $key -}}
|
||||
{{- $group = $group | default slice | append $id -}}
|
||||
{{- $scratch.SetInMap "typeitMap" $key $group -}}
|
||||
<div class="typeit">
|
||||
{{- printf `<%s id="%s" class="%s"></%s>` $tag $id (delimit $classList " ") $tag | safeHTML -}}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user