mirror of
https://git.sr.ht/~seirdy/seirdy.one
synced 2024-11-23 21:02: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:
parent
7fe0a6ef74
commit
aad8b11a70
3 changed files with 16 additions and 3 deletions
|
@ -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 -}}
|
||||||
|
|
7
layouts/shortcodes/quotation.html
Normal file
7
layouts/shortcodes/quotation.html
Normal 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>
|
|
@ -1,5 +1,11 @@
|
||||||
<figcaption>
|
<figcaption>
|
||||||
—
|
{{- with .Parent -}}
|
||||||
|
{{- if eq .Name "quotation" -}}
|
||||||
|
—
|
||||||
|
{{- 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 }}
|
||||||
|
|
Loading…
Reference in a new issue