diff options
Diffstat (limited to '')
| -rw-r--r-- | themes/hugo-book/layouts/shortcodes/button.html | 12 | ||||
| -rw-r--r-- | themes/hugo-book/layouts/shortcodes/columns.html | 9 | ||||
| -rw-r--r-- | themes/hugo-book/layouts/shortcodes/details.html | 7 | ||||
| -rw-r--r-- | themes/hugo-book/layouts/shortcodes/hint.html | 3 | ||||
| -rw-r--r-- | themes/hugo-book/layouts/shortcodes/html.html | 1 | ||||
| -rw-r--r-- | themes/hugo-book/layouts/shortcodes/i18n.html | 2 | ||||
| -rw-r--r-- | themes/hugo-book/layouts/shortcodes/katex.html | 13 | ||||
| -rw-r--r-- | themes/hugo-book/layouts/shortcodes/mermaid.html | 12 | ||||
| -rw-r--r-- | themes/hugo-book/layouts/shortcodes/section.html | 13 | ||||
| -rw-r--r-- | themes/hugo-book/layouts/shortcodes/tab.html | 9 | ||||
| -rw-r--r-- | themes/hugo-book/layouts/shortcodes/tabs.html | 3 |
11 files changed, 84 insertions, 0 deletions
diff --git a/themes/hugo-book/layouts/shortcodes/button.html b/themes/hugo-book/layouts/shortcodes/button.html new file mode 100644 index 0000000..efae3e0 --- /dev/null +++ b/themes/hugo-book/layouts/shortcodes/button.html @@ -0,0 +1,12 @@ +{{- $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 new file mode 100644 index 0000000..bb01da9 --- /dev/null +++ b/themes/hugo-book/layouts/shortcodes/columns.html @@ -0,0 +1,9 @@ +{{- $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/details.html b/themes/hugo-book/layouts/shortcodes/details.html new file mode 100644 index 0000000..a80209b --- /dev/null +++ b/themes/hugo-book/layouts/shortcodes/details.html @@ -0,0 +1,7 @@ +<details {{ if or (.Get "open") (in .Params "open") }}open{{ end }}> + {{- $summary := cond .IsNamedParams (.Get "title") (.Get 0) -}} + <summary>{{ $summary }}</summary> + <div class="markdown-inner"> + {{ .InnerDeindent | safeHTML }} + </div> +</details> diff --git a/themes/hugo-book/layouts/shortcodes/hint.html b/themes/hugo-book/layouts/shortcodes/hint.html new file mode 100644 index 0000000..95e4f83 --- /dev/null +++ b/themes/hugo-book/layouts/shortcodes/hint.html @@ -0,0 +1,3 @@ +<blockquote class="book-hint {{ .Get 0 }}"> + {{ .Inner | safeHTML }} +</blockquote> diff --git a/themes/hugo-book/layouts/shortcodes/html.html b/themes/hugo-book/layouts/shortcodes/html.html new file mode 100644 index 0000000..b447d45 --- /dev/null +++ b/themes/hugo-book/layouts/shortcodes/html.html @@ -0,0 +1 @@ +{{- .Inner | safeHTML -}}
\ No newline at end of file diff --git a/themes/hugo-book/layouts/shortcodes/i18n.html b/themes/hugo-book/layouts/shortcodes/i18n.html new file mode 100644 index 0000000..b65f70a --- /dev/null +++ b/themes/hugo-book/layouts/shortcodes/i18n.html @@ -0,0 +1,2 @@ +{{- $content := .Get 0 -}} +{{- default $content (i18n $content) -}}
\ 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..4eafc35 --- /dev/null +++ b/themes/hugo-book/layouts/shortcodes/katex.html @@ -0,0 +1,13 @@ +{{- 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/shortcodes/mermaid.html b/themes/hugo-book/layouts/shortcodes/mermaid.html new file mode 100644 index 0000000..07a3bfc --- /dev/null +++ b/themes/hugo-book/layouts/shortcodes/mermaid.html @@ -0,0 +1,12 @@ +{{ if not (.Page.Scratch.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 }} +{{ end }} + +<pre class="mermaid{{ with .Get "class" }} {{ . }}{{ end }}"> + {{- .Inner -}} +</pre> diff --git a/themes/hugo-book/layouts/shortcodes/section.html b/themes/hugo-book/layouts/shortcodes/section.html new file mode 100644 index 0000000..b700ec4 --- /dev/null +++ b/themes/hugo-book/layouts/shortcodes/section.html @@ -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"> + {{ default .Summary .Description }} + </dd> + {{ end -}} +{{ end }} +</dl> diff --git a/themes/hugo-book/layouts/shortcodes/tab.html b/themes/hugo-book/layouts/shortcodes/tab.html new file mode 100644 index 0000000..b5a753d --- /dev/null +++ b/themes/hugo-book/layouts/shortcodes/tab.html @@ -0,0 +1,9 @@ +{{- $group := printf "tabs-%v" (default .Parent.Ordinal (.Parent.Get 0)) -}} +{{- $tab := printf "%s-%d" $group .Ordinal }} +<input type="radio" class="toggle" name="{{ $group }}" id="{{ $tab }}" {{ if not .Ordinal }}checked="checked"{{ end }} /> +<label for="{{ $tab }}"> + {{- .Get 0 -}} +</label> +<div class="book-tabs-content markdown-inner"> + {{- .Inner -}} +</div> diff --git a/themes/hugo-book/layouts/shortcodes/tabs.html b/themes/hugo-book/layouts/shortcodes/tabs.html new file mode 100644 index 0000000..fecbbeb --- /dev/null +++ b/themes/hugo-book/layouts/shortcodes/tabs.html @@ -0,0 +1,3 @@ +<div class="book-tabs"> +{{ .Inner }} +</div> |
