Improve code quality & consistency

* Add EditorConfig
* Rebuild animate.css: remove an unused animation
* Slightly rewrite header part
This commit is contained in:
Track3 2018-12-12 00:02:36 +08:00
parent caf088cbfb
commit 3bb532df30
16 changed files with 76 additions and 59 deletions

20
.editorconfig Normal file
View file

@ -0,0 +1,20 @@
# editorconfig.org
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
[*.{html,xml}]
indent_style = tab
[*.md]
indent_style = unset
indent_size = unset
insert_final_newline = unset
trim_trailing_whitespace = unset

File diff suppressed because one or more lines are too long

View file

@ -29,4 +29,4 @@ $code-fonts: Consolas, "Andale Mono WT", "Andale Mono", Menlo, Monaco, "Lucida C
background-color: $theme; background-color: $theme;
} }
} }
} }

View file

@ -196,6 +196,7 @@ table {
.hdr-wrapper { .hdr-wrapper {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center;
padding: .5em 0; padding: .5em 0;
font-size: 1.2rem; font-size: 1.2rem;
@ -217,10 +218,14 @@ table {
} }
.hdr-icons { .hdr-icons {
display: inline-block;
font-size: 1.2em; font-size: 1.2em;
}
a { .hdr-social {
display: inline-block;
margin-left: .6em;
&>a {
margin-left: .4em; margin-left: .4em;
} }
} }
@ -232,9 +237,9 @@ table {
cursor: pointer; cursor: pointer;
} }
#menu-btn, #menu-btn {
#search-btn {
display: none; display: none;
margin-left: .7em;
cursor: pointer; cursor: pointer;
} }
@ -450,10 +455,6 @@ p.img-404 {
opacity: 1; opacity: 1;
} }
#show-img-btn {
margin-right: .3em;
}
.post-header { .post-header {
margin-top: 1.2em; margin-top: 1.2em;
line-height: normal; line-height: normal;

View file

@ -16,4 +16,4 @@
{{ define "footer" }} {{ define "footer" }}
<script>let haveHeader = false;</script> <script>let haveHeader = false;</script>
{{ end }} {{ end }}

View file

@ -33,4 +33,4 @@
{{ template "_internal/google_analytics_async.html" . }} {{ template "_internal/google_analytics_async.html" . }}
</body> </body>
</html> </html>

View file

@ -3,7 +3,7 @@
{{ end }} {{ end }}
{{ define "main" }} {{ define "main" }}
<main class="site-main section-inner thin animated fadeIn faster"> <main class="site-main section-inner thin animated fadeIn faster">
<h1>{{ .Title }}</h1> <h1>{{ .Title }}</h1>
{{- if .Content }} {{- if .Content }}
<div class="content"> <div class="content">
@ -31,4 +31,4 @@
{{ define "footer" }} {{ define "footer" }}
{{ partialCached "footer.html" . }} {{ partialCached "footer.html" . }}
<script>let haveHeader = true;</script> <script>let haveHeader = true;</script>
{{ end }} {{ end }}

View file

@ -19,4 +19,4 @@
{{ define "footer" }} {{ define "footer" }}
{{ partialCached "footer.html" . }} {{ partialCached "footer.html" . }}
<script>let haveHeader = true;</script> <script>let haveHeader = true;</script>
{{ end }} {{ end }}

View file

@ -27,4 +27,4 @@
{{ define "footer" }} {{ define "footer" }}
<script>let haveHeader = false;</script> <script>let haveHeader = false;</script>
{{ end }} {{ end }}

View file

@ -1,4 +1,4 @@
<footer id="site-footer" class="section-inner thin animated fadeIn faster"> <footer id="site-footer" class="section-inner thin animated fadeIn faster">
<p>&copy; 2018 <a href="{{ .Site.BaseURL }}">{{ .Site.Author.name }}</a>{{ .Site.Params.footerCopyright | safeHTML }}</p> <p>&copy; 2018 <a href="{{ .Site.BaseURL }}">{{ .Site.Author.name }}</a>{{ .Site.Params.footerCopyright | safeHTML }}</p>
<p>Made with <a href="https://gohugo.io/" target="_blank" rel="noopener">Hugo</a> &#183; Theme <a href="https://github.com/Track3/hermit" target="_blank" rel="noopener">Hermit</a> &#183; <a href="{{ "posts/index.xml" | absURL }}" target="_blank" title="rss"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-rss"><path d="M4 11a9 9 0 0 1 9 9"></path><path d="M4 4a16 16 0 0 1 16 16"></path><circle cx="5" cy="19" r="1"></circle></svg></a></p> <p>Made with <a href="https://gohugo.io/" target="_blank" rel="noopener">Hugo</a> &#183; Theme <a href="https://github.com/Track3/hermit" target="_blank" rel="noopener">Hermit</a> &#183; <a href="{{ "posts/index.xml" | absURL }}" target="_blank" title="rss"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-rss"><path d="M4 11a9 9 0 0 1 9 9"></path><path d="M4 4a16 16 0 0 1 16 16"></path><circle cx="5" cy="19" r="1"></circle></svg></a></p>
</footer> </footer>

View file

@ -10,18 +10,14 @@
{{- end }} {{- end }}
</nav> </nav>
</div> </div>
<div class="hdr-right"> <div class="hdr-right hdr-icons">
<div class="hdr-icons"> {{- with .Params.featuredImg }}
{{- with .Params.featuredImg }} <button class="hdr-btn" onclick="showFeaturedImg()"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-image"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect><circle cx="8.5" cy="8.5" r="1.5"></circle><polyline points="21 15 16 10 5 21"></polyline></svg></button>
<button id="show-img-btn" class="hdr-btn" onclick="showFeaturedImg()"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-image"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect><circle cx="8.5" cy="8.5" r="1.5"></circle><polyline points="21 15 16 10 5 21"></polyline></svg></button> {{- end }}
{{- end }} {{- with .Site.Params.social -}}
{{- with .Site.Params.social }} <span class="hdr-social hide-in-mobile">{{ partialCached "social-icons.html" . }}</span>
<span class="hide-in-mobile"> {{- end -}}
{{- partialCached "social-icons.html" . -}} <button id="menu-btn" class="hdr-btn"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-menu"><line x1="3" y1="12" x2="21" y2="12"></line><line x1="3" y1="6" x2="21" y2="6"></line><line x1="3" y1="18" x2="21" y2="18"></line></svg></button>
</span>
{{- end }}
<button id="menu-btn" class="hdr-btn"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-menu"><line x1="3" y1="12" x2="21" y2="12"></line><line x1="3" y1="6" x2="21" y2="6"></line><line x1="3" y1="18" x2="21" y2="18"></line></svg></button>
</div>
</div> </div>
</div> </div>
</header> </header>
@ -31,4 +27,4 @@
<li><a href="{{ .URL }}">{{ .Name }}</a></li> <li><a href="{{ .URL }}">{{ .Name }}</a></li>
{{- end }} {{- end }}
</ul> </ul>
</div> </div>

View file

@ -1,3 +1,3 @@
{{ range . -}} {{ range . -}}
<a href="{{ .url }}" target="_blank" rel="noopener"><span class="screen-reader-text">{{ .name }}</span>{{ partial "svg.html" . }}</a> <a href="{{ .url }}" target="_blank" rel="noopener"><span class="screen-reader-text">{{ .name }}</span>{{ partial "svg.html" . }}</a>
{{- end }} {{- end -}}

View file

@ -1,27 +1,27 @@
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel> <channel>
<title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}</title> <title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}</title>
<link>{{ .Permalink }}</link> <link>{{ .Permalink }}</link>
<description>Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }}</description> <description>Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }}</description>
<generator>Hugo -- gohugo.io</generator>{{ with .Site.LanguageCode }} <generator>Hugo -- gohugo.io</generator>{{ with .Site.LanguageCode }}
<language>{{.}}</language>{{end}}{{ with .Site.Author.email }} <language>{{.}}</language>{{end}}{{ with .Site.Author.email }}
<managingEditor>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</managingEditor>{{end}}{{ with .Site.Author.email }} <managingEditor>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</managingEditor>{{end}}{{ with .Site.Author.email }}
<webMaster>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }} <webMaster>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }}
<copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }} <copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }}
<lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }} <lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}
{{ with .OutputFormats.Get "RSS" -}} {{ with .OutputFormats.Get "RSS" -}}
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }} {{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
{{ end -}} {{ end -}}
{{ range .Pages }} {{ range .Pages }}
<item> <item>
<title>{{ .Title }}</title> <title>{{ .Title }}</title>
<link>{{ .Permalink }}</link> <link>{{ .Permalink }}</link>
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate> <pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
{{ with .Site.Author.email }}<author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author>{{end}} {{ with .Site.Author.email }}<author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author>{{end}}
<guid>{{ .Permalink }}</guid> <guid>{{ .Permalink }}</guid>
<description>{{ .Summary | html }}</description> <description>{{ .Summary | html }}</description>
<content type="html">{{ printf `<![CDATA[%s]]>` .Content | safeHTML }}</content> <content type="html">{{ printf `<![CDATA[%s]]>` .Content | safeHTML }}</content>
</item> </item>
{{ end }} {{ end }}
</channel> </channel>
</rss> </rss>

View file

@ -55,4 +55,4 @@
{{ define "footer" }} {{ define "footer" }}
{{ partialCached "footer.html" . }} {{ partialCached "footer.html" . }}
<script>let haveHeader = true;</script> <script>let haveHeader = true;</script>
{{ end }} {{ end }}

File diff suppressed because one or more lines are too long

View file

@ -1 +1 @@
{"Target":"css/style.min.ec583408c122bca52321e03f9c58d80a134f8a85e464b32adcf049fd64bc5bcb.css","MediaType":"text/css","Data":{"Integrity":"sha256-7Fg0CMEivKUjIeA/nFjYChNPioXkZLMq3PBJ/WS8W8s="}} {"Target":"css/style.min.1a05bb70ba65f83d17c1933042808ce6a5986b022278a25e4490c44d9e4ed68a.css","MediaType":"text/css","Data":{"Integrity":"sha256-GgW7cLpl+D0XwZMwQoCM5qWYawIieKJeRJDETZ5O1oo="}}