From dac4cbecc15f923210b0b89654c1c5fb7f716e7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Weber?= Date: Sun, 16 Feb 2025 00:29:04 +0100 Subject: [PATCH] chore: even more Unix line feed conversion --- layouts/partials/_relearn/linkObject.gotmpl | 94 +++++++++---------- .../partials/_relearn/urlErrorReport.gotmpl | 44 ++++----- layouts/partials/version.txt | 2 +- 3 files changed, 70 insertions(+), 70 deletions(-) diff --git a/layouts/partials/_relearn/linkObject.gotmpl b/layouts/partials/_relearn/linkObject.gotmpl index 7a08aa31c2..c9b2ab15e7 100644 --- a/layouts/partials/_relearn/linkObject.gotmpl +++ b/layouts/partials/_relearn/linkObject.gotmpl @@ -1,48 +1,48 @@ -{{- $page := .page }} -{{- $linkObject := "" }} -{{- $u := urls.Parse .url }} -{{- $path := strings.TrimPrefix "./" $u.Path }} -{{- $searchLocal := .searchLocal | default true }} -{{- $searchGlobal := .searchGlobal | default true }} -{{- $searchPage := .searchPage | default true }} -{{- $searchResource := .searchResource | default true }} -{{- if $path }} - {{- with or - (and $searchLocal $searchPage ($page.Page.GetPage $path)) - (and $searchLocal $searchPage ($page.Page.GetPage (strings.TrimRight "/" $path))) - (and $searchGlobal $searchPage (site.GetPage $path)) - (and $searchGlobal $searchPage (site.GetPage (strings.TrimRight "/" $path))) - (and $searchLocal $searchResource ($page.Page.Resources.Get $path)) - (and $searchGlobal $searchResource (resources.Get $path)) - }} - {{- $linkObject = . }} - {{- else }} - {{- /* is it a link into another translation? */}} - {{- if strings.HasPrefix $path "/" }} - {{- range $page.AllTranslations }} - {{- $lang := .Language.Lang }} - {{- $prefix := printf "/%s" $lang }} - {{- $suffix := strings.TrimPrefix $prefix $path | default "/" }} - {{- /* with the second check we check if the prefix was finished; - eg. /pir/index.html vs. /pirate/index.html, were the latter is - an external address outside of this site */}} - {{- if and (strings.HasPrefix $path $prefix) (strings.HasPrefix $suffix "/") }} - {{- with or - (and $searchLocal $searchPage (.GetPage $suffix)) - (and $searchLocal $searchPage (.GetPage (strings.TrimRight "/" $suffix))) - (and $searchGlobal $searchPage (site.GetPage $path)) - (and $searchGlobal $searchPage (site.GetPage (strings.TrimRight "/" $path))) - (and $searchLocal $searchResource (.Resources.Get $suffix)) - (and $searchGlobal $searchResource (resources.Get $suffix)) - }} - {{- $linkObject = . }} - {{- break }} - {{- end }} - {{- end }} - {{- end }} - {{- end }} - {{- end }} -{{- else }} - {{- $linkObject = $page.Page }} -{{- end }} +{{- $page := .page }} +{{- $linkObject := "" }} +{{- $u := urls.Parse .url }} +{{- $path := strings.TrimPrefix "./" $u.Path }} +{{- $searchLocal := .searchLocal | default true }} +{{- $searchGlobal := .searchGlobal | default true }} +{{- $searchPage := .searchPage | default true }} +{{- $searchResource := .searchResource | default true }} +{{- if $path }} + {{- with or + (and $searchLocal $searchPage ($page.Page.GetPage $path)) + (and $searchLocal $searchPage ($page.Page.GetPage (strings.TrimRight "/" $path))) + (and $searchGlobal $searchPage (site.GetPage $path)) + (and $searchGlobal $searchPage (site.GetPage (strings.TrimRight "/" $path))) + (and $searchLocal $searchResource ($page.Page.Resources.Get $path)) + (and $searchGlobal $searchResource (resources.Get $path)) + }} + {{- $linkObject = . }} + {{- else }} + {{- /* is it a link into another translation? */}} + {{- if strings.HasPrefix $path "/" }} + {{- range $page.AllTranslations }} + {{- $lang := .Language.Lang }} + {{- $prefix := printf "/%s" $lang }} + {{- $suffix := strings.TrimPrefix $prefix $path | default "/" }} + {{- /* with the second check we check if the prefix was finished; + eg. /pir/index.html vs. /pirate/index.html, were the latter is + an external address outside of this site */}} + {{- if and (strings.HasPrefix $path $prefix) (strings.HasPrefix $suffix "/") }} + {{- with or + (and $searchLocal $searchPage (.GetPage $suffix)) + (and $searchLocal $searchPage (.GetPage (strings.TrimRight "/" $suffix))) + (and $searchGlobal $searchPage (site.GetPage $path)) + (and $searchGlobal $searchPage (site.GetPage (strings.TrimRight "/" $path))) + (and $searchLocal $searchResource (.Resources.Get $suffix)) + (and $searchGlobal $searchResource (resources.Get $suffix)) + }} + {{- $linkObject = . }} + {{- break }} + {{- end }} + {{- end }} + {{- end }} + {{- end }} + {{- end }} +{{- else }} + {{- $linkObject = $page.Page }} +{{- end }} {{- return $linkObject }} \ No newline at end of file diff --git a/layouts/partials/_relearn/urlErrorReport.gotmpl b/layouts/partials/_relearn/urlErrorReport.gotmpl index 17bf37bc80..928094bf01 100644 --- a/layouts/partials/_relearn/urlErrorReport.gotmpl +++ b/layouts/partials/_relearn/urlErrorReport.gotmpl @@ -1,23 +1,23 @@ -{{- $pageParam := index .page.Params .param }} -{{- $siteParam := index site.Params .param }} -{{- $applyErrorIgnore := .applyErrorIgnore | default true }} -{{- $errorlevel := or (and $pageParam $pageParam.errorlevel) (and $siteParam $siteParam.errorlevel) }} -{{- $errorignore := slice | append (.page.Params.errorignore | default slice ) | append (site.Params.errorignore | default slice ) }} -{{- if and (eq $errorlevel "warning") (partial "inline/show-error" (dict "errorignore" $errorignore "url" .url "applyErrorIgnore" $applyErrorIgnore)) }} - {{- warnf .msg }} -{{- else if and (eq $errorlevel "error") (partial "inline/show-error" (dict "errorignore" $errorignore "url" .url "applyErrorIgnore" $applyErrorIgnore)) }} - {{- errorf .msg }} -{{- end }} - -{{- define "partials/inline/show-error" }} - {{- $ret := true }} - {{- if .applyErrorIgnore }} - {{- range .errorignore }} - {{- if findRE . $.url 1 }} - {{- $ret = false }} - {{- break }} - {{- end }} - {{- end }} - {{- end }} - {{- return $ret }} +{{- $pageParam := index .page.Params .param }} +{{- $siteParam := index site.Params .param }} +{{- $applyErrorIgnore := .applyErrorIgnore | default true }} +{{- $errorlevel := or (and $pageParam $pageParam.errorlevel) (and $siteParam $siteParam.errorlevel) }} +{{- $errorignore := slice | append (.page.Params.errorignore | default slice ) | append (site.Params.errorignore | default slice ) }} +{{- if and (eq $errorlevel "warning") (partial "inline/show-error" (dict "errorignore" $errorignore "url" .url "applyErrorIgnore" $applyErrorIgnore)) }} + {{- warnf .msg }} +{{- else if and (eq $errorlevel "error") (partial "inline/show-error" (dict "errorignore" $errorignore "url" .url "applyErrorIgnore" $applyErrorIgnore)) }} + {{- errorf .msg }} +{{- end }} + +{{- define "partials/inline/show-error" }} + {{- $ret := true }} + {{- if .applyErrorIgnore }} + {{- range .errorignore }} + {{- if findRE . $.url 1 }} + {{- $ret = false }} + {{- break }} + {{- end }} + {{- end }} + {{- end }} + {{- return $ret }} {{- end }} \ No newline at end of file diff --git a/layouts/partials/version.txt b/layouts/partials/version.txt index d143342d5c..7d62bdfb51 100644 --- a/layouts/partials/version.txt +++ b/layouts/partials/version.txt @@ -1 +1 @@ -7.3.2+6499d96e5261ebca9761a7d620dac5c062363f57 \ No newline at end of file +7.3.2+177d2329cbbe503311ea40321dd704ea104d6792 \ No newline at end of file