Add Lotusdocs theme
This commit is contained in:
30
themes/lotusdocs/layouts/shortcodes/alert.html
Normal file
30
themes/lotusdocs/layouts/shortcodes/alert.html
Normal file
@@ -0,0 +1,30 @@
|
||||
{{ $icon_array := dict
|
||||
"info" "info"
|
||||
"warning" "warning"
|
||||
"success" "check_circle"
|
||||
"danger" "report"
|
||||
"default" "notifications"
|
||||
"primary" "info"
|
||||
}}
|
||||
<div class="alert alert-{{ with .Get "context" }}{{.}}{{ else }}default{{ end }} d-flex" role="alert">
|
||||
<div class="flex-shrink-1 alert-icon">
|
||||
{{ with .Get "icon" }}
|
||||
{{ . }}
|
||||
{{ else }}
|
||||
<span class="material-icons size-20 me-2">
|
||||
{{ with .Get "context" }}{{ index $icon_array . }}{{ else }}{{ $icon_array.default }}{{ end }}
|
||||
</span>
|
||||
{{- end -}}
|
||||
</div>
|
||||
{{ with .Get "text" }}
|
||||
<div class="w-100">{{ . | $.Page.RenderString }}</div>
|
||||
{{ else }}
|
||||
{{ with .InnerDeindent }}
|
||||
<div class="w-100">
|
||||
{{ . }}
|
||||
</div>
|
||||
{{ else }}
|
||||
{{ errorf "No valid text variable or Inner content given"}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
</div>
|
||||
8
themes/lotusdocs/layouts/shortcodes/katex.html
Normal file
8
themes/lotusdocs/layouts/shortcodes/katex.html
Normal file
@@ -0,0 +1,8 @@
|
||||
{{- $inner := trim .Inner "\r\n" }}
|
||||
{{- if hasPrefix $inner "$$" }}
|
||||
<div class="equation leqno" >
|
||||
{{- $inner }}
|
||||
</div>
|
||||
{{- else }}
|
||||
{{- $inner }}
|
||||
{{- end }}
|
||||
1
themes/lotusdocs/layouts/shortcodes/markdownify.html
Normal file
1
themes/lotusdocs/layouts/shortcodes/markdownify.html
Normal file
@@ -0,0 +1 @@
|
||||
{{ .Inner | .Page.RenderString }}
|
||||
37
themes/lotusdocs/layouts/shortcodes/prism.html
Normal file
37
themes/lotusdocs/layouts/shortcodes/prism.html
Normal file
@@ -0,0 +1,37 @@
|
||||
{{ $inner := replaceRE "^\r?\n" "" .Inner | string }}
|
||||
{{ $innerRemoveLB := replaceRE "\r\n?|\n" "" .Inner | string }}
|
||||
{{ $ordinal := .Ordinal }}
|
||||
{{ $codeHash := sha1 (delimit (slice $innerRemoveLB $ordinal "prismshortcode") "") }}
|
||||
{{ $codeHashShort := substr $codeHash 0 7 }}
|
||||
{{ if len .Params | eq 0 }}
|
||||
<pre id="{{ $codeHashShort }}"><code>{{ $inner }}</code></pre>
|
||||
{{ else }}
|
||||
{{ if .IsNamedParams }}
|
||||
<div class="prism-shortcode {{- if .Get "line" }} data-line{{ end }}">
|
||||
<pre {{- if .Get "id" }} id="{{ .Get "id" }}"{{ else }} id="{{ $codeHashShort }}"{{ end }} class="
|
||||
{{- if .Get "lang" }}language-{{ .Get "lang" }}{{ end }}
|
||||
{{- if .Get "line-numbers" }} line-numbers{{ end }}
|
||||
{{- if .Get "linkable-line-numbers" }} linkable-line-numbers{{ end }}
|
||||
{{- if .Get "command-line" }} command-line{{ end }}"
|
||||
{{- /* file highlight plugin */ -}}
|
||||
{{- if .Get "src" }} data-src="{{ .Get "src" }}"{{ end }}
|
||||
{{- if .Get "src-range" }} data-range="{{ .Get "src-range" }}"{{ end }}
|
||||
{{- /* line highlight plugin */ -}}
|
||||
{{- if .Get "line" }} data-line="{{ .Get "line" }}"{{ end }}
|
||||
{{- if .Get "line-offset" }} data-line-offset="{{ .Get "line-offset" }}"{{ end }}
|
||||
{{- /* line number plugin */ -}}
|
||||
{{- if .Get "start" }} data-start="{{ .Get "start" }}"{{ end }}
|
||||
{{- /* command-line plugin */ -}}
|
||||
{{- if .Get "user" }} data-user="{{ .Get "user" }}"{{ end }}
|
||||
{{- if .Get "host" }} data-host="{{ .Get "host" }}"{{ end }}
|
||||
{{- if .Get "prompt" }} data-prompt="{{ .Get "prompt" }}"{{ end }}
|
||||
{{- if .Get "output" }} data-output="{{ .Get "output" }}"{{ end }}
|
||||
>{{- if .Get "src" }}{{ $inner }}{{ else }}<code {{ if .Get "lang" }}class="language-{{ .Get "lang" }}"{{ end }}
|
||||
>{{ $inner }}</code>{{ end }}</pre>
|
||||
</div>
|
||||
{{ else }}
|
||||
<pre id="{{ $codeHashShort }}" class="language-{{ .Get 0 }}">
|
||||
<code class="language-{{ .Get 0 }}">{{ $inner }}</code>
|
||||
</pre>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
11
themes/lotusdocs/layouts/shortcodes/tab.html
Normal file
11
themes/lotusdocs/layouts/shortcodes/tab.html
Normal file
@@ -0,0 +1,11 @@
|
||||
<!-- https://github.com/rvanhorn/hugo-dynamic-tabs -->
|
||||
{{ $tabName := .Get "tabName" }}
|
||||
{{ $tabID := delimit (shuffle (slice "a" "b" "c" "d" "e" "f")) "" }}
|
||||
{{ .Parent.Scratch.Add "tabName" (slice $tabName) }}
|
||||
{{ .Parent.Scratch.Add "tabID" (slice $tabID) }}
|
||||
|
||||
<div class="tab-pane fade{{ if eq .Ordinal 0 }} show active{{ end }}" id="{{ $tabID }}" role="tabpanel" aria-labelledby="nav-1">
|
||||
|
||||
{{ $.Inner }}
|
||||
|
||||
</div>
|
||||
8
themes/lotusdocs/layouts/shortcodes/table.html
Normal file
8
themes/lotusdocs/layouts/shortcodes/table.html
Normal file
@@ -0,0 +1,8 @@
|
||||
{{ $htmlTable := .Inner | .Page.RenderString }}
|
||||
{{ $class := .Get 0 }}
|
||||
{{ $old := "<table>" }}
|
||||
{{ $new := printf "<table class=\"table %s\">" $class }}
|
||||
{{ $htmlTable := replace $htmlTable $old $new }}
|
||||
{{ $htmlTable := replaceRE "align=\"([a-z]+)\"" "style=\"text-align: $1\"" $htmlTable}}
|
||||
|
||||
{{ $htmlTable | safeHTML }}
|
||||
25
themes/lotusdocs/layouts/shortcodes/tabs.html
Normal file
25
themes/lotusdocs/layouts/shortcodes/tabs.html
Normal file
@@ -0,0 +1,25 @@
|
||||
<!-- https://github.com/rvanhorn/hugo-dynamic-tabs -->
|
||||
<nav>
|
||||
<div class="nav nav-tabs" id="nav-tab" role="tablist">
|
||||
|
||||
{{ $tabTotal := .Get "tabTotal" }}
|
||||
{{ $tabRightAlign := .Get "tabRightAlign" }}
|
||||
{{ $tabName := .Scratch.Get "tabName" }}
|
||||
{{ $tabID := .Scratch.Get "tabID" }}
|
||||
|
||||
{{ range $i, $sequence := (seq $tabTotal) }}
|
||||
|
||||
<a class="nav-link {{ if eq $i 0 }} active{{ end }}{{ if in $tabRightAlign (add 1 $i) }} ms-auto {{ end }}"
|
||||
id="{{ (index $tabID $i) }}Tab" data-bs-toggle="tab" data-bs-target="#{{ (index $tabID $i) }}"
|
||||
type="button" role="tab" aria-controls="{{ (index $tabID $i) }}" aria-selected="true">{{ (replaceRE "(\\s)" " " (index $tabName $i)) }}</a>
|
||||
|
||||
{{ end }}
|
||||
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div class="tab-content" id="nav-tab-content">
|
||||
|
||||
{{ .Inner }}
|
||||
|
||||
</div>
|
||||
Reference in New Issue
Block a user