From a0cb9ffcb1883898216d5fbad0a3a86850704233 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Weber?= Date: Sun, 16 Feb 2025 00:03:08 +0100 Subject: [PATCH] chore: convert to Unix line breaks --- .editorconfig | 29 ++-- .gitignore | 16 +- .prettierignore | 44 ++--- .vscode/extensions.json | 6 +- .vscode/settings.json | 40 ++--- .../content/en/log/first-day/_index.md | 58 +++---- .../content/en/log/second-day/index.md | 64 +++---- exampleSite/content/en/log/third-day.md | 62 +++---- .../content/pir/log/first-day/_index.md | 10 +- .../content/pir/log/second-day/index.md | 12 +- exampleSite/content/pir/log/third-day.md | 10 +- layouts/_default/baseof.md | 10 +- layouts/_default/baseof.source.md | 6 +- .../partials/_relearn/decoratedLink.gotmpl | 112 ++++++------- .../partials/_relearn/imageAttributes.gotmpl | 156 +++++++++--------- .../partials/_relearn/linkAttributes.gotmpl | 142 ++++++++-------- layouts/partials/version.txt | 2 +- 17 files changed, 390 insertions(+), 389 deletions(-) diff --git a/.editorconfig b/.editorconfig index f4c81fdeb9..5f7dc53d0d 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,14 +1,15 @@ -# https://editorconfig.org - -root = true - -[*] -charset = utf-8 -indent_size = 2 -indent_style = space -insert_final_newline = true -max_line_length = 9999 -trim_trailing_whitespace = true - -[*.md] -trim_trailing_whitespace = false +# https://editorconfig.org + +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_size = 2 +indent_style = space +insert_final_newline = true +max_line_length = 9999 +trim_trailing_whitespace = true + +[*.md] +trim_trailing_whitespace = false diff --git a/.gitignore b/.gitignore index 2c4e5ab505..952e6a773a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,8 @@ -.DS_Store -.githooks/hooks.log -.hugo_build.lock -docs/public* -exampleSite/public* -hugo*.exe -*.xcf -*.zip +.DS_Store +.githooks/hooks.log +.hugo_build.lock +docs/public* +exampleSite/public* +hugo*.exe +*.xcf +*.zip diff --git a/.prettierignore b/.prettierignore index c5ec1450f2..70835f5233 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,22 +1,22 @@ -assets/css/chroma*.css -assets/css/variables.css -assets/_relearn_searchindex.js -docs/.frontmatter -docs/content -docs/layouts -docs/static -docs/frontmatter.json -exampleSite -layouts -static/css/auto-complete.css -static/css/*.min.css -static/css/swagger*.css -static/js/d3 -static/js/lunr -static/js/mathjax -static/js/swagger-ui -static/js/auto-complete.js -static/js/*.min.js -*.md -*.yaml -*.yml +assets/css/chroma*.css +assets/css/variables.css +assets/_relearn_searchindex.js +docs/.frontmatter +docs/content +docs/layouts +docs/static +docs/frontmatter.json +exampleSite +layouts +static/css/auto-complete.css +static/css/*.min.css +static/css/swagger*.css +static/js/d3 +static/js/lunr +static/js/mathjax +static/js/swagger-ui +static/js/auto-complete.js +static/js/*.min.js +*.md +*.yaml +*.yml diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 53dd67cb73..c83e26348e 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,3 +1,3 @@ -{ - "recommendations": ["esbenp.prettier-vscode"] -} +{ + "recommendations": ["esbenp.prettier-vscode"] +} diff --git a/.vscode/settings.json b/.vscode/settings.json index 17eb675b34..c1c32b8854 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,20 +1,20 @@ -{ - "editor.defaultFormatter": "esbenp.prettier-vscode", - "[css]": { - "editor.defaultFormatter": "esbenp.prettier-vscode" - }, - "[javascript]": { - "editor.defaultFormatter": "esbenp.prettier-vscode" - }, - "[json]": { - "editor.defaultFormatter": "esbenp.prettier-vscode" - }, - "[yaml]": { - "editor.defaultFormatter": "esbenp.prettier-vscode" - }, - "editor.formatOnSave": true, - "extensions.ignoreRecommendations": false, - "prettier.useEditorConfig": true, - "spellright.documentTypes": ["latex", "markdown"], - "spellright.language": ["en"] -} +{ + "editor.defaultFormatter": "esbenp.prettier-vscode", + "[css]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[javascript]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[json]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[yaml]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "editor.formatOnSave": true, + "extensions.ignoreRecommendations": false, + "prettier.useEditorConfig": true, + "spellright.documentTypes": ["latex", "markdown"], + "spellright.language": ["en"] +} diff --git a/exampleSite/content/en/log/first-day/_index.md b/exampleSite/content/en/log/first-day/_index.md index 2dff8f9d88..e414e79db5 100644 --- a/exampleSite/content/en/log/first-day/_index.md +++ b/exampleSite/content/en/log/first-day/_index.md @@ -1,29 +1,29 @@ -+++ -description = 'Launch Day' -title = 'Day 1' -weight = 1 -+++ - -## Launch Day - -**Captain’s Log, 0120 hours** - -> ***"No mission too saucy for us!"*** -> – Captain’s official decree - -It seems we accidentally loaded a crate of rubber chickens instead of emergency food rations, but the crew is already brainstorming new dance routines with them. Meanwhile, our quartermaster replaced the lifebuoys with giant doughnuts for a "themed" departure—perfect for dunking our morale into sugary bliss. - -### Status - -- **Reason for voyage:** A midnight run to deliver top-secret cargo (pasta flour and extra marinara). -- **Crew status:** - - Eager to set sail - - Full of energy (and possibly leftover breadsticks) - -### Early Observations - -The moonlit sky casts {{% badge style="primary" icon="anchor" %}}The Purple Pulpo{{% /badge %}} in a mysterious glow. Rumor has it, our **octopus figurehead** twitched its wooden tentacles twice, a good omen for our daring spaghetti mission. Some say those tentacles can sense hidden spice routes. - ---- - -Stay tuned for [more updates](second-day) from our floating festival of noodles and nautical nonsense. ++++ +description = 'Launch Day' +title = 'Day 1' +weight = 1 ++++ + +## Launch Day + +**Captain’s Log, 0120 hours** + +> ***"No mission too saucy for us!"*** +> – Captain’s official decree + +It seems we accidentally loaded a crate of rubber chickens instead of emergency food rations, but the crew is already brainstorming new dance routines with them. Meanwhile, our quartermaster replaced the lifebuoys with giant doughnuts for a "themed" departure—perfect for dunking our morale into sugary bliss. + +### Status + +- **Reason for voyage:** A midnight run to deliver top-secret cargo (pasta flour and extra marinara). +- **Crew status:** + - Eager to set sail + - Full of energy (and possibly leftover breadsticks) + +### Early Observations + +The moonlit sky casts {{% badge style="primary" icon="anchor" %}}The Purple Pulpo{{% /badge %}} in a mysterious glow. Rumor has it, our **octopus figurehead** twitched its wooden tentacles twice, a good omen for our daring spaghetti mission. Some say those tentacles can sense hidden spice routes. + +--- + +Stay tuned for [more updates](second-day) from our floating festival of noodles and nautical nonsense. diff --git a/exampleSite/content/en/log/second-day/index.md b/exampleSite/content/en/log/second-day/index.md index 7d03a81c73..e27e392d7b 100644 --- a/exampleSite/content/en/log/second-day/index.md +++ b/exampleSite/content/en/log/second-day/index.md @@ -1,32 +1,32 @@ - -+++ -description = 'At Sea' -title = 'Day 2' -weight = 2 -+++ - -## At Sea - -**Captain’s Log, 0545 hours** - -> ***"A little sea spray can’t break our spirit—nor our appetite!"*** -> – The Chef, after a minor sauce-spill incident - -The waves crash and the crew awakens to the salty sea breeze. Our beloved ship, {{% badge style="primary" icon="anchor" %}}The Purple Pulpo{{% /badge %}}, plows forward, determined to complete our "Operation Squid Spaghetti." - -### Status - -- **Weather:** Slightly stormy with a touch of dramatic sea mist -- **Crew Morale:** - 1. Excitement level: High - 2. Hunger level: *Astronomical* - 3. Willingness to sing shanties: ∞ - -### Culinary Update - -The kitchen rattles with every wave, saucepans clanging like a symphony of disorganized percussion. Marinara overboard? Twice. -But fear not, the crew valiantly rescued the floating ladle, dubbing it **Sir Stir-a-Lot**. - ---- - -Stay tuned for the [next thrilling entry](third-day): How fresh noodles fare in gale-force winds... and whether the sauce can hold up against the unstoppable appetite of seafaring sailors! + ++++ +description = 'At Sea' +title = 'Day 2' +weight = 2 ++++ + +## At Sea + +**Captain’s Log, 0545 hours** + +> ***"A little sea spray can’t break our spirit—nor our appetite!"*** +> – The Chef, after a minor sauce-spill incident + +The waves crash and the crew awakens to the salty sea breeze. Our beloved ship, {{% badge style="primary" icon="anchor" %}}The Purple Pulpo{{% /badge %}}, plows forward, determined to complete our "Operation Squid Spaghetti." + +### Status + +- **Weather:** Slightly stormy with a touch of dramatic sea mist +- **Crew Morale:** + 1. Excitement level: High + 2. Hunger level: *Astronomical* + 3. Willingness to sing shanties: ∞ + +### Culinary Update + +The kitchen rattles with every wave, saucepans clanging like a symphony of disorganized percussion. Marinara overboard? Twice. +But fear not, the crew valiantly rescued the floating ladle, dubbing it **Sir Stir-a-Lot**. + +--- + +Stay tuned for the [next thrilling entry](third-day): How fresh noodles fare in gale-force winds... and whether the sauce can hold up against the unstoppable appetite of seafaring sailors! diff --git a/exampleSite/content/en/log/third-day.md b/exampleSite/content/en/log/third-day.md index a764842c14..f1f1015e1e 100644 --- a/exampleSite/content/en/log/third-day.md +++ b/exampleSite/content/en/log/third-day.md @@ -1,31 +1,31 @@ -+++ -description = 'Island Arrival' -title = 'Day 3' -weight = 3 -+++ - -## Island Arrival - -**Captain’s Log, 1140 hours** - -> ***"Ahoy, pasta-lovers! Our mission is finally a sauce-cess!"*** -> – The Enthused Quartermaster - -The sun blazes overhead, revealing an island coastline shaped like a **questionable noodle bowl** — the perfect destination for our midnight pasta cargo. - -### Status - -- Purple sails flutter in the island breeze -- The octopus figurehead is **oddly** shining—some claim the wooden tentacles are still dancing to an unseen rhythm -- *Slight tang* of marinara lingers across the entire deck - -### Incident in the Crow's Nest - -Upon our arrival in the harbor, the lookout nearly toppled from his perch in a fit of excitement. A mysterious figure on the dock signaled with a lantern three times—followed by a deafening call of a heron in flight. - -The lookout swears the bird cawed in perfect Morse code, as if warning us of impending calamity. Moments later, a sudden gust toppled the spyglass stand, sending it clattering down to the quarterdeck, just as the heron sped off with a triumphant whistle. - -> [!primary]+ Mission Debriefing -> - [x] Crates of sauce offloaded with care (and the occasional accidental slosh) -> - [x] Crowds of locals, excited for fresh spaghetti -> - [ ] _Squid ink_ banner hoisted high to announce “Operation Squid Spaghetti Complete” ++++ +description = 'Island Arrival' +title = 'Day 3' +weight = 3 ++++ + +## Island Arrival + +**Captain’s Log, 1140 hours** + +> ***"Ahoy, pasta-lovers! Our mission is finally a sauce-cess!"*** +> – The Enthused Quartermaster + +The sun blazes overhead, revealing an island coastline shaped like a **questionable noodle bowl** — the perfect destination for our midnight pasta cargo. + +### Status + +- Purple sails flutter in the island breeze +- The octopus figurehead is **oddly** shining—some claim the wooden tentacles are still dancing to an unseen rhythm +- *Slight tang* of marinara lingers across the entire deck + +### Incident in the Crow's Nest + +Upon our arrival in the harbor, the lookout nearly toppled from his perch in a fit of excitement. A mysterious figure on the dock signaled with a lantern three times—followed by a deafening call of a heron in flight. + +The lookout swears the bird cawed in perfect Morse code, as if warning us of impending calamity. Moments later, a sudden gust toppled the spyglass stand, sending it clattering down to the quarterdeck, just as the heron sped off with a triumphant whistle. + +> [!primary]+ Mission Debriefing +> - [x] Crates of sauce offloaded with care (and the occasional accidental slosh) +> - [x] Crowds of locals, excited for fresh spaghetti +> - [ ] _Squid ink_ banner hoisted high to announce “Operation Squid Spaghetti Complete” diff --git a/exampleSite/content/pir/log/first-day/_index.md b/exampleSite/content/pir/log/first-day/_index.md index e4c57c5067..566df8b9da 100644 --- a/exampleSite/content/pir/log/first-day/_index.md +++ b/exampleSite/content/pir/log/first-day/_index.md @@ -1,6 +1,6 @@ -+++ -description = 'Launch Day' -title = 'Day 1' -weight = 1 -+++ ++++ +description = 'Launch Day' +title = 'Day 1' +weight = 1 ++++ {{< piratify >}} \ No newline at end of file diff --git a/exampleSite/content/pir/log/second-day/index.md b/exampleSite/content/pir/log/second-day/index.md index 076e65a913..5cfc1436e9 100644 --- a/exampleSite/content/pir/log/second-day/index.md +++ b/exampleSite/content/pir/log/second-day/index.md @@ -1,7 +1,7 @@ - -+++ -description = 'At Sea' -title = 'Day 2' -weight = 2 -+++ + ++++ +description = 'At Sea' +title = 'Day 2' +weight = 2 ++++ {{< piratify >}} \ No newline at end of file diff --git a/exampleSite/content/pir/log/third-day.md b/exampleSite/content/pir/log/third-day.md index 4d49909695..dec8c1eb2a 100644 --- a/exampleSite/content/pir/log/third-day.md +++ b/exampleSite/content/pir/log/third-day.md @@ -1,6 +1,6 @@ -+++ -description = 'Island Arrival' -title = 'Day 3' -weight = 3 -+++ ++++ +description = 'Island Arrival' +title = 'Day 3' +weight = 3 ++++ {{< piratify >}} \ No newline at end of file diff --git a/layouts/_default/baseof.md b/layouts/_default/baseof.md index c08fda1b70..1576c49b46 100644 --- a/layouts/_default/baseof.md +++ b/layouts/_default/baseof.md @@ -1,6 +1,6 @@ -{{/* the following check avoids to print out content of headless bundles if called from nestedContent.gotmpl */}} -{{- if .RelPermalink -}} -# {{ .Title }} - -{{ strings.TrimLeft "\n\r\t " .RawContent | safeHTML }} +{{/* the following check avoids to print out content of headless bundles if called from nestedContent.gotmpl */}} +{{- if .RelPermalink -}} +# {{ .Title }} + +{{ strings.TrimLeft "\n\r\t " .RawContent | safeHTML }} {{- end }} \ No newline at end of file diff --git a/layouts/_default/baseof.source.md b/layouts/_default/baseof.source.md index 05a480f90e..ef3147e4bc 100644 --- a/layouts/_default/baseof.source.md +++ b/layouts/_default/baseof.source.md @@ -1,4 +1,4 @@ -{{/* the following check avoids to print out content of headless bundles if called from nestedContent.gotmpl */}} -{{- with and .File .File.Filename -}} -{{ readFile . | safeHTML }} +{{/* the following check avoids to print out content of headless bundles if called from nestedContent.gotmpl */}} +{{- with and .File .File.Filename -}} +{{ readFile . | safeHTML }} {{- end }} \ No newline at end of file diff --git a/layouts/partials/_relearn/decoratedLink.gotmpl b/layouts/partials/_relearn/decoratedLink.gotmpl index 2be07ef583..882fb3cddd 100644 --- a/layouts/partials/_relearn/decoratedLink.gotmpl +++ b/layouts/partials/_relearn/decoratedLink.gotmpl @@ -1,57 +1,57 @@ -{{- $href := partial "permalink.gotmpl" (dict "to" .linkObject) }} -{{- $silent := .silent | default false }} -{{- $hideFilepath := .hideFilepath | default false }} -{{- $u := urls.Parse .url }} -{{- with $u.RawQuery }} - {{- $href = printf "%s?%s" $href . }} -{{- end }} -{{- with $u.Fragment }} - {{- $href = printf "%s#%s" $href . }} - {{- if not $silent }} - {{- partial "inline/validate-fragment.html" (dict "origPage" $.page "page" $.linkObject "parsedURL" $u "url" $.url "param" $.param "hideFilepath" $hideFilepath) }} - {{- end }} -{{- end }} -{{- return $href }} - -{{- define "partials/inline/validate-fragment.html" }} - {{- /* - Validates the fragment portion of a link destination. - */}} - - {{- /* Initialize. */}} - {{- $errorLevel := .errorLevel }} - {{- $origPage := .origPage }} - {{- $p := .page }} - {{- $url := .url }} - {{- $u := .parsedURL }} - {{- $param := .param }} - {{- $hideFilepath := .hideFilepath }} - - {{- /* Validate. */}} - {{- with $u.Fragment }} - {{- if $p.Fragments.Identifiers.Contains . }} - {{- if gt ($p.Fragments.Identifiers.Count .) 1 }} - {{- $filepath := "[virtual file]" }}{{ with and $origPage $origPage.File $origPage.File.Filename }}{{ $filepath = . }}{{ end }} - {{- $msg := printf "%q: duplicate heading ID %q found" $filepath . }} - {{- partial "_relearn/urlErrorReport.gotmpl" (dict "url" $url "page" $origPage "param" $param "msg" $msg) }} - {{- end }} - {{- else }} - {{- /* Determine target path for warning and error message. */}} - {{- $targetPath := "" }} - {{- with $p.File }} - {{- $targetPath = .Path }} - {{- else }} - {{- $targetPath = .Path }} - {{- end }} - {{- $filepath := "[virtual file]" }}{{ with and $origPage $origPage.File $origPage.File.Filename }}{{ $filepath = . }}{{ end }} - {{- $msg := printf "heading ID %q not found" . }} - {{- if not $hideFilepath }} - {{- $msg = printf "%q: %s" $filepath $msg }} - {{- end }} - {{- if or $hideFilepath (ne $origPage $p) }} - {{- $msg = printf "%s in %q" $msg $targetPath }} - {{- end }} - {{- partial "_relearn/urlErrorReport.gotmpl" (dict "url" $url "page" $origPage "param" $param "msg" $msg) }} - {{- end }} - {{- end }} +{{- $href := partial "permalink.gotmpl" (dict "to" .linkObject) }} +{{- $silent := .silent | default false }} +{{- $hideFilepath := .hideFilepath | default false }} +{{- $u := urls.Parse .url }} +{{- with $u.RawQuery }} + {{- $href = printf "%s?%s" $href . }} +{{- end }} +{{- with $u.Fragment }} + {{- $href = printf "%s#%s" $href . }} + {{- if not $silent }} + {{- partial "inline/validate-fragment.html" (dict "origPage" $.page "page" $.linkObject "parsedURL" $u "url" $.url "param" $.param "hideFilepath" $hideFilepath) }} + {{- end }} +{{- end }} +{{- return $href }} + +{{- define "partials/inline/validate-fragment.html" }} + {{- /* + Validates the fragment portion of a link destination. + */}} + + {{- /* Initialize. */}} + {{- $errorLevel := .errorLevel }} + {{- $origPage := .origPage }} + {{- $p := .page }} + {{- $url := .url }} + {{- $u := .parsedURL }} + {{- $param := .param }} + {{- $hideFilepath := .hideFilepath }} + + {{- /* Validate. */}} + {{- with $u.Fragment }} + {{- if $p.Fragments.Identifiers.Contains . }} + {{- if gt ($p.Fragments.Identifiers.Count .) 1 }} + {{- $filepath := "[virtual file]" }}{{ with and $origPage $origPage.File $origPage.File.Filename }}{{ $filepath = . }}{{ end }} + {{- $msg := printf "%q: duplicate heading ID %q found" $filepath . }} + {{- partial "_relearn/urlErrorReport.gotmpl" (dict "url" $url "page" $origPage "param" $param "msg" $msg) }} + {{- end }} + {{- else }} + {{- /* Determine target path for warning and error message. */}} + {{- $targetPath := "" }} + {{- with $p.File }} + {{- $targetPath = .Path }} + {{- else }} + {{- $targetPath = .Path }} + {{- end }} + {{- $filepath := "[virtual file]" }}{{ with and $origPage $origPage.File $origPage.File.Filename }}{{ $filepath = . }}{{ end }} + {{- $msg := printf "heading ID %q not found" . }} + {{- if not $hideFilepath }} + {{- $msg = printf "%q: %s" $filepath $msg }} + {{- end }} + {{- if or $hideFilepath (ne $origPage $p) }} + {{- $msg = printf "%s in %q" $msg $targetPath }} + {{- end }} + {{- partial "_relearn/urlErrorReport.gotmpl" (dict "url" $url "page" $origPage "param" $param "msg" $msg) }} + {{- end }} + {{- end }} {{- end }} \ No newline at end of file diff --git a/layouts/partials/_relearn/imageAttributes.gotmpl b/layouts/partials/_relearn/imageAttributes.gotmpl index 2ef4b54cc4..c51ce7bb96 100644 --- a/layouts/partials/_relearn/imageAttributes.gotmpl +++ b/layouts/partials/_relearn/imageAttributes.gotmpl @@ -1,79 +1,79 @@ -{{- $attributes := .attributes | default dict }} -{{- $height := "auto" }} -{{- $width := "auto" }} -{{- $effects := dict "border" false "dataurl" false "inlinecontent" false "lazy" true "lightbox" true "shadow" false }} -{{- if .page.Site.Params.imageeffects }} - {{- $effects = merge $effects .page.Site.Params.imageeffects }} -{{- end }} -{{- if .page.Params.imageEffects }} - {{- $effects = merge $effects .page.Params.imageEffects }} -{{- end }} -{{- $u := urls.Parse .url }} -{{- if $u.RawQuery }} - {{- if $u.Query.Has "classes" }} - {{- $classes := slice | append (split ($u.Query.Get "classes") ",") }} - {{- range $classes }} - {{- $k := . }} - {{- $v := true }} - {{- if strings.HasPrefix $k "no" }} - {{- $k := strings.TrimPrefix "no" $k }} - {{- $v := false }} - {{- end }} - {{- $effects = merge $effects (dict $k $v) }} - {{- end }} - {{- end }} - {{- if $u.Query.Has "featherlight" }} - {{- $filepath := "[virtual file]" }}{{ with and .page .page.File .page.File.Filename }}{{ $filepath = . }}{{ end }} - {{- warnf "%q: DEPRECATED usage of 'featherlight' image CSS class found, use 'lightbox' instead; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/5/#5-11-0" $filepath }} - {{- $effects = merge $effects (dict "lightbox" (ne ($u.Query.Get "featherlight") "false")) }} - {{- end }} - {{- range $k, $v := $effects }} - {{- if $u.Query.Has $k }} - {{- $effects = merge $effects (dict $k (ne ($u.Query.Get $k) "false")) }} - {{- end }} - {{- end }} - {{- range $k, $v := $effects }} - {{- if $u.Query.Has $k }} - {{- $paramValue := $u.Query.Get $k }} - {{- $newValue := true }} - {{- if eq $paramValue "" }} - {{- $newValue = true }} - {{- else if eq $paramValue "true" }} - {{- $newValue = true }} - {{- else if eq $paramValue "false" }} - {{- $newValue = false }} - {{- else }} - {{- $newValue = $paramValue }} - {{- end }} - {{- $effects = merge $effects (dict $k $newValue) }} - {{- end }} - {{- end }} - {{- with $u.Query.Get "height" }} - {{- $height = . }} - {{- end }} - {{- with $u.Query.Get "width" }} - {{- $width = . }} - {{- end }} -{{- end }} -{{- $classes := slice }} -{{- range $k, $v := $effects }} - {{- if $v }} - {{- if eq (printf "%T" $v) "bool" }} - {{- $classes = $classes | append $k }} - {{- end }} - {{- end }} -{{- end }} -{{- if and .linkObject $effects.inlinecontent (eq .linkObject.MediaType.Type "image/svg+xml") }} - {{- $content := .linkObject.Content | replaceRE `(?s)^\s*<\?.*?\?>\s*` "" }} - {{- $attributes = merge $attributes (dict "content" $content) }} -{{- else if and .linkObject $effects.dataurl }} - {{- $src := printf "data:%s;base64,%s" .linkObject.MediaType.Type (.linkObject.Content | base64Encode) }} - {{- $attributes = merge $attributes (dict "src" $src) }} -{{- else }} - {{- $attributes = merge $attributes (dict "src" .url) }} -{{- end }} -{{- if $attributes.class }}{{ $classes = $classes | append (split $attributes.class " ") }}{{ end }} -{{- $attributes = merge $attributes (dict "class" (delimit $classes " ")) }} -{{- $attributes = merge $attributes (dict "style" (printf " height: %s; width: %s;%s" $height $width (index $attributes "style" | default ""))) }} -{{- if $effects.lazy }}{{ $attributes = merge $attributes (dict "loading" "lazy") }}{{ end }} +{{- $attributes := .attributes | default dict }} +{{- $height := "auto" }} +{{- $width := "auto" }} +{{- $effects := dict "border" false "dataurl" false "inlinecontent" false "lazy" true "lightbox" true "shadow" false }} +{{- if .page.Site.Params.imageeffects }} + {{- $effects = merge $effects .page.Site.Params.imageeffects }} +{{- end }} +{{- if .page.Params.imageEffects }} + {{- $effects = merge $effects .page.Params.imageEffects }} +{{- end }} +{{- $u := urls.Parse .url }} +{{- if $u.RawQuery }} + {{- if $u.Query.Has "classes" }} + {{- $classes := slice | append (split ($u.Query.Get "classes") ",") }} + {{- range $classes }} + {{- $k := . }} + {{- $v := true }} + {{- if strings.HasPrefix $k "no" }} + {{- $k := strings.TrimPrefix "no" $k }} + {{- $v := false }} + {{- end }} + {{- $effects = merge $effects (dict $k $v) }} + {{- end }} + {{- end }} + {{- if $u.Query.Has "featherlight" }} + {{- $filepath := "[virtual file]" }}{{ with and .page .page.File .page.File.Filename }}{{ $filepath = . }}{{ end }} + {{- warnf "%q: DEPRECATED usage of 'featherlight' image CSS class found, use 'lightbox' instead; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/5/#5-11-0" $filepath }} + {{- $effects = merge $effects (dict "lightbox" (ne ($u.Query.Get "featherlight") "false")) }} + {{- end }} + {{- range $k, $v := $effects }} + {{- if $u.Query.Has $k }} + {{- $effects = merge $effects (dict $k (ne ($u.Query.Get $k) "false")) }} + {{- end }} + {{- end }} + {{- range $k, $v := $effects }} + {{- if $u.Query.Has $k }} + {{- $paramValue := $u.Query.Get $k }} + {{- $newValue := true }} + {{- if eq $paramValue "" }} + {{- $newValue = true }} + {{- else if eq $paramValue "true" }} + {{- $newValue = true }} + {{- else if eq $paramValue "false" }} + {{- $newValue = false }} + {{- else }} + {{- $newValue = $paramValue }} + {{- end }} + {{- $effects = merge $effects (dict $k $newValue) }} + {{- end }} + {{- end }} + {{- with $u.Query.Get "height" }} + {{- $height = . }} + {{- end }} + {{- with $u.Query.Get "width" }} + {{- $width = . }} + {{- end }} +{{- end }} +{{- $classes := slice }} +{{- range $k, $v := $effects }} + {{- if $v }} + {{- if eq (printf "%T" $v) "bool" }} + {{- $classes = $classes | append $k }} + {{- end }} + {{- end }} +{{- end }} +{{- if and .linkObject $effects.inlinecontent (eq .linkObject.MediaType.Type "image/svg+xml") }} + {{- $content := .linkObject.Content | replaceRE `(?s)^\s*<\?.*?\?>\s*` "" }} + {{- $attributes = merge $attributes (dict "content" $content) }} +{{- else if and .linkObject $effects.dataurl }} + {{- $src := printf "data:%s;base64,%s" .linkObject.MediaType.Type (.linkObject.Content | base64Encode) }} + {{- $attributes = merge $attributes (dict "src" $src) }} +{{- else }} + {{- $attributes = merge $attributes (dict "src" .url) }} +{{- end }} +{{- if $attributes.class }}{{ $classes = $classes | append (split $attributes.class " ") }}{{ end }} +{{- $attributes = merge $attributes (dict "class" (delimit $classes " ")) }} +{{- $attributes = merge $attributes (dict "style" (printf " height: %s; width: %s;%s" $height $width (index $attributes "style" | default ""))) }} +{{- if $effects.lazy }}{{ $attributes = merge $attributes (dict "loading" "lazy") }}{{ end }} {{- return $attributes }} \ No newline at end of file diff --git a/layouts/partials/_relearn/linkAttributes.gotmpl b/layouts/partials/_relearn/linkAttributes.gotmpl index 275ef167d9..1d5ac8f2a4 100644 --- a/layouts/partials/_relearn/linkAttributes.gotmpl +++ b/layouts/partials/_relearn/linkAttributes.gotmpl @@ -1,72 +1,72 @@ -{{- $attributes := .attributes | default dict }} -{{- /* target will be boolean false if no user defined value was set and effect default should be applied */}} -{{- $target := false }} -{{- $u := urls.Parse .url }} -{{- if $u.IsAbs }} - {{- $attributes = merge $attributes (dict "rel" "external") }} - {{- $target = "_blank" }} - {{- if isset .page.Site.Params "externallinktarget" }} - {{- $target = .page.Site.Params.externalLinkTarget }} - {{- if in (slice "false" false 0) $target }} - {{- $target = "" }} - {{- end }} - {{- if in (slice "true" true 1) $target }} - {{- $target = "_blank" }} - {{- end }} - {{- end }} -{{- end }} -{{- $effects := dict "download" false "target" false }} -{{- if .page.Site.Params.linkeffects }} - {{- $effects = merge $effects .page.Site.Params.linkeffects }} -{{- end }} -{{- if .page.Params.linkeffects }} - {{- $effects = merge $effects .page.Params.linkeffects }} -{{- end }} -{{- $target := .target | default $target }} -{{- if ne (printf "%T" $target) "bool" }} - {{- $effects = merge $effects (dict "target" $target) }} -{{- end }} -{{- if $u.RawQuery }} - {{- if $u.Query.Has "classes" }} - {{- $classes := slice | append (split ($u.Query.Get "classes") ",") }} - {{- range $classes }} - {{- $k := . }} - {{- $v := true }} - {{- if strings.HasPrefix $k "no" }} - {{- $k := strings.TrimPrefix "no" $k }} - {{- $v := false }} - {{- end }} - {{- $effects = merge $effects (dict $k $v) }} - {{- end }} - {{- end }} - {{- range $k, $v := $effects }} - {{- if $u.Query.Has $k }} - {{- $paramValue := $u.Query.Get $k }} - {{- $newValue := true }} - {{- if eq $paramValue "" }} - {{- $newValue = true }} - {{- else if eq $paramValue "true" }} - {{- $newValue = true }} - {{- else if eq $paramValue "false" }} - {{- $newValue = false }} - {{- else }} - {{- $newValue = $paramValue }} - {{- end }} - {{- $effects = merge $effects (dict $k $newValue) }} - {{- end }} - {{- end }} -{{- end }} -{{- $classes := slice }} -{{- range $k, $v := $effects }} - {{- if $v }} - {{- if eq (printf "%T" $v) "bool" }} - {{- $classes = $classes | append $k }} - {{- end }} - {{- end }} -{{- end }} -{{- if $attributes.class }}{{ $classes = $classes | append (split $attributes.class " ") }}{{ end }} -{{- $attributes = merge $attributes (dict "class" (delimit $classes " ")) }} -{{- $attributes = merge $attributes (dict "href" .url) }} -{{- $attributes = merge $attributes (dict "download" $effects.download) }} -{{- $attributes = merge $attributes (dict "target" $effects.target) }} +{{- $attributes := .attributes | default dict }} +{{- /* target will be boolean false if no user defined value was set and effect default should be applied */}} +{{- $target := false }} +{{- $u := urls.Parse .url }} +{{- if $u.IsAbs }} + {{- $attributes = merge $attributes (dict "rel" "external") }} + {{- $target = "_blank" }} + {{- if isset .page.Site.Params "externallinktarget" }} + {{- $target = .page.Site.Params.externalLinkTarget }} + {{- if in (slice "false" false 0) $target }} + {{- $target = "" }} + {{- end }} + {{- if in (slice "true" true 1) $target }} + {{- $target = "_blank" }} + {{- end }} + {{- end }} +{{- end }} +{{- $effects := dict "download" false "target" false }} +{{- if .page.Site.Params.linkeffects }} + {{- $effects = merge $effects .page.Site.Params.linkeffects }} +{{- end }} +{{- if .page.Params.linkeffects }} + {{- $effects = merge $effects .page.Params.linkeffects }} +{{- end }} +{{- $target := .target | default $target }} +{{- if ne (printf "%T" $target) "bool" }} + {{- $effects = merge $effects (dict "target" $target) }} +{{- end }} +{{- if $u.RawQuery }} + {{- if $u.Query.Has "classes" }} + {{- $classes := slice | append (split ($u.Query.Get "classes") ",") }} + {{- range $classes }} + {{- $k := . }} + {{- $v := true }} + {{- if strings.HasPrefix $k "no" }} + {{- $k := strings.TrimPrefix "no" $k }} + {{- $v := false }} + {{- end }} + {{- $effects = merge $effects (dict $k $v) }} + {{- end }} + {{- end }} + {{- range $k, $v := $effects }} + {{- if $u.Query.Has $k }} + {{- $paramValue := $u.Query.Get $k }} + {{- $newValue := true }} + {{- if eq $paramValue "" }} + {{- $newValue = true }} + {{- else if eq $paramValue "true" }} + {{- $newValue = true }} + {{- else if eq $paramValue "false" }} + {{- $newValue = false }} + {{- else }} + {{- $newValue = $paramValue }} + {{- end }} + {{- $effects = merge $effects (dict $k $newValue) }} + {{- end }} + {{- end }} +{{- end }} +{{- $classes := slice }} +{{- range $k, $v := $effects }} + {{- if $v }} + {{- if eq (printf "%T" $v) "bool" }} + {{- $classes = $classes | append $k }} + {{- end }} + {{- end }} +{{- end }} +{{- if $attributes.class }}{{ $classes = $classes | append (split $attributes.class " ") }}{{ end }} +{{- $attributes = merge $attributes (dict "class" (delimit $classes " ")) }} +{{- $attributes = merge $attributes (dict "href" .url) }} +{{- $attributes = merge $attributes (dict "download" $effects.download) }} +{{- $attributes = merge $attributes (dict "target" $effects.target) }} {{- return $attributes }} \ No newline at end of file diff --git a/layouts/partials/version.txt b/layouts/partials/version.txt index 350c1364c0..06a947e82e 100644 --- a/layouts/partials/version.txt +++ b/layouts/partials/version.txt @@ -1 +1 @@ -7.3.2+3ac0206314069cacb7c5585d7271248b8304f4db \ No newline at end of file +7.3.2+f9d00be7b4ca85e6b5c3070b2e1cf3588beeee11 \ No newline at end of file