From c578d235d21870fe780add7db73c0f04630816b4 Mon Sep 17 00:00:00 2001 From: Will Faught Date: Sat, 14 Jan 2023 21:10:46 -0800 Subject: [PATCH] Consolidate figure designs --- exampleSite/content/blog/figure-shortcode.md | 44 +++++++++++++-- layouts/partials/paige/figure.html | 30 ++++++----- layouts/partials/paige/image-figure.html | 49 ++++++----------- layouts/shortcodes/paige/gallery.html | 56 ++++++++++---------- layouts/shortcodes/paige/quote.html | 42 +++++++++------ 5 files changed, 126 insertions(+), 95 deletions(-) diff --git a/exampleSite/content/blog/figure-shortcode.md b/exampleSite/content/blog/figure-shortcode.md index e0cf0741..fe112551 100644 --- a/exampleSite/content/blog/figure-shortcode.md +++ b/exampleSite/content/blog/figure-shortcode.md @@ -40,6 +40,42 @@ Don't believe everything you read on the Internet. Code: +```go-text-template +{{}} +Michael was having brunch with Sally Sitwell at a restaurant called Skip Church's Bistro. In addition to brunch, the restaurant was known for an item on the menu called the "Skip's Scramble", an omelet that contained everything on the menu. Do not order the Skip's Scramble. You might enjoy this. Oh. Em. Gee. That's amazing. It feels good to be back in a queen! I need a tea to give my dingle less tingle. Teamocil. Heyyyyyy Uncle Father Oscar. +{{}} +``` + +Result: + +{{< paige/figure caption="Abraham Lincoln" >}} +Michael was having brunch with Sally Sitwell at a restaurant called Skip Church's Bistro. In addition to brunch, the restaurant was known for an item on the menu called the "Skip's Scramble", an omelet that contained everything on the menu. Do not order the Skip's Scramble. You might enjoy this. Oh. Em. Gee. That's amazing. It feels good to be back in a queen! I need a tea to give my dingle less tingle. Teamocil. Heyyyyyy Uncle Father Oscar. +{{< /paige/figure >}} + +--- + +Code: + +```go-text-template +{{}} +Michael was having brunch +{{}} + +Michael was having brunch with Sally Sitwell at a restaurant called Skip Church's Bistro. In addition to brunch, the restaurant was known for an item on the menu called the "Skip's Scramble", an omelet that contained everything on the menu. Do not order the Skip's Scramble. You might enjoy this. Oh. Em. Gee. That's amazing. It feels good to be back in a queen! I need a tea to give my dingle less tingle. Teamocil. Heyyyyyy Uncle Father Oscar. +``` + +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" >}} +Michael was having brunch with Sally Sitwell +{{< /paige/figure >}} + +Michael was having brunch with Sally Sitwell at a restaurant called Skip Church's Bistro. In addition to brunch, the restaurant was known for an item on the menu called the "Skip's Scramble", an omelet that contained everything on the menu. Do not order the Skip's Scramble. You might enjoy this. Oh. Em. Gee. That's amazing. It feels good to be back in a queen! I need a tea to give my dingle less tingle. Teamocil. Heyyyyyy Uncle Father Oscar. + +--- + +Code: + ```go-text-template {{}} Don't believe everything you read on the Internet. @@ -62,24 +98,24 @@ Code: ```go-text-template {{}} -
+
Hickory dickory dock. The mouse ran up the clock. The clock struck one, The mouse ran down, Hickory dickory dock. -
+ {{}} ``` Result: {{< paige/figure caption="Hickory Dickory Dock" >}} -
+
Hickory dickory dock. The mouse ran up the clock. The clock struck one, The mouse ran down, Hickory dickory dock. -
+ {{< /paige/figure >}} diff --git a/layouts/partials/paige/figure.html b/layouts/partials/paige/figure.html index b98755bb..b632192a 100644 --- a/layouts/partials/paige/figure.html +++ b/layouts/partials/paige/figure.html @@ -48,26 +48,28 @@ {{ end }} {{ end }} -{{ $margins := "" }} +{{ $margin := "" }} {{ if $float }} {{ if eq $float "start" }} - {{ $margins = "me-4" }} + {{ $margin = "me-4" }} {{ else if eq $float "end" }} - {{ $margins = "ms-4" }} + {{ $margin = "ms-4" }} {{ else }} {{ errorf "invalid float: %q" $float }} {{ end }} {{ end }} -
- {{ with $style }} -
- {{ end }} -
{{ $content }}
- {{ with $caption }} -
{{ . }}
- {{ end }} - {{ if $style }} -
- {{ end }} +
+
+ {{ if $float }} +
+ {{ end }} +
{{ $content }}
+ {{ with $caption }} +
{{ . }}
+ {{ end }} + {{ if $float }} +
+ {{ end }} +
diff --git a/layouts/partials/paige/image-figure.html b/layouts/partials/paige/image-figure.html index 03fb6d77..138dc5f1 100644 --- a/layouts/partials/paige/image-figure.html +++ b/layouts/partials/paige/image-figure.html @@ -7,6 +7,7 @@ {{ $maxwidth := .maxwidth }} {{ $method := .method }} {{ $options := .options }} +{{ $packed := .packed }} {{ $page := .page }} {{ $resource := .resource }} {{ $src := .src }} @@ -14,14 +15,9 @@ {{ $title := .title }} {{ $width := .width }} -{{ $class := "img-fluid" }} -{{ if $caption }} - {{ $class = "figure-img img-fluid" }} -{{ end }} - {{ $content := partial "paige/img.html" (dict "alt" $alt - "class" $class + "class" "img-fluid" "method" $method "options" $options "page" $page @@ -79,15 +75,8 @@ {{ end }} {{ end }} -{{ if $table }} -
- {{ $content }} - {{ with $caption }} -
{{ . }}
- {{ end }} -
-{{ else if $float }} - {{ $margin := "" }} +{{ $margin := "" }} +{{ if $float }} {{ if eq $float "start" }} {{ $margin = "me-4" }} {{ else if eq $float "end" }} @@ -95,25 +84,19 @@ {{ else }} {{ errorf "invalid float: %q" $float }} {{ end }} -
- {{ $content }} +{{ end }} + +
+
+ {{ if or $float $table }} +
+ {{ end }} +
{{ $content }}
{{ with $caption }} -
{{ . }}
+
{{ . }}
+ {{ end }} + {{ if or $float $table }} +
{{ end }} -
-{{ else }} -
- {{ with $style }} -
-
- {{ end }} - {{ $content }} - {{ with $caption }} -
{{ . }}
- {{ end }} - {{ if $style }} -
- {{ end }}
-{{ end }} diff --git a/layouts/shortcodes/paige/gallery.html b/layouts/shortcodes/paige/gallery.html index fe8b54ec..060fe638 100644 --- a/layouts/shortcodes/paige/gallery.html +++ b/layouts/shortcodes/paige/gallery.html @@ -25,6 +25,7 @@ "maxwidth" $maxwidth "method" $method "options" $options + "packed" true "page" .Page "resource" $resource "src" $image @@ -51,48 +52,49 @@
{{ if eq $type "grid" }} -
+
{{ with $inner }} {{ . }} {{ else }} {{ range $resources }} - {{ partial "paige/image-figure.html" (dict - "height" $height - "link" .RelPermalink - "maxheight" $maxheight - "maxwidth" $maxwidth - "method" $method - "options" $options - "page" $.Page - "resource" . - "table" true - "width" $width +
+ {{ partial "paige/a.html" (dict + "content" (partial "paige/img.html" (dict + "class" "img-fluid" + "height" $height + "maxheight" $maxheight + "maxwidth" $maxwidth + "method" $method + "options" $options + "resource" . + "width" $width + )) + "href" .RelPermalink ) }} +
{{ end }} {{ end }}
{{ else if eq $type "rows" }} - {{ if not (or $height $maxheight) }} - {{ $maxheight = $maxheight | default "10rem" }} - {{ end }} -
+
{{ with $inner }} {{ . }} {{ else }} {{ range $resources }} - {{ partial "paige/image-figure.html" (dict - "height" $height - "link" .RelPermalink - "maxheight" $maxheight - "maxwidth" $maxwidth - "method" $method - "options" $options - "page" $.Page - "resource" . - "table" true - "width" $width + {{ partial "paige/a.html" (dict + "content" (partial "paige/img.html" (dict + "class" "img-fluid" + "height" $height + "maxheight" $maxheight + "maxwidth" $maxwidth + "method" $method + "options" $options + "resource" . + "width" $width + )) + "href" .RelPermalink ) }} {{ end }} {{ end }} diff --git a/layouts/shortcodes/paige/quote.html b/layouts/shortcodes/paige/quote.html index 142ceeb2..4756d877 100644 --- a/layouts/shortcodes/paige/quote.html +++ b/layouts/shortcodes/paige/quote.html @@ -51,29 +51,37 @@ {{ end }} {{ end }} -{{ $margins := "" }} +{{ $margin := "" }} {{ if $float }} {{ if eq $float "start" }} - {{ $margins = "me-4" }} + {{ $margin = "me-4" }} {{ else if eq $float "end" }} - {{ $margins = "ms-4" }} + {{ $margin = "ms-4" }} {{ else }} {{ errorf "invalid float: %q" $float }} {{ end }} {{ end }} -
- {{ with $style }} -
- {{ end }} -
{{ $content }}
- {{ with $caption }} -
{{ . }}
- {{ end }} - {{ with $cite }} - - {{ end }} - {{ if $style }} -
- {{ end }} +
+
+ {{ if $float }} +
+ {{ end }} + {{ if $caption }} +
+ {{ end }} +
{{ $content }}
+ {{ if $caption }} +
+ {{ end }} + {{ with $caption }} +
{{ . }}
+ {{ end }} + {{ with $cite }} + + {{ end }} + {{ if $float }} +
+ {{ end }} +