Files
web/layouts/_shortcodes/publications.html
T

62 lines
2.9 KiB
HTML

{{- /* Render data/publications.yaml using the cached CSL-JSON in
data/citations/ (populated by `make citations`). Group members'
surnames are shown in bold. */ -}}
{{- /* Group surnames to embolden, taken from each /people page's `surname`
(current members and alumni alike) so the roster is the single source
of truth. Use ASCII surnames to match the CSL `family` names. */ -}}
{{- $group := slice -}}
{{- range (site.GetPage "/people").Pages -}}
{{- with .Params.surname -}}{{- $group = $group | append . -}}{{- end -}}
{{- end -}}
<ul class="pub-list">
{{- range hugo.Data.publications.papers -}}
{{- $note := .note -}}
{{- $arxiv := .arxiv -}}
{{- $fix := .fix -}}
{{- $key := .doi | lower | replaceRE "[^a-z0-9]" "_" -}}
{{- $c := index hugo.Data.citations $key -}}
{{- if $c -}}
{{- $names := slice -}}
{{- $groupExtra := slice -}}
{{- range $i, $a := $c.author -}}
{{- $ini := "" -}}
{{- range (split ($a.given | default "") " ") -}}
{{- $t := trim . " " -}}
{{- if gt (len $t) 0 -}}{{- $ini = printf "%s%s. " $ini (substr $t 0 1) -}}{{- end -}}
{{- end -}}
{{- $family := $a.family | default "" -}}
{{- with $fix -}}{{- with (index . $family) -}}{{- $family = . -}}{{- end -}}{{- end -}}
{{- $name := printf "%s%s" $ini $family -}}
{{- $isgroup := in $group $family -}}
{{- if $isgroup -}}{{- $name = printf "<strong>%s</strong>" $name -}}{{- end -}}
{{- $names = $names | append $name -}}
{{- if and $isgroup (gt $i 0) -}}{{- $groupExtra = $groupExtra | append $name -}}{{- end -}}
{{- end -}}
{{- /* Long author lists: first author + et al., still naming group members. */ -}}
{{- $authors := "" -}}
{{- if le (len $names) 10 -}}
{{- $authors = delimit $names ", " -}}
{{- else -}}
{{- $authors = printf "%s et al." (index $names 0) -}}
{{- with $groupExtra -}}{{- $authors = printf "%s, incl. %s" $authors (delimit . ", ") -}}{{- end -}}
{{- end -}}
{{- $year := "" -}}
{{- with $c.issued -}}{{- with (index . "date-parts") -}}{{- $year = index (index . 0) 0 -}}{{- end -}}{{- end -}}
{{- $container := index $c "container-title" -}}
{{- $art := or (index $c "article-number") (index $c "page") -}}
{{- $doi := $c.DOI -}}
<li>
{{ $authors | safeHTML }},
<em>{{ $c.title }}</em>,
{{- if $container }} {{ $container }}{{ with $c.volume }} <strong>{{ . }}</strong>{{ end }}{{ with $art }}, {{ . }}{{ end }}
{{- else }} arXiv:{{ replaceRE `(?i)^10\.48550/arxiv\.` "" $doi }}
{{- end }}
{{- with $year }} ({{ . }}){{ end }}.
<a href="https://doi.org/{{ $doi }}">doi:{{ $doi }}</a>{{ with $arxiv }} / <a href="https://arxiv.org/abs/{{ . }}">arXiv:{{ . }}</a>{{ end }}{{ with $note }} (<em>{{ . }}</em>){{ end }}
</li>
{{- else -}}
{{- warnf "publications: no cached citation for DOI %q (run: make citations)" .doi -}}
{{- end -}}
{{- end -}}
</ul>