Tweak theme

This commit is contained in:
Dave Gallant
2024-04-07 21:46:55 -04:00
parent 2475d2d67e
commit 8d898eb69a
117 changed files with 5 additions and 9 deletions

View File

@@ -0,0 +1 @@
{{ partial "cv/cv.html" . }}

View File

@@ -0,0 +1,16 @@
{{ $type := .Get 0 }}
{{ $languages := readDir "node_modules/prismjs/components" }}
{{ $plugins := readDir "node_modules/prismjs/plugins" }}
{{ if eq $type "languages" }}
{{ range after 1 $languages -}}
{{ $lang := .Name | replaceRE ".*\\.min\\.js" "" | replaceRE "prism-([\\w-]*).js" "${1}" -}}
{{ if not (eq $lang "") }}
{{ $lang -}}
{{ end -}}
{{ end }}
{{ else if eq $type "plugins" }}
{{ range $plugins }}
{{ path.Base .Name -}}
{{ end }}
{{ end }}

View File

@@ -0,0 +1,57 @@
<!--
Embed videos from Hugo Page Resources.
Setting src="my-video" with the Page Bundle containing...
- my-video.png
- my-video.mp4
- my-video.webm
...will render the following:
<video poster="my-video.png">
<source src="my-video.mp4" type="video/mp4" />
<source src="my-video.webm" type="video/webm" />
</video>
-->
{{ $src := .Get "src" }}
{{ if strings.HasPrefix $src "./" }}
<!-- Strip "./" prefix from relative path -->
{{ $src = substr $src 2 }}
{{ end }}
{{ $poster := ((.Page.Resources.ByType "image").GetMatch (printf "%s*" $src)) }}
{{ $videos := (.Page.Resources.ByType "video").Match (printf "%s*" $src) }}
<!--prettier-ignore-->
{{ if .Get "caption" }}
<figure>
{{ end }}
{{ if $videos }}
<video
{{ if eq (.Get "autoplay") "true" }}autoplay{{ end }}
{{ if eq (.Get "controls" | default "true") "true" }}controls{{ end }}
{{ with .Get "height" }}height="{{ . }}"{{ end }}
{{ if eq (.Get "loop") "true" }}loop{{ end }}
{{ if eq (.Get "muted") "true" }}muted{{ end }}
{{ with $poster }}poster="{{ .RelPermalink }}"{{ end }}
{{ with .Get "preload" }}preload="{{ . }}"{{ end }}
{{ with .Get "width" }}width="{{ . }}"{{ end }}
{{ if eq (.Get "playsinline" | default "true") "true" }}playsinline{{ end }}
>
{{- range $videos -}}
<source src="{{ .RelPermalink }}" type="{{ .MediaType }}" />
{{- end -}}
</video>
{{ end }}
<!--prettier-ignore-->
{{ if .Get "caption" }}
<figcaption>{{ .Page.RenderString (.Get "caption") }}</figcaption>
</figure>
{{ end }}