1

Introduction du nouveau thème

This commit is contained in:
2025-10-11 00:36:18 +02:00
parent fa5ba208ed
commit 2653b0fa01
112 changed files with 1590 additions and 2766 deletions

View File

@@ -0,0 +1,30 @@
{{- $imageURL := .Get 0 -}}
{{- $alignment := .Get 1 | default "center" -}}
{{- $title := .Get 2 | default "" -}}
{{- $description := .Get 3 | default "" -}}
{{- $attribution := .Get 4 | default "" -}}
{{- $imageURL := printf "%s?raw=true" $imageURL -}}
{{- $remoteImage := resources.GetRemote $imageURL -}}
{{- $hash := md5 $imageURL -}}
{{- $extension := path.Ext $imageURL -}}
{{- $cleanFilename := printf "%s%s" $hash $extension -}}
{{- $cleanFilename := replace $cleanFilename "?raw=true" "" -}}
{{- $localImage := $remoteImage | resources.Copy (printf "remote-images/%s" $cleanFilename) -}}
{{- $width := (cond (eq $alignment "center") "1024x" "500x") -}}
{{- $resizedImage := $localImage.Resize $width -}}
<figure class="custom-image {{ $alignment }}">
<a href="{{ $localImage.RelPermalink }}" title="Cliquez pour agrandir l'image">
<img src="{{ $resizedImage.RelPermalink }}" alt="{{ $title }}" title="{{ $title }}" />
</a>
{{- with $attribution }}
<p class="details">
<strong>Attribution :</strong>
<em>{{ . | markdownify }}</em>
</p>
{{- end }}
{{- with $description }}
<figcaption>
<p>{{ .| markdownify }}</p>
</figcaption>
{{- end }}
</figure>

View File

@@ -0,0 +1,28 @@
{{- $soundData := .Get 0 -}}
{{- $alignment := .Get 1 | default "center" -}}
{{- $dataFile := .Page.Resources.Get (printf "data/sounds/%s.yaml" $soundData) -}}
{{- if $dataFile -}}
{{- $data := $dataFile.Content | transform.Unmarshal -}}
{{- $audio := .Page.Resources.Get $data.file -}}
{{- if $audio -}}
<figure class="custom-sound {{ $alignment }}">
<audio controls preload="metadata">
<source src="{{ $audio.RelPermalink }}">
Votre navigateur ne prend pas en charge la lecture audio.
</audio>
{{- if or $data.title (or $data.description $data.attribution) }}
<figcaption>
{{- with $data.title }}
<p><strong>{{ . }}</strong></p>
{{- end }}
{{- with $data.description }}
<p>{{ . | markdownify }}</p>
{{- end }}
{{- with $data.attribution }}
<p class="details"><strong>Attribution :</strong> <em>{{ . | markdownify }}</em></p>
{{- end }}
</figcaption>
{{- end }}
</figure>
{{- end -}}
{{- end -}}

View File

@@ -0,0 +1,44 @@
{{- $videoData := .Get 0 -}}
{{- $alignment := .Get 1 | default "center" -}}
{{- $dataFile := .Page.Resources.Get (printf "data/videos/%s.yaml" $videoData) -}}
{{- if $dataFile -}}
{{- $data := $dataFile.Content | transform.Unmarshal -}}
{{- $video := .Page.Resources.Get $data.file -}}
{{- if $video -}}
<figure class="custom-video {{ $alignment }}">
<video controls preload="metadata" width="100%">
<source src="{{ $video.RelPermalink }}" type="video/mp4">
Votre navigateur ne prend pas en charge la lecture des vidéos.
</video>
{{- if $data.prompt }}
<details>
<summary>
<strong>Attribution :</strong>
{{- with $data.attribution }}
<em>{{ . | markdownify }}</em>
{{- end }}
</summary>
{{- with $data.prompt }}
<p><strong>Prompt :</strong> <em>{{ . }}</em></p>
{{- end }}
</details>
{{- with $data.description }}
<figcaption>
<p>{{ .| markdownify }}</p>
</figcaption>
{{- end }}
{{- else }}
{{- with $data.attribution }}
<p class="details">
<strong>Attribution :</strong>
<em>{{ . | markdownify }}</em>
</p>
{{- end }}{{- with $data.description }}
<figcaption>
<p>{{ .| markdownify }}</p>
</figcaption>
{{- end }}
{{- end }}
</figure>
{{- end -}}
{{- end -}}