feat(partial): add hook and image partial
This commit is contained in:
@@ -36,6 +36,7 @@
|
|||||||
.home-description {
|
.home-description {
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
|
margin: 0;
|
||||||
padding: .4rem;
|
padding: .4rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,7 +44,12 @@
|
|||||||
padding-top: .6rem;
|
padding-top: .6rem;
|
||||||
|
|
||||||
i {
|
i {
|
||||||
font-size: 1.4rem;
|
font-size: 1.45rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
img {
|
||||||
|
width: 1.5rem;
|
||||||
|
height: 1.5rem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,6 @@
|
|||||||
<figure>
|
<figure>
|
||||||
<img
|
{{- $loading := resources.Get "svg/loading.svg" | minify -}}
|
||||||
{{ $res := resources.Get "svg/loading.svg" | minify -}}
|
<img src="{{ $loading.RelPermalink }}" data-sizes="auto" data-src="{{ .Destination | safeURL }}" alt="{{ .Text }}"{{ with .Title }} title="{{ . }}"{{ end }} class="lazyload">
|
||||||
src="{{ $res.RelPermalink }}"
|
|
||||||
data-sizes="auto"
|
|
||||||
data-src="{{ .Destination | safeURL }}"
|
|
||||||
alt="{{ .Text }}"
|
|
||||||
{{ with .Title -}}
|
|
||||||
title="{{ . }}"
|
|
||||||
{{ end -}}
|
|
||||||
class="lazyload"
|
|
||||||
>
|
|
||||||
<figcaption class="image-caption">
|
<figcaption class="image-caption">
|
||||||
{{- if .Title -}}
|
{{- if .Title -}}
|
||||||
{{- .Title -}}
|
{{- .Title -}}
|
||||||
|
|||||||
@@ -1,10 +1,3 @@
|
|||||||
<a href="{{ .Destination | safeURL }}"
|
<a href="{{ .Destination | safeURL }}"{{ with .Title }} title="{{ . }}"{{ end }}{{ if strings.HasPrefix .Destination "http" }} target="_blank"{{ end }}>
|
||||||
{{ with .Title -}}
|
|
||||||
title="{{ . }}"
|
|
||||||
{{ end -}}
|
|
||||||
{{ if strings.HasPrefix .Destination "http" -}}
|
|
||||||
target="_blank"
|
|
||||||
{{ end -}}
|
|
||||||
>
|
|
||||||
{{- .Text | safeHTML -}}
|
{{- .Text | safeHTML -}}
|
||||||
</a>
|
</a>
|
||||||
@@ -6,33 +6,7 @@
|
|||||||
{{- .Title -}}
|
{{- .Title -}}
|
||||||
</h1>
|
</h1>
|
||||||
<div class="post-content">
|
<div class="post-content">
|
||||||
{{- $content := .Content -}}
|
{{- partial "hook/content.html" .Content | safeHTML -}}
|
||||||
|
|
||||||
{{- $REin := `:\(([\w- ]+?)\):` -}}
|
|
||||||
{{- $REout := `<i class="$1 fa-fw"></i>` -}}
|
|
||||||
{{- $content = replaceRE $REin $REout $content -}}
|
|
||||||
|
|
||||||
{{- $REin = `\[(.+?)\]\^\((.+?)\)` -}}
|
|
||||||
{{- $REout = `<strong><ruby>$1<rt>$2</rt></ruby></strong>` -}}
|
|
||||||
{{- $content = replaceRE $REin $REout $content -}}
|
|
||||||
|
|
||||||
{{- $REin = `<sup>\[return\]</sup>` -}}
|
|
||||||
{{- $REout = `↩︎` -}}
|
|
||||||
{{- $content = replaceRE $REin $REout $content -}}
|
|
||||||
|
|
||||||
{{- $REin = `<(h[23456]) (id=".+?")>` -}}
|
|
||||||
{{- $REout = `<a class="post-dummy-target" $2></a><$1>` -}}
|
|
||||||
{{- $content = replaceRE $REin $REout $content -}}
|
|
||||||
|
|
||||||
{{- $REin = `<(.+) (id="fnref:.+?")>` -}}
|
|
||||||
{{- $REout = `<a class="post-dummy-target" $2></a><$1>` -}}
|
|
||||||
{{- $content = replaceRE $REin $REout $content -}}
|
|
||||||
|
|
||||||
{{- $REin = `<li (id="fn:.+?")(.*?)>\s?<p>` -}}
|
|
||||||
{{- $REout = `<li $2><p><a class="post-dummy-target" $1></a>` -}}
|
|
||||||
{{- $content = replaceRE $REin $REout $content -}}
|
|
||||||
|
|
||||||
{{- $content | safeHTML -}}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
@@ -5,13 +5,13 @@
|
|||||||
|
|
||||||
<!--featured_image-->
|
<!--featured_image-->
|
||||||
{{- with .Params.featured_image -}}
|
{{- with .Params.featured_image -}}
|
||||||
{{- $image := $.Params.featured_image_preview | default . -}}
|
|
||||||
<div class="post-featured-image-preview">
|
<div class="post-featured-image-preview">
|
||||||
{{- $res := resources.Get "svg/loading.svg" | minify -}}
|
{{- $image := $.Params.featured_image_preview | default . -}}
|
||||||
<img src="{{ $res.RelPermalink }}" data-sizes="auto" data-src="{{ $image }}" alt="featured image" class="lazyload">
|
{{- partial "image" $image -}}
|
||||||
</div>
|
</div>
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
<!-- end featured_image-->
|
<!-- end featured_image-->
|
||||||
|
|
||||||
<h1 class="post-title post-list-title" itemprop="name headline">
|
<h1 class="post-title post-list-title" itemprop="name headline">
|
||||||
<a href="{{ .Permalink }}">{{ .Title }}</a>
|
<a href="{{ .Permalink }}">{{ .Title }}</a>
|
||||||
</h1>
|
</h1>
|
||||||
@@ -40,17 +40,7 @@
|
|||||||
{{- .Params.description -}}
|
{{- .Params.description -}}
|
||||||
</p>
|
</p>
|
||||||
{{- else -}}
|
{{- else -}}
|
||||||
{{- $summary := .Summary -}}
|
{{- partial "hook/content.html" .Summary | safeHTML -}}
|
||||||
|
|
||||||
{{- $REin := `:\(([\w- ]+?)\):` -}}
|
|
||||||
{{- $REout := `<i class="$1 fa-fw"></i>` -}}
|
|
||||||
{{- $summary = replaceRE $REin $REout $summary -}}
|
|
||||||
|
|
||||||
{{- $REin = `\[(.+?)\]\^\((.+?)\)` -}}
|
|
||||||
{{- $REout = `<strong><ruby>$1<rt>$2</rt></ruby></strong>` -}}
|
|
||||||
{{- $summary = replaceRE $REin $REout $summary -}}
|
|
||||||
|
|
||||||
{{- $summary | safeHTML -}}
|
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
</div>
|
</div>
|
||||||
<div class="post-footer">
|
<div class="post-footer">
|
||||||
|
|||||||
@@ -282,4 +282,7 @@
|
|||||||
<a href="mailto:{{ . }}" rel="me noopener noreffer">
|
<a href="mailto:{{ . }}" rel="me noopener noreffer">
|
||||||
<i class="far fa-envelope fa-fw" target="_blank" title="Email"></i>
|
<i class="far fa-envelope fa-fw" target="_blank" title="Email"></i>
|
||||||
</a>
|
</a>
|
||||||
|
{{- end -}}
|
||||||
|
{{- with .Site.Params.Social.Custom}}
|
||||||
|
{{- . | safeHTML -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
24
layouts/partials/hook/content.html
Normal file
24
layouts/partials/hook/content.html
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
{{- $REin := `:\(([\w- ]+?)\):` -}}
|
||||||
|
{{- $REout := `<i class="$1 fa-fw"></i>` -}}
|
||||||
|
{{- $content := replaceRE $REin $REout . -}}
|
||||||
|
|
||||||
|
{{- $REin = `\[(.+?)\]\^\((.+?)\)` -}}
|
||||||
|
{{- $REout = `<strong><ruby>$1<rt>$2</rt></ruby></strong>` -}}
|
||||||
|
{{- $content = replaceRE $REin $REout $content -}}
|
||||||
|
|
||||||
|
{{- $REin = `<sup>\[return\]</sup>` -}}
|
||||||
|
{{- $REout = `↩︎` -}}
|
||||||
|
{{- $content = replaceRE $REin $REout $content -}}
|
||||||
|
|
||||||
|
{{- $REin = `<(h[23456]) (id=".+?")>` -}}
|
||||||
|
{{- $REout = `<a class="post-dummy-target" $2></a><$1>` -}}
|
||||||
|
{{- $content = replaceRE $REin $REout $content -}}
|
||||||
|
|
||||||
|
{{- $REin = `<(.+) (id="fnref:.+?")>` -}}
|
||||||
|
{{- $REout = `<a class="post-dummy-target" $2></a><$1>` -}}
|
||||||
|
{{- $content = replaceRE $REin $REout $content -}}
|
||||||
|
|
||||||
|
{{- $REin = `<li (id="fn:.+?")(.*?)>\s?<p>` -}}
|
||||||
|
{{- $REout = `<li $2><p><a class="post-dummy-target" $1></a>` -}}
|
||||||
|
|
||||||
|
{{- return replaceRE $REin $REout $content -}}
|
||||||
2
layouts/partials/image.html
Normal file
2
layouts/partials/image.html
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
{{- $res := resources.Get "svg/loading.svg" | minify -}}
|
||||||
|
<img src="{{ $res.RelPermalink }}" data-sizes="auto" data-src="{{ . }}" alt="featured image" class="lazyload">
|
||||||
@@ -39,8 +39,7 @@
|
|||||||
|
|
||||||
{{- with .Params.featured_image -}}
|
{{- with .Params.featured_image -}}
|
||||||
<div class="post-featured-image">
|
<div class="post-featured-image">
|
||||||
{{- $res := resources.Get "svg/loading.svg" | minify -}}
|
{{- partial "image" . -}}
|
||||||
<img src="{{ $res.RelPermalink }}" data-sizes="auto" data-src="{{ . }}" alt="featured image" class="lazyload">
|
|
||||||
</div>
|
</div>
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
@@ -70,33 +69,7 @@
|
|||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
<div class="post-content">
|
<div class="post-content">
|
||||||
{{- $content := .Content -}}
|
{{- partial "hook/content.html" .Content | safeHTML -}}
|
||||||
|
|
||||||
{{- $REin := `:\(([\w- ]+?)\):` -}}
|
|
||||||
{{- $REout := `<i class="$1 fa-fw"></i>` -}}
|
|
||||||
{{- $content = replaceRE $REin $REout $content -}}
|
|
||||||
|
|
||||||
{{- $REin = `\[(.+?)\]\^\((.+?)\)` -}}
|
|
||||||
{{- $REout = `<strong><ruby>$1<rt>$2</rt></ruby></strong>` -}}
|
|
||||||
{{- $content = replaceRE $REin $REout $content -}}
|
|
||||||
|
|
||||||
{{- $REin = `<sup>\[return\]</sup>` -}}
|
|
||||||
{{- $REout = `↩︎` -}}
|
|
||||||
{{- $content = replaceRE $REin $REout $content -}}
|
|
||||||
|
|
||||||
{{- $REin = `<(h[23456]) (id=".+?")>` -}}
|
|
||||||
{{- $REout = `<a class="post-dummy-target" $2></a><$1>` -}}
|
|
||||||
{{- $content = replaceRE $REin $REout $content -}}
|
|
||||||
|
|
||||||
{{- $REin = `<(.+?) (id="fnref:.+?")>` -}}
|
|
||||||
{{- $REout = `<a class="post-dummy-target" $2></a><$1>` -}}
|
|
||||||
{{- $content = replaceRE $REin $REout $content -}}
|
|
||||||
|
|
||||||
{{- $REin = `<li (id="fn:.+?")(.*?)>\s?<p>` -}}
|
|
||||||
{{- $REout = `<li $2><p><a class="post-dummy-target" $1></a>` -}}
|
|
||||||
{{- $content = replaceRE $REin $REout $content -}}
|
|
||||||
|
|
||||||
{{- $content | safeHTML -}}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{- partial "post/footer.html" . -}}
|
{{- partial "post/footer.html" . -}}
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
|||||||
|
{"Target":"css/style.min.css","MediaType":"text/css","Data":{}}
|
||||||
Reference in New Issue
Block a user