From d0024703a9adae3a729db87701787dcc2816e1d8 Mon Sep 17 00:00:00 2001 From: Bruno Grossniklaus Date: Wed, 10 Jan 2018 12:07:38 +0100 Subject: [PATCH 1/4] fix figure (allow dots in path and filename) --- layouts/shortcodes/figure.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/layouts/shortcodes/figure.html b/layouts/shortcodes/figure.html index 4c6ff1f..1acb406 100644 --- a/layouts/shortcodes/figure.html +++ b/layouts/shortcodes/figure.html @@ -7,7 +7,8 @@ {{- if not ($.Page.Scratch.Get "figurecount") }}{{ end }} {{- $.Page.Scratch.Add "figurecount" 1 -}} -{{- $thumb := .Get "src" | default (printf "%s." (.Get "thumb") | replace (.Get "link") ".") }} +{{- $filetype := index (findRE "[^.]+$" (.Get "link") ) 0 }} +{{- $thumb := .Get "src" | default (printf "%s.%s" (replaceRE "\\.[^.]+$" (.Get "thumb") (.Get "link") ) $filetype ) | relURL }}
From f70e710f0f156489b8ad741592be87ba32060640 Mon Sep 17 00:00:00 2001 From: Bruno Grossniklaus Date: Wed, 10 Jan 2018 12:25:59 +0100 Subject: [PATCH 2/4] fix gallery (allow dots in path and filename) --- layouts/shortcodes/gallery.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/layouts/shortcodes/gallery.html b/layouts/shortcodes/gallery.html index aac2ace..594cdb7 100644 --- a/layouts/shortcodes/gallery.html +++ b/layouts/shortcodes/gallery.html @@ -18,7 +18,8 @@ {{- if and $isimg (not $isthumb) }} {{- $caption := .Name | replaceRE "\\..*" "" | humanize }} {{- $linkURL := print $baseURL ($.Get "dir") "/" .Name | absURL }} - {{- $thumb := .Name | replaceRE "(\\.)" ($thumbext | printf "%s.") }} + {{- $filetype := index (findRE "[^.]+$" .Name ) 0 }} + {{- $thumb := .Name | replaceRE "\\.[^.]+$" (printf "%s.%s" $thumbext $filetype) }} {{- $thumbexists := where $files "Name" $thumb }} {{- $thumbURL := print $baseURL ($.Get "dir") "/" $thumb | absURL }}
From 956b7a34cebcb6fc1c98b177cbf6576f8030ea54 Mon Sep 17 00:00:00 2001 From: Bruno Grossniklaus Date: Wed, 10 Jan 2018 13:03:41 +0100 Subject: [PATCH 3/4] untabify --- layouts/shortcodes/gallery.html | 60 ++++++++++++++++----------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/layouts/shortcodes/gallery.html b/layouts/shortcodes/gallery.html index 594cdb7..710c6c3 100644 --- a/layouts/shortcodes/gallery.html +++ b/layouts/shortcodes/gallery.html @@ -7,36 +7,36 @@ {{- $.Page.Scratch.Add "figurecount" 1 }} {{ $baseURL := .Site.BaseURL }} From 52adf4ffb8bccb09b991ea72009dd2f1889a4de7 Mon Sep 17 00:00:00 2001 From: Bruno Grossniklaus Date: Thu, 11 Jan 2018 08:52:38 +0100 Subject: [PATCH 4/4] fix baseurl issue (relURL) --- layouts/shortcodes/figure.html | 6 +++--- layouts/shortcodes/gallery.html | 2 +- layouts/shortcodes/load-photoswipe-theme.html | 4 ++-- layouts/shortcodes/load-photoswipe.html | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/layouts/shortcodes/figure.html b/layouts/shortcodes/figure.html index 1acb406..8005cab 100644 --- a/layouts/shortcodes/figure.html +++ b/layouts/shortcodes/figure.html @@ -4,17 +4,17 @@ Documentation and licence at https://github.com/liwenyip/hugo-easy-gallery/ --> -{{- if not ($.Page.Scratch.Get "figurecount") }}{{ end }} +{{- if not ($.Page.Scratch.Get "figurecount") }}{{ end }} {{- $.Page.Scratch.Add "figurecount" 1 -}} {{- $filetype := index (findRE "[^.]+$" (.Get "link") ) 0 }} {{- $thumb := .Get "src" | default (printf "%s.%s" (replaceRE "\\.[^.]+$" (.Get "thumb") (.Get "link") ) $filetype ) | relURL }}
-
+
- {{ with .Get "link" | default (.Get "src") }}{{ end }} + {{ with .Get "link" | default (.Get "src") }}{{ end }} {{- if or (or (.Get "title") (.Get "caption")) (.Get "attr")}}
{{- with .Get "title" }}

{{.}}

{{ end }} diff --git a/layouts/shortcodes/gallery.html b/layouts/shortcodes/gallery.html index 710c6c3..70422e8 100644 --- a/layouts/shortcodes/gallery.html +++ b/layouts/shortcodes/gallery.html @@ -3,7 +3,7 @@ Documentation and licence at https://github.com/liwenyip/hugo-easy-gallery/ --> -{{- if not ($.Page.Scratch.Get "figurecount") }}{{ end }} +{{- if not ($.Page.Scratch.Get "figurecount") }}{{ end }} {{- $.Page.Scratch.Add "figurecount" 1 }} {{ $baseURL := .Site.BaseURL }}
-{{ end }} \ No newline at end of file +{{ end }} diff --git a/layouts/shortcodes/load-photoswipe.html b/layouts/shortcodes/load-photoswipe.html index 9eec863..dab63b0 100644 --- a/layouts/shortcodes/load-photoswipe.html +++ b/layouts/shortcodes/load-photoswipe.html @@ -13,7 +13,7 @@ - If your template already loads jQuery in the footer, then you could load load-photoswipe.js from the footer instead --> - + @@ -68,4 +68,4 @@
-{{ end }} \ No newline at end of file +{{ end }}