diff --git a/_config.yml b/_config.yml index badec8d1a41b..47621435c98a 100644 --- a/_config.yml +++ b/_config.yml @@ -242,8 +242,10 @@ scholar: # Filter out certain bibtex entry keywords used internally from the bib output filtered_bibtex_keywords: [abbr, abstract, arxiv, bibtex_show, html, pdf, selected, supp, blog, code, poster, slides, website, preview] -# Maximum number of authors to be shown, other authors will be visible on hover, leave blank to show all authors -max_author_limit: 3 +# Maximum number of authors to be shown for each publication (more authors are visible on click) +max_author_limit: 3 # leave blank to always show all authors +more_authors_animation_delay: 10 # more authors are revealed on click using animation; smaller delay means faster animation + # ----------------------------------------------------------------------------- # Responsive WebP Images diff --git a/_layouts/bib.html b/_layouts/bib.html index 5ce2f1edd38e..cfc3b6c0492b 100644 --- a/_layouts/bib.html +++ b/_layouts/bib.html @@ -29,22 +29,22 @@
{% assign author_array_size = entry.author_array | size %} + {% assign author_array_limit = author_array_size %} {%- if site.max_author_limit and author_array_size > site.max_author_limit %} {% assign author_array_limit = site.max_author_limit %} - {% else %} - {% assign author_array_limit = author_array_size %} {% endif %} {%- for author in entry.author_array limit: author_array_limit -%} {%- assign author_is_self = false -%} - {%- if author.last == site.scholar.last_name %} + {%- assign author_last_name = author.last | remove: "¶" | remove: "&" | remove: "*" | remove: "†" | remove: "^" -%} + {%- if author_last_name == site.scholar.last_name -%} {%- if site.scholar.first_name contains author.first -%} {%- assign author_is_self = true -%} {%- endif -%} {%- endif -%} {%- assign coauthor_url = nil -%} - {%- if site.data.coauthors[author.last] -%} - {%- for coauthor in site.data.coauthors[author.last] -%} + {%- if site.data.coauthors[author_last_name] -%} + {%- for coauthor in site.data.coauthors[author_last_name] -%} {%- if coauthor.firstname contains author.first -%} {%- assign coauthor_url = coauthor.url -%} {%- break -%} @@ -52,53 +52,35 @@ {%- endfor -%} {%- endif -%} - {%- if forloop.length == 1 -%} - {%- if author_is_self %} - {{author.last}}, {{author.first}} - {%- else -%} - {{author.last}}, {{author.first}} - {%- endif -%} + {%- if forloop.length > 1 -%} + {%- if forloop.first == false -%}, {%- endif -%} + {%- if forloop.last and author_array_limit == author_array_size -%}and {%- endif -%} + {%- endif -%} + {%- if author_is_self -%} + {{author.first}} {{author.last}} {%- else -%} - {%- unless forloop.last -%} - {% if author_is_self %} - {{author.last}}, {{author.first}},  - {%- else -%} - {% if coauthor_url -%} - {{author.last}}, {{author.first}},  - {%- else -%} - {{author.last}}, {{author.first}},  - {%- endif -%} - {%- endif -%} + {%- if coauthor_url -%} + {{author.first}} {{author.last}} {%- else -%} - {%- if author_array_limit == author_array_size %} and {% endif %} - {% if author_is_self -%} - {{author.last}}, {{author.first}} - {% else -%} - {%- if coauthor_url -%} - {{author.last}}, {{author.first}} - {% else -%} - {{author.last}}, {{author.first}} - {%- endif -%} - {%- endif -%} - {%- endunless -%} + {{author.first}} {{author.last}} + {%- endif -%} {%- endif -%} - {%- endfor %} - - {% assign more_authors = author_array_size | minus: author_array_limit %} - - {%- if more_authors > 0 %} - {% assign more_authors_hide = more_authors | append: " more author" %} - {% if more_authors > 1 %} - {% assign more_authors_hide = more_authors_hide | append: "s" %} - {% endif %} - {% assign more_authors_show = '' %} + {%- endfor -%} + {%- assign more_authors = author_array_size | minus: author_array_limit -%} + + {%- assign more_authors_hide = more_authors | append: " more author" -%} + {%- if more_authors > 0 -%} + {%- if more_authors > 1 -%} + {%- assign more_authors_hide = more_authors_hide | append: "s" -%} + {%- endif -%} + {%- assign more_authors_show = '' -%} {%- for author in entry.author_array offset: author_array_limit -%} - {% assign more_authors_show = more_authors_show | append: author.last | append: ", " | append: author.first %} - {% unless forloop.last %} - {% assign more_authors_show = more_authors_show | append: ", " %} - {% endunless %} + {%- assign more_authors_show = more_authors_show | append: author.first | append: " " | append: author.last -%} + {%- unless forloop.last -%} + {%- assign more_authors_show = more_authors_show | append: ", " -%} + {%- endunless -%} {%- endfor -%} - and + , and {{more_authors_hide}} - {% endif %} + {%- endif -%}