refactor: replace gulp by webpack and npm scripts (#258)
BREAKING CHANGE: We have replaced `gulp` with `webpack` and `npm scripts` to build this theme. If you build it on your own or use build commands during the deployment, you may have to adjust your setup. BREAKING CHANGE: The `GeekblogIcons` font is using the icon name as Unicode now. As a consequence, you have to replace all references to Icons from this font if you have customized the theme. BREAKING CHANGE: We have refactored the search integration to split Hugo templates from JavaScript code. To get it working again, you need to adjust the `outputFormats` and `outputs` in your Hugo configuration file, as [documented](https://geekdocs.de/usage/configuration/#site-configuration).
This commit is contained in:
parent
2ac2a9faab
commit
5c5e2d59cb
122 changed files with 18705 additions and 5208 deletions
|
@ -3,7 +3,7 @@
|
|||
{{ $size := default "regular" (.Get "size" | lower) }}
|
||||
|
||||
{{ if not (in (slice "regular" "large") $size) }}
|
||||
{{ $size = "regular" }}
|
||||
{{ $size = "regular" }}
|
||||
{{ end }}
|
||||
|
||||
{{ with .Get "href" }}
|
||||
|
@ -15,8 +15,13 @@
|
|||
{{ $ref = relref $ . }}
|
||||
{{ end }}
|
||||
|
||||
<span class="gdoc-button gdoc-button--{{ $size }}{{ with .Get "class" }} {{ . }}{{ end }}">
|
||||
<a {{ with $ref }} href="{{.}}" {{ end }} {{ with $target }} target="{{.}}" {{ end }} class="gdoc-button__link">
|
||||
{{ $.Inner }}
|
||||
</a>
|
||||
|
||||
<span class="gdoc-button gdoc-button--{{ $size }}{{ with .Get "class" }}{{ . }}{{ end }}">
|
||||
<a
|
||||
{{ with $ref }}href="{{ . }}"{{ end }}
|
||||
{{ with $target }}target="{{ . }}"{{ end }}
|
||||
class="gdoc-button__link"
|
||||
>
|
||||
{{ $.Inner }}
|
||||
</a>
|
||||
</span>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<div class="gdoc-columns flex flex-wrap flex-mobile-column">
|
||||
{{ range split .Inner "<--->" }}
|
||||
<div class="gdoc-columns__content gdoc-markdown--nested flex-even">
|
||||
{{ . | $.Page.RenderString }}
|
||||
</div>
|
||||
<div class="gdoc-columns__content gdoc-markdown--nested flex-even">
|
||||
{{ . | $.Page.RenderString }}
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{{ $id := .Get 0 }}
|
||||
|
||||
{{- with $id -}}
|
||||
<svg class="icon {{ . }}"><use xlink:href="#{{ . }}"></use></svg>
|
||||
<svg class="icon {{ . }}"><use xlink:href="#{{ . }}"></use></svg>
|
||||
{{- end -}}
|
||||
|
|
|
@ -4,26 +4,41 @@
|
|||
{{ $lazyLoad := default (default true $.Site.Params.GeekdocImageLazyLoading) (.Get "lazy") }}
|
||||
|
||||
{{ with $source }}
|
||||
{{ $caption := default .Title $customAlt }}
|
||||
{{ $caption := default .Title $customAlt }}
|
||||
|
||||
{{ $tiny := (.Resize "320x").RelPermalink }}
|
||||
{{ $small := (.Resize "600x").RelPermalink }}
|
||||
{{ $medium := (.Resize "1200x").RelPermalink }}
|
||||
{{ $large := (.Resize "1800x").RelPermalink }}
|
||||
{{ $tiny := (.Resize "320x").RelPermalink }}
|
||||
{{ $small := (.Resize "600x").RelPermalink }}
|
||||
{{ $medium := (.Resize "1200x").RelPermalink }}
|
||||
{{ $large := (.Resize "1800x").RelPermalink }}
|
||||
|
||||
{{ $size := dict "tiny" $tiny "small" $small "medium" $medium "large" $large }}
|
||||
{{ $size := dict "tiny" $tiny "small" $small "medium" $medium "large" $large }}
|
||||
|
||||
<div class="flex justify-center">
|
||||
<figure class="gdoc-markdown__figure">
|
||||
<a class="gdoc-markdown__link--raw" href="{{ .RelPermalink }}">
|
||||
|
||||
<div class="flex justify-center">
|
||||
<figure class="gdoc-markdown__figure">
|
||||
<a class="gdoc-markdown__link--raw" href="{{ .RelPermalink }}">
|
||||
<picture>
|
||||
<source {{ with $customSize }}srcset="{{ index $size $customSize }}"{{ else }}srcset="{{ $size.small }} 600w, {{ $size.medium }} 1200w" sizes="100vw"{{ end }} />
|
||||
<img {{ if $lazyLoad }}loading="lazy" {{ end }}src="{{ $size.large }}" alt="{{ $caption }}" />
|
||||
<source
|
||||
{{ with $customSize }}
|
||||
srcset="{{ index $size $customSize }}"
|
||||
{{ else }}
|
||||
srcset="{{ $size.small }} 600w, {{ $size.medium }} 1200w" sizes="100vw"
|
||||
{{ end }}
|
||||
/>
|
||||
<img
|
||||
{{ if $lazyLoad }}
|
||||
loading="lazy"
|
||||
{{ end }}
|
||||
src="{{ $size.large }}"
|
||||
alt="{{ $caption }}"
|
||||
/>
|
||||
</picture>
|
||||
</a>
|
||||
{{ with $caption -}}
|
||||
<figcaption>{{ . }}{{ with $source.Params.credits }} ({{ . | $.Page.RenderString }}){{ end }}</figcaption>
|
||||
{{- end }}
|
||||
</figure>
|
||||
</div>
|
||||
</a>
|
||||
{{ with $caption -}}
|
||||
<figcaption>
|
||||
{{ . }}{{ with $source.Params.credits }}({{ . | $.Page.RenderString }}){{ end }}
|
||||
</figcaption>
|
||||
{{- end }}
|
||||
</figure>
|
||||
</div>
|
||||
{{ end }}
|
||||
|
|
|
@ -4,14 +4,15 @@
|
|||
{{ $language := .Get "language" }}
|
||||
{{ $options :=.Get "options" }}
|
||||
|
||||
|
||||
<div class="gdoc-include">
|
||||
{{- if (.Get "language") -}}
|
||||
{{- if (.Get "language") -}}
|
||||
{{- highlight ($file | readFile) $language (default "linenos=table" $options) -}}
|
||||
{{- else if eq $type "html" -}}
|
||||
{{- else if eq $type "html" -}}
|
||||
{{- $file | readFile | safeHTML -}}
|
||||
{{- else if eq $type "page" -}}
|
||||
{{- else if eq $type "page" -}}
|
||||
{{- with $page }}{{ .Content }}{{ end -}}
|
||||
{{- else -}}
|
||||
{{- else -}}
|
||||
{{- $file | readFile | $.Page.RenderString -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
</div>
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
{{ if not (.Page.Scratch.Get "katex") }}
|
||||
<!-- Include katext only first time -->
|
||||
<link rel="stylesheet" href="{{ index .Site.Data.assets "katex.min.css" | relURL }}" />
|
||||
<script defer src="{{ index .Site.Data.assets "js/katex.min.js" | relURL }}"></script>
|
||||
<script defer src="{{ index .Site.Data.assets "js/auto-render.min.js" | relURL }}"></script>
|
||||
<script defer src="{{ index .Site.Data.assets "js/katex-loader.min.js" | relURL }}"></script>
|
||||
{{ .Page.Scratch.Set "katex" true }}
|
||||
<!-- Include katext 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 }}
|
||||
|
||||
<span class="gdoc-katex katex{{ with .Get "class" }} {{ . }}{{ end }}">
|
||||
|
||||
<span class="gdoc-katex katex{{ with .Get "class" }}{{ . }}{{ end }}">
|
||||
{{ cond (in .Params "display") "\\[" "\\(" -}}
|
||||
{{- trim .Inner "\n" -}}
|
||||
{{- cond (in .Params "display") "\\]" "\\)" }}
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
{{ if not (.Page.Scratch.Get "mermaid") }}
|
||||
<!-- Include mermaid only first time -->
|
||||
<script defer src="{{ index .Site.Data.assets "js/mermaid.min.js" | relURL }}"></script>
|
||||
<script defer src="{{ index .Site.Data.assets "js/mermaid-loader.min.js" | relURL }}"></script>
|
||||
{{ .Page.Scratch.Set "mermaid" true }}
|
||||
<!-- Include mermaid only first time --><script defer src="{{ index (index .Site.Data.assets "mermaid.js") "src" | relURL }}"></script>
|
||||
{{ .Page.Scratch.Set "mermaid" true }}
|
||||
{{ end }}
|
||||
|
||||
<pre class="gdoc-mermaid mermaid{{ with .Get "class" }} {{ . }}{{ end }}">
|
||||
|
||||
<pre class="gdoc-mermaid mermaid{{ with .Get "class" }}{{ printf " %s" . }}{{ end }}">
|
||||
{{- .Inner -}}
|
||||
</pre>
|
||||
|
|
|
@ -9,4 +9,4 @@
|
|||
{{ .Parent.Scratch.Add $group (dict "Name" $name "Content" .Inner) }}
|
||||
{{ else }}
|
||||
{{ errorf "%q: 'tab' shortcode must be inside 'tabs' shortcode" .Page.Path }}
|
||||
{{ end}}
|
||||
{{ end }}
|
||||
|
|
|
@ -2,10 +2,16 @@
|
|||
{{ $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 }} />
|
||||
<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>
|
||||
|
|
|
@ -1,32 +1,38 @@
|
|||
{{ $tocLevels := default (default 6 .Site.Params.GeekdocToC) .Page.Params.GeekdocToC }}
|
||||
|
||||
{{ if $tocLevels }}
|
||||
<div class="gdoc-toc gdoc-toc__level--{{$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 "title" . }}{{ with .Params.GeekdocDescription }}:</a> {{ . }}{{ else }}</a>{{ end }}
|
||||
</span>
|
||||
{{ else }}
|
||||
<span>{{ partial "title" . }}{{ with .Params.GeekdocDescription }}: {{ . }}{{ end }}</span>
|
||||
{{ end }}
|
||||
{{ 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 "title" . }}{{ with .Params.GeekdocDescription }}:{{ end }}
|
||||
</a>
|
||||
{{ with .Params.GeekdocDescription }}{{ . }}{{ end }}
|
||||
</span>
|
||||
{{ else }}
|
||||
<span>
|
||||
{{ partial "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 }}
|
||||
{{ $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>
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
{{ $tocLevels := default (default 6 .Site.Params.GeekdocToC) .Page.Params.GeekdocToC }}
|
||||
|
||||
{{ if and $tocLevels .Page.TableOfContents }}
|
||||
<div class="gdoc-toc gdoc-toc__level--{{$tocLevels}}">{{ .Page.TableOfContents }}<hr></div>
|
||||
<div class="gdoc-toc gdoc-toc__level--{{ $tocLevels }}">
|
||||
{{ .Page.TableOfContents }}
|
||||
<hr />
|
||||
</div>
|
||||
{{ end }}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue