1
0
Fork 0
mirror of https://git.sr.ht/~seirdy/seirdy.one synced 2024-09-19 20:02:10 +00:00

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.
This commit is contained in:
Rohan Kumar 2022-04-27 17:20:16 -07:00
parent 7fe0a6ef74
commit aad8b11a70
No known key found for this signature in database
GPG key ID: 1E892DB2A5F84479
3 changed files with 16 additions and 3 deletions

View file

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

View file

@ -0,0 +1,7 @@
{{- $itemprop := "mentions" -}}
{{- with .Get "itemprop" -}}
{{- $itemprop = . -}}
{{- end -}}
<figure itemprop="{{ $itemprop }}"{{ with .Get "id" }} id="{{ . }}"{{ end }} itemscope itemtype="https://schema.org/Quotation">
{{ .Inner | markdownify }}
</figure>

View file

@ -1,5 +1,11 @@
<figcaption>
&mdash;
{{- with .Parent -}}
{{- if eq .Name "quotation" -}}
&mdash;
{{- else if eq .Name "codefigure" -}}
Taken from
{{- end -}}
{{- end -}}
<span class="h-cite" itemprop="citation" role="doc-credit">
<span itemprop="isPartOf" itemscope itemtype="https://schema.org/{{ .Get "partOfType" }}">
{{ .Inner | markdownify | safeHTML }}