chore(partials): refactor partials

This commit is contained in:
Dillon
2020-02-21 23:42:35 +08:00
parent 611518ddd1
commit 4e6fe224cc
27 changed files with 554 additions and 534 deletions

View File

@@ -0,0 +1,28 @@
{{- /* Font Awesome */ -}}
{{- /* :(far fa-circle): -> <i class="far fa-circle fa-fw"></i> */ -}}
{{- $REin := `:\(([\w- ]+?)\):` -}}
{{- $REout := `<i class="$1 fa-fw"></i>` -}}
{{- $content := replaceRE $REin $REout . -}}
{{- /* Ruby */ -}}
{{- /* [EN]^(English) -> <strong><ruby>EN<rt>English</rt></ruby></strong> */ -}}
{{- $REin = `\[(.+?)\]\^\((.+?)\)` -}}
{{- $REout = `<strong><ruby>$1<rt>$2</rt></ruby></strong>` -}}
{{- $content = replaceRE $REin $REout $content -}}
{{- /* Checkbox */ -}}
{{- $REin = `<input disabled="" type="checkbox">` -}}
{{- $REout = `<i class="far fa-check-square fa-fw"></i>` -}}
{{- $content = replaceRE $REin $REout $content -}}
{{- /* Checkbox checked */ -}}
{{- $REin = `<input checked="" disabled="" type="checkbox">` -}}
{{- $REout = `<i class="far fa-square fa-fw"></i>` -}}
{{- $content = replaceRE $REin $REout $content -}}
{{- /* Fix <sup>[return]</sup> */ -}}
{{- $REin = `<sup>\[return\]</sup>` -}}
{{- $REout = `↩︎` -}}
{{- $content = replaceRE $REin $REout $content -}}
{{- $content | safeHTML -}}

View File

@@ -0,0 +1,65 @@
{{- $modify_date := .Lastmod.Format (.Site.Params.dateFormatToUse | default "2006-01-02") -}}
<div class="post-footer" id="post-footer">
<div class="post-info">
<div class="post-info-line">
<div class="post-info-mod">
<span>
{{- printf (T "lastMod") $modify_date -}}
</span>
</div>
<div class="post-info-license">
{{- if .Params.license -}}
<span>
{{- printf (T "license") .Params.license | safeHTML -}}
</span>
{{- end -}}
</div>
</div>
<div class="post-info-line">
<div class="post-info-md">
{{- if .Site.Params.page.linkToMarkdown -}}
{{- with .OutputFormats.Get "markdown" -}}
<span>
<a class="link-to-markdown" href="{{ .Permalink }}" target="_blank">
{{- T "seeMarkdown" -}}
</a>
</span>
{{- end -}}
{{- end -}}
</div>
<div class="post-info-share">
{{- if .Site.Params.page.socialShare -}}
<span>
{{- partial "plugin/share.html" . -}}
</span>
{{- end -}}
</div>
</div>
</div>
<div class="post-info-more">
<section>
{{- with .Params.tags -}}
{{- range . -}}
<span>
<a href="{{ `/tags/` | relLangURL }}{{ urlize .}}">
<i class="fas fa-tag fa-fw"></i>{{ . }}
</a>
</span>&nbsp;
{{- end -}}
{{- end -}}
</section>
<section>
<span><a href="javascript:window.history.back();">{{ T "back" }}</a></span>&nbsp;|&nbsp;<span><a href="{{ `/` | relLangURL }}">{{ T "home" }}</a></span>
</section>
</div>
<div class="post-nav">
{{- if .PrevInSection -}}
<a href="{{ .PrevInSection.Permalink }}" class="prev" rel="prev" title="{{ .PrevInSection.Title }}"><i class="fas fa-angle-left fa-fw"></i>{{ .PrevInSection.Title }}</a>
{{- end -}}
{{ if .NextInSection }}
<a href="{{ .NextInSection.Permalink }}" class="next" rel="next" title="{{ .NextInSection.Title }}">{{ .NextInSection.Title }}<i class="fas fa-angle-right fa-fw"></i></a>
{{- end -}}
</div>
</div>