This commit is contained in:
Gabriele Musco 2024-10-09 14:30:39 +02:00 committed by GitHub
commit 912456a1f9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 22 additions and 7 deletions

View File

@ -291,6 +291,12 @@ body[dir="rtl"] .book-menu {
will-change: transform, margin, opacity; will-change: transform, margin, opacity;
} }
.book-filetree-icon {
width: 16px;
height: 16px;
vertical-align: middle;
}
@media screen and (max-width: $mobile-breakpoint) { @media screen and (max-width: $mobile-breakpoint) {
#menu-control, #menu-control,
#toc-control { #toc-control {

View File

@ -3,7 +3,7 @@
<img src="{{ "svg/menu.svg" | relURL }}" class="book-icon" alt="Menu" /> <img src="{{ "svg/menu.svg" | relURL }}" class="book-icon" alt="Menu" />
</label> </label>
<strong>{{ partial "docs/title" . }}</strong> <strong>{{ partial "docs/title-with-icon" . }}</strong>
<label for="toc-control"> <label for="toc-control">
{{ if default true (default .Site.Params.BookToC .Params.BookToC) }} {{ if default true (default .Site.Params.BookToC .Params.BookToC) }}

View File

@ -32,18 +32,18 @@
<input type="checkbox" id="section-{{ md5 .Page }}" class="toggle" {{ if or $current $ancestor }}checked{{ end }} /> <input type="checkbox" id="section-{{ md5 .Page }}" class="toggle" {{ if or $current $ancestor }}checked{{ end }} />
<label for="section-{{ md5 .Page }}" class="flex justify-between"> <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 }}"> <a {{ if .Page.Content }}href="{{ .Page.RelPermalink }}"{{ else }}role="button"{{ end }} class="{{ if $current }}active{{ end }}">
{{- partial "docs/title" .Page -}} {{- partial "docs/title-with-icon" .Page -}}
</a> </a>
</label> </label>
{{ else if .Page.Params.BookHref }} {{ else if .Page.Params.BookHref }}
<a href="{{ .Page.Params.BookHref }}" class="{{ if $current }}active{{ end }}" target="_blank" rel="noopener"> <a href="{{ .Page.Params.BookHref }}" class="{{ if $current }}active{{ end }}" target="_blank" rel="noopener">
{{- partial "docs/title" .Page -}} {{- partial "docs/title-with-icon" .Page -}}
</a> </a>
{{ else if .Page.Content }} {{ else if .Page.Content }}
<a href="{{ .Page.RelPermalink }}" class="{{ if $current }}active{{ end }}"> <a href="{{ .Page.RelPermalink }}" class="{{ if $current }}active{{ end }}">
{{- partial "docs/title" .Page -}} {{- partial "docs/title-with-icon" .Page -}}
</a> </a>
{{ else }} {{ else }}
<span>{{- partial "docs/title" .Page -}}</span> <span>{{- partial "docs/title-with-icon" .Page -}}</span>
{{ end }} {{ end }}
{{ end }} {{ end }}

View File

@ -13,7 +13,7 @@
<a href="{{ .URL }}" {{ with .Params.class }}class="{{ . }}"{{ end }} {{ if not .Page }}target="_blank" rel="noopener"{{ end }}> <a href="{{ .URL }}" {{ with .Params.class }}class="{{ . }}"{{ end }} {{ if not .Page }}target="_blank" rel="noopener"{{ end }}>
{{- .Pre -}} {{- .Pre -}}
{{ with .Page }} {{ with .Page }}
{{ partial "docs/title" .Page }} {{ partial "docs/title-with-icon" .Page }}
{{ else }} {{ else }}
{{ .Name }} {{ .Name }}
{{ end }} {{ end }}

View File

@ -0,0 +1,9 @@
{{ $title := (partial "docs/title" .) }}
{{ $icon := "" }}
{{ if .Params.Icon }}
{{ $icon = printf "<img src=\"%s\" class=\"book-filetree-icon\" />" .Params.Icon }}
{{ end }}
{{ $out := printf "%s %s" $icon $title | safeHTML }}
{{ return $out }}

View File

@ -2,7 +2,7 @@
{{ range sort .Paginator.Pages }} {{ range sort .Paginator.Pages }}
<article class="markdown book-post"> <article class="markdown book-post">
<h2> <h2>
<a href="{{ .RelPermalink }}">{{ partial "docs/title.html" . }}</a> <a href="{{ .RelPermalink }}">{{ partial "docs/title-with-icon.html" . }}</a>
</h2> </h2>
{{ partial "docs/post-meta" . }} {{ partial "docs/post-meta" . }}
<div class="book-post-content"> <div class="book-post-content">