diff --git a/README.md b/README.md index e840dd9c..766ac21b 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 caption="My caption" >}} +{{< paige/figure caption="My caption" float="left" >}} My content {{< /paige/figure >}} ``` @@ -523,6 +523,8 @@ Parameters:
Required. String. Markdown. The inner content.
caption
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.
### Quote @@ -530,7 +532,7 @@ Parameters: The `paige/quote` shortcode provides a figure with a centered quotation. ``` -{{< paige/quote align="center" caption="My caption" cite="My citation" >}} +{{< paige/quote align="center" caption="My caption" cite="My citation" float="left" >}} My content {{< /paige/quote >}} ``` @@ -546,6 +548,8 @@ Parameters:
Optional. String. Markdown. Descriptive text that appears centered below the quotation. Must not be used with cite.
cite
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.
### Code @@ -553,7 +557,7 @@ Parameters: The `paige/code` shortcode provides a figure with centered code. ``` -{{< paige/code caption="My caption" lang="html" options="linenos=true" >}} +{{< paige/code caption="My caption" float="left" lang="html" options="linenos=true" >}} @@ -570,6 +574,8 @@ Parameters:
Required. String. Markdown. The inner content.
caption
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.
lang
Optional. Position 0. String. Chroma language code. Defaults to plaintext. See available codes.
options
@@ -584,6 +590,7 @@ The `paige/image` shortcode provides a figure with a centered image. {{< paige/image alt="My alt" >}} caption="My caption" + float="left" height="10rem" link="https://github.com/willfaught/paige" maxheight="10rem" @@ -602,6 +609,8 @@ Parameters:
Optional. String. Plain text. Image alt.
caption
Optional. String. Markdown. Descriptive text that appears centered below the image.
+
float
+
Optional. String. Float to one side of its container. Must be start or end.
height
Optional. String. Image height.
link
diff --git a/exampleSite/content/blog/code-shortcode.md b/exampleSite/content/blog/code-shortcode.md index 68d97a56..1ab5b5cb 100644 --- a/exampleSite/content/blog/code-shortcode.md +++ b/exampleSite/content/blog/code-shortcode.md @@ -88,6 +88,26 @@ q = 'q = %s%s%s; print(q %% (chr(39), q, chr(39)))'; print(q % (chr(39), q, chr( Code: +```go-text-template +{{}} +q = 'q = %r; print(q %% q)'; print(q % q) +{{}} + +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. Do the right thing here. String this blind girl along so that dad doesn't have to pay his debt to society. Dead Dove DO NOT EAT. Come on, this is a Bluth family celebration. It's no place for children. If you didn't have adult onset diabetes, I wouldn't mind giving you a little sugar. +``` + +Result: + +{{< paige/code caption="Python quine" float="end" >}} +q = 'q = %r; print(q %% q)'; print(q % q) +{{< /paige/code >}} + +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. Do the right thing here. String this blind girl along so that dad doesn't have to pay his debt to society. Dead Dove DO NOT EAT. Come on, this is a Bluth family celebration. It's no place for children. If you didn't have adult onset diabetes, I wouldn't mind giving you a little sugar. + +--- + +Code: + ```go-text-template {{}} --- diff --git a/exampleSite/content/blog/figure-shortcode.md b/exampleSite/content/blog/figure-shortcode.md index f21e0fa4..e0cf0741 100644 --- a/exampleSite/content/blog/figure-shortcode.md +++ b/exampleSite/content/blog/figure-shortcode.md @@ -40,6 +40,26 @@ Don't believe everything you read on the Internet. Code: +```go-text-template +{{}} +Don't believe everything you read on the Internet. +{{}} + +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" float="start" >}} +Don't believe everything you read on the Internet. +{{< /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 {{}}
diff --git a/exampleSite/content/blog/image-shortcode.md b/exampleSite/content/blog/image-shortcode.md
index 4fd8e407..2154bb79 100644
--- a/exampleSite/content/blog/image-shortcode.md
+++ b/exampleSite/content/blog/image-shortcode.md
@@ -27,3 +27,23 @@ Code:
 Result:
 
 {{< paige/image src="stretch.webp" caption="Landscape" width="50%" link="https://github.com/willfaught/paige" >}}
+
+---
+
+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. Let's see some bananas and nuts! So Ann, the question is, do you want a man or a boy? I know how I would answer. Never once touched my per diem. I'd go to Craft Service, get some raw veggies, bacon, Cup-A-Soup…baby, I got a stew goin'. You might enjoy this. Oh. Em. Gee. That's amazing. I've always been deeply passionate about nature. Perhaps you remember Neuterfest? I'll never forget your wedding. But I did finally get into Dad's pants. Although I had to have the crotch taken in a little bit. She's a girl, I need to teach her how to be a woman. Within her lies a queen. Let me out that queen. There are dozens of us! Dozens! Oh please. They didn't sneak into this country to be your friends. No one's called him Baby Buster since high school. I mean, it's one banana, Michael. What could it cost, ten dollars? "Circumvent." It means "to go around." Gob: The old "reach around." Mom always taught us to curl up in a ball and remain motionless when confronted. You're Killing Me, Buster.
+```
+
+Result:
+
+{{< paige/image src="stretch.webp" caption="Landscape" width="25%" link="https://github.com/willfaught/paige" float="start" >}}
+
+{{< paige/image src="stretch.webp" caption="Landscape" width="25%" link="https://github.com/willfaught/paige" float="end" >}}
+
+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. Let's see some bananas and nuts! So Ann, the question is, do you want a man or a boy? I know how I would answer. Never once touched my per diem. I'd go to Craft Service, get some raw veggies, bacon, Cup-A-Soup…baby, I got a stew goin'. You might enjoy this. Oh. Em. Gee. That's amazing. I've always been deeply passionate about nature. Perhaps you remember Neuterfest? I'll never forget your wedding. But I did finally get into Dad's pants. Although I had to have the crotch taken in a little bit. She's a girl, I need to teach her how to be a woman. Within her lies a queen. Let me out that queen. There are dozens of us! Dozens! Oh please. They didn't sneak into this country to be your friends. No one's called him Baby Buster since high school. I mean, it's one banana, Michael. What could it cost, ten dollars? "Circumvent." It means "to go around." Gob: The old "reach around." Mom always taught us to curl up in a ball and remain motionless when confronted. You're Killing Me, Buster.
diff --git a/exampleSite/content/blog/quote-shortcode.md b/exampleSite/content/blog/quote-shortcode.md
index 3976e1c3..3ee0b20b 100644
--- a/exampleSite/content/blog/quote-shortcode.md
+++ b/exampleSite/content/blog/quote-shortcode.md
@@ -88,6 +88,26 @@ Use the Force, Harry.
 
 Code:
 
+```go-text-template
+{{}}
+Don't believe everything you read on the Internet.
+{{}}
+
+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. Do the right thing here. String this blind girl along so that dad doesn't have to pay his debt to society. Dead Dove DO NOT EAT. Come on, this is a Bluth family celebration. It's no place for children. If you didn't have adult onset diabetes, I wouldn't mind giving you a little sugar. She's not 'that Mexican', Mom. She's my Mexican. And she's Colombian or something. Friday night.
+```
+
+Result:
+
+{{< paige/quote cite="Abraham Lincoln" float="end" >}}
+Don't believe everything you read on the Internet.
+{{< /paige/quote >}}
+
+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. Do the right thing here. String this blind girl along so that dad doesn't have to pay his debt to society. Dead Dove DO NOT EAT. Come on, this is a Bluth family celebration. It's no place for children. If you didn't have adult onset diabetes, I wouldn't mind giving you a little sugar. She's not 'that Mexican', Mom. She's my Mexican. And she's Colombian or something. Friday night.
+
+---
+
+Code:
+
 ```go-text-template
 {{}}
 
Hickory dickory dock. diff --git a/layouts/partials/paige/figure.html b/layouts/partials/paige/figure.html index c3a5a26d..55254db0 100644 --- a/layouts/partials/paige/figure.html +++ b/layouts/partials/paige/figure.html @@ -1,7 +1,19 @@ {{ $caption := .caption | markdownify }} {{ $content := .content | markdownify }} +{{ $float := .float }} -
+{{ $margins := "" }} +{{ if $float }} + {{ if eq $float "start" }} + {{ $margins = "me-4" }} + {{ else if eq $float "end" }} + {{ $margins = "ms-4" }} + {{ else }} + {{ errorf "invalid float: %q" $float }} + {{ end }} +{{ end }} + +
{{ $content }}
{{ with $caption }}
{{ . }}
diff --git a/layouts/partials/paige/image-figure.html b/layouts/partials/paige/image-figure.html index a674df19..fe8ee059 100644 --- a/layouts/partials/paige/image-figure.html +++ b/layouts/partials/paige/image-figure.html @@ -1,5 +1,6 @@ {{ $alt := .alt }} {{ $caption := .caption }} +{{ $float := .float }} {{ $height := .height }} {{ $link := .link }} {{ $maxheight := .maxheight }} @@ -21,16 +22,12 @@ {{ $content := partial "paige/img.html" (dict "alt" $alt "class" $class - "height" $height - "maxheight" $maxheight - "maxwidth" $maxwidth "method" $method "options" $options "page" $page "resource" $resource "src" $src "title" $title - "width" $width ) }} {{ if $link }} @@ -40,9 +37,83 @@ ) }} {{ end }} -
+{{ $style := "" }} + +{{ if $height }} + {{ with printf "height: %v" $height }} + {{ if $style }} + {{ $style = printf "%v; %v" $style . }} + {{ else }} + {{ $style = . }} + {{ end }} + {{ end }} +{{ end }} + +{{ if $maxheight }} + {{ with printf "max-height: %v" $maxheight }} + {{ if $style }} + {{ $style = printf "%v; %v" $style . }} + {{ else }} + {{ $style = . }} + {{ end }} + {{ end }} +{{ end }} + +{{ if $maxwidth }} + {{ with printf "max-width: %v" $maxwidth }} + {{ if $style }} + {{ $style = printf "%v; %v" $style . }} + {{ else }} + {{ $style = . }} + {{ end }} + {{ end }} +{{ end }} + +{{ if $width }} + {{ with printf "width: %v" $width }} + {{ if $style }} + {{ $style = printf "%v; %v" $style . }} + {{ else }} + {{ $style = . }} + {{ end }} + {{ end }} +{{ end }} + +{{ if $table }} +
+ {{ $content }} + {{ with $caption }} +
{{ . }}
+ {{ end }} +
+{{ else if $float }} + {{ $margins := "" }} + {{ if eq $float "start" }} + {{ $margins = "me-4" }} + {{ else if eq $float "end" }} + {{ $margins = "ms-4" }} + {{ else }} + {{ errorf "invalid float: %q" $float }} + {{ end }} +
+ {{ $content }} + {{ with $caption }} +
{{ . }}
+ {{ end }} +
+{{ else }} +
+ {{ with $style }} +
+
+ {{ end }} {{ $content }} {{ with $caption }} -
{{ . }}
+
{{ . }}
+ {{ end }} + {{ if $style }} +
+
{{ end }}
+{{ end }} diff --git a/layouts/shortcodes/paige/code.html b/layouts/shortcodes/paige/code.html index f849f9d9..2673399c 100644 --- a/layouts/shortcodes/paige/code.html +++ b/layouts/shortcodes/paige/code.html @@ -1,4 +1,5 @@ {{ $caption := .Get "caption" }} +{{ $float := .Get "float" }} {{ $lang := .Get 0 | default (.Get "lang") | default "plaintext" }} {{ $options := .Get "options" }} @@ -7,4 +8,5 @@ {{ partial "paige/figure.html" (dict "caption" $caption "content" $content + "float" $float ) }} diff --git a/layouts/shortcodes/paige/figure.html b/layouts/shortcodes/paige/figure.html index 7d005971..7a07bb40 100644 --- a/layouts/shortcodes/paige/figure.html +++ b/layouts/shortcodes/paige/figure.html @@ -1,8 +1,10 @@ {{ $caption := .Get 0 | default (.Get "caption") }} +{{ $float := .Get "float" }} {{ $content := .Inner }} {{ partial "paige/figure.html" (dict "caption" $caption "content" $content + "float" $float ) }} diff --git a/layouts/shortcodes/paige/image.html b/layouts/shortcodes/paige/image.html index 87cb5c4c..5b8c5748 100644 --- a/layouts/shortcodes/paige/image.html +++ b/layouts/shortcodes/paige/image.html @@ -1,5 +1,6 @@ {{ $alt := .Get "alt" }} {{ $caption := .Get "caption" }} +{{ $float := .Get "float" }} {{ $height := .Get "height" }} {{ $link := .Get "link" }} {{ $maxheight := .Get "maxheight" }} @@ -13,6 +14,7 @@ {{ partial "paige/image-figure.html" (dict "alt" $alt "caption" $caption + "float" $float "height" $height "link" $link "maxheight" $maxheight diff --git a/layouts/shortcodes/paige/quote.html b/layouts/shortcodes/paige/quote.html index 10378cef..afde21c0 100644 --- a/layouts/shortcodes/paige/quote.html +++ b/layouts/shortcodes/paige/quote.html @@ -1,12 +1,24 @@ {{ $align := .Get "align" | default "center" }} {{ $caption := .Get "caption" }} {{ $cite := .Get 0 | default (.Get "cite") }} +{{ $float := .Get "float" }} {{ $caption = $caption | markdownify }} {{ $cite = $cite | markdownify }} {{ $content := .Inner | markdownify }} -
+{{ $margins := "" }} +{{ if $float }} + {{ if eq $float "start" }} + {{ $margins = "me-4" }} + {{ else if eq $float "end" }} + {{ $margins = "ms-4" }} + {{ else }} + {{ errorf "invalid float: %q" $float }} + {{ end }} +{{ end }} + +
{{ $content }}
{{ with $caption }}