From ead88d5e16ab86333687b3cea00c2feb1f194e04 Mon Sep 17 00:00:00 2001 From: BBaoVanC Date: Mon, 22 Nov 2021 02:21:15 -0600 Subject: [PATCH] Use indentation inside templating blocks for better readability --- layouts/_default/baseof.html | 16 +- layouts/_default/list.html | 62 +++--- layouts/_default/single.html | 178 +++++++++--------- layouts/_default/summary/post.html | 6 +- layouts/_default/summary/series.html | 18 +- layouts/partials/figure.html | 39 ++-- layouts/partials/head.html | 14 +- layouts/partials/post-meta-item/authors.html | 29 ++- .../partials/post-meta-item/readingtime.html | 8 +- layouts/partials/post-meta-item/series.html | 17 +- layouts/partials/post-meta-item/tags.html | 17 +- .../partials/post-meta-item/translations.html | 12 +- .../partials/post-meta-item/viewsource.html | 20 +- layouts/partials/post-metadata/full.html | 46 ++--- layouts/partials/post-metadata/short.html | 30 +-- layouts/partials/remote_figure.html | 25 +-- layouts/partials/rss-link.html | 2 +- layouts/partials/seo-tags/author.html | 10 +- layouts/partials/top.html | 65 +++---- layouts/shortcodes/aside.html | 4 +- layouts/shortcodes/figure.html | 4 +- layouts/shortcodes/image.html | 4 +- layouts/shortcodes/video.html | 4 +- layouts/taxonomy/list.html | 6 +- 24 files changed, 310 insertions(+), 326 deletions(-) diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index e3a499c..fb1420f 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -9,22 +9,22 @@ {{ if not .IsHome }} - {{ partial "breadcrumb.html" . }} + {{ partial "breadcrumb.html" . }} {{ end }}
{{ block "main" . }} - {{ .Content }} + {{ .Content }} {{ end }}
{{ with .Site.Copyright }} - + {{ end }} diff --git a/layouts/_default/list.html b/layouts/_default/list.html index 248b7b6..d0d2bd2 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -1,37 +1,35 @@ {{ define "main" }} - -

- {{ with .Params.icon }}{{ partial "icon.html" . }}{{ end }} - {{ .Title | markdownify }} - - {{ with .OutputFormats.Get "rss" }} - {{ partial "icon.html" "rss-feed" }} - {{ end }} - -

- -
- {{ with .Sections }} -
- {{ range . }} - {{ .Render "summary/section" }} - {{ end }} -
- {{ end }} - -
-
    - {{ range .Paginator.Pages }} -
  • {{ .Render "summary/post" }}
  • - {{ else }} -
    - {{ i18n "no_posts" }} -
    +

    + {{ with .Params.icon }}{{ partial "icon.html" . }}{{ end }} + {{ .Title | markdownify }} + + {{ with .OutputFormats.Get "rss" }} + {{ partial "icon.html" "rss-feed" }} {{ end }} -

+ + + +
+ {{ with .Sections }} +
+ {{ range . }} + {{ .Render "summary/section" }} + {{ end }} +
+ {{ end }} + +
+
    + {{ range .Paginator.Pages }} +
  • {{ .Render "summary/post" }}
  • + {{ else }} +
    + {{ i18n "no_posts" }} +
    + {{ end }} +
+
-
- -{{ partial "pagination.html" . }} + {{ partial "pagination.html" . }} {{ end }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 52b0385..049509f 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -1,106 +1,102 @@ {{ define "main" }} -
-

- {{ .Title | markdownify }} - {{ if .Draft }}{{ partial "icon.html" "write" }}{{ end }} -

-
+
+

+ {{ .Title | markdownify }} + {{ if .Draft }}{{ partial "icon.html" "write" }}{{ end }} +

+
-{{ partial "post-metadata/full.html" . }} + {{ partial "post-metadata/full.html" . }} - -{{ with (.GetTerms "series") }} - -{{ $series := slice }} -{{ range . }} -{{ $series = $series | append (printf `%s` .Permalink .LinkTitle) }} -{{ end }} - -
- {{ partial "icon.html" "info" }} - {{ if gt (len $series) 1 }} - This post is part of multiple series: - {{ else }} - This post is part of a series: - {{ end }} - - {{ delimit $series ", " }} -
- -{{ end }} - - -{{ if .Params.Toc }} -
-
- {{ i18n "table_of_contents" }} - {{ .TableOfContents }} -
-
-
- {{ i18n "table_of_contents" }} - {{ .TableOfContents }} -
-{{ end }} - -{{ with .Resources.GetMatch "feature" }} -
- {{ partial "figure.html" (dict "src" . "border" true) }} -
-{{ end }} - -{{ .Content }} - -{{ $related := .Site.RegularPages.Related . | first 5 }} -{{ with $related }} -
-

{{ i18n "see_also" }}

- -
    + {{ with (.GetTerms "series") }} + {{ $series := slice }} {{ range . }} -
  • - {{ with .Parent.Params.icon }}{{ partial "icon.html" . }}{{ end }} - {{ .Title | markdownify }} -
  • + {{ $series = $series | append (printf `%s` .Permalink .LinkTitle) }} {{ end }} -
-
-{{ end }} -{{ if or .NextInSection .PrevInSection }} -
- {{ with .NextInSection }} -
- {{ else }} - {{ end }} - {{ with .PrevInSection }} -
-{{ end }} -{{ if .Params.comments }} -
- {{ partial "comments.html" . }} -
-{{ end }} + {{ with .Resources.GetMatch "feature" }} +
+ {{ partial "figure.html" (dict "src" . "border" true) }} +
+ {{ end }} + {{ .Content }} + + {{ $related := .Site.RegularPages.Related . | first 5 }} + {{ with $related }} +
+

{{ i18n "see_also" }}

+ +
    + {{ range . }} +
  • + {{ with .Parent.Params.icon }}{{ partial "icon.html" . }}{{ end }} + {{ .Title | markdownify }} +
  • + {{ end }} +
+
+ {{ end }} + + {{ if or .NextInSection .PrevInSection }} +
+ {{ with .NextInSection }} + + {{ else }} + + {{ end }} + + {{ with .PrevInSection }} + + {{ else }} + + {{ end }} +
+ {{ end }} + + {{ if .Params.comments }} +
+ {{ partial "comments.html" . }} +
+ {{ end }} {{ end }} diff --git a/layouts/_default/summary/post.html b/layouts/_default/summary/post.html index a6372ce..89b18fb 100644 --- a/layouts/_default/summary/post.html +++ b/layouts/_default/summary/post.html @@ -8,9 +8,9 @@ {{ partial "post-metadata/short.html" . }} {{ with .Resources.GetMatch "feature" }} -
- {{ partial "figure.html" (dict "src" . "border" true) }} -
+
+ {{ partial "figure.html" (dict "src" . "border" true) }} +
{{ end }}
diff --git a/layouts/_default/summary/series.html b/layouts/_default/summary/series.html index 95e2fe5..05434d3 100644 --- a/layouts/_default/summary/series.html +++ b/layouts/_default/summary/series.html @@ -9,14 +9,14 @@ {{ partial "post-meta-item/translations.html" . }} {{ if ne .Site.Params.readingtime false }} - + {{ end }} {{ partial "post-meta-item/viewsource.html" . }} @@ -29,7 +29,7 @@
    {{ range .Data.Pages.Reverse }} -
  • {{ .Render "summary/post" }}
  • +
  • {{ .Render "summary/post" }}
  • {{ end }}
diff --git a/layouts/partials/figure.html b/layouts/partials/figure.html index 56f999a..9030142 100644 --- a/layouts/partials/figure.html +++ b/layouts/partials/figure.html @@ -1,29 +1,28 @@ {{ $hidecaption := index . "hidecaption" }} {{ if index . "noborder" }} -
+
{{ else }} -
+
{{ end }} + {{ with index . "src" }} + {{ $media := . }} + {{ if eq .MediaType.MainType "image" }} + {{ $media.Title }} + {{ else if eq .MediaType.MainType "video" }} + + {{ end }} - {{ $media := . }} - {{ if eq .MediaType.MainType "image" }} - {{ $media.Title }} - {{ else if eq .MediaType.MainType "video" }} - - {{ end }} - - {{ if not $hidecaption }} - {{ with $media.Title }} -
- {{ . | markdownify }} -
- {{ end }} - {{ end }} - + {{ if not $hidecaption }} + {{ with $media.Title }} +
+ {{ . | markdownify }} +
+ {{ end }} + {{ end }} {{ end }}
diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 68fb2b6..93c7d3c 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -4,26 +4,26 @@ {{ hugo.Generator }} {{ with resources.Get "css/bobastyle.css" | fingerprint "sha512" }} - + {{ end }} {{ with resources.Get "css/syntax.css" | fingerprint "sha512" }} - + {{ end }} {{ with resources.Get "css/syntax-light.css" | fingerprint "sha512" }} - + {{ end }} {{ with .Site.Params.faviconICO }} - + {{ end }} {{ with .Site.Params.faviconPNG }} - + {{ end }} {{ if .IsHome }} - {{ .Site.Title | plainify }} + {{ .Site.Title | plainify }} {{ else }} - {{ (print .Title " | " .Site.Title) | plainify }} + {{ (print .Title " | " .Site.Title) | plainify }} {{ end }} {{ partial "seo-tags/opengraph.html" . }} diff --git a/layouts/partials/post-meta-item/authors.html b/layouts/partials/post-meta-item/authors.html index 1f90598..1646763 100644 --- a/layouts/partials/post-meta-item/authors.html +++ b/layouts/partials/post-meta-item/authors.html @@ -1,19 +1,16 @@ {{ with .Params.authors }} - {{ end }} diff --git a/layouts/partials/post-meta-item/readingtime.html b/layouts/partials/post-meta-item/readingtime.html index 071622c..9598d33 100644 --- a/layouts/partials/post-meta-item/readingtime.html +++ b/layouts/partials/post-meta-item/readingtime.html @@ -1,6 +1,6 @@ {{ if ne .Site.Params.readingtime false }} - + {{ end }} diff --git a/layouts/partials/post-meta-item/series.html b/layouts/partials/post-meta-item/series.html index 4eff26b..b3ca861 100644 --- a/layouts/partials/post-meta-item/series.html +++ b/layouts/partials/post-meta-item/series.html @@ -1,12 +1,11 @@ {{ with (.GetTerms "series") }} + {{ $series := slice }} + {{ range . }} + {{ $series = $series | append (printf `%s` .Permalink .LinkTitle) }} + {{ end }} -{{ $series := slice }} -{{ range . }} -{{ $series = $series | append (printf `%s` .Permalink .LinkTitle) }} -{{ end }} - -
- {{ partial "icon.html" "files" }} - {{ delimit $series ", " }} -
+
+ {{ partial "icon.html" "files" }} + {{ delimit $series ", " }} +
{{ end }} diff --git a/layouts/partials/post-meta-item/tags.html b/layouts/partials/post-meta-item/tags.html index 7bcef5f..fe28812 100644 --- a/layouts/partials/post-meta-item/tags.html +++ b/layouts/partials/post-meta-item/tags.html @@ -1,12 +1,11 @@ {{ with (.GetTerms "tags") }} + {{ $tags := slice }} + {{ range . }} + {{ $tags = $tags | append (printf `%s` .Permalink .LinkTitle) }} + {{ end }} -{{ $tags := slice }} -{{ range . }} -{{ $tags = $tags | append (printf `%s` .Permalink .LinkTitle) }} -{{ end }} - -
- {{ partial "icon.html" "tag" }} - {{ delimit $tags ", " }} -
+
+ {{ partial "icon.html" "tag" }} + {{ delimit $tags ", " }} +
{{ end }} diff --git a/layouts/partials/post-meta-item/translations.html b/layouts/partials/post-meta-item/translations.html index 5ac2f38..e2cc7d7 100644 --- a/layouts/partials/post-meta-item/translations.html +++ b/layouts/partials/post-meta-item/translations.html @@ -1,8 +1,8 @@ {{ if .IsTranslated }} - + {{ end }} diff --git a/layouts/partials/post-meta-item/viewsource.html b/layouts/partials/post-meta-item/viewsource.html index 8f92cdd..b5514e2 100644 --- a/layouts/partials/post-meta-item/viewsource.html +++ b/layouts/partials/post-meta-item/viewsource.html @@ -1,13 +1,13 @@ {{ if and .Site.Params.gitFileURL .File.Path }} - {{ end }} diff --git a/layouts/partials/post-metadata/full.html b/layouts/partials/post-metadata/full.html index 2a0e158..ce549e3 100644 --- a/layouts/partials/post-metadata/full.html +++ b/layouts/partials/post-metadata/full.html @@ -1,28 +1,28 @@ {{ if or .Date .Params.authors .IsTranslated .Site.Params.readingtime .Site.Params.gitFileURL }} - {{ end }} diff --git a/layouts/partials/post-metadata/short.html b/layouts/partials/post-metadata/short.html index 02a2342..571ab06 100644 --- a/layouts/partials/post-metadata/short.html +++ b/layouts/partials/post-metadata/short.html @@ -1,18 +1,18 @@ {{ if or .Date .Params.authors .IsTranslated .Site.Params.readingtime }} - {{ end }} diff --git a/layouts/partials/remote_figure.html b/layouts/partials/remote_figure.html index 1a61823..7cad595 100644 --- a/layouts/partials/remote_figure.html +++ b/layouts/partials/remote_figure.html @@ -4,24 +4,25 @@ {{ $alt := index . "alt" }} {{ if index . "border" }} -
+
{{ else }} -
+
{{ end }} + {{ if eq $type "image" }} - {{ $alt }} + {{ $alt }} {{ else if eq $type "video" }} - + {{ end }} {{ if not $hidecaption }} - {{ with $alt }} -
- {{ . | markdownify }} -
- {{ end }} + {{ with $alt }} +
+ {{ . | markdownify }} +
+ {{ end }} {{ end }}
diff --git a/layouts/partials/rss-link.html b/layouts/partials/rss-link.html index 55f9d1a..57a23aa 100644 --- a/layouts/partials/rss-link.html +++ b/layouts/partials/rss-link.html @@ -1,5 +1,5 @@ {{ with .OutputFormats.Get "rss" }} - {{ partial "icon.html" "rss-feed" }} + {{ partial "icon.html" "rss-feed" }} {{ end }} diff --git a/layouts/partials/seo-tags/author.html b/layouts/partials/seo-tags/author.html index 83656cc..1dbba00 100644 --- a/layouts/partials/seo-tags/author.html +++ b/layouts/partials/seo-tags/author.html @@ -1,9 +1,7 @@ {{ with .Params.authors }} + - - -{{ range . }} - -{{ end }} - + {{ range . }} + + {{ end }} {{ end }} diff --git a/layouts/partials/top.html b/layouts/partials/top.html index b2d0cb2..5f4f98d 100644 --- a/layouts/partials/top.html +++ b/layouts/partials/top.html @@ -5,49 +5,46 @@
{{ if .Site.IsMultiLingual }} -
- - {{- partial "icon.html" "world" -}} - -
    - {{ range .AllTranslations }} -
  • - {{ .Language.LanguageName }} -
  • - {{ end }} +
    + + {{- partial "icon.html" "world" -}} + +
      + {{ range .AllTranslations }} +
    • + {{ .Language.LanguageName }} +
    • + {{ end }} - {{ $site_translations := slice }} - {{ range .Site.Languages }} - {{ $site_translations = $site_translations | append .LanguageName }} - {{ end }} + {{ $site_translations := slice }} + {{ range .Site.Languages }} + {{ $site_translations = $site_translations | append .LanguageName }} + {{ end }} - {{ $translation_codes := slice }} - {{ range .AllTranslations }} - {{ $translation_codes = $translation_codes | append .Language }} - {{ end }} + {{ $translation_codes := slice }} + {{ range .AllTranslations }} + {{ $translation_codes = $translation_codes | append .Language }} + {{ end }} - {{ range (.Site.Languages | complement $translation_codes) }} -
    • - {{ .LanguageName }} -
    • - {{ end }} -
    -
    + {{ range (.Site.Languages | complement $translation_codes) }} +
  • + {{ .LanguageName }} +
  • + {{ end }} +
+
{{ end }}
diff --git a/layouts/shortcodes/aside.html b/layouts/shortcodes/aside.html index c51e4e3..2b03c27 100644 --- a/layouts/shortcodes/aside.html +++ b/layouts/shortcodes/aside.html @@ -1,7 +1,7 @@ diff --git a/layouts/shortcodes/figure.html b/layouts/shortcodes/figure.html index 8d8ff9b..7a272ac 100644 --- a/layouts/shortcodes/figure.html +++ b/layouts/shortcodes/figure.html @@ -2,12 +2,12 @@ {{ $noborder := false }} {{ if .Get "noborder" }} -{{ $noborder = true }} + {{ $noborder = true }} {{ end }} {{ $hidecaption := false }} {{ if .Get "hidecaption" }} -{{ $hidecaption = true }} + {{ $hidecaption = true }} {{ end }}

diff --git a/layouts/shortcodes/image.html b/layouts/shortcodes/image.html index e442c1e..480a9b0 100644 --- a/layouts/shortcodes/image.html +++ b/layouts/shortcodes/image.html @@ -1,11 +1,11 @@ {{ $border := false }} {{ if .Get "border" }} -{{ $border = true }} + {{ $border = true }} {{ end }} {{ $hidecaption := false }} {{ if .Get "hidecaption" }} -{{ $hidecaption = true }} + {{ $hidecaption = true }} {{ end }}

diff --git a/layouts/shortcodes/video.html b/layouts/shortcodes/video.html index 1f18685..27b6df8 100644 --- a/layouts/shortcodes/video.html +++ b/layouts/shortcodes/video.html @@ -1,11 +1,11 @@ {{ $border := false }} {{ if .Get "border" }} -{{ $border = true }} + {{ $border = true }} {{ end }} {{ $hidecaption := false }} {{ if .Get "hidecaption" }} -{{ $hidecaption = true }} + {{ $hidecaption = true }} {{ end }}

diff --git a/layouts/taxonomy/list.html b/layouts/taxonomy/list.html index c9899e8..7e3b822 100644 --- a/layouts/taxonomy/list.html +++ b/layouts/taxonomy/list.html @@ -12,9 +12,9 @@