diff --git a/README.md b/README.md index 247395e2..42826349 100644 --- a/README.md +++ b/README.md @@ -482,7 +482,7 @@ Parameters:
process
Optional. String. Hugo image processing methods and options, mixed together, for the displayed image. If no method is specified, resize is used. If no image dimensions are specified, the originals are used. If it is default, the default options are used.
type
-
Optional. String. Type of layout. Must be grid or rows (default).
+
Optional. String. Type of layout. Must be filled-rows, grid, or rows (default).
width
Optional. String. CSS value. Image width.
diff --git a/exampleSite/content/shortcodes/gallery/index.md b/exampleSite/content/shortcodes/gallery/index.md index ab25878a..8cb3d7df 100644 --- a/exampleSite/content/shortcodes/gallery/index.md +++ b/exampleSite/content/shortcodes/gallery/index.md @@ -309,6 +309,18 @@ Result: Code: +```go-text-template +{{}} +``` + +Result: + +{{< paige/gallery images="*.jpg" maxheight="10rem" type="filled-rows" />}} + +--- + +Code: + ```go-text-template {{}} ``` diff --git a/layouts/partials/paige/image.html b/layouts/partials/paige/image.html index 7777b768..5377249e 100644 --- a/layouts/partials/paige/image.html +++ b/layouts/partials/paige/image.html @@ -16,21 +16,13 @@ {{ $sizes := $params.sizes }} {{ $src := $params.src }} {{ $srcset := $params.srcset }} +{{ $style := $params.style }} {{ $title := $params.title }} {{ $width := $params.width }} {{ $intrinsicheight := "" }} {{ $intrinsicwidth := "" }} -{{ if $class }} - {{ $class = split $class " " }} -{{ else }} - {{ $class = slice }} -{{ end }} - -{{ $class = $class | append "img-fluid" | uniq | sort }} -{{ $class = delimit $class " " }} - {{ if and (or $height $maxheight) (not (or $maxwidth $width)) }} {{ $width = "auto" }} {{ end }} @@ -39,7 +31,23 @@ {{ $height = "auto" }} {{ end }} -{{ $style := slice }} +{{ if $style }} + {{ $mapped := slice }} + + {{ range split $style ";" }} + {{ $s := . | strings.TrimLeft " " | strings.TrimRight " " }} + + {{ if not $s }} + {{ continue }} + {{ end }} + + {{ $mapped = $mapped | append $s }} + {{ end }} + + {{ $style = $mapped }} +{{ else }} + {{ $style = slice }} +{{ end }} {{ if $height }} {{ $style = $style | append (print "height: " $height) }} @@ -57,7 +65,7 @@ {{ $style = $style | append (print "width: " $width) }} {{ end }} -{{ $style = delimit $style "; " }} +{{ $style = delimit ($style | uniq | sort) "; " }} {{ if and (not $resource) $src }} {{ $resource = partial "paige/resource.html" $src }} @@ -277,4 +285,4 @@ {{ $content = partial "paige/a.html" (dict "content" $content "href" $link) }} {{ end }} -
{{ $content }}
+{{ $content }} diff --git a/layouts/shortcodes/paige/gallery.html b/layouts/shortcodes/paige/gallery.html index c0fb5f14..4b4d4142 100644 --- a/layouts/shortcodes/paige/gallery.html +++ b/layouts/shortcodes/paige/gallery.html @@ -37,7 +37,30 @@ {{ end }}