Files
hugo/layouts/partials/notes/bibmeta.html
T

14 lines
847 B
HTML

{{- $p := . -}}
{{- $raw := $p.RawContent -}}
{{- $author := $p.Params.ref_author | default "" -}}
{{- if not $author }}{{ with findRE `(?m)^Author\(s\)\r?\n: (.+)$` $raw 1 }}{{ $author = replaceRE `^Author\(s\)\r?\n: ` "" (index . 0) }}{{ end }}{{ end -}}
{{- $author = $author | replaceRE `&` "&" | strings.TrimSpace -}}
{{- $year := $p.Params.ref_year | default "" -}}
{{- if not $year }}{{ with findRE `(?m)^Year\r?\n: (\d{4})` $raw 1 }}{{ $year = replaceRE `^Year\r?\n: ` "" (index . 0) }}{{ end }}{{ end -}}
{{- $notes := slice -}}
{{- range findRE `relref "[^"]+\.md"` $raw -}}
{{- $base := . | replaceRE `^relref "(?:.*/)?([^"/]+)\.md"$` "$1" -}}
{{- with site.GetPage (printf "/zettels/%s" $base) }}{{ $notes = $notes | append . }}{{ end -}}
{{- end -}}
{{- return (dict "author" $author "year" (string $year) "notes" $notes) -}}