diff --git a/assets/docs/scss/custom/structure/_content.scss b/assets/docs/scss/custom/structure/_content.scss index 6a5b0456..59c000e9 100644 --- a/assets/docs/scss/custom/structure/_content.scss +++ b/assets/docs/scss/custom/structure/_content.scss @@ -257,6 +257,33 @@ i { } } + +// goat diagrams +figure.goat.svg-container { + + padding: 0.1rem; + align-items: center; + width: 100%; + @include media-breakpoint-up(md) { + width: auto; + padding:.5rem; + padding-left: auto; + padding-right: auto; + } + @include media-breakpoint-up(lg) { + padding: 1rem; + } + svg { + width:100%; + @include media-breakpoint-up(lg) { + max-width: 60rem; + } + font-family: var(--bs-font-monospace); + font-size: 0.7rem; + } +} + + // Chroma Highlighter CSS .docs-content .main-content td pre { diff --git a/assets/js/app.js b/assets/js/app.js index f182d2ef..cd885708 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -27,4 +27,12 @@ function toggleMenu() { } else { isOpen.style.display = "block"; } -}; \ No newline at end of file +}; + +window.addEventListener("DOMContentLoaded", (ev) => { + const viewers = document.querySelectorAll(".image-compare"); + viewers.forEach((element, i) => { + let view = new ImageCompare(element, JSON.parse(element.dataset.icConfig) ).mount(); + }); + +}); \ No newline at end of file diff --git a/assets/scss/style.scss b/assets/scss/style.scss index d14f0fda..396bb88f 100644 --- a/assets/scss/style.scss +++ b/assets/scss/style.scss @@ -27,25 +27,17 @@ $font-family-monospace: {{ .Site.Params.mono_font | default "SFMono-Regular, Me // Structure @import "custom/structure/general"; @import "custom/structure/topbar"; -// @import "custom/structure/content"; -// @import "custom/structure/sidebar-layouts"; -// @import "custom/structure/doc-nav"; -// @import "custom/structure/toc-layouts"; @import "custom/structure/footer"; -// // Components +// Components @import "custom/components/buttons"; @import "custom/components/badge"; -@import "custom/components/backgrounds"; -// @import "custom/components/alerts"; -// @import "custom/components/card"; -// // Pages +// Pages // @import "custom/pages/blog"; @import "custom/pages/features"; @import "custom/pages/helper"; @import "custom/pages/hero"; -{{ if ($.Scratch.Get "image_compare_enabled") }}@import "custom/pages/image-compare-viewer";{{ end }} +@import "custom/pages/image-compare-viewer"; -// @import "custom/pages/simplebar"; diff --git a/data/landing.yaml b/data/landing_default.yaml similarity index 100% rename from data/landing.yaml rename to data/landing_default.yaml diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 1f8aa7e2..c05981f2 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -1,31 +1,19 @@ -{{ $.Scratch.Delete "social_list" }} +{{ $.Scratch.Delete "social_list" -}} -{{ $social_params := slice "github" "twitter" "instagram" "rss" }} -{{ range $social_params }} +{{- $social_params := slice "github" "twitter" "instagram" "rss" -}} +{{- range $social_params -}} {{ if isset site.Params.social . }} {{ $.Scratch.Add "social_list" (slice .) }} {{ end }} -{{ end }} +{{- end -}} -{{ $ic := newScratch }} -{{ range $value := .Site.Data.landing }} - {{ $template := string (replaceRE `( |-{1,})` "_" $value.template) }} - {{ if eq $template "image_compare" }} - {{ if $value.enable }} - {{ $ic.Add "enabled" (slice $value.enable) }} - {{ range $value.items }} - {{ $ic.Add "config" (slice (.config | jsonify | safeJS)) }} - {{ end }} - {{ end }} - {{- end }} -{{ end }} - -{{ $.Scratch.Set "image_compare_enabled" (in ($ic.Get "enabled") true) }} +{{$.Page.Scratch.Set "image_compare_config" (slice ) }} +{{$.Page.Scratch.Set "image_compare_used" false }} {{- partial "head.html" . -}} @@ -38,28 +26,5 @@ {{- partial "footer.html" . -}} - - {{ $app := resources.Get "/js/app.js" }} - {{- if not .Site.IsServer }} - {{- $js := (slice $app) | resources.Concat "/js/bundle.js" | minify | fingerprint "sha384" }} - - {{- else }} - {{- $js := (slice $app) | resources.Concat "/js/bundle.js" }} - - {{- end }} - - - {{ if ($.Scratch.Get "image_compare_enabled") }} - - {{ end }} - diff --git a/layouts/docs/_markup/render-codeblock-goat.html b/layouts/docs/_markup/render-codeblock-goat.html new file mode 100644 index 00000000..b1107e24 --- /dev/null +++ b/layouts/docs/_markup/render-codeblock-goat.html @@ -0,0 +1,18 @@ +{{ $width := .Attributes.width }} +{{ $height := .Attributes.height }} +{{ $class := .Attributes.class | default "" }} +
+ {{ with diagrams.Goat .Inner }} + + {{ .Inner }} + + {{ end }} +
\ No newline at end of file diff --git a/layouts/index.html b/layouts/index.html index 76b71a33..8d843507 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -1,5 +1,8 @@ {{ define "main" }} - {{ $landingData := .Site.Data.landing }} + + {{ $landingData := (default .Site.Data.landing_default .Site.Data.landing) }} + + {{ $map := newScratch }} {{ range $key, $value := $landingData }} @@ -11,14 +14,16 @@ "weight" $weight "template" $template "sectionTitle" $sectionTitle + "data" $value )}} {{ end }} {{ end }} {{ range sort ($map.Get "wgtTpl") ".weight" }} + {{ $.Scratch.Set "sectionTitle" .sectionTitle }} {{ $path := printf "landing/%s.html" .template }} - {{ partial $path $.Page }} + {{ partial $path . }} {{ end }} {{/* printf "%s" (sort ($map.Get "wgtTpl") ".weight" ) */}} {{ end }} \ No newline at end of file diff --git a/layouts/partials/head.html b/layouts/partials/head.html index e3fbcf3e..e5bb45b6 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -27,7 +27,10 @@ {{- end -}} - {{ $js := resources.Get "js/bootstrap.js" }} + {{- $imgviewjs := resources.Get "/js/image-compare-viewer.min.js" -}} + {{- $appjs := resources.Get "/js/app.js" -}} + {{- $bsjs := resources.Get "js/bootstrap.js" -}} + {{- $js := slice $bsjs $imgviewjs $appjs | resources.Concat "/js/bundle.js"}} {{ $params := dict }} {{ $sourceMap := cond hugo.IsProduction "" "inline" }} {{ $opts := dict "sourceMap" $sourceMap "minify" hugo.IsProduction "target" "es2018" "params" $params }} @@ -35,18 +38,8 @@ {{ if hugo.IsProduction }} {{ $js = $js | fingerprint "sha384" }} {{ end }} + - - {{ if ($.Scratch.Get "image_compare_enabled") }} - {{ $imagecompare := resources.Get "js/image-compare-viewer.min.js" }} - {{- if not .Site.IsServer }} - {{- $js := (slice $imagecompare) | resources.Concat "/js/image-compare.js" | minify | fingerprint "sha384" }} - - {{- else }} - {{- $js := (slice $imagecompare) | resources.Concat "/js/image-compare.js" }} - - {{- end }} - {{- end }} {{- if not .Site.IsServer }} {{ if and (.Site.Params.plausible.scriptURL) (.Site.Params.plausible.dataDomain) -}} diff --git a/layouts/partials/landing/feature_grid.html b/layouts/partials/landing/feature_grid.html index 9449f34f..bd06d767 100644 --- a/layouts/partials/landing/feature_grid.html +++ b/layouts/partials/landing/feature_grid.html @@ -1,6 +1,4 @@ -{{ $sectionTitle := .Scratch.Get "sectionTitle" }} -{{ with (index .Site.Data.landing $sectionTitle) }} -{{ if eq .enable true }} +{{- $sectionTitle := .sectionTitle }}{{ with .data }}{{ if eq .enable true }}
diff --git a/layouts/partials/landing/hero.html b/layouts/partials/landing/hero.html index 5e95f83b..a208f0e4 100644 --- a/layouts/partials/landing/hero.html +++ b/layouts/partials/landing/hero.html @@ -1,6 +1,4 @@ -{{ $sectionTitle := .Scratch.Get "sectionTitle" }} -{{ with (index .Site.Data.landing $sectionTitle) }} -{{ if eq .enable true }} +{{- $sectionTitle := .sectionTitle }}{{ with .data }}{{ if eq .enable true }} {{ with .backgroundImage }} {{ $path := .path | default "images" }} @@ -62,7 +60,7 @@

{{ with .ctaButton }} - + {{ with .icon }} {{ . }} {{ end }} diff --git a/layouts/partials/landing/image_compare.html b/layouts/partials/landing/image_compare.html index afbf57b5..be379ab8 100644 --- a/layouts/partials/landing/image_compare.html +++ b/layouts/partials/landing/image_compare.html @@ -1,6 +1,5 @@ -{{ $sectionTitle := .Scratch.Get "sectionTitle" }} -{{ with (index .Site.Data.landing $sectionTitle) }} -{{ if eq .enable true }} +{{- $sectionTitle := .sectionTitle }}{{ with .data }}{{ if eq .enable true }} +{{- page.Scratch.Set "image_compare_used" true -}}
@@ -39,6 +38,7 @@

{{ . }}

+ {{ $icc := (default nil .config ) }} {{ $title := .title }} {{ $path := .imagePath | default "images" }} {{ $imageBefore := .imageBefore }} @@ -46,7 +46,7 @@

{{ . }}

{{ $pathBefore := printf "%s/%s" $path $imageBefore }} {{ $pathAfter := printf "%s/%s" $path $imageAfter }} {{ with and $imageBefore $imageAfter }} -
+
{{ with $imageBefore := resources.Get $pathBefore }} {{ $imageBefore }} {{ end }} @@ -64,5 +64,6 @@

{{ . }}

+ {{ end }} {{ end }} \ No newline at end of file diff --git a/layouts/partials/landing/image_text.html b/layouts/partials/landing/image_text.html index d65dd9d6..75e27ba9 100644 --- a/layouts/partials/landing/image_text.html +++ b/layouts/partials/landing/image_text.html @@ -1,6 +1,4 @@ -{{ $sectionTitle := .Scratch.Get "sectionTitle" }} -{{ with (index .Site.Data.landing $sectionTitle) }} -{{ if eq .enable true }} +{{- $sectionTitle := .sectionTitle }}{{ with .data }}{{ if eq .enable true }}