Update figure shortcode to properly float left and right

This commit is contained in:
Justin Nguyen 2020-12-22 19:18:44 -08:00
parent 734364f330
commit 0b270e29cf
7 changed files with 22 additions and 13 deletions

View File

@ -92,17 +92,26 @@ figure {
max-width: 100%;
margin: 25px 0;
&.left {
margin-right: auto;
&.center {
width: 100%;
float: none;
}
&.center {
margin-left: auto;
margin-right: auto;
&.left {
width: 50%;
float: left;
padding-right: 3em;
}
&.right {
width: 50%;
float: right;
padding-left: 3em;
}
img {
margin-left: auto;
margin-right: auto;
}
figcaption {
@ -122,7 +131,7 @@ figure {
}
&.right {
text-align: right;
text-align: left;
}
}
}

View File

@ -1,5 +1,5 @@
{{ if .Get "src" }}
<figure class="{{ with .Get "position"}}{{ . }}{{ else -}} left {{- end }}" >
<figure class="{{ with .Get "position"}}{{ . }}{{ else -}} center {{- end }}" {{ with .Get "containerStyle" }} style="{{ . | safeCSS }}" {{ end }} >
<img src="{{ .Get "src" | safeURL }}" {{ with .Get "alt" }} alt="{{ . | plainify }}" {{ end }} {{ with .Get "style" }} style="{{ . | safeCSS }}" {{ end }} />
{{ if .Get "caption" }}
<figcaption class="{{ with .Get "captionPosition"}}{{ . }}{{ else -}} center {{- end }}" {{ with .Get "captionStyle" }} style="{{ . | safeCSS }}" {{ end }}>{{ .Get "caption" | safeHTML }}</figcaption>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long