Remove most class and style params

master
Will Faught 3 years ago
parent 9f89cd3f0f
commit cefc10bbe1

@ -3,4 +3,4 @@
{{ $href := .href }} {{ $href := .href }}
{{ $style := .style }} {{ $style := .style }}
<a {{ with $class }} {{ . }} {{ end }} {{ with $href }} href="{{ . }}" {{ end }} {{ with $style }} {{ . | safeCSS }} {{ end }}>{{ $content }}</a> <a {{ with $class }} class="{{ . }}" {{ end }} {{ with $href }} href="{{ . }}" {{ end }} {{ with $style }} style="{{ . | safeCSS }}" {{ end }}>{{ $content }}</a>

@ -1,15 +1,9 @@
{{ $caption := .caption | markdownify }} {{ $caption := .caption | markdownify }}
{{ $captionclass := .captionclass | default "figure-caption" }}
{{ $captionstyle := .captionstyle }}
{{ $class := .class | default "align-items-center d-flex flex-column justify-content-center paige-figure" }}
{{ $content := .content | markdownify }} {{ $content := .content | markdownify }}
{{ $contentclass := .contentclass }}
{{ $contentstyle := .contentstyle }}
{{ $style := .style }}
<figure {{ with $class }} class="{{ . }}" {{ end }} {{ with $style }} style="{{ . | safeCSS }}" {{ end }}> <figure class="align-items-center d-flex flex-column justify-content-center paige-figure">
<div {{ with $contentclass }} class="{{ . }}" {{ end }} {{ with $contentstyle }} style="{{ . | safeCSS }}" {{ end }}>{{ $content }}</div> <div {{ if $caption }} class="mb-2" {{ end }}>{{ $content }}</div>
{{ with $caption }} {{ with $caption }}
<figcaption {{ with $captionclass }} class="{{ . }}" {{ end }} {{ with $captionstyle }} style="{{ . | safeCSS }}" {{ end }}>{{ . }}</figcaption> <figcaption class="figure-caption">{{ . }}</figcaption>
{{ end }} {{ end }}
</figure> </figure>

@ -1,37 +1,30 @@
{{ $alt := .alt }} {{ $alt := .alt }}
{{ $caption := .caption }} {{ $caption := .caption }}
{{ $captionclass := .captionclass }}
{{ $captionstyle := .captionstyle }}
{{ $class := .class }}
{{ $contentclass := .contentclass }}
{{ $contentstyle := .contentstyle }}
{{ $height := .height }} {{ $height := .height }}
{{ $imageclass := .imageclass | default "img-fluid" }}
{{ $imagestyle := .imagestyle }}
{{ $link := .link }} {{ $link := .link }}
{{ $method := .method }} {{ $method := .method }}
{{ $options := .options }} {{ $options := .options }}
{{ $page := .page }} {{ $page := .page }}
{{ $resource := .resource }} {{ $resource := .resource }}
{{ $src := .src }} {{ $src := .src }}
{{ $style := .style }} {{ $table := .table }}
{{ $title := .title }} {{ $title := .title }}
{{ $width := .width }} {{ $width := .width }}
{{ if and (not $contentclass) $caption }} {{ $class := "img-fluid" }}
{{ $contentclass = "figure-img" }} {{ if $caption }}
{{ $class = "figure-img img-fluid" }}
{{ end }} {{ end }}
{{ $content := partial "paige/img.html" (dict {{ $content := partial "paige/img.html" (dict
"alt" $alt "alt" $alt
"class" $imageclass "class" $class
"height" $height "height" $height
"method" $method "method" $method
"options" $options "options" $options
"page" $page "page" $page
"resource" $resource "resource" $resource
"src" $src "src" $src
"style" $imagestyle
"title" $title "title" $title
"width" $width "width" $width
) }} ) }}
@ -43,13 +36,9 @@
) }} ) }}
{{ end }} {{ end }}
{{ partial "paige/figure.html" (dict <figure class="{{ if $table }} d-table mb-0 {{ end }} paige-figure text-center">
"caption" $caption {{ $content }}
"captionclass" $captionclass {{ with $caption }}
"captionstyle" $captionstyle <figcaption class="figure-caption" {{ if $table }} style="caption-side: bottom; display: table-caption" {{ end }}>{{ . }}</figcaption>
"class" $class {{ end }}
"content" $content </figure>
"contentclass" $contentclass
"contentstyle" $contentstyle
"style" $style
) }}

@ -1,26 +1,10 @@
{{ $caption := .Get "caption" }} {{ $caption := .Get "caption" }}
{{ $captionclass := .Get "captionclass" }}
{{ $captionstyle := .Get "captionstyle" }}
{{ $class := .Get "class" }}
{{ $contentclass := .Get "contentclass" | default "mb-2" }}
{{ $contentstyle := .Get "contentstyle" }}
{{ $lang := .Get 0 | default (.Get "lang") | default "plaintext" }} {{ $lang := .Get 0 | default (.Get "lang") | default "plaintext" }}
{{ $options := .Get "options" }} {{ $options := .Get "options" }}
{{ $style := .Get "style" }}
{{ if $caption }}
{{ $contentclass = $contentclass | default "mb-2" }}
{{ end }}
{{ $content := highlight (.Inner | replaceRE "^\n" "") $lang $options }} {{ $content := highlight (.Inner | replaceRE "^\n" "") $lang $options }}
{{ partial "paige/figure.html" (dict {{ partial "paige/figure.html" (dict
"caption" $caption "caption" $caption
"captionclass" $captionclass
"captionstyle" $captionstyle
"class" $class
"content" $content "content" $content
"contentclass" $contentclass
"contentstyle" $contentstyle
"style" $style
) }} ) }}

@ -1,24 +1,8 @@
{{ $caption := .Get 0 | default (.Get "caption") }} {{ $caption := .Get 0 | default (.Get "caption") }}
{{ $captionclass := .Get "captionclass" }}
{{ $captionstyle := .Get "captionstyle" }}
{{ $class := .Get "class" }}
{{ $contentclass := .Get "contentclass" }}
{{ $contentstyle := .Get "contentstyle" }}
{{ $style := .Get "style" }}
{{ if $caption }}
{{ $contentclass = $contentclass | default "mb-2" }}
{{ end }}
{{ $content := .Inner }} {{ $content := .Inner }}
{{ partial "paige/figure.html" (dict {{ partial "paige/figure.html" (dict
"caption" $caption "caption" $caption
"captionclass" $captionclass
"captionstyle" $captionstyle
"class" $class
"content" $content "content" $content
"contentclass" $contentclass
"contentstyle" $contentstyle
"style" $style
) }} ) }}

@ -1,25 +1,15 @@
{{ $align := .Get "align" | default "center" }}
{{ $caption := .Get "caption" }} {{ $caption := .Get "caption" }}
{{ $captionclass := .Get "captionclass" }} {{ $height := .Get "height" }}
{{ $captionstyle := .Get "captionstyle" }}
{{ $class := .Get "class" }}
{{ $contentclass := .Get "contentclass" }}
{{ $contentstyle := .Get "contentstyle" }}
{{ $image := .Get "image" }} {{ $image := .Get "image" }}
{{ $imageclass := .Get "imageclass" }}
{{ $images := .Get 0 | default (.Get "images") }} {{ $images := .Get 0 | default (.Get "images") }}
{{ $imagestyle := .Get "imagestyle" }} {{ $justify := .Get "justify" | default "center" }}
{{ $innercaptionclass := .Get "innercaptionclass" }}
{{ $innercaptionstyle := .Get "innercaptionstyle" }}
{{ $innerclass := .Get "innerclass" | default "d-table mb-0" }}
{{ $innerstyle := .Get "innerstyle" }}
{{ $method := .Get "method" | default "resize" }} {{ $method := .Get "method" | default "resize" }}
{{ $options := .Get "options" | default "550x webp picture Lanczos" }} {{ $options := .Get "options" | default "550x webp picture Lanczos" }}
{{ $style := .Get "style" }}
{{ $type := .Get "type" | default "rows" }} {{ $type := .Get "type" | default "rows" }}
{{ $width := .Get "width" }}
{{ if $image }} {{ if $image }}
{{ $captionclass = $captionclass | default "figure-caption text-center" }}
{{ $captionstyle = $captionstyle | default "caption-side: bottom; display: table-caption" }}
{{ $resource := partial "paige/func-resource.html" (dict {{ $resource := partial "paige/func-resource.html" (dict
"page" .Page "page" .Page
"url" $image "url" $image
@ -27,20 +17,13 @@
{{ partial "paige/image-figure.html" (dict {{ partial "paige/image-figure.html" (dict
"caption" $caption "caption" $caption
"captionclass" $captionclass
"captionstyle" $captionstyle
"class" $innerclass
"contentclass" $contentclass
"contentstyle" $contentstyle
"imageclass" $imageclass
"imagestyle" $imagestyle
"link" $resource.RelPermalink "link" $resource.RelPermalink
"method" $method "method" $method
"options" $options "options" $options
"page" .Page "page" .Page
"resource" $resource "resource" $resource
"src" $image "src" $image
"style" $innerstyle "table" true
) }} ) }}
{{ else }} {{ else }}
{{ $inner := chomp .Inner }} {{ $inner := chomp .Inner }}
@ -63,49 +46,35 @@
<figure> <figure>
{{ if eq $type "grid" }} {{ if eq $type "grid" }}
<div class="container-fluid{{ if $caption }} figure-img{{ end }} px-0"> <div class="container-fluid{{ if $caption }} figure-img{{ end }} px-0">
<div class="align-items-center gx-3 gy-3 justify-content-center row row-cols-1 row-cols-sm-2 row-cols-md-3 row-cols-lg-4 row-cols-xl-5 row-cols-xxl-6"> <div class="align-items-{{ $align }} gx-3 gy-3 justify-content-{{ $justify }} row row-cols-1 row-cols-sm-2 row-cols-md-3 row-cols-lg-4 row-cols-xl-5 row-cols-xxl-6">
{{ with $inner }} {{ with $inner }}
{{ . }} {{ . }}
{{ else }} {{ else }}
{{ range $resources }} {{ range $resources }}
{{ partial "paige/image-figure.html" (dict {{ partial "paige/image-figure.html" (dict
"captionclass" $captionclass
"captionstyle" $captionstyle
"class" $innerclass
"contentclass" $contentclass
"contentstyle" $contentstyle
"imageclass" $imageclass
"imagestyle" $imagestyle
"link" .RelPermalink "link" .RelPermalink
"method" $method "method" $method
"options" $options "options" $options
"resource" . "resource" .
"style" $innerstyle "table" true
) }} ) }}
{{ end }} {{ end }}
{{ end }} {{ end }}
</div> </div>
</div> </div>
{{ else if eq $type "rows" }} {{ else if eq $type "rows" }}
{{ $imagestyle = $imagestyle | default "max-height: 10rem" }} <div class="align-items-{{ $align }} column-gap-3 d-flex{{ with $caption }} figure-img{{ end }} flex-wrap justify-content-{{ $justify }} row-gap-3">
<div class="align-items-center column-gap-3 d-flex{{ with $caption }} figure-img{{ end }} flex-wrap justify-content-center row-gap-3">
{{ with $inner }} {{ with $inner }}
{{ . }} {{ . }}
{{ else }} {{ else }}
{{ range $resources }} {{ range $resources }}
{{ partial "paige/image-figure.html" (dict {{ partial "paige/image-figure.html" (dict
"captionclass" $captionclass "height" "10rem"
"captionstyle" $captionstyle
"class" $innerclass
"contentclass" $contentclass
"contentstyle" $contentstyle
"imageclass" $imageclass
"imagestyle" $imagestyle
"link" .RelPermalink "link" .RelPermalink
"method" $method "method" $method
"options" $options "options" $options
"resource" . "resource" .
"style" $innerstyle "table" true
) }} ) }}
{{ end }} {{ end }}
{{ end }} {{ end }}

@ -1,39 +1,21 @@
{{ $alt := .Get "alt" }} {{ $alt := .Get "alt" }}
{{ $caption := .Get "caption" }} {{ $caption := .Get "caption" }}
{{ $captionclass := .Get "captionclass" }}
{{ $captionstyle := .Get "captionstyle" }}
{{ $class := .Get "class" }}
{{ $contentclass := .Get "contentclass" }}
{{ $contentstyle := .Get "contentstyle" }}
{{ $height := .Get "height" }} {{ $height := .Get "height" }}
{{ $imageclass := .Get "imageclass" }}
{{ $imagestyle := .Get "imagestyle" }}
{{ $link := .Get "link" }} {{ $link := .Get "link" }}
{{ $method := .Get "method" }} {{ $method := .Get "method" }}
{{ $options := .Get "options" }} {{ $options := .Get "options" }}
{{ $src := .Get 0 | default (.Get "src") }} {{ $src := .Get 0 | default (.Get "src") }}
{{ $style := .Get "style" }}
{{ $title := .Get "title" }} {{ $title := .Get "title" }}
{{ $width := .Get "width" }} {{ $width := .Get "width" }}
{{ partial "paige/image-figure.html" (dict {{ partial "paige/image-figure.html" (dict
"caption" $caption
"captionclass" $captionclass
"captionstyle" $captionstyle
"class" $class
"contentclass" $contentclass
"contentstyle" $contentstyle
"style" $style
"alt" $alt "alt" $alt
"caption" $caption
"height" $height "height" $height
"imageclass" $imageclass "link" $link
"imagestyle" $imagestyle
"method" $method "method" $method
"options" $options "options" $options
"src" $src "src" $src
"title" $title "title" $title
"width" $width "width" $width
"link" $link
) }} ) }}

Loading…
Cancel
Save