diff options
author | Thibaud Lepretre <thibaud.lepretre@gmail.com> | 2021-09-08 12:33:55 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-08 12:33:55 +0300 |
commit | db1b8d77b793ba2910790e0fa2cb9c1a0618b3e0 (patch) | |
tree | 37cf56e33c19b4d943f485d9f77e604a138750c3 | |
parent | 866ffd1207495dded6332136c323523b870d7b48 (diff) | |
parent | 5390383ba853a27652d39f509ffdea03d9535185 (diff) |
Merge pull request #515 from kakawait/fix-gallery-title-with-spaces
Use regexp instead of split
-rw-r--r-- | layouts/partials/post/gallery.html | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/layouts/partials/post/gallery.html b/layouts/partials/post/gallery.html index 220ede6..d8e63fe 100644 --- a/layouts/partials/post/gallery.html +++ b/layouts/partials/post/gallery.html @@ -9,16 +9,16 @@ </div> <div class="image-gallery-photos {{ if gt $galleryLength 2 }}image-gallery-photos--thumbnail{{ end }}"> {{ range $index, $element := .Params.gallery }} - {{ $image := (split $element " ") }} + {{ $image := findRE "[^\\s\"']+|\"([^\"]*)\"|'([^']*)'" $element }} {{ $imageLength := len $image }} <div class="photo-box"> - <a class="photo-box-inner fancybox" + <a class="photo-box-inner fancybox" data-fancybox="gallery-{{ $.File.UniqueID }}" - data-caption="{{ if gt $imageLength 2 }}{{ index $image 2 }}{{ else }}{{ index $image 1 }}{{ end }}" - title="{{ if gt $imageLength 2 }}{{ index $image 2 }}{{ else }}{{ index $image 1 }}{{ end }}" + data-caption="{{ if gt $imageLength 2 }}{{ replace (index $image 2) "\"" "" }}{{ else }}{{ replace (index $image 1) "\"" "" }}{{ end }}" + title="{{ if gt $imageLength 2 }}{{ replace (index $image 2) "\"" "" }}{{ else }}{{ replace (index $image 1) "\"" "" }}{{ end }}" href="{{ index $image 0 }}" aria-label="{{ i18n "global.zoom_in_on_picture" }}"> - {{ if lt $index $GALLERY_IMAGES_DISPLAYED_LIMIT }} + {{ if lt $index $GALLERY_IMAGES_DISPLAYED_LIMIT }} <img class="photo" src="{{ if gt $imageLength 2 }}{{ index $image 1 }}{{ else }}{{ index $image 0 }}{{ end }}"> {{ end }} </a> @@ -27,4 +27,4 @@ </div> </div> {{ end }} -{{ end }}
\ No newline at end of file +{{ end }} |