docs: update theme preview and translation (#262)

This commit is contained in:
Dillon
2020-04-26 23:00:29 +08:00
committed by GitHub
parent a4439ad596
commit 19c7da333d
55 changed files with 728 additions and 114 deletions

View File

@@ -7,12 +7,12 @@
<h1 id="error-emoji"></h1>
<p class="error-text">
{{- T "pageNotFoundText" -}}&nbsp;
<a href="{{ .Site.Home.RelPermalink }}" title="{{ T `backToHome` }}">↩︎</a>
<a href="javascript:void(0);" title="{{ T `back` }}" onclick="window.history.back();"><i class="far fa-hand-point-left fa-fw"></i></a>
</p>
</div>
<script type="text/javascript">
(function() {
var emojiArray = ['\\(o_o)/', '(o^^)o', '(˚Δ˚)b', '(^-^*)', '(≥o≤)', '(^_^)b', '(·_·)','(=\'X\'=)', '(>_<)', '(;-;)', '\\(^Д^)/'];
var emojiArray = ['\\(o_o)/', '(˚Δ˚)b', '(^-^*)', '(≥o≤)', '(^_^)b', '(·_·)','(=\'X\'=)', '(>_<)', '(;-;)'];
document.getElementById('error-emoji').appendChild(document.createTextNode(emojiArray[Math.floor(Math.random() * emojiArray.length)]));
})();
</script>

View File

@@ -11,7 +11,12 @@
{{- /* Paginate */ -}}
{{- $pages := .Pages.GroupByDate "2006" -}}
{{- range (.Site.Params.section.paginate | default .Site.Params.paginate | .Paginate $pages).PageGroups -}}
{{- with .Site.Params.section.paginate | default .Site.Params.paginate -}}
{{- $pages = $.Paginate $pages . -}}
{{- else -}}
{{- $pages = .Paginate $pages -}}
{{- end -}}
{{- range $pages.PageGroups -}}
<h3 class="group-title">{{ .Key }}</h3>
{{- range .Pages -}}
<article class="archive-item">

View File

@@ -24,7 +24,11 @@
{{- else -}}
{{- $pages = where $pages "Params.hiddenfromhomepage" "!=" true -}}
{{- end -}}
{{- $pages = .Site.Params.home.posts.paginate | default .Site.Params.paginate | .Paginate $pages -}}
{{- with .Site.Params.home.posts.paginate | default .Site.Params.paginate -}}
{{- $pages = $.Paginate $pages . -}}
{{- else -}}
{{- $pages = .Paginate $pages -}}
{{- end -}}
{{- range $pages.Pages -}}
{{- .Render "summary" -}}
{{- end -}}

View File

@@ -28,7 +28,8 @@
{{- /* style.min.css */ -}}
{{- $stylesheet := dict "source" "css/style.template.scss" "fingerprint" $fingerprint -}}
{{- $options := dict "targetPath" "css/style.min.css" "includePaths" (slice "config/css") -}}
{{- $targetPath := cond .Site.IsMultiLingual (printf "css/style.%s.min.css" .Language.Lang) "css/style.min.css" -}}
{{- $options := dict "targetPath" $targetPath "includePaths" (slice "config/css") -}}
{{- $stylesheet = dict "template" "style.scss" "context" . "toCSS" $options | merge $stylesheet -}}
{{- partial "plugin/stylesheet.html" $stylesheet -}}

View File

@@ -19,7 +19,7 @@
{{- end -}}
<img
class="lazyload{{ with .class }} {{ . }}{{ end }}"
src="{{ $loading.RelPermalink | safeURL }}"
src="{{ $loading.RelPermalink }}"
data-sizes="auto"
data-srcset="{{ $small | relURL }}, {{ .src | relURL }} 1.5x, {{ $large | relURL }} 2x"
data-src="{{ .src | relURL }}"

View File

@@ -55,7 +55,7 @@
{{- end -}}
</section>
<section>
<span><a href="javascript:window.history.back();">{{ T "back" }}</a></span>&nbsp;|&nbsp;<span><a href="{{ .Site.Home.RelPermalink }}">{{ T "home" }}</a></span>
<span><a href="javascript:void(0);" onclick="window.history.back();">{{ T "back" }}</a></span>&nbsp;|&nbsp;<span><a href="{{ .Site.Home.RelPermalink }}">{{ T "home" }}</a></span>
</section>
</div>

View File

@@ -66,17 +66,14 @@
{{- end -}}
{{- /* Static TOC */ -}}
{{- if $params.toc.enable -}}
{{- if ne $params.toc.enable false -}}
<div class="details toc" id="toc-static">
<div class="details-summary toc-title">
<span>{{ T "contents" }}</span>
<span><i class="details-icon fas fa-angle-down"></i></span>
</div>
<div class="details-content toc-content" id="toc-content-static">
{{- $toc := .TableOfContents -}}
{{- $toc = partial "function/fontawesome.html" $toc -}}
{{- $toc = partial "function/ruby.html" $toc -}}
{{- $toc | safeHTML -}}
{{- dict "content" .TableOfContents "ruby" $params.ruby "fraction" $params.fraction "fontawesome" $params.fontawesome | partial "function/content.html" | safeHTML -}}
</div>
</div>
{{- end -}}

View File

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

View File

@@ -3,7 +3,8 @@
{{- $type := .Get 1 | default "new" | lower -}}
{{- $label := T $type -}}
{{- $color := cond (eq $type "changed") "ff9101" "00b1ff" | cond (eq $type "deleted") "ff5252" -}}
{{- $path := printf "svg/version/%s-%s.svg" $version $label -}}
{{- $pathTemplate := cond .Site.IsMultiLingual (printf "svg/version/%%s-%%s.%s.svg" .Page.Language.Lang) "svg/version/%s-%s.svg" -}}
{{- $path := printf $pathTemplate $version $type -}}
{{- $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 -}}

View File

@@ -18,7 +18,12 @@
{{- /* Paginate */ -}}
{{- $pages := .Pages.GroupByDate "2006" -}}
{{- range (.Site.Params.list.paginate | default .Site.Params.paginate | .Paginate $pages).PageGroups -}}
{{- with .Site.Params.list.paginate | default .Site.Params.paginate -}}
{{- $pages = $.Paginate $pages . -}}
{{- else -}}
{{- $pages = .Paginate $pages -}}
{{- end -}}
{{- range $pages.PageGroups -}}
<h3 class="group-title">{{ .Key }}</h3>
{{- range .Pages -}}
<article class="archive-item">