forked from TrueCloudLab/distribution
docs: add hugo site
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
This commit is contained in:
parent
f7b3869062
commit
e2ae76f1f2
291 changed files with 2833 additions and 2 deletions
29
docs/themes/hugo-geekdoc/layouts/shortcodes/button.html
vendored
Normal file
29
docs/themes/hugo-geekdoc/layouts/shortcodes/button.html
vendored
Normal file
|
@ -0,0 +1,29 @@
|
|||
{{- $ref := "" }}
|
||||
{{- $class := "" }}
|
||||
{{- $size := default "regular" (.Get "size" | lower) }}
|
||||
|
||||
{{- if not (in (slice "regular" "large") $size) }}
|
||||
{{- $size = "regular" }}
|
||||
{{- end }}
|
||||
|
||||
{{- with .Get "href" }}
|
||||
{{- $ref = . }}
|
||||
{{- end }}
|
||||
|
||||
{{- with .Get "relref" }}
|
||||
{{- $ref = relref $ . }}
|
||||
{{- end }}
|
||||
|
||||
{{- with .Get "class" }}
|
||||
{{- $class = . }}
|
||||
{{- end }}
|
||||
|
||||
|
||||
<span class="gdoc-button gdoc-button--{{ $size }}{{ with $class }}{{ printf " %s" . }}{{ end }}">
|
||||
<a
|
||||
class="gdoc-button__link"
|
||||
{{- with $ref }}{{ printf " href=\"%s\"" . | safeHTMLAttr }}{{ end }}
|
||||
>
|
||||
{{ $.Inner }}
|
||||
</a>
|
||||
</span>
|
14
docs/themes/hugo-geekdoc/layouts/shortcodes/columns.html
vendored
Normal file
14
docs/themes/hugo-geekdoc/layouts/shortcodes/columns.html
vendored
Normal file
|
@ -0,0 +1,14 @@
|
|||
{{- $size := default "regular" (.Get "size" | lower) }}
|
||||
|
||||
{{- if not (in (slice "regular" "large" "small") $size) }}
|
||||
{{- $size = "regular" }}
|
||||
{{- end }}
|
||||
|
||||
|
||||
<div class="gdoc-columns gdoc-columns--{{ $size }} flex flex-gap flex-mobile-column">
|
||||
{{- range split .Inner "<--->" }}
|
||||
<div class="gdoc-columns__content gdoc-markdown--nested flex-even">
|
||||
{{ . | $.Page.RenderString -}}
|
||||
</div>
|
||||
{{- end }}
|
||||
</div>
|
11
docs/themes/hugo-geekdoc/layouts/shortcodes/expand.html
vendored
Normal file
11
docs/themes/hugo-geekdoc/layouts/shortcodes/expand.html
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
{{ $id := substr (sha1 .Inner) 0 8 }}
|
||||
<div class="gdoc-expand">
|
||||
<label class="gdoc-expand__head flex justify-between" for="{{ $id }}-{{ .Ordinal }}">
|
||||
<span>{{ default "Expand" (.Get 0) }}</span>
|
||||
<span>{{ default "↕" (.Get 1) }}</span>
|
||||
</label>
|
||||
<input id="{{ $id }}-{{ .Ordinal }}" type="checkbox" class="gdoc-expand__control hidden" />
|
||||
<div class="gdoc-markdown--nested gdoc-expand__content">
|
||||
{{ .Inner | $.Page.RenderString }}
|
||||
</div>
|
||||
</div>
|
16
docs/themes/hugo-geekdoc/layouts/shortcodes/hint.html
vendored
Normal file
16
docs/themes/hugo-geekdoc/layouts/shortcodes/hint.html
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
{{ $type := default "note" (.Get "type") }}
|
||||
{{ $icon := .Get "icon" }}
|
||||
{{ $title := default ($type | title) (.Get "title") }}
|
||||
|
||||
|
||||
<blockquote class="gdoc-hint {{ $type | lower }}">
|
||||
<div class="gdoc-hint__title flex align-center">
|
||||
{{- with $icon -}}
|
||||
<svg class="gdoc-icon {{ . }}"><use xlink:href="#{{ . }}"></use></svg>
|
||||
<span>{{ $title }}</span>
|
||||
{{- else -}}
|
||||
<i class="fa {{ $type | lower }}" title="{{ $title }}"></i>
|
||||
{{- end -}}
|
||||
</div>
|
||||
<div class="gdoc-hint__text">{{ .Inner | $.Page.RenderString }}</div>
|
||||
</blockquote>
|
5
docs/themes/hugo-geekdoc/layouts/shortcodes/icon.html
vendored
Normal file
5
docs/themes/hugo-geekdoc/layouts/shortcodes/icon.html
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
{{ $id := .Get 0 }}
|
||||
|
||||
{{- with $id -}}
|
||||
<svg class="gdoc-icon {{ . }}"><use xlink:href="#{{ . }}"></use></svg>
|
||||
{{- end -}}
|
71
docs/themes/hugo-geekdoc/layouts/shortcodes/img.html
vendored
Normal file
71
docs/themes/hugo-geekdoc/layouts/shortcodes/img.html
vendored
Normal file
|
@ -0,0 +1,71 @@
|
|||
{{- $source := ($.Page.Resources.ByType "image").GetMatch (printf "%s" (.Get "name")) }}
|
||||
{{- $customAlt := .Get "alt" }}
|
||||
{{- $customSize := .Get "size" | lower }}
|
||||
{{- $lazyLoad := default (default true $.Site.Params.geekdocImageLazyLoading) (.Get "lazy") }}
|
||||
{{- $data := newScratch }}
|
||||
|
||||
{{- with $source }}
|
||||
{{- $caption := default .Title $customAlt }}
|
||||
{{- $isSVG := (eq .MediaType.SubType "svg") }}
|
||||
|
||||
{{- $origin := .Permalink }}
|
||||
{{- if $isSVG }}
|
||||
{{- $data.SetInMap "size" "profile" "180" }}
|
||||
{{- $data.SetInMap "size" "tiny" "320" }}
|
||||
{{- $data.SetInMap "size" "small" "600" }}
|
||||
{{- $data.SetInMap "size" "medium" "1200" }}
|
||||
{{- $data.SetInMap "size" "large" "1800" }}
|
||||
{{- else }}
|
||||
{{- $data.SetInMap "size" "profile" (.Fill "180x180 Center").Permalink }}
|
||||
{{- $data.SetInMap "size" "tiny" (.Resize "320x").Permalink }}
|
||||
{{- $data.SetInMap "size" "small" (.Resize "600x").Permalink }}
|
||||
{{- $data.SetInMap "size" "medium" (.Resize "1200x").Permalink }}
|
||||
{{- $data.SetInMap "size" "large" (.Resize "1800x").Permalink }}
|
||||
{{- end }}
|
||||
|
||||
|
||||
<div class="flex justify-center">
|
||||
<figure
|
||||
class="gdoc-markdown__figure
|
||||
{{- if eq $customSize "profile" }}{{ print " gdoc-post__figure--round" }}{{ end }}"
|
||||
>
|
||||
<a class="gdoc-markdown__link--raw" href="{{ .Permalink }}">
|
||||
<picture>
|
||||
{{- $size := $data.Get "size" }}
|
||||
{{- if not $isSVG }}
|
||||
<source
|
||||
{{- with $customSize }}
|
||||
srcset="{{ index $size $customSize }}"
|
||||
{{- else }}
|
||||
srcset="{{ $size.small }} 600w, {{ $size.medium }} 1200w" sizes="100vw"
|
||||
{{- end }}
|
||||
/>
|
||||
{{- end }}
|
||||
<img
|
||||
{{- if $isSVG }}
|
||||
src="{{ $origin }}" width="{{ index $size (default "medium" $customSize) }}"
|
||||
{{- else }}
|
||||
{{- if $lazyLoad }}{{ print " loading=\"lazy\"" | safeHTMLAttr }}{{- end }}
|
||||
{{- if eq $customSize "origin" }}
|
||||
src="{{ $origin }}"
|
||||
{{- else }}
|
||||
src="{{ $size.large }}"
|
||||
{{- end }}
|
||||
alt="{{ $caption }}"
|
||||
{{- end }}
|
||||
/>
|
||||
</picture>
|
||||
</a>
|
||||
{{- if not (eq $customSize "profile") }}
|
||||
{{- with $caption }}
|
||||
<figcaption>
|
||||
{{ . }}
|
||||
{{- with $source.Params.credits }}
|
||||
{{ printf " (%s)" . | $.Page.RenderString }}
|
||||
{{- end }}
|
||||
</figcaption>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
</figure>
|
||||
</div>
|
||||
{{- end }}
|
18
docs/themes/hugo-geekdoc/layouts/shortcodes/include.html
vendored
Normal file
18
docs/themes/hugo-geekdoc/layouts/shortcodes/include.html
vendored
Normal file
|
@ -0,0 +1,18 @@
|
|||
{{ $file := .Get "file" }}
|
||||
{{ $page := .Site.GetPage $file }}
|
||||
{{ $type := .Get "type" }}
|
||||
{{ $language := .Get "language" }}
|
||||
{{ $options :=.Get "options" }}
|
||||
|
||||
|
||||
<div class="gdoc-include">
|
||||
{{- if (.Get "language") -}}
|
||||
{{- highlight ($file | readFile) $language (default "linenos=table" $options) -}}
|
||||
{{- else if eq $type "html" -}}
|
||||
{{- $file | readFile | safeHTML -}}
|
||||
{{- else if eq $type "page" -}}
|
||||
{{- with $page }}{{ .Content }}{{ end -}}
|
||||
{{- else -}}
|
||||
{{- $file | readFile | $.Page.RenderString -}}
|
||||
{{- end -}}
|
||||
</div>
|
18
docs/themes/hugo-geekdoc/layouts/shortcodes/katex.html
vendored
Normal file
18
docs/themes/hugo-geekdoc/layouts/shortcodes/katex.html
vendored
Normal file
|
@ -0,0 +1,18 @@
|
|||
<!-- prettier-ignore-start -->
|
||||
{{ if not (.Page.Scratch.Get "katex") }}
|
||||
<!-- Include katex only first time -->
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="{{ index (index .Site.Data.assets "katex.css") "src" | relURL }}"
|
||||
/>
|
||||
<script defer src="{{ index (index .Site.Data.assets "katex.js") "src" | relURL }}"></script>
|
||||
{{ .Page.Scratch.Set "katex" true }}
|
||||
{{ end }}
|
||||
<!-- prettier-ignore-end -->
|
||||
|
||||
<span class="gdoc-katex {{ with .Get "class" }}{{ . }}{{ end }}">
|
||||
{{ cond (in .Params "display") "\\[" "\\(" -}}
|
||||
{{- trim .Inner "\n" -}}
|
||||
{{- cond (in .Params "display") "\\]" "\\)" -}}
|
||||
</span>
|
||||
{{- /* Drop trailing newlines */ -}}
|
11
docs/themes/hugo-geekdoc/layouts/shortcodes/mermaid.html
vendored
Normal file
11
docs/themes/hugo-geekdoc/layouts/shortcodes/mermaid.html
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<!-- prettier-ignore-start -->
|
||||
{{ if not (.Page.Scratch.Get "mermaid") }}
|
||||
<!-- Include mermaid only first time -->
|
||||
<script defer src="{{ index (index .Site.Data.assets "mermaid.js") "src" | relURL }}"></script>
|
||||
{{ .Page.Scratch.Set "mermaid" true }}
|
||||
{{ end }}
|
||||
<!-- prettier-ignore-end -->
|
||||
|
||||
<pre class="gdoc-mermaid mermaid{{ with .Get "class" }}{{ printf " %s" . }}{{ end }}">
|
||||
{{- .Inner -}}
|
||||
</pre>
|
23
docs/themes/hugo-geekdoc/layouts/shortcodes/progress.html
vendored
Normal file
23
docs/themes/hugo-geekdoc/layouts/shortcodes/progress.html
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
{{- $value := default 0 (.Get "value") -}}
|
||||
{{- $title := .Get "title" -}}
|
||||
{{- $icon := .Get "icon" -}}
|
||||
|
||||
|
||||
<div class="gdoc-progress">
|
||||
<div class="gdoc-progress__label flex justify-between">
|
||||
<div class="gdoc-progress__label--name flex align-center">
|
||||
{{ with $icon -}}
|
||||
<svg class="gdoc-icon {{ . }}"><use xlink:href="#{{ . }}"></use></svg>
|
||||
{{- end }}
|
||||
{{ with $title }}<span>{{ . }}</span>{{ end }}
|
||||
</div>
|
||||
<div>{{ $value }}%</div>
|
||||
</div>
|
||||
<div class="gdoc-progress__wrap">
|
||||
<div
|
||||
class="gdoc-progress__bar"
|
||||
data-percent="{{ $value }}"
|
||||
style="width: {{ $value }}%;"
|
||||
></div>
|
||||
</div>
|
||||
</div>
|
60
docs/themes/hugo-geekdoc/layouts/shortcodes/propertylist.html
vendored
Normal file
60
docs/themes/hugo-geekdoc/layouts/shortcodes/propertylist.html
vendored
Normal file
|
@ -0,0 +1,60 @@
|
|||
{{- $name := .Get "name" -}}
|
||||
{{- $sort := .Get "sort" -}}
|
||||
{{- $order := default "asc" (.Get "order") -}}
|
||||
{{- $showAnchor := (and (default true .Page.Params.geekdocAnchor) (default true .Page.Site.Params.geekdocAnchor)) -}}
|
||||
|
||||
{{- if .Site.Data.properties }}
|
||||
<dl class="gdoc-props">
|
||||
{{- with (index .Site.Data.properties (split $name ".")) }}
|
||||
{{- $properties := .properties }}
|
||||
{{- with $sort }}
|
||||
{{- $properties = (sort $properties . $order) }}
|
||||
{{- end }}
|
||||
{{- range $properties }}
|
||||
<dt class="flex flex-wrap align-center gdoc-props__meta"{{ if $showAnchor }} id="{{ anchorize .name }}"{{ end }}>
|
||||
<span class="gdoc-props__title">{{ .name }}</span>
|
||||
{{- if .required }}
|
||||
<span class="gdoc-props__tag warning">{{ i18n "propertylist_required" | lower }}</span>
|
||||
{{- else }}
|
||||
<span class="gdoc-props__tag tip">{{ i18n "propertylist_optional" | lower }}</span>
|
||||
{{- end }}
|
||||
{{- with .type }}
|
||||
<span class="gdoc-props__tag note">{{ . }}</span>
|
||||
{{- end }}
|
||||
|
||||
{{- with .tags }}
|
||||
{{- $tags := . }}
|
||||
{{- if reflect.IsMap $tags }}
|
||||
{{- $tags = (index $tags $.Site.Language.Lang) }}
|
||||
{{- end }}
|
||||
{{- range $tags }}
|
||||
<span class="gdoc-props__tag">{{ . }}</span>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if $showAnchor }}
|
||||
<a data-clipboard-text="{{ .Page.Permalink }}#{{ anchorize .name | safeHTML }}" class="gdoc-page__anchor clip flex align-center" title="{{ i18n "title_anchor_prefix" }} {{ .name | safeHTML }}" aria-label="{{ i18n "title_anchor_prefix" }} {{ .name | safeHTML }}" href="#{{ anchorize .name | safeHTML }}">
|
||||
<svg class="gdoc-icon gdoc_link"><use xlink:href="#gdoc_link"></use></svg>
|
||||
</a>
|
||||
{{- end }}
|
||||
</dt>
|
||||
<dd>
|
||||
<div class="gdoc-props__description">
|
||||
{{- with .description }}
|
||||
{{- $desc := . }}
|
||||
{{- if reflect.IsMap $desc }}
|
||||
{{- $desc = (index $desc $.Site.Language.Lang) }}
|
||||
{{- end }}
|
||||
{{ $desc | $.Page.RenderString }}
|
||||
{{- end }}
|
||||
</div>
|
||||
<div class="gdoc-props__default">
|
||||
{{- with default "none" (.defaultValue | string) }}
|
||||
<span>{{ i18n "propertylist_default" | title }}:</span>
|
||||
<span>{{ . }}</span>
|
||||
{{- end }}
|
||||
</div>
|
||||
</dd>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
</dl>
|
||||
{{- end }}
|
12
docs/themes/hugo-geekdoc/layouts/shortcodes/tab.html
vendored
Normal file
12
docs/themes/hugo-geekdoc/layouts/shortcodes/tab.html
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
{{- if .Parent }}
|
||||
{{- $name := .Get 0 }}
|
||||
{{- $group := printf "tabs-%s" (.Parent.Get 0) }}
|
||||
|
||||
{{- if not (.Parent.Scratch.Get $group) }}
|
||||
{{- .Parent.Scratch.Set $group slice }}
|
||||
{{- end }}
|
||||
|
||||
{{- .Parent.Scratch.Add $group (dict "Name" $name "Content" .Inner) }}
|
||||
{{- else }}
|
||||
{{ errorf "%q: 'tab' shortcode must be inside 'tabs' shortcode" .Page.Path }}
|
||||
{{- end }}
|
22
docs/themes/hugo-geekdoc/layouts/shortcodes/tabs.html
vendored
Normal file
22
docs/themes/hugo-geekdoc/layouts/shortcodes/tabs.html
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
{{- if .Inner }}{{ end }}
|
||||
{{- $id := .Get 0 }}
|
||||
{{- $group := printf "tabs-%s" $id }}
|
||||
|
||||
|
||||
<div class="gdoc-tabs">
|
||||
{{- range $index, $tab := .Scratch.Get $group }}
|
||||
<input
|
||||
type="radio"
|
||||
class="gdoc-tabs__control hidden"
|
||||
name="{{ $group }}"
|
||||
id="{{ printf "%s-%d" $group $index }}"
|
||||
{{ if not $index }}checked="checked"{{ end }}
|
||||
/>
|
||||
<label for="{{ printf "%s-%d" $group $index }}" class="gdoc-tabs__label">
|
||||
{{ $tab.Name }}
|
||||
</label>
|
||||
<div class="gdoc-markdown--nested gdoc-tabs__content">
|
||||
{{ .Content | $.Page.RenderString }}
|
||||
</div>
|
||||
{{- end }}
|
||||
</div>
|
41
docs/themes/hugo-geekdoc/layouts/shortcodes/toc-tree.html
vendored
Normal file
41
docs/themes/hugo-geekdoc/layouts/shortcodes/toc-tree.html
vendored
Normal file
|
@ -0,0 +1,41 @@
|
|||
{{- $tocLevels := default (default 6 .Site.Params.geekdocToC) .Page.Params.geekdocToC }}
|
||||
|
||||
{{- if $tocLevels }}
|
||||
<div class="gdoc-toc gdoc-toc__level--{{ $tocLevels }}">
|
||||
{{ template "toc-tree" dict "sect" .Page.Pages }}
|
||||
</div>
|
||||
{{- end }}
|
||||
|
||||
|
||||
<!-- templates -->
|
||||
{{- define "toc-tree" }}
|
||||
<ul>
|
||||
{{- range .sect.GroupBy "Weight" }}
|
||||
{{- range .ByTitle }}
|
||||
{{- if or (not .Params.geekdocHidden) (not (default true .Params.geekdocHiddenTocTree)) }}
|
||||
<li>
|
||||
{{- if or .Content .Params.geekdocFlatSection }}
|
||||
<span>
|
||||
<a href="{{ .RelPermalink }}" class="gdoc-toc__entry">
|
||||
{{- partial "utils/title" . }}{{ with .Params.geekdocDescription }}:{{ end }}
|
||||
</a>
|
||||
{{- with .Params.geekdocDescription }}{{ . }}{{ end }}
|
||||
</span>
|
||||
{{- else -}}
|
||||
<span>
|
||||
{{- partial "utils/title" . }}{{ with .Params.geekdocDescription }}
|
||||
: {{ . }}
|
||||
{{ end }}
|
||||
</span>
|
||||
{{- end -}}
|
||||
|
||||
{{- $numberOfPages := (add (len .Pages) (len .Sections)) }}
|
||||
{{- if and (ne $numberOfPages 0) (not .Params.geekdocFlatSection) }}
|
||||
{{- template "toc-tree" dict "sect" .Pages }}
|
||||
{{- end }}
|
||||
</li>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
</ul>
|
||||
{{- end }}
|
13
docs/themes/hugo-geekdoc/layouts/shortcodes/toc.html
vendored
Normal file
13
docs/themes/hugo-geekdoc/layouts/shortcodes/toc.html
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
{{- $format := default "html" (.Get "format") }}
|
||||
{{- $tocLevels := default (default 6 .Site.Params.geekdocToC) .Page.Params.geekdocToC }}
|
||||
|
||||
{{- if and $tocLevels .Page.TableOfContents -}}
|
||||
{{- if not (eq ($format | lower) "raw") -}}
|
||||
<div class="gdoc-toc gdoc-toc__level--{{ $tocLevels }}">
|
||||
{{ .Page.TableOfContents }}
|
||||
<hr />
|
||||
</div>
|
||||
{{- else -}}
|
||||
{{ .Page.TableOfContents }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
Loading…
Add table
Add a link
Reference in a new issue