Move a bunch of shortcodes and partials back from the platters theme

This commit is contained in:
Eryn Wells 2024-10-08 08:45:44 -07:00
parent 20d53e0df2
commit 3102dc1e56
29 changed files with 1 additions and 1 deletions

View file

@ -0,0 +1,4 @@
{{- $trimmedInner := trim .Inner "\n " -}}
<figure class="code">
{{ $.Page.RenderString $trimmedInner }}
</figure>

View file

@ -0,0 +1,45 @@
{{- $imgs := slice -}}
{{- $class := .Get "class" -}}
{{- $shouldResize := .Get "shouldResize" | default true -}}
{{- $shouldShowTitle := (.Get "shouldShowTitle") | default true -}}
{{- if .Get "name" -}}
{{- $imgs = $imgs | append (.Page.Resources.GetMatch (.Get "name")) -}}
{{- else if .Get "names" -}}
{{- range (split (.Get "names") ",") -}}
{{- $imgs = $imgs | append ($.Page.Resources.GetMatch .) -}}
{{- end -}}
{{- else -}}
{{ errorf "Missing name or names parameter to figures/image" }}
{{- end -}}
{{- if lt (len $imgs) 0 -}}
{{ errorf "No images found for name(s) parameter" }}
{{- end -}}
<figure {{ with $class }}class="{{ . }}"{{ end }}>
<div class=container>
{{ range $img := $imgs }}
{{- $linkedImg := $img -}}
{{ if not $img }}
{{ errorf "Found nil in images list for %s" $.Page.Permalink }}
{{ end }}
{{- if $shouldResize -}}
{{ $linkedImg = $img.Fit "1280x1280" }}
{{- end -}}
{{- $altText := $img.Params.alt | default $img.Title -}}
<a href="{{ $img.RelPermalink }}">
<img src="{{ $linkedImg.RelPermalink }}"
{{- with $altText }} alt="{{ . }}"{{- end }}
{{- with $img.Title }} title="{{ . }}"{{- end }}>
</a>
{{- end }}
</div>
{{ if and $shouldShowTitle -}}
{{- range $imgs -}}
{{- if gt (len .Title) 0 -}}
<figcaption>{{ .Title }}</figcaption>
{{- end -}}
{{- end -}}
{{- end }}
</figure>

View file

@ -0,0 +1,4 @@
{{- $id := .Get "id" -}}
<div class="centered">
<figure class="p5-sketch {{ with .Get "bordered" }}bordered{{ end }}" id="{{ $id }}"></figure>
</div>

View file

@ -0,0 +1,3 @@
{{- $id := .Get "id" -}}
<figure class="railroad-diagram" {{ if $id }}id="{{ $id }}"{{ end }}></figure>
{{ .Inner }}

View file

@ -0,0 +1,12 @@
{{- $pc := .Page.Site.Config.Privacy.YouTube -}}
{{- if not $pc.Disable -}}
{{- $ytHost := cond $pc.PrivacyEnhanced "www.youtube-nocookie.com" "www.youtube.com" -}}
{{- $id := .Get "id" | default (.Get 0) -}}
{{- $class := .Get "class" | default (.Get 1) -}}
{{- $title := .Get "title" | default "YouTube Video" }}
<figure {{ with $class }}class="{{ . }}"{{ end }}>
<div class="youtube">
<iframe src="https://{{ $ytHost }}/embed/{{ $id }}{{ with .Get "autoplay" }}{{ if eq . "true" }}?autoplay=1{{ end }}{{ end }}" allowfullscreen frameborder=0 title="{{ $title }}"></iframe>
</div>
</figure>
{{ end -}}