Add float param to shortcodes

This commit is contained in:
Will Faught
2023-01-12 22:30:54 -08:00
parent 92a3166625
commit 03790e5bb0
11 changed files with 201 additions and 11 deletions

View File

@@ -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
) }}

View File

@@ -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
) }}

View File

@@ -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

View File

@@ -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 }}
<figure class="d-flex align-items-center flex-column paige-figure">
{{ $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 }}
<figure class="d-flex align-items-center flex-column {{ with $float }} float-{{ . }} {{ end }} {{ with $margins }} {{ . }} {{ end }} paige-figure">
<div>
<blockquote class="blockquote {{ if $caption }} mb-2 {{ end }} text-{{ $align }}">{{ $content }}</blockquote>
{{ with $caption }}