From 17abad4523f1ee0a9d8c46c4e5233964fc85d9cb Mon Sep 17 00:00:00 2001 From: Will Faught Date: Sat, 8 Apr 2023 21:06:50 -0700 Subject: [PATCH] Add gallery param process --- README.md | 12 +++--------- exampleSite/content/shortcodes/gallery/index.md | 6 +++--- layouts/shortcodes/paige/gallery.html | 12 +++--------- 3 files changed, 9 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 5f299c9e..a0bf2611 100644 --- a/README.md +++ b/README.md @@ -429,14 +429,12 @@ The `paige/gallery` shortcode provides a figure with a collection of images. ``` {{< paige/gallery align="" - format="" height="" images="" justify="" maxheight="" maxwidth="" - method="" - options="" + process="" type="" width="" >}} @@ -450,8 +448,6 @@ Parameters:
align
Optional. String. Cross axis alignment. Must be baseline, center, end, start, or stretch.
-
format
-
Optional. String. Image format. Must be bmp, gif, jpg, png, tiff, or webp. Must not be used with method or options.
height
Optional. String. CSS value. Image height.
images
@@ -462,10 +458,8 @@ Parameters:
Optional. String. CSS value. Maximum image height.
maxwidth
Optional. String. CSS value. Maximum image width.
-
method
-
Optional. String. Hugo image processing method. Must be crop, fill, fit, or resize. Default is resize. See the methods.
-
options
-
Optional. String. Hugo image processing options. Default is 550x webp picture Lanczos. See the options.
+
process
+
Optional. String or boolean. If a string, it is the Hugo image processing methods and options, mixed together. If no method is specified, resize is used. If no image dimensions are given, the originals are used. If a boolean that is true, the Hugo image processing method resize is used, and the default Hugo image processing options are used.
type
Optional. String. Type of layout. Grid and list layouts use the horizontal axis as the main axis, and the vertical axis as the cross axis. Must be grid or list. Default is list.
width
diff --git a/exampleSite/content/shortcodes/gallery/index.md b/exampleSite/content/shortcodes/gallery/index.md index b26a0e53..187b23ca 100644 --- a/exampleSite/content/shortcodes/gallery/index.md +++ b/exampleSite/content/shortcodes/gallery/index.md @@ -197,17 +197,17 @@ Result: {{< paige/gallery images="*-2.jpg" maxwidth="20rem" />}} -## Method and options parameters +## Process parameter Code: ```go-text-template -{{}} +{{}} ``` Result: -{{< paige/gallery images="*-2.jpg" method="fill" options="550x550 r90 webp picture Lanczos" />}} +{{< paige/gallery images="*-2.jpg" process="300x300 center crop lanczos picture r90 webp" />}} ## Type diff --git a/layouts/shortcodes/paige/gallery.html b/layouts/shortcodes/paige/gallery.html index d630b0f7..5d07bb52 100644 --- a/layouts/shortcodes/paige/gallery.html +++ b/layouts/shortcodes/paige/gallery.html @@ -1,12 +1,10 @@ {{ $align := .Get "align" | default "center" }} -{{ $format := .Get "format" }} {{ $height := .Get "height" }} {{ $images := .Get 0 | default (.Get "images") }} {{ $justify := .Get "justify" | default "center" }} {{ $maxheight := .Get "maxheight" }} {{ $maxwidth := .Get "maxwidth" }} -{{ $method := .Get "method" | default "resize" }} -{{ $options := .Get "options" | default "550x webp picture Lanczos" }} +{{ $process := .Get "process" }} {{ $type := .Get "type" | default "rows" }} {{ $width := .Get "width" }} @@ -45,12 +43,10 @@ {{ partial "paige/a.html" (dict "content" (partial "paige/img.html" (dict "class" "img-fluid" - "format" $format "height" $height "maxheight" $maxheight "maxwidth" $maxwidth - "method" $method - "options" $options + "process" $process "resource" . "width" $width )) @@ -70,12 +66,10 @@ {{ partial "paige/a.html" (dict "content" (partial "paige/img.html" (dict "class" "img-fluid" - "format" $format "height" $height "maxheight" $maxheight "maxwidth" $maxwidth - "method" $method - "options" $options + "process" $process "resource" . "width" $width ))