1

Extraire les partiels de calcul du thème 2026

This commit is contained in:
2026-04-04 01:34:49 +02:00
parent 9f381c3e56
commit 5c2235b6bb
6 changed files with 0 additions and 74 deletions

View File

@@ -1,74 +0,0 @@
{{- $reportPath := "data/external_links.yaml" -}}
{{- $report := dict -}}
{{- if reflect.IsMap . -}}
{{- with index . "ReportPath" -}}
{{- $reportPath = . -}}
{{- end -}}
{{- with index . "Report" -}}
{{- $report = . -}}
{{- end -}}
{{- else if . -}}
{{- $report = . -}}
{{- end -}}
{{- if eq (len $report) 0 -}}
{{- if eq $reportPath "data/external_links.yaml" -}}
{{- with index site.Data "external_links" -}}
{{- $report = . -}}
{{- end -}}
{{- else if fileExists $reportPath -}}
{{- $report = transform.Unmarshal (readFile $reportPath) -}}
{{- end -}}
{{- end -}}
{{- $sourceLinks := slice -}}
{{- with index $report "deadLinks" -}}
{{- $sourceLinks = . -}}
{{- end -}}
{{- if and (eq (len $sourceLinks) 0) (isset $report "links") -}}
{{- $sourceLinks = default (slice) (index $report "links") -}}
{{- end -}}
{{- $links := slice -}}
{{- range $sourceLinks -}}
{{- $code := "" -}}
{{- if isset . "code" -}}
{{- $rawCode := index . "code" -}}
{{- if ne $rawCode nil -}}
{{- $code = printf "%v" $rawCode -}}
{{- end -}}
{{- end -}}
{{- $statusText := "" -}}
{{- with index . "statusText" -}}
{{- $statusText = printf "%v" . -}}
{{- end -}}
{{- if eq $statusText "" -}}
{{- with index . "status" -}}
{{- $statusText = printf "%v" . -}}
{{- end -}}
{{- end -}}
{{- $status := "" -}}
{{- with $code -}}
{{- $status = . -}}
{{- end -}}
{{- if and (eq $status "") (ne $statusText "") -}}
{{- $status = $statusText -}}
{{- end -}}
{{- $links = $links | append (dict
"url" (default "" (index . "url"))
"code" $code
"statusText" $statusText
"status" $status
"locations" (default (slice) (index . "locations"))
"errorType" (default "" (index . "errorType"))
"checkedAt" (default "" (index . "checkedAt"))
) -}}
{{- end -}}
{{- return (dict
"generatedAt" (default "" (index $report "generatedAt"))
"entries" (default (dict) (index $report "entries"))
"links" $links
) -}}