From 7d418a96fe9e9b16cf826e57c6548ffe7d397538 Mon Sep 17 00:00:00 2001 From: Will Faught Date: Mon, 16 Jan 2023 21:56:16 -0800 Subject: [PATCH] Add justify param --- README.md | 15 ++++++++++++--- exampleSite/content/blog/figure-shortcode.md | 4 ++-- layouts/partials/paige/figure.html | 5 +++-- layouts/shortcodes/paige/code.html | 2 ++ layouts/shortcodes/paige/figure.html | 2 ++ layouts/shortcodes/paige/image.html | 2 ++ layouts/shortcodes/paige/quote.html | 2 ++ 7 files changed, 25 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 1df4afcd..f2a563df 100644 --- a/README.md +++ b/README.md @@ -511,7 +511,7 @@ title: Search The `paige/figure` shortcode provides a figure with centered content. ``` -{{< paige/figure align="center" caption="My caption" float="left" >}} +{{< paige/figure align="center" caption="My caption" float="left" justify="center" >}} My content {{< /paige/figure >}} ``` @@ -527,6 +527,8 @@ Parameters:
Optional. Position 0. String. Markdown. Descriptive text that appears centered below the content.
float
Optional. String. Float to one side of its container. Must be start or end.
+
justify
+
Optional. String. Vertical spacing of the figure and caption. Must be start, center, or end. Default is center.
### Quote @@ -534,7 +536,7 @@ Parameters: The `paige/quote` shortcode provides a figure with a centered quotation. ``` -{{< paige/quote align="center" caption="My caption" cite="My citation" float="left" >}} +{{< paige/quote align="center" caption="My caption" cite="My citation" float="left" justify="center" >}} My content {{< /paige/quote >}} ``` @@ -552,6 +554,8 @@ Parameters:
Optional. Position 0. String. Markdown. Citation text that appears centered below the quotation. Must not be used with caption.
float
Optional. String. Float to one side of its container. Must be start or end.
+
justify
+
Optional. String. Vertical spacing of the figure and caption. Must be start, center, or end. Default is center.
### Code @@ -559,7 +563,7 @@ Parameters: The `paige/code` shortcode provides a figure with centered code. ``` -{{< paige/code align="center" caption="My caption" float="left" lang="html" options="linenos=true" >}} +{{< paige/code align="center" caption="My caption" float="left" justify="center" lang="html" options="linenos=true" >}} @@ -580,6 +584,8 @@ Parameters:
Optional. String. Markdown. Descriptive text that appears centered below the code.
float
Optional. String. Float to one side of its container. Must be start or end.
+
justify
+
Optional. String. Vertical spacing of the figure and caption. Must be start, center, or end. Default is center.
lang
Optional. Position 0. String. Chroma language code. Defaults to plaintext. See available codes.
options
@@ -597,6 +603,7 @@ The `paige/image` shortcode provides a figure with a centered image. caption="My caption" float="left" height="10rem" + justify="center" link="https://github.com/willfaught/paige" maxheight="10rem" maxwidth="10rem" @@ -621,6 +628,8 @@ Parameters:
Optional. String. Float to one side of its container. Must be start or end.
height
Optional. String. Image height.
+
justify
+
Optional. String. Vertical spacing of the figure and caption. Must be start, center, or end. Default is center.
link
Optional. String. URL. Image link.
maxheight
diff --git a/exampleSite/content/blog/figure-shortcode.md b/exampleSite/content/blog/figure-shortcode.md index 57d20f45..55191a46 100644 --- a/exampleSite/content/blog/figure-shortcode.md +++ b/exampleSite/content/blog/figure-shortcode.md @@ -57,7 +57,7 @@ Michael was having brunch with Sally Sitwell at a restaurant called Skip Church' Code: ```go-text-template -{{}} +{{}} Michael was having brunch {{}} @@ -66,7 +66,7 @@ Michael was having brunch with Sally Sitwell at a restaurant called Skip Church' Result: -{{< paige/figure caption="Michael was having brunch with Sally Sitwell at a restaurant called Skip Church's Bistro." width="20%" height="15rem" float="end" >}} +{{< paige/figure caption="Michael was having brunch with Sally Sitwell at a restaurant called Skip Church's Bistro." width="20%" height="15rem" float="end" justify="center" >}} Michael was having brunch with Sally Sitwell {{< /paige/figure >}} diff --git a/layouts/partials/paige/figure.html b/layouts/partials/paige/figure.html index 0b212049..73f3a22d 100644 --- a/layouts/partials/paige/figure.html +++ b/layouts/partials/paige/figure.html @@ -5,6 +5,7 @@ {{ $float := .float }} {{ $gap := .gap }} {{ $height := .height }} +{{ $justify := .justify | default "center" }} {{ $maxheight := .maxheight }} {{ $maxwidth := .maxwidth }} {{ $width := .width }} @@ -69,9 +70,9 @@ {{ end }} {{ end }} -
+
{{ if and (not $float) $style }} -
+
{{ end }} {{ if $table }}
diff --git a/layouts/shortcodes/paige/code.html b/layouts/shortcodes/paige/code.html index 4cf58703..403a6a40 100644 --- a/layouts/shortcodes/paige/code.html +++ b/layouts/shortcodes/paige/code.html @@ -2,6 +2,7 @@ {{ $caption := .Get "caption" }} {{ $float := .Get "float" }} {{ $height := .Get "height" }} +{{ $justify := .Get "justify" }} {{ $lang := .Get 0 | default (.Get "lang") | default "plaintext" }} {{ $maxheight := .Get "maxheight" }} {{ $maxwidth := .Get "maxwidth" }} @@ -17,6 +18,7 @@ "float" $float "gap" 2 "height" $height + "justify" $justify "maxheight" $maxheight "maxwidth" $maxwidth "width" $width diff --git a/layouts/shortcodes/paige/figure.html b/layouts/shortcodes/paige/figure.html index 27997c7a..af4c79b3 100644 --- a/layouts/shortcodes/paige/figure.html +++ b/layouts/shortcodes/paige/figure.html @@ -3,6 +3,7 @@ {{ $content := .Inner | markdownify }} {{ $float := .Get "float" }} {{ $height := .Get "height" }} +{{ $justify := .Get "justify" }} {{ $maxheight := .Get "maxheight" }} {{ $maxwidth := .Get "maxwidth" }} {{ $width := .Get "width" }} @@ -14,6 +15,7 @@ "float" $float "gap" 2 "height" $height + "justify" $justify "maxheight" $maxheight "maxwidth" $maxwidth "width" $width diff --git a/layouts/shortcodes/paige/image.html b/layouts/shortcodes/paige/image.html index 7d19cbb4..eab215be 100644 --- a/layouts/shortcodes/paige/image.html +++ b/layouts/shortcodes/paige/image.html @@ -3,6 +3,7 @@ {{ $caption := .Get "caption" }} {{ $float := .Get "float" }} {{ $height := .Get "height" }} +{{ $justify := .Get "justify" }} {{ $link := .Get "link" }} {{ $maxheight := .Get "maxheight" }} {{ $maxwidth := .Get "maxwidth" }} @@ -20,6 +21,7 @@ "float" $float "gap" 2 "height" $height + "justify" $justify "link" $link "maxheight" $maxheight "maxwidth" $maxwidth diff --git a/layouts/shortcodes/paige/quote.html b/layouts/shortcodes/paige/quote.html index 4c75a045..44f39999 100644 --- a/layouts/shortcodes/paige/quote.html +++ b/layouts/shortcodes/paige/quote.html @@ -3,6 +3,7 @@ {{ $content := .Inner | markdownify }} {{ $float := .Get "float" }} {{ $height := .Get "height" }} +{{ $justify := .Get "justify" }} {{ $maxheight := .Get "maxheight" }} {{ $maxwidth := .Get "maxwidth" }} {{ $width := .Get "width" }} @@ -15,6 +16,7 @@ "content" $content "float" $float "height" $height + "justify" $justify "maxheight" $maxheight "maxwidth" $maxwidth "width" $width