This commit is contained in:
Smaug123
2024-03-13 15:56:24 +00:00
parent a680d7badf
commit ce38f6ba39
3 changed files with 99 additions and 16 deletions

View File

@@ -1,3 +1,6 @@
<details>
{{ $summary := default "Click to view gallery" (.Get "summary") }}
<summary>{{ $summary }}</summary>
<div class="gallery">
{{ $base := .Get "src" }}
{{ $path := print "static/" (.Get "src") }}
@@ -7,7 +10,7 @@
{{- $isthumb := .Name | findRE ($thumbext | printf "%s\\.") }}<!-- is the current file a thumbnail image? -->
{{- $isimg := lower .Name | findRE "\\.(gif|jpg|jpeg|tiff|png|bmp)" }}<!-- is the current file an image? -->
{{- if and $isimg (not $isthumb) }}
{{- $thumb := .Name | replaceRE "(\\.)" ($thumbext | printf "%s.") }}
{{- $thumb := .Name | replaceRE "(\\.[^.]+)" ($thumbext | printf "%s.jpg") }}
{{- $alttextfile := .Name | replaceRE "(\\..+)" ".md" }}
{{- $alttext := printf "%s/%s" $path $alttextfile | os.ReadFile }}
<a data-fancybox="gallery" href="/{{ $base }}/{{ .Name }}">
@@ -15,4 +18,5 @@
</a>
{{- end }}
{{ end }}
</div>
</div>
</details>