diff options
Diffstat (limited to '')
76 files changed, 443 insertions, 177 deletions
diff --git a/themes/hugo-book/layouts/_default/_markup/render-heading.html b/themes/hugo-book/layouts/_default/_markup/render-heading.html deleted file mode 100644 index 5439d20..0000000 --- a/themes/hugo-book/layouts/_default/_markup/render-heading.html +++ /dev/null @@ -1,4 +0,0 @@ -<h{{ .Level }} id="{{ .Anchor | safeURL }}"> - {{ .Text | safeHTML }} - <a class="anchor" href="#{{ .Anchor | safeURL }}">#</a> -</h{{ .Level }}> diff --git a/themes/hugo-book/layouts/_default/_markup/render-image.html b/themes/hugo-book/layouts/_default/_markup/render-image.html deleted file mode 100644 index 148cbaf..0000000 --- a/themes/hugo-book/layouts/_default/_markup/render-image.html +++ /dev/null @@ -1,19 +0,0 @@ -{{- if .Page.Site.Params.BookPortableLinks -}} - {{- template "portable-image" . -}} -{{- else -}} - <img src="{{ .Destination | safeURL }}" alt="{{ .Text }}" {{ with .Title }}title="{{ . }}"{{ end }}/> -{{- end -}} - -{{- define "portable-image" -}} - {{- $isRemote := or (in .Destination "://") (strings.HasPrefix .Destination "//") }} - {{- if not $isRemote }} - {{- $path := print .Page.File.Dir .Destination }} - {{- if strings.HasPrefix .Destination "/" }} - {{- $path = print "/static" .Destination }} - {{- end }} - {{- if not (fileExists $path) }} - {{- warnf "Image '%s' not found in '%s'" .Destination .Page.File }} - {{- end }} - {{- end }} - <img src="{{ .Destination | safeURL }}" alt="{{ .Text }}" {{ with .Title }}title="{{ . }}"{{ end }}/> -{{- end -}} diff --git a/themes/hugo-book/layouts/_default/_markup/render-link.html b/themes/hugo-book/layouts/_default/_markup/render-link.html deleted file mode 100644 index 288d81c..0000000 --- a/themes/hugo-book/layouts/_default/_markup/render-link.html +++ /dev/null @@ -1,29 +0,0 @@ -{{- if .Page.Site.Params.BookPortableLinks -}} - {{- template "portable-link" . -}} -{{- else -}} - <a href="{{ .Destination | safeURL }}"{{ with .Title}} title="{{ . }}"{{ end }}>{{ .Text | safeHTML }}</a> -{{- end -}} - -{{- define "portable-link" -}} - {{- $destination := .Destination }} - {{- $isRemote := or (in .Destination ":") (strings.HasPrefix .Destination "//") }} - {{- $isFragment := strings.HasPrefix .Destination "#" }} - {{- if and (not $isRemote) (not $isFragment) }} - {{- $url := urls.Parse .Destination }} - {{- $path := strings.TrimSuffix "/_index.md" $url.Path }} - {{- $path = strings.TrimSuffix "/_index" $path }} - {{- $path = strings.TrimSuffix ".md" $path }} - {{- $page := .Page.GetPage $path }} - {{- if $page }} - {{- $destination = $page.RelPermalink }} - {{- if $url.Fragment }} - {{- $destination = print $destination "#" $url.Fragment }} - {{- end }} - {{- else if fileExists (print .Page.File.Dir .Destination) }} - <!-- Nothing --> - {{- else -}} - {{- warnf "Page '%s' not found in '%s'" .Destination .Page.File }} - {{- end }} - {{- end }} - <a href="{{ $destination | safeURL }}"{{ with .Title}} title="{{ . }}"{{ end }}>{{ .Text | safeHTML }}</a> -{{- end -}} diff --git a/themes/hugo-book/layouts/_markup/render-blockquote.html b/themes/hugo-book/layouts/_markup/render-blockquote.html new file mode 100644 index 0000000..88809a1 --- /dev/null +++ b/themes/hugo-book/layouts/_markup/render-blockquote.html @@ -0,0 +1,9 @@ +{{- $attributes := .Attributes }} +{{- $class := printf "book-hint %s" ($.AlertType | lower) }} +{{- if isset $attributes "class" }} + {{ $class = printf "%s %s" $class (index $attributes "class") }} +{{ end -}} +{{- $attributes = merge $attributes (dict "class" $class) }} +<blockquote {{ range $key, $value := $attributes }}{{printf "%s='%s'" $key $value | safeHTMLAttr}}{{ end }}> + {{ .Text }} +</blockquote>
\ No newline at end of file diff --git a/themes/hugo-book/layouts/_markup/render-codeblock-katex.html b/themes/hugo-book/layouts/_markup/render-codeblock-katex.html new file mode 100644 index 0000000..94bcb55 --- /dev/null +++ b/themes/hugo-book/layouts/_markup/render-codeblock-katex.html @@ -0,0 +1,13 @@ +{{- if not (.Page.Store.Get "katex") -}} +<!-- Include katex only first time --> +<link rel="stylesheet" href="{{ "katex/katex.min.css" | relURL }}" /> +<script defer src="{{ "katex/katex.min.js" | relURL }}"></script> +{{ with resources.Get "katex.json" }} +<script defer src="{{ "katex/auto-render.min.js" | relURL }}" onload="renderMathInElement(document.body, {{ .Content | safeJS }});"></script> +{{ end }} +{{- .Page.Store.Set "katex" true -}} +{{- end -}} + +{{- with .Inner }} +<span>\[ {{ .| htmlEscape | safeHTML }} \]</span> +{{ end -}} diff --git a/themes/hugo-book/layouts/_markup/render-codeblock-mermaid.html b/themes/hugo-book/layouts/_markup/render-codeblock-mermaid.html new file mode 100644 index 0000000..097857a --- /dev/null +++ b/themes/hugo-book/layouts/_markup/render-codeblock-mermaid.html @@ -0,0 +1,12 @@ +{{ if not (.Page.Store.Get "mermaid") }} +<!-- Include mermaid only first time --> +<script src="{{ "mermaid.min.js" | relURL }}"></script> +{{ with resources.Get "mermaid.json" }} + <script>mermaid.initialize({{ .Content | safeJS }})</script> +{{ end }} +{{ .Page.Store.Set "mermaid" true }} +{{ end }} + +<pre class="mermaid"> + {{- .Inner -}} +</pre> diff --git a/themes/hugo-book/layouts/_markup/render-codeblock.html b/themes/hugo-book/layouts/_markup/render-codeblock.html new file mode 100644 index 0000000..a79563f --- /dev/null +++ b/themes/hugo-book/layouts/_markup/render-codeblock.html @@ -0,0 +1,10 @@ +{{- with (index .Attributes "filename") -}} + {{- $href := index $.Attributes "href" -}} + {{- if $href -}} + {{- $href = partial "docs/links/portable-link" (dict "Page" $.PageInner "Destination" $href) -}} + {{- end -}} +<div class="book-codeblock-filename"> + <a {{ with $href }}href="{{ . }}"{{ end }}>{{ . }}</a> +</div> +{{- end -}} +{{- (transform.HighlightCodeBlock . .Options).Wrapped -}} diff --git a/themes/hugo-book/layouts/_markup/render-heading.html b/themes/hugo-book/layouts/_markup/render-heading.html new file mode 100644 index 0000000..d2b3c28 --- /dev/null +++ b/themes/hugo-book/layouts/_markup/render-heading.html @@ -0,0 +1,6 @@ +<h{{ .Level }} id="{{ .Anchor }}" {{- with .Attributes.class }} class="{{ . }}" {{- end }}> + {{ .Text }} + {{ if default true .Page.Params.bookHeadingAnchor }} + <a class="anchor" href="#{{ .Anchor }}">#</a> + {{ end }} +</h{{ .Level }}> diff --git a/themes/hugo-book/layouts/_markup/render-image.html b/themes/hugo-book/layouts/_markup/render-image.html new file mode 100644 index 0000000..2453b46 --- /dev/null +++ b/themes/hugo-book/layouts/_markup/render-image.html @@ -0,0 +1,6 @@ +{{- $destination := .Destination -}} +{{- if .Page.Site.Params.BookPortableLinks -}} + {{- $destination = partial "docs/links/portable-image" . -}} +{{- end -}} +<img src="{{ $destination | safeURL }}" alt="{{ .Text }}" {{ with .Title }}title="{{ . }}"{{ end }}/> +{{- /**/ -}}
\ No newline at end of file diff --git a/themes/hugo-book/layouts/_markup/render-link.html b/themes/hugo-book/layouts/_markup/render-link.html new file mode 100644 index 0000000..8aefa3f --- /dev/null +++ b/themes/hugo-book/layouts/_markup/render-link.html @@ -0,0 +1,6 @@ +{{- $destination := .Destination -}} +{{- if .Page.Site.Params.BookPortableLinks -}} + {{- $destination = partial "docs/links/portable-link" . -}} +{{- end -}} +<a href="{{ $destination | safeURL }}"{{ with .Title}} title="{{ . }}"{{ end }}>{{ .Text | safeHTML }}</a> +{{- /**/ -}}
\ No newline at end of file diff --git a/themes/hugo-book/layouts/partials/docs/brand.html b/themes/hugo-book/layouts/_partials/docs/brand.html index fa7f415..7824ef1 100644 --- a/themes/hugo-book/layouts/partials/docs/brand.html +++ b/themes/hugo-book/layouts/_partials/docs/brand.html @@ -1,7 +1,7 @@ <h2 class="book-brand"> <a class="flex align-center" href="{{ cond (not .Site.Home.File) .Sites.Default.Home.RelPermalink .Site.Home.RelPermalink }}"> {{- with .Site.Params.BookLogo -}} - <img src="{{ . | relURL }}" alt="Logo" class="book-icon" /> + <img src="{{ . | relURL }}" alt="Logo" /> {{- end -}} <span>{{ .Site.Title }}</span> </a> diff --git a/themes/hugo-book/layouts/partials/docs/comments.html b/themes/hugo-book/layouts/_partials/docs/comments.html index 59c5f22..59c5f22 100644 --- a/themes/hugo-book/layouts/partials/docs/comments.html +++ b/themes/hugo-book/layouts/_partials/docs/comments.html diff --git a/themes/hugo-book/layouts/partials/docs/date.html b/themes/hugo-book/layouts/_partials/docs/date.html index 8c75361..8c75361 100644 --- a/themes/hugo-book/layouts/partials/docs/date.html +++ b/themes/hugo-book/layouts/_partials/docs/date.html diff --git a/themes/hugo-book/layouts/_partials/docs/footer.html b/themes/hugo-book/layouts/_partials/docs/footer.html new file mode 100644 index 0000000..01d8322 --- /dev/null +++ b/themes/hugo-book/layouts/_partials/docs/footer.html @@ -0,0 +1,29 @@ +<div class="flex flex-wrap justify-between"> + +{{ if and .GitInfo .Site.Params.BookLastChangeLink }} +<div> + {{- $date := partial "docs/date" (dict "Date" .Lastmod "Format" .Site.Params.BookDateFormat) -}} + <a class="flex align-center" href="{{ partial "docs/links/commit" . }}" title='{{ i18n "Last modified by" }} {{ .GitInfo.AuthorName }} | {{ $date }}' target="_blank" rel="noopener"> + <img src="{{ "svg/calendar.svg" | relURL }}" class="book-icon" alt="" /> + <span>{{ $date }}</span> + </a> +</div> +{{ end }} + +{{ if and .File .Site.Params.BookEditLink }} +<div> + <a class="flex align-center" href="{{ partial "docs/links/edit" . }}" target="_blank" rel="noopener edit"> + <img src="{{ "svg/edit.svg" | relURL }}" class="book-icon" alt="" /> + <span>{{ i18n "Edit this page" }}</span> + </a> +</div> +{{ end }} + +</div> + +{{ partial "docs/prev-next" . }} + +{{ $script := resources.Get "clipboard.js" | resources.Minify }} +{{ with $script.Content }} + <script>{{ . | safeJS }}</script> +{{ end }} diff --git a/themes/hugo-book/layouts/partials/docs/header.html b/themes/hugo-book/layouts/_partials/docs/header.html index 646b8ff..ad5582e 100644 --- a/themes/hugo-book/layouts/partials/docs/header.html +++ b/themes/hugo-book/layouts/_partials/docs/header.html @@ -6,7 +6,7 @@ <h3>{{ partial "docs/title" . }}</h3> <label for="toc-control"> - {{ if default true (default .Site.Params.BookToC .Params.BookToC) }} + {{ if partial "docs/toc-show" . }} <img src="{{ "svg/toc.svg" | relURL }}" class="book-icon" alt="Table of Contents" /> {{ end }} </label> diff --git a/themes/hugo-book/layouts/partials/docs/html-head-favicon.html b/themes/hugo-book/layouts/_partials/docs/html-head-favicon.html index 8278050..8278050 100644 --- a/themes/hugo-book/layouts/partials/docs/html-head-favicon.html +++ b/themes/hugo-book/layouts/_partials/docs/html-head-favicon.html diff --git a/themes/hugo-book/layouts/partials/docs/html-head-title.html b/themes/hugo-book/layouts/_partials/docs/html-head-title.html index 49a109d..49a109d 100644 --- a/themes/hugo-book/layouts/partials/docs/html-head-title.html +++ b/themes/hugo-book/layouts/_partials/docs/html-head-title.html diff --git a/themes/hugo-book/layouts/partials/docs/html-head.html b/themes/hugo-book/layouts/_partials/docs/html-head.html index 6a6d0ec..6a6d0ec 100644 --- a/themes/hugo-book/layouts/partials/docs/html-head.html +++ b/themes/hugo-book/layouts/_partials/docs/html-head.html diff --git a/themes/hugo-book/layouts/partials/docs/inject/body.html b/themes/hugo-book/layouts/_partials/docs/inject/body.html index e69de29..e69de29 100644 --- a/themes/hugo-book/layouts/partials/docs/inject/body.html +++ b/themes/hugo-book/layouts/_partials/docs/inject/body.html diff --git a/themes/hugo-book/layouts/partials/docs/inject/content-after.html b/themes/hugo-book/layouts/_partials/docs/inject/content-after.html index e69de29..e69de29 100644 --- a/themes/hugo-book/layouts/partials/docs/inject/content-after.html +++ b/themes/hugo-book/layouts/_partials/docs/inject/content-after.html diff --git a/themes/hugo-book/layouts/partials/docs/inject/content-before.html b/themes/hugo-book/layouts/_partials/docs/inject/content-before.html index e69de29..e69de29 100644 --- a/themes/hugo-book/layouts/partials/docs/inject/content-before.html +++ b/themes/hugo-book/layouts/_partials/docs/inject/content-before.html diff --git a/themes/hugo-book/layouts/partials/docs/inject/footer.html b/themes/hugo-book/layouts/_partials/docs/inject/footer.html index e69de29..e69de29 100644 --- a/themes/hugo-book/layouts/partials/docs/inject/footer.html +++ b/themes/hugo-book/layouts/_partials/docs/inject/footer.html diff --git a/themes/hugo-book/layouts/partials/docs/inject/head.html b/themes/hugo-book/layouts/_partials/docs/inject/head.html index e69de29..e69de29 100644 --- a/themes/hugo-book/layouts/partials/docs/inject/head.html +++ b/themes/hugo-book/layouts/_partials/docs/inject/head.html diff --git a/themes/hugo-book/layouts/partials/docs/inject/menu-after.html b/themes/hugo-book/layouts/_partials/docs/inject/menu-after.html index e69de29..e69de29 100644 --- a/themes/hugo-book/layouts/partials/docs/inject/menu-after.html +++ b/themes/hugo-book/layouts/_partials/docs/inject/menu-after.html diff --git a/themes/hugo-book/layouts/partials/docs/inject/menu-before.html b/themes/hugo-book/layouts/_partials/docs/inject/menu-before.html index e69de29..e69de29 100644 --- a/themes/hugo-book/layouts/partials/docs/inject/menu-before.html +++ b/themes/hugo-book/layouts/_partials/docs/inject/menu-before.html diff --git a/themes/hugo-book/layouts/partials/docs/inject/toc-after.html b/themes/hugo-book/layouts/_partials/docs/inject/toc-after.html index e69de29..e69de29 100644 --- a/themes/hugo-book/layouts/partials/docs/inject/toc-after.html +++ b/themes/hugo-book/layouts/_partials/docs/inject/toc-after.html diff --git a/themes/hugo-book/layouts/partials/docs/inject/toc-before.html b/themes/hugo-book/layouts/_partials/docs/inject/toc-before.html index e69de29..e69de29 100644 --- a/themes/hugo-book/layouts/partials/docs/inject/toc-before.html +++ b/themes/hugo-book/layouts/_partials/docs/inject/toc-before.html diff --git a/themes/hugo-book/layouts/partials/docs/languages.html b/themes/hugo-book/layouts/_partials/docs/languages.html index 51aabdd..70ddc0a 100644 --- a/themes/hugo-book/layouts/partials/docs/languages.html +++ b/themes/hugo-book/layouts/_partials/docs/languages.html @@ -13,10 +13,10 @@ <ul class="book-languages"> <li> <input type="checkbox" id="languages" class="toggle" /> - <label for="languages" class="flex justify-between"> - <a role="button" class="flex align-center"> + <label for="languages" class="flex"> + <a role="button" class="flex flex-auto"> <img src="{{ "svg/translate.svg" | relURL }}" class="book-icon" alt="Languages" /> - {{ $.Site.Language.LanguageName }} + <span>{{ $.Site.Language.LanguageName }}</span> </a> </label> @@ -24,7 +24,7 @@ {{ range .Site.Languages }}{{ with index $translations .Lang }} <li> <a href="{{ cond hugo.IsMultihost .Permalink .RelPermalink }}"> - {{ .Language.LanguageName }} + <span>{{ .Language.LanguageName }}</span> </a> </li> {{ end }}{{ end }} diff --git a/themes/hugo-book/layouts/_partials/docs/links/commit.html b/themes/hugo-book/layouts/_partials/docs/links/commit.html new file mode 100644 index 0000000..a20f07c --- /dev/null +++ b/themes/hugo-book/layouts/_partials/docs/links/commit.html @@ -0,0 +1,5 @@ +{{- return (partial "docs/text/template" (dict "Template" .Site.Params.BookLastChangeLink "Context" (dict + "Site" .Site + "Page" .Page + "GitInfo" .GitInfo +)) | urls.JoinPath) -}}
\ No newline at end of file diff --git a/themes/hugo-book/layouts/_partials/docs/links/edit.html b/themes/hugo-book/layouts/_partials/docs/links/edit.html new file mode 100644 index 0000000..3243412 --- /dev/null +++ b/themes/hugo-book/layouts/_partials/docs/links/edit.html @@ -0,0 +1,5 @@ +{{- return (partial "docs/text/template" (dict "Template" .Site.Params.BookEditLink "Context" (dict + "Site" .Site + "Page" .Page + "Path" (strings.TrimPrefix hugo.WorkingDir .Page.File.Filename) +)) | urls.JoinPath) -}}
\ No newline at end of file diff --git a/themes/hugo-book/layouts/_partials/docs/links/portable-image.html b/themes/hugo-book/layouts/_partials/docs/links/portable-image.html new file mode 100644 index 0000000..4b9bc44 --- /dev/null +++ b/themes/hugo-book/layouts/_partials/docs/links/portable-image.html @@ -0,0 +1,26 @@ +{{- $destination := .Destination -}} +{{- $url := urls.Parse .Destination -}} + +{{- $isRemote := gt (len $url.Host) 0 -}} +{{- $isFragment := strings.HasPrefix .Destination "#" -}} + +{{- if and (not $isRemote) (not $isFragment) -}} + {{- $path := strings.TrimPrefix "./" $url.Path -}} + {{- $path = strings.TrimPrefix "/assets/" $path -}} + + {{- with (.Page.Resources.Get $path) -}} + {{- $destination = .RelPermalink -}} + {{- else with (resources.Get $path) -}} + {{- $destination = .RelPermalink -}} + {{- else -}} + {{- warnf "Image reference '%s' not found in '%s'" .Destination .Page.Permalink -}} + {{- end -}} + + {{- with $url.RawQuery -}} + {{- $destination = print $destination "?" . -}} + {{- end -}} + {{- with $url.Fragment -}} + {{- $destination = print $destination "#" . -}} + {{- end -}} +{{- end -}} +{{- return $destination -}} diff --git a/themes/hugo-book/layouts/_partials/docs/links/portable-link.html b/themes/hugo-book/layouts/_partials/docs/links/portable-link.html new file mode 100644 index 0000000..4c5c0c0 --- /dev/null +++ b/themes/hugo-book/layouts/_partials/docs/links/portable-link.html @@ -0,0 +1,29 @@ +{{- $destination := .Destination -}} +{{- $url := urls.Parse .Destination -}} + +{{- $isRemote := gt (len $url.Host) 0 -}} +{{- $isFragment := strings.HasPrefix .Destination "#" -}} + +{{- if and (not $isRemote) (not $isFragment) -}} + {{- $path := strings.TrimPrefix "./" $url.Path -}} + {{- $path = strings.TrimSuffix ".md" $path -}} + {{- $path = strings.TrimSuffix "/_index" $path -}} + + {{- with (.Page.GetPage $path) -}} + {{- $destination = .RelPermalink -}} + {{- else with (.Page.Resources.Get $path) -}} + {{- $destination = .RelPermalink -}} + {{- else with (resources.Get $path) -}} + {{- $destination = .RelPermalink -}} + {{- else -}} + {{- warnf "Reference '%s' not found in '%s'" .Destination .Page.Permalink -}} + {{- end -}} + + {{- with $url.RawQuery -}} + {{- $destination = print $destination "?" . -}} + {{- end -}} + {{- with $url.Fragment -}} + {{- $destination = print $destination "#" . -}} + {{- end -}} +{{- end -}} +{{- return $destination -}}
\ No newline at end of file diff --git a/themes/hugo-book/layouts/partials/docs/menu-filetree.html b/themes/hugo-book/layouts/_partials/docs/menu-filetree.html index 1494588..5105aa8 100644 --- a/themes/hugo-book/layouts/partials/docs/menu-filetree.html +++ b/themes/hugo-book/layouts/_partials/docs/menu-filetree.html @@ -30,8 +30,8 @@ {{ if .Page.Params.BookCollapseSection }} <input type="checkbox" id="section-{{ md5 .Page }}" class="toggle" {{ if or $current $ancestor }}checked{{ end }} /> - <label for="section-{{ md5 .Page }}" class="flex justify-between"> - <a {{ if .Page.Content }}href="{{ .Page.RelPermalink }}"{{ else }}role="button"{{ end }} class="{{ if $current }}active{{ end }}"> + <label for="section-{{ md5 .Page }}" class="flex"> + <a {{ if .Page.Content }}href="{{ .Page.RelPermalink }}"{{ else }}role="button"{{ end }} class="flex-auto {{ if $current }}active{{ end }}"> {{- partial "docs/title" .Page -}} </a> </label> diff --git a/themes/hugo-book/layouts/partials/docs/menu-hugo.html b/themes/hugo-book/layouts/_partials/docs/menu-hugo.html index 5f01be0..871eea7 100644 --- a/themes/hugo-book/layouts/partials/docs/menu-hugo.html +++ b/themes/hugo-book/layouts/_partials/docs/menu-hugo.html @@ -10,7 +10,8 @@ <ul> {{ range . }} <li> - <a href="{{ .URL }}" {{ with .Params.class }}class="{{ . }}"{{ end }} {{ if not .Page }}target="_blank" rel="noopener"{{ end }}> + {{ $isRemote := not (or (.Page) (strings.HasPrefix .URL "/")) }} + <a href="{{ .URL }}" {{ with .Params.class }}class="{{ . }}"{{ end }} {{ if $isRemote }}target="_blank" rel="noopener"{{ end }}> {{- .Pre -}} {{ with .Page }} {{ partial "docs/title" .Page }} diff --git a/themes/hugo-book/layouts/partials/docs/menu.html b/themes/hugo-book/layouts/_partials/docs/menu.html index dbb2e49..dbb2e49 100644 --- a/themes/hugo-book/layouts/partials/docs/menu.html +++ b/themes/hugo-book/layouts/_partials/docs/menu.html diff --git a/themes/hugo-book/layouts/_partials/docs/pagination.html b/themes/hugo-book/layouts/_partials/docs/pagination.html new file mode 100644 index 0000000..9e0d154 --- /dev/null +++ b/themes/hugo-book/layouts/_partials/docs/pagination.html @@ -0,0 +1,28 @@ +{{- if .Paginator -}} +<div class="flex flex-wrap justify-between"> + <span> + {{- with .Paginator.Prev }} + <a href="{{ .URL }}" class="flex align-center"> + <img src="{{ "svg/backward.svg" | relURL }}" class="book-icon" alt="Previous" /> + </a> + {{ end }} + </span> + {{ if gt (len .Paginator.Pagers) 1 }} + <span class="flex gap"> + {{- $currentPageNumber := .Paginator.PageNumber -}} + {{- range $pageIndex := (slice -2 -1 0 1 2) -}} + {{- with index $.Paginator.Pagers (add $currentPageNumber $pageIndex -1) -}} + <a {{if ne $currentPageNumber .PageNumber }}href="{{ .URL }}"{{end}}>{{ .PageNumber }}</a> + {{- end -}} + {{- end -}} + </span> + {{ end }} + <span> + {{- with .Paginator.Next }} + <a href="{{ .URL }}" class="flex align-center"> + <img src="{{ "svg/forward.svg" | relURL }}" class="book-icon" alt="Next" /> + </a> + {{ end }} + </span> +</div> +{{- end -}} diff --git a/themes/hugo-book/layouts/partials/docs/post-meta.html b/themes/hugo-book/layouts/_partials/docs/post-meta.html index 457e2c0..457e2c0 100644 --- a/themes/hugo-book/layouts/partials/docs/post-meta.html +++ b/themes/hugo-book/layouts/_partials/docs/post-meta.html diff --git a/themes/hugo-book/layouts/_partials/docs/post-prev-next.html b/themes/hugo-book/layouts/_partials/docs/post-prev-next.html new file mode 100644 index 0000000..d7192c0 --- /dev/null +++ b/themes/hugo-book/layouts/_partials/docs/post-prev-next.html @@ -0,0 +1,18 @@ +<div class="flex flex-wrap justify-between"> + <span> + {{ with .NextInSection }} + <a href="{{ .RelPermalink }}" class="flex align-center"> + <img src="{{ "svg/backward.svg" | relURL }}" class="book-icon" alt="Previous" title="{{ partial "docs/title" . }}" /> + <span>{{ partial "docs/title" . }}</span> + </a> + {{ end }} + </span> + <span> + {{ with .PrevInSection }} + <a href="{{ .RelPermalink }}" class="flex align-center"> + <span>{{ partial "docs/title" . }}</span> + <img src="{{ "svg/forward.svg" | relURL }}" class="book-icon" alt="Next" title="{{ partial "docs/title" . }}" /> + </a> + {{ end }} + </span> +</div>
\ No newline at end of file diff --git a/themes/hugo-book/layouts/_partials/docs/prev-next-cache.html b/themes/hugo-book/layouts/_partials/docs/prev-next-cache.html new file mode 100644 index 0000000..1561c06 --- /dev/null +++ b/themes/hugo-book/layouts/_partials/docs/prev-next-cache.html @@ -0,0 +1,14 @@ +{{ $scratch := newScratch }} +{{ template "recurse" (dict "Scratch" $scratch "Sections" .) }} +{{ define "recurse" }} + {{ range .Sections }} + {{ if and .Content (not .Params.BookHidden) }} + {{ $.Scratch.Add "BookPages" (slice .) }} + {{ end }} + {{ if .IsSection }} + {{ template "recurse" (dict "Scratch" $.Scratch "Sections" .Pages) }} + {{ end }} + {{ end }} +{{ end }} + +{{ return $scratch.Get "BookPages" }} diff --git a/themes/hugo-book/layouts/_partials/docs/prev-next.html b/themes/hugo-book/layouts/_partials/docs/prev-next.html new file mode 100644 index 0000000..d93e5ed --- /dev/null +++ b/themes/hugo-book/layouts/_partials/docs/prev-next.html @@ -0,0 +1,31 @@ +{{ $bookSection := default "docs" .Site.Params.BookSection }} +{{ if eq $bookSection "*" }} + {{ $bookSection = "/" }}{{/* Backward compatibility */}} +{{ end }} + +{{ with .Site.GetPage $bookSection }} + {{ $pages := partialCached "docs/prev-next-cache" .Pages }} + {{ $prev := $pages.Next $ }} + {{ $next := $pages.Prev $ }} + + {{- if or $prev $next }} + <div class="flex flex-wrap justify-between"> + <span> + {{ with $prev }} + <a href="{{ .RelPermalink }}" class="flex align-center"> + <img src="{{ "svg/backward.svg" | relURL }}" class="book-icon" alt="Previous" title="{{ partial "docs/title" . }}" /> + <span>{{ partial "docs/title" . }}</span> + </a> + {{ end }} + </span> + <span> + {{ with $next }} + <a href="{{ .RelPermalink }}" class="flex align-center"> + <span>{{ partial "docs/title" . }}</span> + <img src="{{ "svg/forward.svg" | relURL }}" class="book-icon" alt="Next" title="{{ partial "docs/title" . }}" /> + </a> + {{ end }} + </span> + </div> + {{ end -}} +{{ end }} diff --git a/themes/hugo-book/layouts/partials/docs/search.html b/themes/hugo-book/layouts/_partials/docs/search.html index 937f595..937f595 100644 --- a/themes/hugo-book/layouts/partials/docs/search.html +++ b/themes/hugo-book/layouts/_partials/docs/search.html diff --git a/themes/hugo-book/layouts/partials/docs/taxonomy.html b/themes/hugo-book/layouts/_partials/docs/taxonomy.html index 63ef315..90366ae 100644 --- a/themes/hugo-book/layouts/partials/docs/taxonomy.html +++ b/themes/hugo-book/layouts/_partials/docs/taxonomy.html @@ -3,7 +3,7 @@ {{ range $term, $_ := .Site.Taxonomies }} {{ with $.Site.GetPage (printf "/%s" $term | urlize) }} <li class="book-section-flat"> - <strong>{{ .Title | title }}</strong> + <span>{{ .Title | title }}</span> <ul> {{ range .Pages }} <li class="flex justify-between"> diff --git a/themes/hugo-book/layouts/_partials/docs/text/template.html b/themes/hugo-book/layouts/_partials/docs/text/template.html new file mode 100644 index 0000000..53e535d --- /dev/null +++ b/themes/hugo-book/layouts/_partials/docs/text/template.html @@ -0,0 +1,9 @@ +<!-- + Returns rendered string from template and context. + Usage: partial "docs/string-template" (dict "Template" "param={{ . }}" "Context" "Input") +--> + +{{- $checksum := . | encoding.Jsonify | crypto.SHA1 | printf "book-%s" -}} +{{- $template := resources.FromString $checksum .Template -}} +{{- $template = $template | resources.ExecuteAsTemplate $checksum .Context -}} +{{- return $template.Content -}}
\ No newline at end of file diff --git a/themes/hugo-book/layouts/partials/docs/title.html b/themes/hugo-book/layouts/_partials/docs/title.html index 83df5b6..83df5b6 100644 --- a/themes/hugo-book/layouts/partials/docs/title.html +++ b/themes/hugo-book/layouts/_partials/docs/title.html diff --git a/themes/hugo-book/layouts/_partials/docs/toc-show.html b/themes/hugo-book/layouts/_partials/docs/toc-show.html new file mode 100644 index 0000000..5115c84 --- /dev/null +++ b/themes/hugo-book/layouts/_partials/docs/toc-show.html @@ -0,0 +1,4 @@ +{{ return default + (not (eq .TableOfContents "<nav id=\"TableOfContents\"></nav>")) + (default .Site.Params.BookToC .Params.BookToC) +}}
\ No newline at end of file diff --git a/themes/hugo-book/layouts/partials/docs/toc.html b/themes/hugo-book/layouts/_partials/docs/toc.html index 64697a4..64697a4 100644 --- a/themes/hugo-book/layouts/partials/docs/toc.html +++ b/themes/hugo-book/layouts/_partials/docs/toc.html diff --git a/themes/hugo-book/layouts/_shortcodes/badge.html b/themes/hugo-book/layouts/_shortcodes/badge.html new file mode 100644 index 0000000..0bbfcb1 --- /dev/null +++ b/themes/hugo-book/layouts/_shortcodes/badge.html @@ -0,0 +1,5 @@ +{{- $style := default "default" (.Get "style") -}} +<span class="book-badge {{ $style }}"> + {{- with .Get "title" }}<span class="book-badge-title">{{ . | plainify }}</span>{{ end -}} + {{- with .Get "value" }}<span class="book-badge-value">{{ . | plainify }}</span>{{ end -}} +</span>
\ No newline at end of file diff --git a/themes/hugo-book/layouts/_shortcodes/button.html b/themes/hugo-book/layouts/_shortcodes/button.html new file mode 100644 index 0000000..cd7e016 --- /dev/null +++ b/themes/hugo-book/layouts/_shortcodes/button.html @@ -0,0 +1,5 @@ +{{ $href := partial "docs/links/portable-link" (dict "Page" .Page "Destination" (.Get "href")) -}} +{{ $isRemote := (urls.Parse $href).Scheme}} +<a {{ with $href }}href="{{ $href }}"{{ end }} {{ with $isRemote }}target="_blank" rel="noopener"{{ end }} class="book-btn{{ with .Get "class" }} {{ . }}{{ end }}"> + {{- .InnerDeindent -}} +</a> diff --git a/themes/hugo-book/layouts/_shortcodes/card.html b/themes/hugo-book/layouts/_shortcodes/card.html new file mode 100644 index 0000000..086fb97 --- /dev/null +++ b/themes/hugo-book/layouts/_shortcodes/card.html @@ -0,0 +1,22 @@ +{{- /* remove whitespace */ -}} +{{- with .Get "href" -}} +{{- $destination := partial "docs/links/portable-link" (dict "Page" $.Page "Destination" .) -}} +<a class="book-card{{ with $.Get "class" }} {{ . }}{{ end }}" href="{{ $destination | safeURL }}"> +{{- template "book-card-content" $ -}} +</a> +{{- else -}} +<div class="book-card{{ with .Get "class" }} {{ . }}{{ end }}"> +{{- template "book-card-content" $ -}} +</div> +{{- end -}} + +{{- define "book-card-content" -}} +{{- with .Get "image" -}} + {{- $destination := partial "docs/links/portable-image" (dict "Page" $.Page "Destination" .) -}} + <img src="{{ $destination | safeURL }}" /> +{{- end }} + <div class="markdown-inner"> + {{ with .InnerDeindent }}{{ . }}{{ end }} + </div> +{{- end -}} +{{- /* remove whitespace */ -}} diff --git a/themes/hugo-book/layouts/_shortcodes/columns.html b/themes/hugo-book/layouts/_shortcodes/columns.html new file mode 100644 index 0000000..1d6abdd --- /dev/null +++ b/themes/hugo-book/layouts/_shortcodes/columns.html @@ -0,0 +1,21 @@ +{{- $ratio := (split (.Get "ratio") ":") -}} +{{- if strings.Contains .InnerDeindent "<--->" -}} +{{ warnf "Columns shortcode seprator '<--->' is deprecated, use markdown list instead." -}} +<div class="book-columns flex flex-wrap{{ with .Get "class" }} {{ . }}{{ end }}"> +{{ range $index, $content := split .InnerDeindent "<--->" }} + {{- $grow := default 1 (index $ratio $index) -}} + <div class="flex-even markdown-inner" style="flex-grow: {{ $grow }};"> + {{ $content | safeHTML }} + </div> +{{ end }} +</div> +{{ else }} +{{- if .Get "ratio" }}<style>{{ range $index, $grow := $ratio }} + .book-columns-{{ $.Ordinal }}>ul>li:nth-child({{ $index | add 1 }}){ + flex-grow: {{ default 1 $grow }}; + } +{{ end }}</style>{{ end -}} +<div class="book-columns book-columns-{{ .Ordinal }} {{ with .Get "class" }}{{ . }}{{ end }}"> +{{ .InnerDeindent | safeHTML }} +</div> +{{ end -}} diff --git a/themes/hugo-book/layouts/shortcodes/details.html b/themes/hugo-book/layouts/_shortcodes/details.html index a80209b..a80209b 100644 --- a/themes/hugo-book/layouts/shortcodes/details.html +++ b/themes/hugo-book/layouts/_shortcodes/details.html diff --git a/themes/hugo-book/layouts/_shortcodes/hint.html b/themes/hugo-book/layouts/_shortcodes/hint.html new file mode 100644 index 0000000..a71f1fd --- /dev/null +++ b/themes/hugo-book/layouts/_shortcodes/hint.html @@ -0,0 +1,3 @@ +<blockquote class="book-hint {{ default "default" (.Get 0) }}"> + {{ .Inner | safeHTML }} +</blockquote> diff --git a/themes/hugo-book/layouts/shortcodes/html.html b/themes/hugo-book/layouts/_shortcodes/html.html index b447d45..b447d45 100644 --- a/themes/hugo-book/layouts/shortcodes/html.html +++ b/themes/hugo-book/layouts/_shortcodes/html.html diff --git a/themes/hugo-book/layouts/shortcodes/i18n.html b/themes/hugo-book/layouts/_shortcodes/i18n.html index b65f70a..b65f70a 100644 --- a/themes/hugo-book/layouts/shortcodes/i18n.html +++ b/themes/hugo-book/layouts/_shortcodes/i18n.html diff --git a/themes/hugo-book/layouts/_shortcodes/image.html b/themes/hugo-book/layouts/_shortcodes/image.html new file mode 100644 index 0000000..e1b9c46 --- /dev/null +++ b/themes/hugo-book/layouts/_shortcodes/image.html @@ -0,0 +1,12 @@ +{{- /* remove whitespaces */ -}} +{{- $destination := partial "docs/links/portable-image" (dict "Page" .Page "Destination" (.Get "src")) -}} +<label class="book-image" for="book-image-toggle-{{ .Ordinal }}"> + <input class="hidden toggle" type="checkbox" id="book-image-toggle-{{ .Ordinal }}" /> + <img src="{{ $destination | safeURL }}" + {{- with .Get "alt"}} alt="{{ . }}"{{ end -}} + {{- with .Get "title"}} title="{{ . }}"{{ end -}} + {{- with .Get "loading"}} loading="{{ . }}"{{ end -}} + {{- with .Get "class"}} class="{{ . }}"{{ end -}} + /> +</label> +{{- /* remove whitespaces */ -}}
\ No newline at end of file diff --git a/themes/hugo-book/layouts/_shortcodes/katex.html b/themes/hugo-book/layouts/_shortcodes/katex.html new file mode 100644 index 0000000..b3f38ac --- /dev/null +++ b/themes/hugo-book/layouts/_shortcodes/katex.html @@ -0,0 +1,19 @@ +{{- if not (.Page.Store.Get "katex") -}} +<!-- Include katex only first time --> +<link rel="stylesheet" href="{{ "katex/katex.min.css" | relURL }}" /> +<script defer src="{{ "katex/katex.min.js" | relURL }}"></script> +{{ with resources.Get "katex.json" }} + <script defer src="{{ "katex/auto-render.min.js" | relURL }}" onload="renderMathInElement(document.body, {{ .Content | safeJS }});"></script> +{{ end }} +{{- .Page.Store.Set "katex" true -}} +{{- end -}} + +{{ if .Inner }} +<span> + {{- if .Get "display" }} + \[ {{ .Inner }} \] + {{ else }} + \( {{ .Inner }} \) + {{ end -}} +</span> +{{ end }} diff --git a/themes/hugo-book/layouts/shortcodes/mermaid.html b/themes/hugo-book/layouts/_shortcodes/mermaid.html index 07a3bfc..078d7d3 100644 --- a/themes/hugo-book/layouts/shortcodes/mermaid.html +++ b/themes/hugo-book/layouts/_shortcodes/mermaid.html @@ -1,12 +1,12 @@ -{{ if not (.Page.Scratch.Get "mermaid") }} +{{ if not (.Page.Store.Get "mermaid") }} <!-- Include mermaid only first time --> <script src="{{ "mermaid.min.js" | relURL }}"></script> {{ with resources.Get "mermaid.json" }} <script>mermaid.initialize({{ .Content | safeJS }})</script> {{ end }} -{{ .Page.Scratch.Set "mermaid" true }} +{{ .Page.Store.Set "mermaid" true }} {{ end }} <pre class="mermaid{{ with .Get "class" }} {{ . }}{{ end }}"> - {{- .Inner -}} + {{- .Inner | htmlEscape | safeHTML -}} </pre> diff --git a/themes/hugo-book/layouts/shortcodes/section.html b/themes/hugo-book/layouts/_shortcodes/section.html index b700ec4..b700ec4 100644 --- a/themes/hugo-book/layouts/shortcodes/section.html +++ b/themes/hugo-book/layouts/_shortcodes/section.html diff --git a/themes/hugo-book/layouts/_shortcodes/steps.html b/themes/hugo-book/layouts/_shortcodes/steps.html new file mode 100644 index 0000000..46cfaa1 --- /dev/null +++ b/themes/hugo-book/layouts/_shortcodes/steps.html @@ -0,0 +1,3 @@ +<div class="book-steps {{ with .Get "class" }}{{ . }}{{ end }}"> + {{ .Inner }} +</div>
\ No newline at end of file diff --git a/themes/hugo-book/layouts/shortcodes/tab.html b/themes/hugo-book/layouts/_shortcodes/tab.html index b5a753d..b5a753d 100644 --- a/themes/hugo-book/layouts/shortcodes/tab.html +++ b/themes/hugo-book/layouts/_shortcodes/tab.html diff --git a/themes/hugo-book/layouts/shortcodes/tabs.html b/themes/hugo-book/layouts/_shortcodes/tabs.html index fecbbeb..fecbbeb 100644 --- a/themes/hugo-book/layouts/shortcodes/tabs.html +++ b/themes/hugo-book/layouts/_shortcodes/tabs.html diff --git a/themes/hugo-book/layouts/_default/baseof.html b/themes/hugo-book/layouts/baseof.html index a6c4c07..2e6b0a9 100644 --- a/themes/hugo-book/layouts/_default/baseof.html +++ b/themes/hugo-book/layouts/baseof.html @@ -4,15 +4,11 @@ {{ partial "docs/html-head" . }} {{ partial "docs/inject/head" . }} </head> -<body dir="{{ default "ltr" .Site.Language.LanguageDirection }}"> +<body dir="{{ default "ltr" .Site.Language.LanguageDirection }}" class="book-kind-{{ .Kind }} book-type-{{ .Type }} book-layout-{{ .Layout }}"> <input type="checkbox" class="hidden toggle" id="menu-control" /> <input type="checkbox" class="hidden toggle" id="toc-control" /> <main class="container flex"> - <aside class="book-menu"> - <div class="book-menu-content"> - {{ template "menu" . }} <!-- Left menu Content --> - </div> - </aside> + {{ template "menu-container" . }} <!-- Left menu --> <div class="book-page"> <header class="book-header"> @@ -29,23 +25,24 @@ </footer> {{ template "comments" . }} <!-- Comments block --> - <label for="menu-control" class="hidden book-menu-overlay"></label> </div> - {{ if default true (default .Site.Params.BookToC .Params.BookToC) }} - <aside class="book-toc"> - <div class="book-toc-content"> - {{ template "toc" . }} <!-- Table of Contents --> - </div> - </aside> - {{ end }} + {{ template "toc-container" . }} <!-- Table of Contents --> </main> {{ partial "docs/inject/body" . }} </body> </html> +{{ define "menu-container" }} +<aside class="book-menu"> + <div class="book-menu-content"> + {{ template "menu" . }} + </div> +</aside> +{{ end }} + {{ define "menu" }} {{ partial "docs/menu" . }} {{ end }} @@ -78,6 +75,16 @@ </article> {{ end }} +{{ define "toc-container" }} +{{ if partial "docs/toc-show" . }} +<aside class="book-toc"> + <div class="book-toc-content"> + {{ template "toc" . }} + </div> +</aside> +{{ end }} +{{ end }} + {{ define "toc" }} {{ partial "docs/toc" . }} {{ end }} diff --git a/themes/hugo-book/layouts/landing.html b/themes/hugo-book/layouts/landing.html new file mode 100644 index 0000000..76b8637 --- /dev/null +++ b/themes/hugo-book/layouts/landing.html @@ -0,0 +1,15 @@ +{{ define "menu-container" }} +<!-- --> +{{ end }} +{{ define "toc-container" }} +<!-- --> +{{ end }} +{{ define "footer" }} +<!-- --> +{{ end }} + +{{ define "header" }} +<nav> + {{ partial "docs/menu-hugo" .Site.Menus.home }} +</nav> +{{ end }} diff --git a/themes/hugo-book/layouts/_default/list.html b/themes/hugo-book/layouts/list.html index 0dc8b68..0dc8b68 100644 --- a/themes/hugo-book/layouts/_default/list.html +++ b/themes/hugo-book/layouts/list.html diff --git a/themes/hugo-book/layouts/partials/docs/footer.html b/themes/hugo-book/layouts/partials/docs/footer.html deleted file mode 100644 index 77e96d8..0000000 --- a/themes/hugo-book/layouts/partials/docs/footer.html +++ /dev/null @@ -1,27 +0,0 @@ -<div class="flex flex-wrap justify-between"> - -{{ if and .GitInfo .Site.Params.BookRepo }} - <div> - {{- $date := partial "docs/date" (dict "Date" .GitInfo.AuthorDate.Local "Format" .Site.Params.BookDateFormat) -}} - <a class="flex align-center" href="{{ partial "docs/links/commit" . }}" title='{{ i18n "Last modified by" }} {{ .GitInfo.AuthorName }} | {{ $date }}' target="_blank" rel="noopener"> - <img src="{{ "svg/calendar.svg" | relURL }}" class="book-icon" alt="" /> - <span>{{ $date }}</span> - </a> - </div> -{{ end }} - -{{ if and .File .Site.Params.BookRepo .Site.Params.BookEditPath }} - <div> - <a class="flex align-center" href="{{ partial "docs/links/edit" . }}" target="_blank" rel="noopener"> - <img src="{{ "svg/edit.svg" | relURL }}" class="book-icon" alt="" /> - <span>{{ i18n "Edit this page" }}</span> - </a> - </div> -{{ end }} - -</div> - -{{ $script := resources.Get "clipboard.js" | resources.Minify }} -{{ with $script.Content }} - <script>{{ . | safeJS }}</script> -{{ end }} diff --git a/themes/hugo-book/layouts/partials/docs/links/commit.html b/themes/hugo-book/layouts/partials/docs/links/commit.html deleted file mode 100644 index 8ab9334..0000000 --- a/themes/hugo-book/layouts/partials/docs/links/commit.html +++ /dev/null @@ -1,2 +0,0 @@ -{{- $commitPath := default "commit" .Site.Params.BookCommitPath -}} -{{- .Site.Params.BookRepo }}/{{ $commitPath }}/{{ .GitInfo.Hash -}}
\ No newline at end of file diff --git a/themes/hugo-book/layouts/partials/docs/links/edit.html b/themes/hugo-book/layouts/partials/docs/links/edit.html deleted file mode 100644 index 920affa..0000000 --- a/themes/hugo-book/layouts/partials/docs/links/edit.html +++ /dev/null @@ -1,2 +0,0 @@ -{{- $bookFilePath := (strings.TrimPrefix hugo.WorkingDir .Page.File.Filename | path.Join) -}} -{{- .Site.Params.BookRepo }}/{{ .Site.Params.BookEditPath }}{{ ($bookFilePath) -}}
\ No newline at end of file diff --git a/themes/hugo-book/layouts/posts/list.html b/themes/hugo-book/layouts/posts/list.html index aff32f5..0d7df53 100644 --- a/themes/hugo-book/layouts/posts/list.html +++ b/themes/hugo-book/layouts/posts/list.html @@ -1,22 +1,39 @@ {{ define "main" }} {{ range sort .Paginator.Pages }} - <article class="markdown book-post"> + <article class="book-post markdown"> <h2> - <a href="{{ .RelPermalink }}">{{ partial "docs/title.html" . }}</a> + <a href="{{ .RelPermalink }}">{{ partial "docs/title" . }}</a> </h2> - {{ partial "docs/post-meta" . }} - <div class="book-post-content"> - {{- .Summary -}} - {{ if .Truncated }} - <a href="{{ .RelPermalink }}">...</a> - {{ end }} + <div class="book-post-container flex gap"> + <div> + {{ partial "docs/post-meta" . }} + <div class="book-post-content markdown-inner"> + {{- .Summary | truncate 256 -}} + </div> + </div> + {{- $thumbnail := default "thumbnail.*" .Params.BookPostThumbnail -}} + {{- with or (.Resources.GetMatch $thumbnail) (resources.GetMatch $thumbnail) -}} + <div class="book-post-thumbnail"> + <img src="{{ .RelPermalink }}" /> + </div> + {{- end -}} </div> </article> {{ end }} +{{ end }} - {{ template "_internal/pagination.html" . }} +{{ define "toc-container" }} +<aside class="book-toc"> + <div class="book-toc-content"> + {{ template "toc" . }} + </div> +</aside> {{ end }} {{ define "toc" }} {{ partial "docs/taxonomy" . }} {{ end }} + +{{ define "footer" }} + {{ partial "docs/pagination.html" . }} +{{ end }}
\ No newline at end of file diff --git a/themes/hugo-book/layouts/posts/single.html b/themes/hugo-book/layouts/posts/single.html index cebdd11..232e14e 100644 --- a/themes/hugo-book/layouts/posts/single.html +++ b/themes/hugo-book/layouts/posts/single.html @@ -1,10 +1,10 @@ {{ define "main" }} <article class="markdown book-post"> <h1> - {{ partial "docs/title.html" . }} + {{ partial "docs/title" . }} </h1> {{ partial "docs/post-meta" . }} - <div class="book-post-content"> + <div class="book-post-content markdown-inner"> {{- .Content -}} </div> </article> @@ -13,3 +13,7 @@ {{ define "toc" }} {{ partial "docs/toc" . }} {{ end }} + +{{ define "footer" }} + {{ partial "docs/post-prev-next" . }} +{{ end }}
\ No newline at end of file diff --git a/themes/hugo-book/layouts/shortcodes/button.html b/themes/hugo-book/layouts/shortcodes/button.html deleted file mode 100644 index efae3e0..0000000 --- a/themes/hugo-book/layouts/shortcodes/button.html +++ /dev/null @@ -1,12 +0,0 @@ -{{- $ref := "" }} -{{- $target := "" -}} -{{- with .Get "href" -}} - {{- $ref = . -}} - {{- $target = "_blank" -}} -{{- end -}} -{{- with .Get "relref" -}} - {{- $ref = relref $ . -}} -{{- end -}} -<a {{ with $ref }} href="{{.}}" {{ end }} {{ with $target }} target="{{.}}" rel="noopener" {{ end }} class="book-btn{{ with .Get "class" }} {{ . }}{{ end }}"> - {{- .InnerDeindent -}} -</a> diff --git a/themes/hugo-book/layouts/shortcodes/columns.html b/themes/hugo-book/layouts/shortcodes/columns.html deleted file mode 100644 index bb01da9..0000000 --- a/themes/hugo-book/layouts/shortcodes/columns.html +++ /dev/null @@ -1,9 +0,0 @@ -{{- $ratio := (split (.Get "ratio") ":") -}} -<div class="book-columns flex flex-wrap{{ with .Get "class" }} {{ . }}{{ end }}"> -{{ range $index, $content := split .InnerDeindent "<--->" }} - {{- $grow := default 1 (index $ratio $index) -}} - <div class="flex-even markdown-inner" style="flex-grow: {{ $grow }};"> - {{ $content | safeHTML }} - </div> -{{ end }} -</div> diff --git a/themes/hugo-book/layouts/shortcodes/hint.html b/themes/hugo-book/layouts/shortcodes/hint.html deleted file mode 100644 index 95e4f83..0000000 --- a/themes/hugo-book/layouts/shortcodes/hint.html +++ /dev/null @@ -1,3 +0,0 @@ -<blockquote class="book-hint {{ .Get 0 }}"> - {{ .Inner | safeHTML }} -</blockquote> diff --git a/themes/hugo-book/layouts/shortcodes/katex.html b/themes/hugo-book/layouts/shortcodes/katex.html deleted file mode 100644 index 4eafc35..0000000 --- a/themes/hugo-book/layouts/shortcodes/katex.html +++ /dev/null @@ -1,13 +0,0 @@ -{{- if not (.Page.Scratch.Get "katex") -}} -<!-- Include katex only first time --> -<link rel="stylesheet" href="{{ "katex/katex.min.css" | relURL }}" /> -<script defer src="{{ "katex/katex.min.js" | relURL }}"></script> -<script defer src="{{ "katex/auto-render.min.js" | relURL }}" onload="renderMathInElement(document.body);"></script> -{{- .Page.Scratch.Set "katex" true -}} -{{- end -}} - -<span {{- with .Get "class" }} class="{{ . }}"{{ end }}> - {{ with .Get "display" }}\[{{else}}\({{end}} - {{- .InnerDeindent -}} - {{ with .Get "display" }}\]{{else}}\){{end}} -</span> diff --git a/themes/hugo-book/layouts/_default/single.html b/themes/hugo-book/layouts/single.html index 0dc8b68..0dc8b68 100644 --- a/themes/hugo-book/layouts/_default/single.html +++ b/themes/hugo-book/layouts/single.html diff --git a/themes/hugo-book/layouts/taxonomy/list.html b/themes/hugo-book/layouts/taxonomy/list.html deleted file mode 100644 index 1d3e763..0000000 --- a/themes/hugo-book/layouts/taxonomy/list.html +++ /dev/null @@ -1,13 +0,0 @@ -{{ define "main" }} -<article class="markdown book-post"> - <h1>{{ .Title | title }}</h1> - {{ $taxonomies := index .Site.Taxonomies .Page.Type }} - {{ range $taxonomies }} - <div><a href="{{ .Page.Permalink }}">{{ .Page.Title }} <sup>{{ .Count }}</sup></a></div> - {{ end }} -</article> -{{ end }} - -{{ define "toc" }} - {{ partial "docs/taxonomy" . }} -{{ end }} diff --git a/themes/hugo-book/layouts/taxonomy/taxonomy.html b/themes/hugo-book/layouts/term.html index badf0f6..1bae9a0 100644 --- a/themes/hugo-book/layouts/taxonomy/taxonomy.html +++ b/themes/hugo-book/layouts/term.html @@ -2,21 +2,26 @@ {{ range sort .Paginator.Pages }} <article class="markdown book-post"> <h2> - <a href="{{ .RelPermalink }}">{{ partial "docs/title.html" . }}</a> + <a href="{{ .RelPermalink }}">{{ partial "docs/title" . }}</a> </h2> {{ partial "docs/post-meta" . }} - <p> + <div class="book-post-content"> {{- .Summary -}} - {{ if .Truncated }} - <a href="{{ .RelPermalink }}">...</a> - {{ end }} - </p> + </div> </article> {{ end }} {{ template "_internal/pagination.html" . }} {{ end }} +{{ define "toc-container" }} +<aside class="book-toc"> + <div class="book-toc-content"> + {{ template "toc" . }} + </div> +</aside> +{{ end }} + {{ define "toc" }} {{ partial "docs/taxonomy" . }} {{ end }} |
