From 628a4df0df81347c74a88e4c110066c9dc6017d1 Mon Sep 17 00:00:00 2001 From: Alex Shpak Date: Tue, 11 Sep 2018 16:51:27 +0200 Subject: Refactor partials, layout and sass files --- layouts/partials/book-brand.html | 3 -- layouts/partials/book-html-head.html | 9 ----- layouts/partials/book-nav.html | 61 --------------------------------- layouts/partials/book-toc.html | 1 - layouts/partials/book/html-head.html | 9 +++++ layouts/partials/book/nav-after.html | 0 layouts/partials/book/nav-auto.html | 63 +++++++++++++++++++++++++++++++++++ layouts/partials/book/nav-brand.html | 3 ++ layouts/partials/book/nav-bundle.html | 5 +++ layouts/partials/book/nav.html | 5 +++ layouts/partials/book/toc.html | 1 + 11 files changed, 86 insertions(+), 74 deletions(-) delete mode 100644 layouts/partials/book-brand.html delete mode 100644 layouts/partials/book-html-head.html delete mode 100644 layouts/partials/book-nav.html delete mode 100644 layouts/partials/book-toc.html create mode 100644 layouts/partials/book/html-head.html create mode 100644 layouts/partials/book/nav-after.html create mode 100644 layouts/partials/book/nav-auto.html create mode 100644 layouts/partials/book/nav-brand.html create mode 100644 layouts/partials/book/nav-bundle.html create mode 100644 layouts/partials/book/nav.html create mode 100644 layouts/partials/book/toc.html (limited to 'layouts/partials') diff --git a/layouts/partials/book-brand.html b/layouts/partials/book-brand.html deleted file mode 100644 index 5a2c9cb..0000000 --- a/layouts/partials/book-brand.html +++ /dev/null @@ -1,3 +0,0 @@ -

- {{ .Site.Title }} -

\ No newline at end of file diff --git a/layouts/partials/book-html-head.html b/layouts/partials/book-html-head.html deleted file mode 100644 index 682423f..0000000 --- a/layouts/partials/book-html-head.html +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - -{{ $styles := resources.Get "styles.scss" | resources.ToCSS | resources.Minify | resources.Fingerprint }} - \ No newline at end of file diff --git a/layouts/partials/book-nav.html b/layouts/partials/book-nav.html deleted file mode 100644 index fc89891..0000000 --- a/layouts/partials/book-nav.html +++ /dev/null @@ -1,61 +0,0 @@ -{{ $bookSection := default "docs" .Site.Params.BookSection }} -{{ if eq $bookSection "*" }} - {{ .Scratch.Set "BookSections" .Site.Sections }} -{{ else }} - {{ $bookSections := where .Site.Sections "Section" $bookSection }} - {{ .Scratch.Set "BookSections" $bookSections }} - - {{ if eq (len $bookSections) 1 }} - {{ $singleSection := index $bookSections 0 }} - {{ .Scratch.Set "BookSections" $singleSection.Sections }} - {{ end }} - -{{ end }} - - - - -{{ define "book-section" }} -
  • - {{ template "book-heading" .Section }} - -
  • -{{ end }} - - -{{ define "book-heading" }} - -{{ $sections := split (trim .Dir "/") "/" }} -{{ $title := index ($sections | last 1) 0 | humanize | title }} -{{ $title := default .Title $title }} - -{{ if .Content }} - - {{- $title -}} - -{{ else }} - - {{- $title -}} - -{{ end }} - -{{ end }} diff --git a/layouts/partials/book-toc.html b/layouts/partials/book-toc.html deleted file mode 100644 index 59e6b35..0000000 --- a/layouts/partials/book-toc.html +++ /dev/null @@ -1 +0,0 @@ -{{ .Page.TableOfContents }} \ No newline at end of file diff --git a/layouts/partials/book/html-head.html b/layouts/partials/book/html-head.html new file mode 100644 index 0000000..bf7db42 --- /dev/null +++ b/layouts/partials/book/html-head.html @@ -0,0 +1,9 @@ + + + + + + + +{{ $styles := resources.Get "styles.scss" | resources.ToCSS | resources.Minify | resources.Fingerprint }} + \ No newline at end of file diff --git a/layouts/partials/book/nav-after.html b/layouts/partials/book/nav-after.html new file mode 100644 index 0000000..e69de29 diff --git a/layouts/partials/book/nav-auto.html b/layouts/partials/book/nav-auto.html new file mode 100644 index 0000000..c54f960 --- /dev/null +++ b/layouts/partials/book/nav-auto.html @@ -0,0 +1,63 @@ +{{ $bookSection := default "docs" .Site.Params.BookSection }} +{{ if eq $bookSection "*" }} + {{ .Scratch.Set "BookSections" .Site.Sections }} +{{ else }} + {{ $bookSections := where .Site.Sections "Section" $bookSection }} + {{ .Scratch.Set "BookSections" $bookSections }} + + {{ if eq (len $bookSections) 1 }} + {{ $singleSection := index $bookSections 0 }} + {{ .Scratch.Set "BookSections" $singleSection.Sections }} + {{ end }} + +{{ end }} + + + + +{{ define "book-section" }} +
  • + {{ template "book-heading" .Section }} + +
  • +{{ end }} + + +{{ define "book-heading" }} + +{{ $sections := split (trim .Dir "/") "/" }} +{{ $title := index ($sections | last 1) 0 | humanize | title }} +{{ $title := default .Title $title }} + +{{ if .Content }} + + {{- $title -}} + +{{ else }} + + {{- $title -}} + +{{ end }} + +{{ end }} diff --git a/layouts/partials/book/nav-brand.html b/layouts/partials/book/nav-brand.html new file mode 100644 index 0000000..5a2c9cb --- /dev/null +++ b/layouts/partials/book/nav-brand.html @@ -0,0 +1,3 @@ +

    + {{ .Site.Title }} +

    \ No newline at end of file diff --git a/layouts/partials/book/nav-bundle.html b/layouts/partials/book/nav-bundle.html new file mode 100644 index 0000000..46665ad --- /dev/null +++ b/layouts/partials/book/nav-bundle.html @@ -0,0 +1,5 @@ + diff --git a/layouts/partials/book/nav.html b/layouts/partials/book/nav.html new file mode 100644 index 0000000..cc24df7 --- /dev/null +++ b/layouts/partials/book/nav.html @@ -0,0 +1,5 @@ +{{ if .Site.Params.BookMenuBundle }} + {{ partial "book/nav-bundle" . }} +{{ else }} + {{ partial "book/nav-auto" . }} +{{ end }} \ No newline at end of file diff --git a/layouts/partials/book/toc.html b/layouts/partials/book/toc.html new file mode 100644 index 0000000..aca3785 --- /dev/null +++ b/layouts/partials/book/toc.html @@ -0,0 +1 @@ +{{ .Page.TableOfContents }} \ No newline at end of file -- cgit v1.2.3