fix(css): fix some css bugs

This commit is contained in:
Dillon
2020-01-31 18:46:28 +08:00
parent 7e6236361f
commit 344f0a9f41
36 changed files with 705 additions and 429 deletions

View File

@@ -0,0 +1,20 @@
<figure>
<img
{{ $res := resources.Get "svg/loading.svg" | minify }}
src="{{ $res.RelPermalink }}"
data-sizes="auto"
data-src="{{ .Destination | safeURL }}"
alt="{{ .Text }}"
{{- with .Title -}}
title="{{ . }}"
{{- end -}}
class="lazyload"
>
<figcaption class="image-caption">
{{- if .Title -}}
{{- .Title -}}
{{- else -}}
{{- .Text -}}
{{- end -}}
</figcaption>
</figure>

View File

@@ -0,0 +1,10 @@
<a href="{{ .Destination | safeURL }}"
{{- with .Title -}}
title="{{ . }}"
{{- end -}}
{{- if strings.HasPrefix .Destination "http" -}}
target="_blank"
{{- end -}}
>
{{- .Text -}}
</a>

View File

@@ -1,13 +1,13 @@
{{ if ne .Site.Params.version "5.x" -}}
{{ errorf "\n\nThere are two possible situations that led to this error:\n 1. You haven't copied the config.toml yet. See https://github.com/dillonzq/LoveIt#installation \n 2. You have an incompatible update. See https://github.com//dillonzq/LoveIt/blob/master/CHANGELOG.md \n\n有两种可能的情况会导致这个错误发生:\n 1. 你还没有复制 config.toml 参考 https://github.com/dillonzq/LoveIt#installation \n 2. 你进行了一次不兼容的更新 参考 https://github.com//dillonzq/LoveIt/blob/master/CHANGELOG.md \n" -}}
{{ end -}}
{{- if ne .Site.Params.version "0.1.X" -}}
{{- errorf "\n\nThere are two possible situations that led to this error:\n 1. You haven't copied the config.toml yet. See https://github.com/dillonzq/LoveIt#installation \n 2. You have an incompatible update. See https://github.com//dillonzq/LoveIt/blob/master/CHANGELOG.md \n\n有两种可能的情况会导致这个错误发生:\n 1. 你还没有复制 config.toml 参考 https://github.com/dillonzq/LoveIt#installation \n 2. 你进行了一次不兼容的更新 参考 https://github.com//dillonzq/LoveIt/blob/master/CHANGELOG.md \n" -}}
{{- end -}}
<!DOCTYPE html>
<html lang="{{ .Site.LanguageCode }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>{{ block "title" . }}{{ .Site.Title }}{{ end }}</title>
{{- partial "head.html" . }}
{{- partial "head.html" . -}}
</head>
<body>
<script>
@@ -15,15 +15,17 @@
window.isDark && document.body.classList.add('dark-theme');
</script>
<div class="wrapper">
{{ partial "header.html" . -}}
{{- partial "header.html" . -}}
<main class="main">
<div class="container">
{{ block "content" . }}{{ end -}}
{{- block "content" . }}{{ end -}}
</div>
</main>
{{ partial "footer.html" . -}}
{{ partial "scripts.html" . -}}
{{- partial "footer.html" . -}}
{{- partial "scripts.html" . -}}
</div>
<a href="#" class="dynamic-to-top" id="dynamic-to-top" data-scroll><span>&nbsp;</span></a>
<a href="#" class="dynamic-to-top" id="dynamic-to-top" data-scroll>
<span>&nbsp;</span>
</a>
</body>
</html>

View File

@@ -1,17 +1,19 @@
{{ define "title" }}{{ T "all" | humanize}}{{ T .Section | default .Section | humanize }} | {{ .Site.Title }}{{ end -}}
{{- define "title" }}{{ T "all" | humanize}}{{ T .Section | default .Section | humanize }} | {{ .Site.Title }}{{ end -}}
{{ define "content" -}}
{{ $data := .Data -}}
<div class="post-warp archive">
{{- define "content" -}}
{{- $data := .Data -}}
<div class="warpper archive">
<h2 class="post-title animated pulse faster">
{{ T "all" | humanize}}{{ T .Section | default .Section | humanize }}
{{- T "all" | humanize}}{{ T .Section | default .Section | humanize -}}
</h2>
{{- range (.Paginate (.Pages.GroupByDate "2006")).PageGroups -}}
<h3>{{ .Key }}</h3>
{{- range .Pages -}}
<article class="archive-item">
<a href="{{ .RelPermalink }}" class="archive-item-link">{{ .Title }}</a>
<a href="{{ .RelPermalink }}" class="archive-item-link">
{{- .Title -}}
</a>
<span class="archive-item-date">
{{- .Date.Format (.Site.Params.dateFormatToUse | default "01-02") -}}
</span>
@@ -20,4 +22,4 @@
{{- end -}}
{{- partial "paginator.html" . -}}
</div>
{{- end }}
{{- end -}}

View File

@@ -1,35 +1,28 @@
{{ define "title" }}{{ .Title }} | {{ .Site.Title }}{{ end }}
{{- define "title" }}{{ .Title }} | {{ .Site.Title }}{{ end -}}
{{ define "content" }}
<div class="post-warp single">
<h1 class="post-title animated pulse faster">{{ .Title }}</h1>
{{- define "content" -}}
<div class="warpper single">
<h1 class="post-title animated pulse faster">
{{- .Title -}}
</h1>
<div class="post-content">
{{ $content := .Content }}
{{ $REin := `<img src="([^"]+)" alt="([^"]+)?" />` }}
{{ $REout := "<figure><img src=/images/loading.svg data-sizes=auto data-src=$1 alt=$2 class=lazyload><figcaption class=image-caption>$2</figcaption></figure>" }}
{{ $content = replaceRE $REin $REout $content }}
{{ $REin = `<img src="([^"]+)" alt="([^"]+)?" title="([^"]+)?" />` }}
{{ $REout = "<figure><img src=/images/loading.svg data-src=$1 data-sizes=auto alt=$2 title=$3 class=lazyload><figcaption class=image-caption>$2</figcaption></figure>" }}
{{ $content = replaceRE $REin $REout $content }}
{{ $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 = printf "<sup>[%s]</sup>" (T "return") }}
{{ $content = replaceRE $REin $REout $content }}
{{ $REin = `<(h[123456]) (id=".+?")>` }}
{{ $REout = `<a class="post-dummy-target" $2></a><$1>` }}
{{ $content = replaceRE $REin $REout $content }}
{{ $REin = `<(sup class="footnote-ref") (id="fnref:.+?")>` }}
{{ $REout = `<a class="post-dummy-target" $2></a><$1>` }}
{{ $content = replaceRE $REin $REout $content }}
{{ $REin = `<(li) (id="fn:.+?")>` }}
{{ $REout = `<$1><a class="post-dummy-target" $2></a>` }}
{{ $content = replaceRE $REin $REout $content }}
{{ $content | safeHTML }}
{{- $content := .Content -}}
{{- $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 = printf "<sup>[%s]</sup>" (T "return") -}}
{{- $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 -}}
{{- $content | safeHTML -}}
</div>
</div>
{{end }}
{{- end -}}

View File

@@ -1,3 +1,3 @@
# {{ .Title }}
{{ .RawContent }}
{{ .RawContent }}

View File

@@ -9,7 +9,8 @@
{{ with .Params.featured_image }}
{{ $image := $.Params.featured_image_preview | default . }}
<div class="post-featured-image-preview">
<img src=/images/loading.svg data-sizes=auto data-src={{ $image }} alt="featured image" class="lazyload">
{{ $res := resources.Get "svg/loading.svg" | minify }}
<img src="{{ $res.RelPermalink }}" data-sizes="auto" data-src="{{ $image }}" alt="featured image" class="lazyload">
</div>
{{ end }}
<!-- end featured_image-->
@@ -42,7 +43,7 @@
{{ $summary = replaceRE $REin $REout $summary }}
{{ $REin = `\[(.+?)\]\^\((.+?)\)` }}
{{ $REout = `<strong><ruby>$1<rt>$2</rt></ruby></strong>` }}
{{ $summary = replaceRE $REin $REout $summary }}
{{ $summary = replaceRE $REin $REout $summary }}
{{ $summary | safeHTML }}
{{ end }}
</div>