diff --git a/.github/actions/release_milestone/action.yaml b/.github/actions/release_milestone/action.yaml index 901b2c26f4..d84d9c7cf5 100644 --- a/.github/actions/release_milestone/action.yaml +++ b/.github/actions/release_milestone/action.yaml @@ -41,7 +41,7 @@ runs: GITHUB_TOKEN: ${{ inputs.github_token }} GREN_GITHUB_TOKEN: ${{ inputs.github_token }} run: | - echo "$MILESTONE" > layouts/partials/version.html + echo -n "$MILESTONE" > layouts/partials/version.txt npx github-release-notes@0.17.1 changelog --generate --override --tags=all git add * git commit --message "Ship tag $MILESTONE" @@ -71,7 +71,7 @@ runs: GITHUB_TOKEN: ${{ inputs.github_token }} GREN_GITHUB_TOKEN: ${{ inputs.github_token }} run: | - echo "$MILESTONE+tip" > layouts/partials/version.html + echo -n "$MILESTONE+tip" > layouts/partials/version.txt git add * git commit --message "Mark non-release version" git push origin main diff --git a/layouts/_default/index.html b/layouts/_default/index.html index e865a08dd1..f85131ad5e 100644 --- a/layouts/_default/index.html +++ b/layouts/_default/index.html @@ -1 +1 @@ -{{- partial "_main.html" . }} \ No newline at end of file +{{- partial "_main.hugo" . }} \ No newline at end of file diff --git a/layouts/_default/index.json b/layouts/_default/index.json index d329ce355c..c6bcdddb22 100644 --- a/layouts/_default/index.json +++ b/layouts/_default/index.json @@ -1,3 +1,4 @@ +{{- partial "page-meta.hugo" . }} {{- $pages := slice }} {{- range .Site.Pages }} {{- if and .Title (or (ne (.Scratch.Get "relearnIsHiddenStem") true) (ne .Site.Params.disableSearchHiddenPages true) ) }} diff --git a/layouts/_default/list.html b/layouts/_default/list.html index e865a08dd1..f85131ad5e 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -1 +1 @@ -{{- partial "_main.html" . }} \ No newline at end of file +{{- partial "_main.hugo" . }} \ No newline at end of file diff --git a/layouts/_default/rss.xml b/layouts/_default/rss.xml index f2bde74493..d502deb3f2 100644 --- a/layouts/_default/rss.xml +++ b/layouts/_default/rss.xml @@ -1,4 +1,3 @@ -{{- printf "" | safeHTML }} {{- partial "page-meta.hugo" . }} {{- $pages := .Page.Pages }} {{- if .Page.IsHome }} @@ -10,6 +9,7 @@ {{- if ge $limit 0 -}} {{- $pages = $pages | first $limit -}} {{- end }} +{{- printf "" | safeHTML }} {{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index e865a08dd1..f85131ad5e 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -1 +1 @@ -{{- partial "_main.html" . }} \ No newline at end of file +{{- partial "_main.hugo" . }} \ No newline at end of file diff --git a/layouts/_default/sitemap.xml b/layouts/_default/sitemap.xml index 86c52db036..1d95c8bf20 100644 --- a/layouts/_default/sitemap.xml +++ b/layouts/_default/sitemap.xml @@ -1,5 +1,5 @@ -{{ printf "" | safeHTML }} {{- partial "page-meta.hugo" . }} +{{- printf "" | safeHTML }} {{- range .Data.Pages }} {{- if and .Title (or (ne (.Scratch.Get "relearnIsHiddenStem") true) (ne .Site.Params.disableSeoHiddenPages true) ) }} diff --git a/layouts/partials/_main.html b/layouts/partials/_main.html deleted file mode 100644 index f185599f5c..0000000000 --- a/layouts/partials/_main.html +++ /dev/null @@ -1,8 +0,0 @@ -{{- partial "page-meta.hugo" . }} -{{- partial "output-partial.html" (dict "base" "header" "page" . "parameter" .) }} -{{- if not .File }} - {{- partial "output-partial.html" (dict "base" "body" "page" . "parameter" (dict "page" . "content" (partial "initial.html" .))) }} -{{- else }} - {{- partial "output-partial.html" (dict "base" "body" "page" . "parameter" (dict "page" . "content" (partial "output-partial.html" (dict "base" "content" "page" . "parameter" .)))) }} -{{- end }} -{{- partial "output-partial.html" (dict "base" "footer" "page" . "parameter" .) }} \ No newline at end of file diff --git a/layouts/partials/_main.hugo b/layouts/partials/_main.hugo new file mode 100644 index 0000000000..841324685e --- /dev/null +++ b/layouts/partials/_main.hugo @@ -0,0 +1,8 @@ +{{- partial "page-meta.hugo" . }} +{{- partial "output-partial.hugo" (dict "base" "header" "page" . "parameter" .) }} +{{- if not .File }} + {{- partial "output-partial.hugo" (dict "base" "body" "page" . "parameter" (dict "page" . "content" (partial "output-partial.hugo" (dict "base" "initial" "page" . "parameter" .)))) }} +{{- else }} + {{- partial "output-partial.hugo" (dict "base" "body" "page" . "parameter" (dict "page" . "content" (partial "output-partial.hugo" (dict "base" "content" "page" . "parameter" .)))) }} +{{- end }} +{{- partial "output-partial.hugo" (dict "base" "footer" "page" . "parameter" .) }} \ No newline at end of file diff --git a/layouts/partials/archetype.html b/layouts/partials/archetype.hugo similarity index 89% rename from layouts/partials/archetype.html rename to layouts/partials/archetype.hugo index f89770ba60..805e1c3cde 100644 --- a/layouts/partials/archetype.html +++ b/layouts/partials/archetype.hugo @@ -12,4 +12,4 @@ {{- if not (fileExists (printf "/layouts/partials/archetypes/%s" $archetype)) }} {{- $archetype = "default" }} {{- end }} -{{- partial "output-partial.html" (dict "base" (printf "archetypes/%s/%s" $archetype $hook) "page" $page "parameter" $parameter) }} \ No newline at end of file +{{- partial "output-partial.hugo" (dict "base" (printf "archetypes/%s/%s" $archetype $hook) "page" $page "parameter" $parameter) }} \ No newline at end of file diff --git a/layouts/partials/article.html b/layouts/partials/article.html index 13d4d4d132..a3e4708d8e 100644 --- a/layouts/partials/article.html +++ b/layouts/partials/article.html @@ -1,3 +1,3 @@ {{- $page := .page }} {{- $content := .content }} -{{- partial "archetype.html" (dict "hook" "article" "page" $page "parameter" (dict "page" $page "content" $content)) }} \ No newline at end of file +{{- partial "archetype.hugo" (dict "hook" "article" "page" $page "parameter" (dict "page" $page "content" $content)) }} \ No newline at end of file diff --git a/layouts/partials/body.html b/layouts/partials/body.html index 532fd516c1..8c48acf563 100644 --- a/layouts/partials/body.html +++ b/layouts/partials/body.html @@ -1,3 +1,3 @@ {{- $page := .page }} {{- $content := .content }} -{{- partial "single-article.html" (dict "page" $page "content" $content) }} \ No newline at end of file +{{- partial "single-article.hugo" (dict "page" $page "content" $content) }} \ No newline at end of file diff --git a/layouts/partials/body.print.html b/layouts/partials/body.print.html index 869c997450..bb35642354 100644 --- a/layouts/partials/body.print.html +++ b/layouts/partials/body.print.html @@ -1,3 +1,3 @@ {{- $page := .page }} {{- $content := .content }} -{{- partial "nested-article.html" (dict "page" $page) }} \ No newline at end of file +{{- partial "nested-article.hugo" (dict "page" $page) }} \ No newline at end of file diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index 530f466320..f9e57d380b 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -7,7 +7,7 @@ -{{- $wantsMathJax := or (.Page.Store.Get "hasMathJax") (and (.Page.Store.Get (printf "%sIsNested" ((partial "output-format.html" .Page) | lower))) (.Page.Store.Get "nestedHasMathJax")) }} +{{- $wantsMathJax := or (.Page.Store.Get "hasMathJax") (and (.Page.Store.Get (printf "%sIsNested" (partial "output-format.hugo" .Page))) (.Page.Store.Get "nestedHasMathJax")) }} {{- if $wantsMathJax }} {{- if isset .Params "mathjaxinitialize" }} {{- $.Scratch.Set "mathJaxInitialize" .Params.mathJaxInitialize }} @@ -48,7 +48,7 @@ {{- end }} {{- end }} -{{- $wantsMermaid := or (.Page.Store.Get "hasMermaid") (and (.Page.Store.Get (printf "%sIsNested" ((partial "output-format.html" .Page) | lower))) (.Page.Store.Get "nestedHasMermaid")) }} +{{- $wantsMermaid := or (.Page.Store.Get "hasMermaid") (and (.Page.Store.Get (printf "%sIsNested" (partial "output-format.hugo" .Page))) (.Page.Store.Get "nestedHasMermaid")) }} {{- if $wantsMermaid }} {{- if isset .Params "custommermaidurl" }} @@ -78,7 +78,7 @@ useMermaid( JSON.parse({{ $.Scratch.Get "mermaidInitialize" }}) ); {{- end }} -{{- $wantsSwagger := or (.Page.Store.Get "hasSwagger") (and (.Page.Store.Get (printf "%sIsNested" ((partial "output-format.html" .Page) | lower))) (.Page.Store.Get "nestedHasSwagger")) }} +{{- $wantsSwagger := or (.Page.Store.Get "hasSwagger") (and (.Page.Store.Get (printf "%sIsNested" (partial "output-format.hugo" .Page))) (.Page.Store.Get "nestedHasSwagger")) }} {{- if $wantsSwagger }} {{- if isset .Params "customswaggerurl" }} diff --git a/layouts/partials/output-format.html b/layouts/partials/get-format.hugo similarity index 97% rename from layouts/partials/output-format.html rename to layouts/partials/get-format.hugo index 2c1c0b3496..f090146d93 100644 --- a/layouts/partials/output-format.html +++ b/layouts/partials/get-format.hugo @@ -43,4 +43,4 @@ except the current one. */}} {{- end }} {{- end }} -{{- return $current }} \ No newline at end of file +{{- return .OutputFormats.Get $current }} \ No newline at end of file diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 5d85a8ebcd..500b0aeec6 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -25,7 +25,7 @@ {{- partial "stylesheet.html" . }} {{- partial "custom-header.html" . }} - +
@@ -105,7 +105,7 @@ {{- end }}
-
+
{{- partial "tags.html" . }} diff --git a/layouts/partials/initial.html b/layouts/partials/initial.html index d3751801cb..5dc9674eb8 100644 --- a/layouts/partials/initial.html +++ b/layouts/partials/initial.html @@ -1,8 +1 @@ -

Create this Page

-

- You need to create a file for this page. You can either -

-
    -
  • create an _index.md, index.md or otherly named markdown file (depending on Hugo's bundle type) in content folder and fill it with Markdown content
  • -
  • create an index.html file in the static folder and fill the file with HTML content
  • -
\ No newline at end of file +{{- partial "initial.md" . | markdownify }} \ No newline at end of file diff --git a/layouts/partials/initial.md b/layouts/partials/initial.md new file mode 100644 index 0000000000..8a6ddc428a --- /dev/null +++ b/layouts/partials/initial.md @@ -0,0 +1,6 @@ +# Create this Page + +You need to create a file for this page. You can either + +- create an _index.md, index.md or otherly named markdown file (depending on Hugo's bundle type) in *content* folder and fill it with Markdown content +- create an *index.html* file in the static folder and fill the file with HTML content \ No newline at end of file diff --git a/layouts/partials/meta.html b/layouts/partials/meta.html index 83d1fdee7b..67253c0ff2 100644 --- a/layouts/partials/meta.html +++ b/layouts/partials/meta.html @@ -5,8 +5,7 @@ {{- $gen := hugo.Generator }} {{- $gen = replaceRE "\\s*/>$" ">" $gen }} {{ $gen | safeHTML }} - {{- $ver := partial "version.html" }} - {{- $ver = replaceRE "\\s*(\\S*)" "${1}" $ver }} + {{- $ver := partial "version.txt" }} {{- $ver := printf "" "Relearn" $ver }} {{ $ver | safeHTML }} {{- if not (and .Title (or (ne (.Scratch.Get "relearnIsHiddenStem") true) (ne .Site.Params.disableSeoHiddenPages true) ) ) }} diff --git a/layouts/partials/nested-article.html b/layouts/partials/nested-article.hugo similarity index 92% rename from layouts/partials/nested-article.html rename to layouts/partials/nested-article.hugo index 9369f7d3bc..7ba79d104e 100644 --- a/layouts/partials/nested-article.html +++ b/layouts/partials/nested-article.hugo @@ -1,5 +1,5 @@ {{- $page := .page }} -{{- $page.Page.Store.Set (printf "%sIsNested" ((partial "output-format.html" $page) | lower)) true }} +{{- $page.Page.Store.Set (printf "%sIsNested" (partial "output-format.hugo" $page)) true }} {{- with $page }} {{- $currentNode := . }} {{- $isActive := .IsHome }} @@ -92,8 +92,8 @@ {{- $currentNode := .currentnode }} {{- with .sect }} {{- $page := . }} - {{- $content := partial "output-partial.html" (dict "base" "content" "page" . "parameter" $page) }} - {{- partial "output-partial.html" (dict "base" "output-article" "page" $page "parameter" (dict "page" $page "content" $content)) }} + {{- $content := partial "output-partial.hugo" (dict "base" "content" "page" . "parameter" $page) }} + {{- partial "output-partial.hugo" (dict "base" "article" "page" $page "parameter" (dict "page" $page "content" $content)) }} {{- $currentNode.Page.Store.Set "nestedHasMathJax" (or ($currentNode.Page.Store.Get "nestedHasMathJax") (.Page.Store.Get "hasMathJax")) }} {{- $currentNode.Page.Store.Set "nestedHasMermaid" (or ($currentNode.Page.Store.Get "nestedHasMermaid") (.Page.Store.Get "hasMermaid")) }} {{- $currentNode.Page.Store.Set "nestedHasSwagger" (or ($currentNode.Page.Store.Get "nestedHasSwagger") (.Page.Store.Get "hasSwagger")) }} diff --git a/layouts/partials/output-article.html b/layouts/partials/output-article.html deleted file mode 100644 index 20baf10274..0000000000 --- a/layouts/partials/output-article.html +++ /dev/null @@ -1,12 +0,0 @@ -{{- $page := .page }} -{{- $content := .content }} -{{- $r_url := $page.RelPermalink }} -{{- with $page.OutputFormats.Get (partial "output-format.html" $page) }} - {{- $s_url := .RelPermalink }} - {{- if not (eq $s_url $r_url) }} - {{/* if we have a relative link in output formats with a path setting, our URLs are one level to deep; so we are making them absolute to our page by prepending the page's permalink */}} - {{- $link_prefix := strings.TrimRight "/" $page.Page.RelPermalink }} - {{- $content = replaceRE "((?:src|href)\\s*=(?:\\s*[\"']\\s*)?)(\\.[^\"'\\s>]*|[\\w]+[^\"'\\s>:]*)([\"'\\s>])" (printf "${1}%s/${2}${3}" $link_prefix) $content }} - {{- end }} -{{- end }} -{{- partial "output-partial.html" (dict "base" "article" "page" $page "parameter" (dict "page" $page "content" $content)) }} \ No newline at end of file diff --git a/layouts/partials/output-format.hugo b/layouts/partials/output-format.hugo new file mode 100644 index 0000000000..66e9380042 --- /dev/null +++ b/layouts/partials/output-format.hugo @@ -0,0 +1,6 @@ +{{- $format := partial "get-format.hugo" . }} +{{- $ret := "default" }} +{{- if $format }} + {{ $ret = $format.Name | lower }} +{{- end }} +{{- return $ret }} \ No newline at end of file diff --git a/layouts/partials/output-partial.html b/layouts/partials/output-partial.html deleted file mode 100644 index 0901f142f5..0000000000 --- a/layouts/partials/output-partial.html +++ /dev/null @@ -1,10 +0,0 @@ -{{- $base := .base }} -{{- $page := .page }} -{{- $parameter := .parameter }} -{{- if or (not (partial "output-format.html" $page)) (not (fileExists (printf "/layouts/partials/%s.%s.html" $base ((partial "output-format.html" $page) | lower)))) }} - {{- if (fileExists (printf "/layouts/partials/%s.html" $base)) }} - {{- partial (printf "%s.html" $base) $parameter }} - {{- end }} -{{- else }} - {{- partial (printf "%s.%s.html" $base ((partial "output-format.html" $page) | lower)) $parameter }} -{{- end }} \ No newline at end of file diff --git a/layouts/partials/output-partial.hugo b/layouts/partials/output-partial.hugo new file mode 100644 index 0000000000..3e77a4a6d8 --- /dev/null +++ b/layouts/partials/output-partial.hugo @@ -0,0 +1,12 @@ +{{- $base := .base }} +{{- $page := .page }} +{{- $parameter := .parameter }} +{{- $format := partial "output-format.hugo" $page }} +{{- $suffix := partial "output-suffix.hugo" $page }} +{{- if or (not $format) (not (fileExists (printf "/layouts/partials/%s.%s.%s" $base $format $suffix))) }} + {{- if (fileExists (printf "/layouts/partials/%s.%s" $base $suffix)) }} + {{- partial (printf "%s.%s" $base $suffix) $parameter }} + {{- end }} +{{- else }} + {{- partial (printf "%s.%s.%s" $base $format $suffix) $parameter }} +{{- end }} \ No newline at end of file diff --git a/layouts/partials/output-suffix.hugo b/layouts/partials/output-suffix.hugo new file mode 100644 index 0000000000..f237c002e8 --- /dev/null +++ b/layouts/partials/output-suffix.hugo @@ -0,0 +1,8 @@ +{{- $format := partial "get-format.hugo" . }} +{{- $ret := "html" }} +{{- if $format }} + {{- range first 1 $format.MediaType.Suffixes }} + {{- $ret = . }} + {{- end }} +{{- end }} +{{- return $ret }} \ No newline at end of file diff --git a/layouts/partials/page-meta.hugo b/layouts/partials/page-meta.hugo index 8007c48326..0e1b881a44 100644 --- a/layouts/partials/page-meta.hugo +++ b/layouts/partials/page-meta.hugo @@ -5,7 +5,7 @@ {{- $currentNode.Scratch.Delete "relearnIsHiddenNode" }}{{/* the node itself is flagged as hidden */}} {{- $currentNode.Scratch.Delete "relearnIsHiddenStem" }}{{/* the node or one of its parents is flagged as hidden */}} {{- $currentNode.Scratch.Delete "relearnIsHiddenFrom" }}{{/* the node is hidden from the current page */}} -{{- $currentNode.Scratch.Delete (printf "%sWantsMathJax" ((partial "output-format.html" $currentNode) | lower)) }} +{{- $currentNode.Scratch.Delete (printf "%sWantsMathJax" (partial "output-format.hugo" $currentNode)) }} {{- $wantsMathjax := or (and (ne $currentNode.Params.disableMathjax nil) (not $currentNode.Params.disableMathjax)) (and (ne .Site.Params.disableMathjax nil) (not .Site.Params.disableMathjax)) }} {{- if $wantsMathjax }} {{- $currentNode.Store.Set "hasMathJax" true }} diff --git a/layouts/partials/single-article.html b/layouts/partials/single-article.html deleted file mode 100644 index 8dbe95cdc4..0000000000 --- a/layouts/partials/single-article.html +++ /dev/null @@ -1,4 +0,0 @@ -{{- $page := .page }} -{{- $content := .content }} -{{- $page.Page.Store.Set (printf "%sIsNested" ((partial "output-format.html" $page) | lower)) false }} -{{- partial "output-partial.html" (dict "base" "output-article" "page" $page "parameter" (dict "page" $page "content" $content)) }} \ No newline at end of file diff --git a/layouts/partials/single-article.hugo b/layouts/partials/single-article.hugo new file mode 100644 index 0000000000..575e028930 --- /dev/null +++ b/layouts/partials/single-article.hugo @@ -0,0 +1,4 @@ +{{- $page := .page }} +{{- $content := .content }} +{{- $page.Page.Store.Set (printf "%sIsNested" (partial "output-format.hugo" $page)) false }} +{{- partial "output-partial.hugo" (dict "base" "article" "page" $page "parameter" (dict "page" $page "content" $content)) }} \ No newline at end of file diff --git a/layouts/partials/stylesheet.html b/layouts/partials/stylesheet.html index 49c8b79131..56cd2e5a21 100644 --- a/layouts/partials/stylesheet.html +++ b/layouts/partials/stylesheet.html @@ -1,5 +1,5 @@ {{- $assetBusting := not .Site.Params.disableAssetsBusting }} - + {{ "" | safeHTML }} @@ -19,8 +19,8 @@ - {{- if (fileExists (printf "/static/css/format-%s.css" ((partial "output-format.html" .) | lower))) }} - + {{- if (fileExists (printf "/static/css/format-%s.css" (partial "output-format.hugo" .))) }} + {{- end }}