(lint) remove unnecessary whitespace

created by hugo's {{ }}
This commit is contained in:
Aditya Telange 2020-09-23 12:52:32 +05:30
parent 2cb5c9dad5
commit 016dd6e9fa
No known key found for this signature in database
GPG Key ID: 82E844EF3DA99E77
14 changed files with 118 additions and 116 deletions

View File

@ -1,39 +1,41 @@
{{ define "main" }}
{{- define "main" }}
<header class="page-header">
<h1>{{ .Title }}</h1>
</header>
{{ $pages := where site.RegularPages "Type" "in" site.Params.mainSections }}
{{ range $pages.GroupByPublishDate "2006" }}
{{ if ne .Key "0001" }}
{{- $pages := where site.RegularPages "Type" "in" site.Params.mainSections }}
{{- range $pages.GroupByPublishDate "2006" }}
{{- if ne .Key "0001" }}
<div class="archive-year">
<h2 class="archive-year-header">{{ replace .Key "0001" "" }}</h2>
{{ range .Pages.GroupByDate "January" }}
<h2 class="archive-year-header">{{- replace .Key "0001" "" }}</h2>
{{- range .Pages.GroupByDate "January" }}
<div class="archive-month">
<h3 class="archive-month-header">{{ .Key }}</h3>
<h3 class="archive-month-header">{{- .Key }}</h3>
<div class="archive-posts">
{{ range .Pages }}
{{ if eq .Kind "page" }}
{{- range .Pages }}
{{- if eq .Kind "page" }}
<div class="archive-entry">
<h3 class="archive-entry-title">
{{ .Title | markdownify }}
{{- .Title | markdownify }}
</h3>
<div class="archive-meta">
{{- if or .Params.author .Site.Params.author }}{{- .Params.author | default .Site.Params.author }} ·
{{ end }}
{{ if $.Site.Params.ShowReadingTime }}{{ .ReadingTime }}{{ i18n "read_time" | default "min read" }}
· {{ end }}
{{- if or .Params.author .Site.Params.author }}
{{- .Params.author | default .Site.Params.author }} ·
{{- end }}
{{- if $.Site.Params.ShowReadingTime }}
{{ .ReadingTime }}{{ i18n "read_time" | default "min read" }}&nbsp;·&nbsp;{{ end }}
{{- .Date.Format "January 2, 2006" -}}
</div>
<a class="entry-link" aria-label="post link to {{ .Title | plainify }}" href="{{ .Permalink }}"></a>
</div>
{{ end }}
{{ end }}
{{- end }}
{{- end }}
</div>
</div>
{{ end }}
{{- end }}
</div>
{{ end }}
{{ end }}
{{- end }}
{{- end }}
{{ end }}{{/* end main */}}
{{- end }}{{/* end main */}}

View File

@ -5,13 +5,12 @@
{{- partial "head.html" . }}
</head>
<body
class="{{ if (and (eq .Kind `page` ) (ne .Layout `archives`)) }}single{{ else }}list{{ if .IsHome }} home {{ end }}{{ end }}{{ if eq $.Site.Params.defaultTheme `dark` }} dark {{ end }}"
id="top">
<body class="{{ if (and (eq .Kind `page` ) (ne .Layout `archives`)) }}single{{ else }}list
{{- if .IsHome }} home{{ end }}{{ end }}{{- if eq $.Site.Params.defaultTheme `dark` }} dark{{ end }}" id="top">
{{- partialCached "header.html" . .Page}}
<main class="main">
{{- block "main" . }}
{{end }}
{{- end }}
</main>
{{- partialCached "footer.html" . .Type }}
</body>

View File

@ -1,21 +1,20 @@
{{ define "main" }}
{{- define "main" }}
{{ if (and .Site.Params.profileMode.enabled .IsHome) }}
{{- if (and .Site.Params.profileMode.enabled .IsHome) }}
{{- partial "indexProfile.html" . }}
{{else}} {{/* if not profileMode */}}
{{- else }} {{/* if not profileMode */}}
{{- if not .IsHome | and .Title }}
<header class="page-header">
<h1>{{ .Title }}</h1>
</header>
{{ end }}
{{- end }}
{{- $pages := .RegularPages }}
{{ $pages := .RegularPages }}
{{ if .IsHome }}
{{ $pages = where site.RegularPages "Type" "in" site.Params.mainSections }}
{{end}}
{{- if .IsHome }}
{{- $pages = where site.RegularPages "Type" "in" site.Params.mainSections }}
{{- end}}
{{ $paginator := .Paginate $pages }}
@ -25,29 +24,29 @@
{{- if (and $.IsHome (eq $paginator.PageNumber 1) (eq $index 0)) }}
{{- if .Site.Params.homeInfoParams | or .Site.Params.disableSpecial1stPost}}
{{- partial "homeInfo.html" . }}
{{else}}
{{- else}}
{{- $class = "first-entry" }}
{{ end }}
{{- end }}
{{- else if .Data.Term }}
{{- $class = "post-entry tag-entry" }}
{{- end }}
<article class="{{ $class }}">
{{ if .Params.cover }}
{{- if .Params.cover }}
<figure class="entry-cover">
<img src="{{ .Params.cover | absURL }}" alt="cover image for {{ .Title }}">
</figure>
{{ end }}
{{- end }}
<header class="entry-header">
<h2>
{{ .Title }}
{{- if .Draft }}<div class="entry-isdraft"><sup>&nbsp;&nbsp;[draft]</sup></div>{{- end }}
</h2>
</header>
{{if (ne .Site.Params.hideSummary true)}}
{{- if (ne .Site.Params.hideSummary true)}}
<section class="entry-content">
<p>{{ .Summary | plainify | htmlUnescape }}...</p>
</section>
{{ end }}
{{- end }}
<footer class="entry-footer">
<time>{{ .Date.Format "January 2, 2006" }}</time>
{{- if $.Site.Params.ShowReadingTime }}&nbsp;.&nbsp;
@ -72,4 +71,4 @@
</footer>
{{- end }}
{{end}}{{/* end profileMode */}}
{{ end }}{{/* end main */}}
{{- end }}{{- /* end main */ -}}

View File

@ -1,4 +1,4 @@
{{ define "main" }}
{{- define "main" }}
<article class="post-single">
<header class="post-header">
@ -6,7 +6,7 @@
{{ .Title }}
{{- if .Draft }}<div class="entry-isdraft"><sup>&nbsp;&nbsp;[draft]</sup></div>{{- end }}
</h1>
{{ if .Params.hideMeta }}{{ else }}
{{- if .Params.hideMeta }}{{ else }}
<div class="post-meta">
<time>{{ .Date.Format "January 2, 2006" }}</time>
{{- if $.Site.Params.ShowReadingTime -}}&nbsp;.&nbsp;
@ -15,34 +15,34 @@
{{- if or .Params.author .Site.Params.author }}&nbsp;.&nbsp;{{- .Params.author | default .Site.Params.author }}{{ end }}
{{- if .IsTranslated -}}&nbsp;|&nbsp;
<ul class="i18n_list">
{{ i18n "translations" | default "Translations"}}:
{{ range .Translations }}
{{- i18n "translations" | default "Translations"}}:
{{- range .Translations }}
<li>
<a href="{{ .Permalink }}">{{ .Language.LanguageName }}</a>
</li>
{{ end }}
{{- end }}
</ul>
{{ end }}
{{- end }}
</div>
{{end}}
{{- end}}
</header>
{{ if .Params.cover }}
{{- if .Params.cover }}
<figure class="entry-cover">
<img src="{{ .Params.cover | absURL }}" alt="cover image for {{ .Title | plainify }}">
</figure>
{{ end }}
{{ if .Params.ShowToc }}
{{- end }}
{{- if .Params.ShowToc }}
<div class="toc">
<details {{if .Params.TocOpen }} open{{ end }}>
<summary>
<div class="details">{{ i18n "toc" | default "Table of Contents" }}</div>
<div class="details">{{- i18n "toc" | default "Table of Contents" }}</div>
</summary>
<blockquote>
{{ partial "toc.html" . }}
{{- partial "toc.html" . }}
</blockquote>
</details>
</div>
{{ end }}
{{- end }}
<div class="post-content">{{ .Content }}</div>
<footer class="post-footer">
{{- if .Params.tags }}
@ -53,9 +53,9 @@
{{- end }}
</ul>
{{- end }}
{{ if (and .Site.Params.ShowShareButtons (ne .Params.disableShare true) ) }}
{{ partial "share-icons.html" . }}
{{ end }}
{{- if (and .Site.Params.ShowShareButtons (ne .Params.disableShare true) ) }}
{{- partial "share-icons.html" . }}
{{- end }}
</footer>
{{- if $.Site.Params.comments }}
@ -63,4 +63,4 @@
{{- end }}
</article>
{{ end }}{{/* end main */}}
{{- end }}{{/* end main */}}

View File

@ -1,21 +1,22 @@
{{ define "main" }}
{{- if .Title }}
<header class="page-header">
<h1>{{ .Title }}</h1>
</header>
{{ end }}
{{- end }}
<ul class="terms-tags">
{{ $type := .Type }}
{{ range $key, $value := .Data.Terms.Alphabetical }}
{{ $name := .Name }}
{{ $count := .Count }}
{{ with $.Site.GetPage (printf "/%s/%s" $type $name) }}
{{- $type := .Type }}
{{- range $key, $value := .Data.Terms.Alphabetical }}
{{- $name := .Name }}
{{- $count := .Count }}
{{- with $.Site.GetPage (printf "/%s/%s" $type $name) }}
<li>
<a href="{{ .Permalink }}">{{ .Name }} <sup><strong><sup>{{ $count }}</sup></strong></sup> </a>
</li>
{{ end }}
{{ end }}
{{- end }}
{{- end }}
</ul>
{{ end }}{{/* end main */}}

View File

@ -11,11 +11,11 @@
<path d="M12 6H0l6-6z" /></svg>
</button>
</a>
{{if in site.Params.mainSections .Type }}
{{ $highlight := resources.Get "js/highlight.min.js" | minify | fingerprint}}
{{- if in site.Params.mainSections .Type }}
{{- $highlight := resources.Get "js/highlight.min.js" | minify | fingerprint}}
<script src="{{ $highlight.Permalink }}" integrity="{{ $highlight.Data.Integrity }}"></script>
<script>hljs.initHighlightingOnLoad();</script>
{{end }}
{{- end }}
<script>
window.onload = function () {
if (localStorage.getItem("menu-scroll-position")) {

View File

@ -12,39 +12,39 @@
{{- end }}
<meta name="author" content="{{ .Params.author | default .Site.Params.author }}">
<link rel="canonical" href="{{ .Permalink }}" />
{{ if .Site.Params.analytics.google.SiteVerificationTag }}
{{- if .Site.Params.analytics.google.SiteVerificationTag }}
<meta name="google-site-verification" content="{{ .Site.Params.analytics.google.SiteVerificationTag }}" />
{{end}}
{{- end}}
<!-- Styles -->
{{ $anoldhope := resources.Get "css/an-old-hope.min.css" | minify }}
{{ $theme := resources.Get "css/theme-vars.css" | minify }}
{{ $reset := resources.Get "css/reset.css" | minify }}
{{ $header := resources.Get "css/header.css" | minify }}
{{ $main := resources.Get "css/main.css" | minify }}
{{ $postentry := resources.Get "css/post-entry.css" | minify }}
{{ $postsingle := resources.Get "css/post-single.css" | minify }}
{{ $terms := resources.Get "css/terms.css" | minify }}
{{ $archive := resources.Get "css/archive.css" | minify }}
{{ $footer := resources.Get "css/footer.css" | minify }}
{{ $404 := resources.Get "css/404.css" | minify }}
{{ $style := slice $theme $reset $header $main $postentry $postsingle $terms $archive $footer $404 | resources.Concat "stylesheet.css" | minify }}
{{ $stylesheet := slice $anoldhope $style | resources.Concat "css/stylesheet.css" | minify | fingerprint }}
{{- $anoldhope := resources.Get "css/an-old-hope.min.css" | minify }}
{{- $theme := resources.Get "css/theme-vars.css" | minify }}
{{- $reset := resources.Get "css/reset.css" | minify }}
{{- $header := resources.Get "css/header.css" | minify }}
{{- $main := resources.Get "css/main.css" | minify }}
{{- $postentry := resources.Get "css/post-entry.css" | minify }}
{{- $postsingle := resources.Get "css/post-single.css" | minify }}
{{- $terms := resources.Get "css/terms.css" | minify }}
{{- $archive := resources.Get "css/archive.css" | minify }}
{{- $footer := resources.Get "css/footer.css" | minify }}
{{- $404 := resources.Get "css/404.css" | minify }}
{{- $style := slice $theme $reset $header $main $postentry $postsingle $terms $archive $footer $404 | resources.Concat "stylesheet.css" | minify }}
{{- $stylesheet := slice $anoldhope $style | resources.Concat "css/stylesheet.css" | minify | fingerprint }}
<link href="{{ $stylesheet.Permalink }}" integrity="{{ $stylesheet.Data.Integrity }}" rel="preload stylesheet"
as="style">
{{ if (and (.Site.Params.profileMode.enabled) (.IsHome)) }}
{{ $profileMode := resources.Get "css/profileMode.css" | minify | fingerprint }}
{{- if (and (.Site.Params.profileMode.enabled) (.IsHome)) }}
{{- $profileMode := resources.Get "css/profileMode.css" | minify | fingerprint }}
<link href="{{ $profileMode.Permalink }}" integrity="{{ $profileMode.Data.Integrity }}" rel="preload stylesheet"
as="style">
{{end}}
{{- end }}
<!-- Favicons -->
<link rel="apple-touch-icon" href="{{ "apple-touch-icon.png" | absURL }}">
<link rel="icon" href="{{ "favicon.ico" | absURL }}">
<!-- Generator -->
{{- hugo.Generator }}
<!-- RSS -->
{{ range .AlternativeOutputFormats -}}
{{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }}
{{ end -}}
{{- range .AlternativeOutputFormats -}}
{{- printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }}
{{- end -}}
<!-- Misc -->
{{- if eq (getenv "HUGO_ENV") "production" | or (eq .Site.Params.env "production") }}
{{- template "_internal/google_analytics_async.html" . }}

View File

@ -1,10 +1,10 @@
{{ if eq .Site.Params.defaultTheme "auto" }}
{{- if eq .Site.Params.defaultTheme "auto" }}
<script>
if (window.matchMedia('(prefers-color-scheme: dark)').matches) {
document.body.classList.add('dark');
}
</script>
{{ end }}
{{- end }}
<header class="header">
<nav class="nav">
{{- if .IsHome }}
@ -12,16 +12,17 @@
{{- else }}
<p class="logo"><a href="{{ "" | absLangURL }}">{{ .Site.Title }}</a></p>
{{- end }}
{{ $currentPage := . }}
{{- $currentPage := . }}
<ul class="menu" id="menu" onscroll="menu_on_scroll()">
{{- range .Site.Menus.main }}
{{ $menu_item_url := .URL | relLangURL }}
{{ $page_url:= $currentPage.RelPermalink | relLangURL }}
{{- $menu_item_url := .URL | relLangURL }}
{{- $page_url:= $currentPage.RelPermalink | relLangURL }}
<li>
<a href="{{ .URL | absLangURL }}">
<span {{ if eq $menu_item_url $page_url }}
{{/* the menu item links to the current page (with relLangURL) */}} class="active"
{{ end }}>{{ .Name }}</span>
<span {{- if eq $menu_item_url $page_url }}
{{- /* the menu item links to the current page (with relLangURL) */}} class="active" {{- end }}>
{{ .Name }}
</span>
</a>
</li>
{{- end }}

View File

@ -1,17 +1,17 @@
{{ with $.Site.Params.homeInfoParams }}
{{- with $.Site.Params.homeInfoParams }}
<article class="first-entry">
<header class="entry-header">
<h2>{{ .Title }}</h2>
<h2>{{- .Title }}</h2>
</header>
<section class="entry-content">
<p>{{ .Content | markdownify }}</p>
<p>{{- .Content | markdownify }}</p>
</section>
<footer class="entry-footer">
{{- with $.Site.Params.socialIcons }}
<div class="social-icons">
{{ partial "social-icons.html" . }}
{{- partial "social-icons.html" . }}
</div>
{{- end }}
</footer>
</article>
{{end}}
{{- end}}

View File

@ -1,7 +1,7 @@
<div class="profile">
{{ with .Site.Params.profileMode }}
{{- with .Site.Params.profileMode }}
<div class="profile_inner">
{{if .imageUrl}}<img src="{{ .imageUrl}}" alt="{{ .imageTitle | default "profile image" }}" />{{end}}
{{- if .imageUrl}}<img src="{{ .imageUrl}}" alt="{{ .imageTitle | default "profile image" }}" />{{- end}}
<h1>{{ .title | default $.Site.Title }}</h1>
{{- with $.Site.Params.socialIcons }}
<div class="social-icons">
@ -10,9 +10,9 @@
{{- end }}
{{- with .buttons }}
<div class="buttons">
{{ partial "indexProfileButtons.html" . }}
{{- partial "indexProfileButtons.html" . }}
</div>
{{- end }}
</div>
{{end}}
{{- end}}
</div>

View File

@ -1,4 +1,4 @@
{{ range . -}}
{{- range . -}}
<a class="button" href="{{ .url }}" rel="noopener" title="{{ .name | humanize }}">
<span class="button-inner">{{ .name }}</span>
</a>

View File

@ -1,5 +1,5 @@
{{ $pageurl := .Permalink }}
{{ $title := .Title }}
{{- $pageurl := .Permalink }}
{{- $title := .Title }}
<div class="share-buttons">
<p>Share On</p>
<a class="share-button-single" target="_blank" rel="noopener noreferrer"
@ -56,5 +56,4 @@
d="M26.49,29.86H5.5a3.37,3.37,0,0,1-2.47-1,3.35,3.35,0,0,1-1-2.47V5.48A3.36,3.36,0,0,1,3,3,3.37,3.37,0,0,1,5.5,2h21A3.38,3.38,0,0,1,29,3a3.36,3.36,0,0,1,1,2.46V26.37a3.35,3.35,0,0,1-1,2.47A3.38,3.38,0,0,1,26.49,29.86Zm-5.38-6.71a.79.79,0,0,0,.85-.66L24.73,9.24a.55.55,0,0,0-.18-.46.62.62,0,0,0-.41-.17q-.08,0-16.53,6.11a.59.59,0,0,0-.41.59.57.57,0,0,0,.43.52l4,1.24,1.61,4.83a.62.62,0,0,0,.63.43.56.56,0,0,0,.4-.17L16.54,20l4.09,3A.9.9,0,0,0,21.11,23.15ZM13.8,20.71l-1.21-4q8.72-5.55,8.78-5.55c.15,0,.23,0,.23.16a.18.18,0,0,1,0,.06s-2.51,2.3-7.52,6.8Z" />
</svg>
</a>
</div>

View File

@ -1,3 +1,4 @@
{{ range . -}}
<a href="{{ .url }}" target="_blank" rel="noopener noreferrer" title="{{ .name | humanize }}" >{{ partial "svg.html" . }}</a>
{{- range . -}}
<a href="{{ .url }}" target="_blank" rel="noopener noreferrer"
title="{{ .name | humanize }}">{{ partial "svg.html" . }}</a>
{{- end -}}

View File

@ -24,10 +24,10 @@
{{- $headerLevel := len (seq $headerLevel) -}}
{{/* get id="xyz" */}}
{{ $id := index (findRE "(id=\"(.*?)\")" $header 9) 0 }}
{{- $id := index (findRE "(id=\"(.*?)\")" $header 9) 0 }}
{{/* strip id="" to leave xyz (no way to get regex capturing groups in hugo :( */}}
{{ $cleanedID := replace (replace $id "id=\"" "") "\"" "" }}
{{- /* strip id="" to leave xyz, no way to get regex capturing groups in hugo */ -}}
{{- $cleanedID := replace (replace $id "id=\"" "") "\"" "" }}
{{- $header := replaceRE "<h[1-4].*?>((.|\n])+?)</h[1-4]>" "$1" $header -}}
{{- if ne $i 0 -}}
@ -69,7 +69,7 @@
{{- end -}}
{{- end -}}
<!-- {{- $firstHeaderLevel := len (seq (index (findRE "[1-4]" (index $headers 0) 1) 0)) -}} -->
{{ $firstHeaderLevel := $largest }}
{{- $firstHeaderLevel := $largest }}
{{- $lastHeaderLevel := len (seq (index (findRE "[1-4]" (index $headers (sub (len $headers) 1)) 1) 0)) -}}
</li>
{{- range seq (sub $lastHeaderLevel $firstHeaderLevel) -}}