From 676c7adfc1c64330ca57b119e4bc0af987e6e17a Mon Sep 17 00:00:00 2001 From: "max.mehl" Date: Mon, 9 Mar 2020 14:12:41 +0100 Subject: [PATCH] add and document extra classes and parameters --- README.md | 3 ++- layouts/shortcodes/figure.html | 48 ++++++++++++++++++---------------- static/css/snap-gallery.css | 5 ++++ 3 files changed, 32 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 86adf0e..67638c3 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,8 @@ Specifying your image files: Optional parameters: - All the [features/parameters](https://gohugo.io/content-management/shortcodes/#figure) of Hugo's built-in `figure` shortcode work as normal, i.e. src, link, rel, title, caption, class, attr (attribution), attrlink, alt. width and height might lead to strange results when used inside `{{< gallery >}}`. -- `class` allows you to set any custom classes you want on the `
` tag. +- `class` allows you to set any custom classes you want on the `
` tag. The values `no-border`, `small`, `medium`, `pull-left` and `pull-right` are made available by this project. +- `lightbox` allows you to control the lightbox. The value `none` will disable the lightbox completely. Optional parameters work for standalone `{{< figure >}}` shortcodes and inside of `{{< gallery >}}`. However, they cannot be applied to `{{< snap-dir >}}`. diff --git a/layouts/shortcodes/figure.html b/layouts/shortcodes/figure.html index 3621228..b58b09b 100644 --- a/layouts/shortcodes/figure.html +++ b/layouts/shortcodes/figure.html @@ -40,7 +40,7 @@ {{- with .Get "rel" }} rel="{{ . }}"{{ end -}} > {{ else -}} - + {{ if not (eq (.Get "lightbox") "none") }}{{ end }} {{- end -}} -
- -
- -

- {{- if or (.Get "caption") (.Get "attr") -}} - {{- .Get "caption" | markdownify -}} - {{- with .Get "attrlink" }} {{- end -}} - {{- with .Get "attr" }} {{ . | markdownify}}{{ end -}} - {{- with .Get "attrlink" }}{{- end -}} + {{- if not (eq (.Get "lightbox") "none") -}} +

+ +
+ +

+ {{- if or (.Get "caption") (.Get "attr") -}} + {{- .Get "caption" | markdownify -}} + {{- with .Get "attrlink" }} {{- end -}} + {{- with .Get "attr" }} {{ . | markdownify}}{{ end -}} + {{- with .Get "attrlink" }}{{- end -}} + {{- end }} +

+
+ + {{- if .Parent -}} + {{- if not (eq $figid 1) -}} + + {{- else -}} + + {{- end -}} + + {{- end }} -

- - {{- if .Parent -}} - {{- if not (eq $figid 1) -}} - - {{- else -}} - - {{- end -}} - - - {{- end }} -
+ {{- end -}}
diff --git a/static/css/snap-gallery.css b/static/css/snap-gallery.css index e3a0946..32fcdcf 100644 --- a/static/css/snap-gallery.css +++ b/static/css/snap-gallery.css @@ -56,6 +56,11 @@ figure figcaption { color: #FFF; } +/* Extra classes for figures */ +figure.no-border .snap-wrapper { + box-shadow: none; +} + /** GALLERY MARKUP **/ .snap-gallery { margin: 10px;