1
0
Fork 0
mirror of https://git.sr.ht/~seirdy/seirdy.one synced 2024-11-10 00:12:09 +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_width := $light_png.Width -}}
{{- $img_height := $light_png.Height -}} {{- $img_height := $light_png.Height -}}
{{- with (.Get "sf") -}} {{- with (.Get "sf") -}}
{{- $img_width = (mul $img_width . ) -}} {{- $img_width = (mul $img_width . | math.Round) -}}
{{- $img_height = (mul $img_height . ) -}} {{- $img_height = (mul $img_height . | math.Round ) -}}
{{- if eq . 2 -}} {{- if eq . 2 -}}
{{- $isPix = true -}} {{- $isPix = true -}}
{{- end -}} {{- 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> <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 class="h-cite" itemprop="citation" role="doc-credit">
<span itemprop="isPartOf" itemscope itemtype="https://schema.org/{{ .Get "partOfType" }}"> <span itemprop="isPartOf" itemscope itemtype="https://schema.org/{{ .Get "partOfType" }}">
{{ .Inner | markdownify | safeHTML }} {{ .Inner | markdownify | safeHTML }}