1

Adapte le rapport des liens morts au nouveau format

This commit is contained in:
2026-03-29 18:13:02 +02:00
parent 5a857f43a2
commit d476c1a8dc
4 changed files with 60 additions and 24 deletions

View File

@@ -32,18 +32,34 @@
{{- $links := slice -}} {{- $links := slice -}}
{{- range $sourceLinks -}} {{- range $sourceLinks -}}
{{- $status := "" -}} {{- $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" -}} {{- with index . "status" -}}
{{- $status = printf "%v" . -}} {{- $statusText = printf "%v" . -}}
{{- end -}} {{- end -}}
{{- if eq $status "" -}}
{{- with index . "code" -}}
{{- $status = printf "%v" . -}}
{{- end -}} {{- end -}}
{{- $status := "" -}}
{{- with $code -}}
{{- $status = . -}}
{{- end -}}
{{- if and (eq $status "") (ne $statusText "") -}}
{{- $status = $statusText -}}
{{- end -}} {{- end -}}
{{- $links = $links | append (dict {{- $links = $links | append (dict
"url" (default "" (index . "url")) "url" (default "" (index . "url"))
"code" $code
"statusText" $statusText
"status" $status "status" $status
"locations" (default (slice) (index . "locations")) "locations" (default (slice) (index . "locations"))
"errorType" (default "" (index . "errorType")) "errorType" (default "" (index . "errorType"))

View File

@@ -32,18 +32,34 @@
{{- $links := slice -}} {{- $links := slice -}}
{{- range $sourceLinks -}} {{- range $sourceLinks -}}
{{- $status := "" -}} {{- $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" -}} {{- with index . "status" -}}
{{- $status = printf "%v" . -}} {{- $statusText = printf "%v" . -}}
{{- end -}} {{- end -}}
{{- if eq $status "" -}}
{{- with index . "code" -}}
{{- $status = printf "%v" . -}}
{{- end -}} {{- end -}}
{{- $status := "" -}}
{{- with $code -}}
{{- $status = . -}}
{{- end -}}
{{- if and (eq $status "") (ne $statusText "") -}}
{{- $status = $statusText -}}
{{- end -}} {{- end -}}
{{- $links = $links | append (dict {{- $links = $links | append (dict
"url" (default "" (index . "url")) "url" (default "" (index . "url"))
"code" $code
"statusText" $statusText
"status" $status "status" $status
"locations" (default (slice) (index . "locations")) "locations" (default (slice) (index . "locations"))
"errorType" (default "" (index . "errorType")) "errorType" (default "" (index . "errorType"))

View File

@@ -16,15 +16,15 @@
<table> <table>
<thead> <thead>
<tr> <tr>
<th>URL</th>
<th>Emplacements</th> <th>Emplacements</th>
<th>Statut</th> <th>URL</th>
<th>Code</th>
<th>Détails</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{{- range $links -}} {{- range $links -}}
<tr> <tr>
<td><a href="{{ .url }}" rel="noreferrer noopener" target="_blank">{{ .url }}</a></td>
<td> <td>
{{- $locations := default (slice) .locations -}} {{- $locations := default (slice) .locations -}}
{{- if gt (len $locations) 0 -}} {{- if gt (len $locations) 0 -}}
@@ -74,7 +74,9 @@
<em>Emplacements inconnus</em> <em>Emplacements inconnus</em>
{{- end -}} {{- end -}}
</td> </td>
<td><code>{{ .status }}</code></td> <td><a href="{{ .url }}" rel="noreferrer noopener" target="_blank">{{ .url }}</a></td>
<td>{{ with .code }}<code>{{ . }}</code>{{ end }}</td>
<td>{{ with .statusText }}<code>{{ . }}</code>{{ end }}</td>
</tr> </tr>
{{- end -}} {{- end -}}
</tbody> </tbody>

View File

@@ -17,17 +17,15 @@
<table> <table>
<thead> <thead>
<tr> <tr>
<th>URL</th>
<th>Emplacements</th> <th>Emplacements</th>
<th>Statut</th> <th>URL</th>
<th>Code</th>
<th>Détails</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{{- range $links }} {{- range $links }}
<tr> <tr>
<td>
<a href="{{ .url }}" rel="noreferrer noopener" target="_blank">{{ .url }}</a>
</td>
<td> <td>
{{- $locations := default (slice) .locations -}} {{- $locations := default (slice) .locations -}}
{{- if gt (len $locations) 0 -}} {{- if gt (len $locations) 0 -}}
@@ -62,7 +60,11 @@
<em>Emplacements inconnus</em> <em>Emplacements inconnus</em>
{{- end -}} {{- end -}}
</td> </td>
<td><code>{{ .status }}</code></td> <td>
<a href="{{ .url }}" rel="noreferrer noopener" target="_blank">{{ .url }}</a>
</td>
<td>{{ with .code }}<code>{{ . }}</code>{{ end }}</td>
<td>{{ with .statusText }}<code>{{ . }}</code>{{ end }}</td>
</tr> </tr>
{{- end }} {{- end }}
</tbody> </tbody>