From 2548ae2ad2642670ed03d5d44b86e5f485a27dea Mon Sep 17 00:00:00 2001 From: George Cushen Date: Sat, 24 Sep 2016 19:46:20 +0100 Subject: [PATCH] Refactor HTML indents to 2 spaces and refactor long lines --- layouts/404.html | 28 ++-- layouts/_default/list.html | 16 +-- layouts/_default/single.html | 24 ++-- layouts/partials/article_metadata.html | 35 ++--- layouts/partials/comments.html | 6 +- layouts/partials/footer.html | 78 ++++++------ layouts/partials/footer_container.html | 21 ++- layouts/partials/header.html | 46 +++---- layouts/partials/navbar.html | 43 ++++--- layouts/partials/pagination.html | 16 +-- layouts/partials/publication_li_detailed.html | 104 ++++++++------- layouts/partials/publication_li_simple.html | 6 +- layouts/partials/publication_links.html | 46 +++++-- layouts/partials/section_pager.html | 18 +-- layouts/partials/share.html | 63 +++++---- layouts/project/single.html | 24 ++-- layouts/publication/single.html | 120 +++++++++--------- layouts/section/post.html | 42 +++--- layouts/section/publication.html | 43 ++++--- 19 files changed, 420 insertions(+), 359 deletions(-) diff --git a/layouts/404.html b/layouts/404.html index 0332ae20..2779df79 100644 --- a/layouts/404.html +++ b/layouts/404.html @@ -2,22 +2,22 @@ {{ partial "navbar.html" . }}
-

Page not found

-

Maybe you were looking for one of these?

+

Page not found

+

Maybe you were looking for one of these?

-

Recent Posts

- {{ range last 20 (where .Data.Pages "Section" "=" "post") }} - - {{ end }} +

Recent Posts

+ {{ range last 20 (where .Data.Pages "Section" "=" "post") }} + + {{ end }} -

Recent Publications

- {{ range last 20 (where .Data.Pages "Section" "=" "publication") }} - - {{ end }} +

Recent Publications

+ {{ range last 20 (where .Data.Pages "Section" "=" "publication") }} + + {{ end }}
{{ partial "footer_container.html" . }} diff --git a/layouts/_default/list.html b/layouts/_default/list.html index 2d86b3a8..ff603be7 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -2,15 +2,15 @@ {{ partial "navbar.html" . }}
- {{ $paginator := .Paginate .Data.Pages }} - {{ range $paginator.Pages }} -
-

{{ .Title }}

-

{{ .Summary }}

-
- {{ end }} + {{ $paginator := .Paginate .Data.Pages }} + {{ range $paginator.Pages }} +
+

{{ .Title }}

+

{{ .Summary }}

+
+ {{ end }} - {{ partial "pagination" . }} + {{ partial "pagination" . }}
{{ partial "footer_container.html" . }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 88d38d9f..4e117d36 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -2,24 +2,24 @@ {{ partial "navbar.html" . }}
-
+
- {{ if .Params.image }} - - {{end}} + {{ if .Params.image }} + + {{end}} -

{{ .Title }}

+

{{ .Title }}

- {{ partial "article_metadata" (dict "content" . "is_list" 0) }} + {{ partial "article_metadata" (dict "content" . "is_list" 0) }} -
- {{ .Content }} -
+
+ {{ .Content }} +
-
+
- {{ partial "section_pager.html" . }} - {{ partial "comments.html" . }} + {{ partial "section_pager.html" . }} + {{ partial "comments.html" . }}
{{ partial "footer_container.html" . }} diff --git a/layouts/partials/article_metadata.html b/layouts/partials/article_metadata.html index ab98c08e..90fce134 100644 --- a/layouts/partials/article_metadata.html +++ b/layouts/partials/article_metadata.html @@ -2,24 +2,27 @@ {{ $ := .content }}
- + - {{ if isset $.Params "tags" }} - {{ $tagsLen := len $.Params.tags }} - {{ if gt $tagsLen 0 }} - - {{ end }} + {{ if isset $.Params "tags" }} + {{ $tagsLen := len $.Params.tags }} + {{ if gt $tagsLen 0 }} + + {{ end }} + {{ end }} - {{ if ne $is_list 1 }} - {{ partial "share.html" $ }} - {{ end }} + {{ if ne $is_list 1 }} + {{ partial "share.html" $ }} + {{ end }}
diff --git a/layouts/partials/comments.html b/layouts/partials/comments.html index 828f4a00..41c6fa0b 100644 --- a/layouts/partials/comments.html +++ b/layouts/partials/comments.html @@ -1,7 +1,7 @@ {{ if and (and (not (eq .Site.DisqusShortname "")) (not (isset .Site.Params "disable_comments")) (not (isset .Params "disable_comments"))) }}
-
- {{ template "_internal/disqus.html" . }} -
+
+ {{ template "_internal/disqus.html" . }} +
{{ end }} diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index b2bacc15..8f5554d5 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -1,45 +1,45 @@ - - - - - - {{ range .Site.Params.custom_js }} - - {{ end }} + + + + + + {{ range .Site.Params.custom_js }} + + {{ end }} - {{ with .Site.GoogleAnalytics }} - - {{ end }} + /* Send outbound link click events */ + var links = document.querySelectorAll('a'); + Array.prototype.map.call(links, function(item) { + if (item.host != document.location.host) { + item.addEventListener('click', function() { + var action = item.getAttribute('data-action') || 'follow'; + ga('send', 'event', 'outbound', action, item.href); + }); + } + }); + + {{ end }} - - - + + + - - {{ if or (and (isset .Site.Params "math") (eq .Site.Params.math true)) (and (isset .Params "math") (eq .Params.math true)) }} - - - {{ end }} + + {{ if or (and (isset .Site.Params "math") (eq .Site.Params.math true)) (and (isset .Params "math") (eq .Params.math true)) }} + + + {{ end }} - + diff --git a/layouts/partials/footer_container.html b/layouts/partials/footer_container.html index bc772d5d..6ec3cb89 100644 --- a/layouts/partials/footer_container.html +++ b/layouts/partials/footer_container.html @@ -1,13 +1,20 @@ diff --git a/layouts/partials/header.html b/layouts/partials/header.html index cf8763c8..d5925e3c 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -2,32 +2,32 @@ - - - - - {{ .Hugo.Generator }} - {{ with .Site.Params.name }}{{ end }} - {{ with .Site.Params.role }}{{ end }} + + + + + {{ .Hugo.Generator }} + {{ with .Site.Params.name }}{{ end }} + {{ with .Site.Params.role }}{{ end }} - - - - - - - {{ range .Site.Params.custom_css }} - - {{ end }} + + + + + + + {{ range .Site.Params.custom_css }} + + {{ end }} - {{ if .RSSlink }} - - - {{ end }} - - + {{ if .RSSlink }} + + + {{ end }} + + - {{ if not .IsHome }}{{ .Title }} | {{ end }}{{ .Site.Title }} + {{ if not .IsHome }}{{ .Title }} | {{ end }}{{ .Site.Title }} diff --git a/layouts/partials/navbar.html b/layouts/partials/navbar.html index f76b5fbf..90201b25 100644 --- a/layouts/partials/navbar.html +++ b/layouts/partials/navbar.html @@ -1,28 +1,29 @@ {{ $baseUrl := .Site.BaseURL }} diff --git a/layouts/partials/pagination.html b/layouts/partials/pagination.html index 0d855667..f023627b 100644 --- a/layouts/partials/pagination.html +++ b/layouts/partials/pagination.html @@ -1,12 +1,12 @@ {{ if or (.Paginator.HasPrev) (.Paginator.HasNext) }} {{ end }} diff --git a/layouts/partials/publication_li_detailed.html b/layouts/partials/publication_li_detailed.html index 3c7a4063..a9c3b9f1 100644 --- a/layouts/partials/publication_li_detailed.html +++ b/layouts/partials/publication_li_detailed.html @@ -1,53 +1,61 @@
-
- {{ if .Params.image_preview }} -
- - - -
-
- {{ else if .Params.image}} -
- - - -
-
- {{ else }} -
- {{end}} +
-

- -

+ {{ if .Params.image_preview }} -
- {{ if .Params.abstract_short }} - {{ .Params.abstract_short }} - {{ else }} - {{ .Params.abstract }} - {{ end }} -
- - - -
- {{ if .Params.publication_short }} - {{ .Params.publication_short | markdownify }} - {{ else }} - {{ .Params.publication | markdownify }} - {{ end }} -
- - - -
+ +
+ + {{ else if .Params.image}} + +
+ + + +
+
+ + {{ else }} + +
+ + {{ end }} + +

+ +

+ +
+ {{ if .Params.abstract_short }} + {{ .Params.abstract_short }} + {{ else }} + {{ .Params.abstract }} + {{ end }} +
+ + + +
+ {{ if .Params.publication_short }} + {{ .Params.publication_short | markdownify }} + {{ else }} + {{ .Params.publication | markdownify }} + {{ end }} +
+ + + +
+
diff --git a/layouts/partials/publication_li_simple.html b/layouts/partials/publication_li_simple.html index 5ac86f8b..21d0491a 100644 --- a/layouts/partials/publication_li_simple.html +++ b/layouts/partials/publication_li_simple.html @@ -1,5 +1,5 @@
  • - - {{ .Title }} -

    {{ partial "publication_links" (dict "content" . "is_list" 1) }}

    + + {{ .Title }} +

    {{ partial "publication_links" (dict "content" . "is_list" 1) }}

  • diff --git a/layouts/partials/publication_links.html b/layouts/partials/publication_links.html index 08830a00..912bd186 100644 --- a/layouts/partials/publication_links.html +++ b/layouts/partials/publication_links.html @@ -2,16 +2,42 @@ {{ $ := .content }} {{ if $is_list }} -Details + + Details + +{{ end }} +{{ with $.Params.url_pdf }} + + PDF + +{{ end }} +{{ with $.Params.url_slides }} + + Slides + +{{ end }} +{{ with $.Params.url_video }} + + Video + +{{ end }} +{{ with $.Params.url_code }} + + Code + +{{ end }} +{{ with $.Params.url_dataset }} + + Dataset + +{{ end }} +{{ with $.Params.url_project }} + + Project + {{ end }} - -{{ with $.Params.url_pdf }}PDF{{ end }} -{{ with $.Params.url_slides }}Slides{{ end }} -{{ with $.Params.url_video }}Video{{ end }} -{{ with $.Params.url_code }}Code{{ end }} -{{ with $.Params.url_dataset }}Dataset{{ end }} -{{ with $.Params.url_project }}Project{{ end }} - {{ range $.Params.url_custom }} -{{ .name }} + + {{ .name }} + {{ end }} diff --git a/layouts/partials/section_pager.html b/layouts/partials/section_pager.html index 83553af7..02093764 100644 --- a/layouts/partials/section_pager.html +++ b/layouts/partials/section_pager.html @@ -1,11 +1,13 @@ diff --git a/layouts/partials/share.html b/layouts/partials/share.html index 89893a0c..557b5223 100644 --- a/layouts/partials/share.html +++ b/layouts/partials/share.html @@ -1,31 +1,40 @@ {{ if .Site.Params.sharing }} {{ end }} diff --git a/layouts/project/single.html b/layouts/project/single.html index 6bc72b17..a427c920 100644 --- a/layouts/project/single.html +++ b/layouts/project/single.html @@ -2,21 +2,23 @@ {{ partial "navbar.html" . }}
    -
    - {{ if .Params.image }} - - {{end}} +
    + {{ if .Params.image }} + + {{end}} -

    {{ .Title }}

    +

    {{ .Title }}

    - {{ with .Params.external_link }}Go to Project Site{{ end }} + {{ with .Params.external_link }} + Go to Project Site + {{ end }} -
    - {{ .Content }} -
    -
    +
    + {{ .Content }} +
    +
    - {{ partial "section_pager.html" . }} + {{ partial "section_pager.html" . }}
    {{ partial "footer_container.html" . }} diff --git a/layouts/publication/single.html b/layouts/publication/single.html index 9880b0fe..2fd37d74 100644 --- a/layouts/publication/single.html +++ b/layouts/publication/single.html @@ -2,73 +2,75 @@ {{ partial "navbar.html" . }}
    -
    -
    -

    {{ .Title }}

    -
    + + {{ partial "section_pager.html" . }}
    {{ partial "footer_container.html" . }} diff --git a/layouts/section/post.html b/layouts/section/post.html index f21564ee..84aebef3 100644 --- a/layouts/section/post.html +++ b/layouts/section/post.html @@ -2,29 +2,29 @@ {{ partial "navbar.html" . }}
    -

    Posts

    +

    Posts

    - {{ $paginator := .Paginate .Data.Pages }} - {{ range $paginator.Pages }} -
    - {{ if .Params.image }} - - - - {{end}} -

    {{ .Title }}

    - {{ partial "article_metadata" (dict "content" . "is_list" 1) }} -

    - {{ if .Truncated }} - {{ printf "%s" .Summary | markdownify }} - {{ else }} - {{ .Content }} - {{ end }} -

    -
    - {{ end }} + {{ $paginator := .Paginate .Data.Pages }} + {{ range $paginator.Pages }} +
    + {{ if .Params.image }} + + + + {{end}} +

    {{ .Title }}

    + {{ partial "article_metadata" (dict "content" . "is_list" 1) }} +

    + {{ if .Truncated }} + {{ printf "%s" .Summary | markdownify }} + {{ else }} + {{ .Content }} + {{ end }} +

    +
    + {{ end }} - {{ partial "pagination" . }} + {{ partial "pagination" . }}
    {{ partial "footer_container.html" . }} diff --git a/layouts/section/publication.html b/layouts/section/publication.html index d56f5808..a153df7e 100644 --- a/layouts/section/publication.html +++ b/layouts/section/publication.html @@ -1,33 +1,34 @@ {{ partial "header.html" . }} {{ partial "navbar.html" . }}
    -
    -
    -

    Publications

    +
    +
    +

    Publications

    - {{ range .Data.Pages.GroupByDate "2006" }} -
    -
    -

    {{ .Key }}

    -
    -
    -
      + {{ range .Data.Pages.GroupByDate "2006" }} +
      +
      +

      {{ .Key }}

      +
      +
      +
        - {{ range .Pages.ByDate.Reverse }} -
      • - - {{ .Title }} -

        {{ partial "publication_links" (dict "content" . "is_list" 1) }}

        -
      • - {{ end }} - -
      -
      -
      + {{ range .Pages.ByDate.Reverse }} +
    • + + {{ .Title }} +

      {{ partial "publication_links" (dict "content" . "is_list" 1) }}

      +
    • {{ end }} +
    +
    + {{ end }} +
    +
    {{ partial "footer_container.html" . }}