From 477f9673d9f2672747c01bb1357ca96c32c25753 Mon Sep 17 00:00:00 2001 From: jchen-cs Date: Wed, 5 Apr 2023 19:08:40 -0400 Subject: [PATCH] Fix comma behavior in publications author list --- layouts/partials/publication.html | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/layouts/partials/publication.html b/layouts/partials/publication.html index 234db7f..6fafb3a 100644 --- a/layouts/partials/publication.html +++ b/layouts/partials/publication.html @@ -10,16 +10,18 @@ class="w-full"/>
- {{ range $author_index, $author_val := .authors }} - {{ if $author_val.me }} - - {{ end }} - - {{- /* Add comma if not last author */ -}} - {{- if le $author_index (len .) -}},{{- end -}} - {{ if $author_val.me }} - - {{ end }} + {{ with $authorlist := .authors }} + {{ range $author_index, $author_val := $authorlist }} + {{ if $author_val.me }} + + {{ end }} + + {{- /* Add comma if not last author */ -}} + {{- if lt $author_index (sub (len $authorlist) 1) -}},{{- end -}} + {{ if $author_val.me }} + + {{ end }} + {{ end }} {{ end }}