huge upgrade to theme and pagefind search bar.
This commit is contained in:
24
themes/hugo-book.backup/layouts/_shortcodes/asciinema.html
Normal file
24
themes/hugo-book.backup/layouts/_shortcodes/asciinema.html
Normal file
@@ -0,0 +1,24 @@
|
||||
{{- if not (.Page.Store.Get "asciinema") -}}
|
||||
{{- /* Include asciinema player only first time */ -}}
|
||||
<link rel="stylesheet" href="{{ "asciinema/asciinema-player.css" | relURL }}" />
|
||||
{{- /* remove whitespaces */ -}}
|
||||
<script defer src="{{ "asciinema/asciinema-player.min.js" | relURL }}"></script>
|
||||
{{- /* remove whitespaces */ -}}
|
||||
<script defer src="{{ "asciinema/asciinema-auto.js" | relURL }}"></script>
|
||||
{{- .Page.Store.Set "asciinema" true -}}
|
||||
{{- end -}}
|
||||
{{- $href := (partial "docs/links/portable-image" (dict "Page" .Page "Destination" (.Get "cast"))) -}}
|
||||
{{- .Store.Set "asciinema" .Params -}}
|
||||
{{- .Store.DeleteInMap "asciinema" "cast" -}}
|
||||
{{- $attributes := partial "docs/text/mapper" (dict
|
||||
"attributes" (dict)
|
||||
"set" (dict
|
||||
"id" (printf "asciinema-%d" .Ordinal)
|
||||
"x-data-cast" $href
|
||||
"x-data-opts" (.Store.Get "asciinema" | jsonify)
|
||||
)
|
||||
"merge" (dict
|
||||
"class" (slice "asciinema" "book-asciinema")
|
||||
)
|
||||
) -}}
|
||||
<div {{ partial "docs/html-attrs" $attributes | safeHTMLAttr }}></div>
|
||||
12
themes/hugo-book.backup/layouts/_shortcodes/badge.html
Normal file
12
themes/hugo-book.backup/layouts/_shortcodes/badge.html
Normal file
@@ -0,0 +1,12 @@
|
||||
{{- $style := or (.Get "style") (.Get 0) "default" -}}
|
||||
{{- $attributes := partial "docs/text/mapper" (dict
|
||||
"attributes" (cond .IsNamedParams .Params dict)
|
||||
"merge" (dict
|
||||
"class" (slice "book-badge" $style)
|
||||
)
|
||||
) -}}
|
||||
<span {{ partial "docs/html-attrs" $attributes | safeHTMLAttr }}>
|
||||
{{- with or (.Get "title") (.Get 1) -}}<span class="book-badge-title">{{ . | plainify }}</span>{{- end -}}
|
||||
{{- with or (.Get "value") (.Get 2) -}}<span class="book-badge-value">{{ . | plainify }}</span>{{- end -}}
|
||||
</span>
|
||||
{{- /* remove whitespaces */ -}}
|
||||
18
themes/hugo-book.backup/layouts/_shortcodes/button.html
Normal file
18
themes/hugo-book.backup/layouts/_shortcodes/button.html
Normal file
@@ -0,0 +1,18 @@
|
||||
{{- $href := partial "docs/links/portable-link" (dict "Page" .Page "Destination" (.Get "href")) -}}
|
||||
{{- $isRemote := (urls.Parse $href).IsAbs -}}
|
||||
{{- $attributes := partial "docs/text/mapper" (dict
|
||||
"attributes" (cond .IsNamedParams .Params dict)
|
||||
"set" (dict
|
||||
"href" $href
|
||||
"target" "_blank"
|
||||
"rel" "noopener"
|
||||
)
|
||||
"merge" (dict
|
||||
"class" "book-btn"
|
||||
)
|
||||
"delete" (cond $isRemote (slice) (slice "target" "rel"))
|
||||
) -}}
|
||||
<a {{ partial "docs/html-attrs" $attributes | safeHTMLAttr }}>
|
||||
{{- .InnerDeindent -}}
|
||||
</a>
|
||||
{{- /* remove whitespaces */ -}}
|
||||
20
themes/hugo-book.backup/layouts/_shortcodes/card.html
Normal file
20
themes/hugo-book.backup/layouts/_shortcodes/card.html
Normal file
@@ -0,0 +1,20 @@
|
||||
{{- with .Get "href" -}}
|
||||
{{- $destination := partial "docs/links/portable-link" (dict "Page" $.Page "Destination" .) -}}
|
||||
<div class="book-card{{ with $.Get "class" }} {{ . }}{{ end }}"><a href="{{ $destination | safeURL }}">
|
||||
{{- template "book-card-content" $ -}}
|
||||
</a></div>
|
||||
{{- 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 }}" alt="{{ partial "docs/text/i18n" ($.Get "alt" ) }}" />
|
||||
{{- end -}}
|
||||
<div class="markdown-inner">
|
||||
{{ with .Inner }}{{ . }}{{ end -}}
|
||||
</div>
|
||||
{{- end -}}
|
||||
33
themes/hugo-book.backup/layouts/_shortcodes/columns.html
Normal file
33
themes/hugo-book.backup/layouts/_shortcodes/columns.html
Normal file
@@ -0,0 +1,33 @@
|
||||
{{- $ratio := (split (.Get "ratio") ":") -}}
|
||||
{{- if strings.Contains .InnerDeindent "<--->" -}}
|
||||
{{- warnf "Columns shortcode seprator '<--->' is deprecated, use markdown list instead." -}}
|
||||
{{- $attributes := partial "docs/text/mapper" (dict
|
||||
"attributes" (cond .IsNamedParams .Params dict)
|
||||
"merge" (dict
|
||||
"class" (slice "book-columns" "flex" "flex-wrap")
|
||||
)
|
||||
) -}}
|
||||
<div {{ partial "docs/html-attrs" $attributes | safeHTMLAttr }}>
|
||||
{{- 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 -}}
|
||||
{{- $attributes := partial "docs/text/mapper" (dict
|
||||
"attributes" (cond .IsNamedParams .Params dict)
|
||||
"merge" (dict
|
||||
"class" (slice "book-columns")
|
||||
)
|
||||
) -}}
|
||||
<div {{ partial "docs/html-attrs" $attributes | safeHTMLAttr }}>
|
||||
{{ .Inner | safeHTML -}}
|
||||
</div>
|
||||
{{- end -}}
|
||||
14
themes/hugo-book.backup/layouts/_shortcodes/details.html
Normal file
14
themes/hugo-book.backup/layouts/_shortcodes/details.html
Normal file
@@ -0,0 +1,14 @@
|
||||
{{- $attributes := partial "docs/text/mapper" (dict
|
||||
"attributes" (cond .IsNamedParams .Params dict)
|
||||
"merge" (dict
|
||||
"open" (cond .IsNamedParams (.Get "open") (in .Params "open"))
|
||||
)
|
||||
) -}}
|
||||
<details {{ partial "docs/html-attrs" $attributes | safeHTMLAttr }}>
|
||||
{{- $summary := cond .IsNamedParams (.Get "title") (.Get 0) -}}
|
||||
<summary>{{ $summary | .Page.RenderString }}</summary>
|
||||
{{- /* remove whitespaces */ -}}
|
||||
<div class="markdown-inner">
|
||||
{{ .Inner | safeHTML -}}
|
||||
</div></details>
|
||||
{{- /* remove whitespaces */ -}}
|
||||
11
themes/hugo-book.backup/layouts/_shortcodes/hint.html
Normal file
11
themes/hugo-book.backup/layouts/_shortcodes/hint.html
Normal file
@@ -0,0 +1,11 @@
|
||||
{{- warnf "Hint shortcode is deprecated, use markdown alerts format: '> [!NOTE] ...'" -}}
|
||||
{{- $attributes := partial "docs/text/mapper" (dict
|
||||
"attributes" (cond .IsNamedParams .Params dict)
|
||||
"merge" (dict
|
||||
"class" (slice "book-hint" (or (.Get 0) "default"))
|
||||
)
|
||||
) -}}
|
||||
<blockquote {{ partial "docs/html-attrs" $attributes | safeHTMLAttr }}>
|
||||
{{ .Inner | safeHTML -}}
|
||||
</blockquote>
|
||||
{{- /* remove whitespaces */ -}}
|
||||
1
themes/hugo-book.backup/layouts/_shortcodes/html.html
Normal file
1
themes/hugo-book.backup/layouts/_shortcodes/html.html
Normal file
@@ -0,0 +1 @@
|
||||
{{- .Inner | safeHTML -}}
|
||||
1
themes/hugo-book.backup/layouts/_shortcodes/i18n.html
Normal file
1
themes/hugo-book.backup/layouts/_shortcodes/i18n.html
Normal file
@@ -0,0 +1 @@
|
||||
{{- partial "docs/text/i18n" (.Get 0) -}}
|
||||
10
themes/hugo-book.backup/layouts/_shortcodes/image.html
Normal file
10
themes/hugo-book.backup/layouts/_shortcodes/image.html
Normal file
@@ -0,0 +1,10 @@
|
||||
{{- $destination := partial "docs/links/portable-image" (dict "Page" .Page "Destination" (.Get "src")) -}}
|
||||
{{- $attributes := partial "docs/text/mapper" (dict
|
||||
"attributes" (cond .IsNamedParams .Params dict)
|
||||
"keep" (slice "id" "class" "tabindex" "alt" "title" "loading")
|
||||
) -}}
|
||||
<label class="book-image" for="book-image-toggle-{{ .Ordinal }}">
|
||||
<input class="hidden toggle" type="checkbox" id="book-image-toggle-{{ .Ordinal }}" />
|
||||
<img src="{{ $destination | safeURL }}" {{ partial "docs/html-attrs" $attributes | safeHTMLAttr }} />
|
||||
</label>
|
||||
{{- /* remove whitespaces */ -}}
|
||||
23
themes/hugo-book.backup/layouts/_shortcodes/katex.html
Normal file
23
themes/hugo-book.backup/layouts/_shortcodes/katex.html
Normal file
@@ -0,0 +1,23 @@
|
||||
{{- $attributes := partial "docs/text/mapper" (dict
|
||||
"attributes" (cond .IsNamedParams .Params dict)
|
||||
"merge" (dict
|
||||
"class" "book-katex"
|
||||
)
|
||||
) -}}
|
||||
{{- if .Inner -}}
|
||||
{{- if .Get "display" -}}
|
||||
<div {{ partial "docs/html-attrs" $attributes | safeHTMLAttr }}>{{ printf "\\[ %s \\]" .Inner }}</div>
|
||||
{{- else -}}
|
||||
<span {{ partial "docs/html-attrs" $attributes | safeHTMLAttr }}>{{ printf "\\( %s \\)" .Inner }}</span>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- if not (.Page.Store.Get "katex") -}}
|
||||
{{- /* Include katex only first time */ -}}
|
||||
<link rel="stylesheet" href="{{ "katex/katex.min.css" | relURL }}" />
|
||||
{{- /* remove whitespaces */ -}}
|
||||
<script defer src="{{ "katex/katex.min.js" | relURL }}"></script>
|
||||
{{- with resources.Get "katex.json" | minify -}}
|
||||
<script defer src="{{ "katex/auto-render.min.js" | relURL }}" onload="renderMathInElement(document.body, {{ .Content | safeJS }});"></script>
|
||||
{{- end -}}
|
||||
{{- .Page.Store.Set "katex" true -}}
|
||||
{{- end -}}
|
||||
16
themes/hugo-book.backup/layouts/_shortcodes/mermaid.html
Normal file
16
themes/hugo-book.backup/layouts/_shortcodes/mermaid.html
Normal file
@@ -0,0 +1,16 @@
|
||||
{{- $attributes := partial "docs/text/mapper" (dict
|
||||
"attributes" (cond .IsNamedParams .Params dict)
|
||||
"merge" (dict
|
||||
"class" "mermaid"
|
||||
)
|
||||
) -}}
|
||||
<pre {{ partial "docs/html-attrs" $attributes | safeHTMLAttr }}>
|
||||
{{- .Inner | htmlEscape | safeHTML -}}
|
||||
</pre>
|
||||
{{- if not (.Page.Store.Get "mermaid") -}}
|
||||
{{- /* Include mermaid only first time */ -}}
|
||||
{{- with resources.Get "mermaid.json" | minify -}}
|
||||
<script src="{{ "mermaid.min.js" | relURL }}" onload="mermaid.initialize({{ .Content | safeJS }})"></script>
|
||||
{{- end -}}
|
||||
{{- .Page.Store.Set "mermaid" true -}}
|
||||
{{- end -}}
|
||||
13
themes/hugo-book.backup/layouts/_shortcodes/section.html
Normal file
13
themes/hugo-book.backup/layouts/_shortcodes/section.html
Normal file
@@ -0,0 +1,13 @@
|
||||
{{- warnf "Section shortcode is deprecated and will be removed" -}}
|
||||
<dl>
|
||||
{{ range .Page.Pages }}
|
||||
<dt>
|
||||
<a href="{{ .RelPermalink }}">{{ partial "docs/title" . }}</a>
|
||||
</dt>
|
||||
{{ if (in $.Params "summary") -}}
|
||||
<dd class="markdown-inner">
|
||||
{{- or .Description .Summary site.Params.description | plainify | htmlUnescape }}
|
||||
</dd>
|
||||
{{ end -}}
|
||||
{{ end }}
|
||||
</dl>
|
||||
10
themes/hugo-book.backup/layouts/_shortcodes/steps.html
Normal file
10
themes/hugo-book.backup/layouts/_shortcodes/steps.html
Normal file
@@ -0,0 +1,10 @@
|
||||
{{- $attributes := partial "docs/text/mapper" (dict
|
||||
"attributes" (cond .IsNamedParams .Params dict)
|
||||
"merge" (dict
|
||||
"class" "book-steps"
|
||||
)
|
||||
) -}}
|
||||
<div {{ partial "docs/html-attrs" $attributes | safeHTMLAttr }}>
|
||||
{{ .Inner -}}
|
||||
</div>
|
||||
{{- /* remove whitespaces */ -}}
|
||||
12
themes/hugo-book.backup/layouts/_shortcodes/tab.html
Normal file
12
themes/hugo-book.backup/layouts/_shortcodes/tab.html
Normal file
@@ -0,0 +1,12 @@
|
||||
{{- $group := printf "tabs-%v" .Parent.Ordinal -}}
|
||||
{{- $tab := printf "%s-%d" $group .Ordinal -}}
|
||||
<input type="radio" class="toggle" name="{{ $group }}" id="{{ $tab }}" {{ if not .Ordinal }}checked="checked"{{ end }} />
|
||||
{{- /* remove whitespaces */ -}}
|
||||
<label for="{{ $tab }}">
|
||||
{{- .Get 0 -}}
|
||||
</label>
|
||||
{{- /* remove whitespaces */ -}}
|
||||
<div class="book-tabs-content markdown-inner">
|
||||
{{ .Inner -}}
|
||||
</div>
|
||||
{{- /* remove whitespaces */ -}}
|
||||
10
themes/hugo-book.backup/layouts/_shortcodes/tabs.html
Normal file
10
themes/hugo-book.backup/layouts/_shortcodes/tabs.html
Normal file
@@ -0,0 +1,10 @@
|
||||
{{- $attributes := partial "docs/text/mapper" (dict
|
||||
"attributes" (cond .IsNamedParams .Params dict)
|
||||
"merge" (dict
|
||||
"class" "book-tabs"
|
||||
)
|
||||
) -}}
|
||||
<div {{ partial "docs/html-attrs" $attributes | safeHTMLAttr }}>
|
||||
{{- .Inner -}}
|
||||
</div>
|
||||
{{- /* remove whitespaces */ -}}
|
||||
Reference in New Issue
Block a user