From aad8b11a7020735dbc5122a7f4c85022e43a5fe7 Mon Sep 17 00:00:00 2001 From: Rohan Kumar Date: Wed, 27 Apr 2022 17:20:16 -0700 Subject: [PATCH] Shortcode improvements - New shortcode for quotation. Not using this yet. - Make picture shortcode round image dimensions to integer values. - Make quotecaption support code snippets borrowed from other places. Not using this yet. --- layouts/shortcodes/picture.html | 4 ++-- layouts/shortcodes/quotation.html | 7 +++++++ layouts/shortcodes/quotecaption.html | 8 +++++++- 3 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 layouts/shortcodes/quotation.html diff --git a/layouts/shortcodes/picture.html b/layouts/shortcodes/picture.html index 3611a67..d4cd601 100644 --- a/layouts/shortcodes/picture.html +++ b/layouts/shortcodes/picture.html @@ -13,8 +13,8 @@ {{- $img_width := $light_png.Width -}} {{- $img_height := $light_png.Height -}} {{- with (.Get "sf") -}} - {{- $img_width = (mul $img_width . ) -}} - {{- $img_height = (mul $img_height . ) -}} + {{- $img_width = (mul $img_width . | math.Round) -}} + {{- $img_height = (mul $img_height . | math.Round ) -}} {{- if eq . 2 -}} {{- $isPix = true -}} {{- end -}} diff --git a/layouts/shortcodes/quotation.html b/layouts/shortcodes/quotation.html new file mode 100644 index 0000000..236a1d7 --- /dev/null +++ b/layouts/shortcodes/quotation.html @@ -0,0 +1,7 @@ +{{- $itemprop := "mentions" -}} +{{- with .Get "itemprop" -}} + {{- $itemprop = . -}} +{{- end -}} +
+{{ .Inner | markdownify }} +
diff --git a/layouts/shortcodes/quotecaption.html b/layouts/shortcodes/quotecaption.html index 0a6e595..ec35f07 100644 --- a/layouts/shortcodes/quotecaption.html +++ b/layouts/shortcodes/quotecaption.html @@ -1,5 +1,11 @@
-— +{{- with .Parent -}} + {{- if eq .Name "quotation" -}} + — + {{- else if eq .Name "codefigure" -}} + Taken from + {{- end -}} +{{- end -}} {{ .Inner | markdownify | safeHTML }}