Adds support `max_author_limit` (#732)
* Adds support max author limit * typo * fix * display all authors by default * Added an example * Added 'and' before the last author * Improve hiding/showing more authors * Add title text Co-authored-by: Maruan Al-Shedivat <maruan@genesistherapeutics.ai> Co-authored-by: Maruan <alshedivat@users.noreply.github.com>
This commit is contained in:
parent
7c71285bc3
commit
07330b9bf9
|
|
@ -71,3 +71,11 @@
|
||||||
author={Einstein, A.},
|
author={Einstein, A.},
|
||||||
year={1905}
|
year={1905}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@book{przibram1967letters,
|
||||||
|
bibtex_show={true},
|
||||||
|
title={Letters on wave mechanics},
|
||||||
|
author={Einstein, Albert and Schrödinger, Erwin and Planck, Max and Lorentz, Hendrik Antoon and Przibram, Karl},
|
||||||
|
year={1967},
|
||||||
|
publisher={Vision}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -234,7 +234,11 @@ scholar:
|
||||||
|
|
||||||
query: "@*"
|
query: "@*"
|
||||||
|
|
||||||
filtered_bibtex_keywords: [abbr, abstract, arxiv, bibtex_show, html, pdf, selected, supp, blog, code, poster, slides, website, preview] # Filter out certain bibtex entry keywords used internally from the bib output
|
# 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
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# Responsive WebP Images
|
# Responsive WebP Images
|
||||||
|
|
|
||||||
|
|
@ -16,3 +16,19 @@
|
||||||
|
|
||||||
- firstname: ["Carl Philipp Emanuel", "C. P. E."]
|
- firstname: ["Carl Philipp Emanuel", "C. P. E."]
|
||||||
url: https://en.wikipedia.org/wiki/Carl_Philipp_Emanuel_Bach
|
url: https://en.wikipedia.org/wiki/Carl_Philipp_Emanuel_Bach
|
||||||
|
|
||||||
|
"Przibram":
|
||||||
|
- firstname: ["Karl"]
|
||||||
|
url: https://link.springer.com/article/10.1007/s00016-019-00242-z
|
||||||
|
|
||||||
|
"Schrödinger":
|
||||||
|
- firstname: ["Erwin"]
|
||||||
|
url: https://en.wikipedia.org/wiki/Erwin_Schr%C3%B6dinger
|
||||||
|
|
||||||
|
"Lorentz":
|
||||||
|
- firstname: ["Hendrik Antoon"]
|
||||||
|
url: https://en.wikipedia.org/wiki/Hendrik_Lorentz
|
||||||
|
|
||||||
|
"Planck":
|
||||||
|
- firstname: ["Max"]
|
||||||
|
url: https://en.wikipedia.org/wiki/Max_Planck
|
||||||
|
|
|
||||||
|
|
@ -27,9 +27,17 @@
|
||||||
<div class="title">{{entry.title}}</div>
|
<div class="title">{{entry.title}}</div>
|
||||||
<!-- Author -->
|
<!-- Author -->
|
||||||
<div class="author">
|
<div class="author">
|
||||||
{%- for author in entry.author_array -%}
|
{% assign author_array_size = entry.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 -%}
|
{%- assign author_is_self = false -%}
|
||||||
{%- if author.last == site.scholar.last_name%}
|
{%- if author.last == site.scholar.last_name %}
|
||||||
{%- if site.scholar.first_name contains author.first -%}
|
{%- if site.scholar.first_name contains author.first -%}
|
||||||
{%- assign author_is_self = true -%}
|
{%- assign author_is_self = true -%}
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
|
|
@ -62,18 +70,53 @@
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
{%- else -%}
|
{%- else -%}
|
||||||
|
{%- if author_array_limit == author_array_size %} and {% endif %}
|
||||||
{% if author_is_self -%}
|
{% if author_is_self -%}
|
||||||
and <em>{{author.last}}, {{author.first}}</em>
|
<em>{{author.last}}, {{author.first}}</em>
|
||||||
{% else -%}
|
{% else -%}
|
||||||
{%- if coauthor_url -%}
|
{%- if coauthor_url -%}
|
||||||
and <a href="{{coauthor_url}}">{{author.last}}, {{author.first}}</a>
|
<a href="{{coauthor_url}}">{{author.last}}, {{author.first}}</a>
|
||||||
{% else -%}
|
{% else -%}
|
||||||
and {{author.last}}, {{author.first}}
|
{{author.last}}, {{author.first}}
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
{%- endunless -%}
|
{%- endunless -%}
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
{%- endfor %}
|
{%- 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 = '' %}
|
||||||
|
{%- 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 %}
|
||||||
|
{%- endfor -%}
|
||||||
|
and
|
||||||
|
<span
|
||||||
|
class="more-authors"
|
||||||
|
title="click to view {{more_authors_hide}}"
|
||||||
|
onclick="
|
||||||
|
var element = $('span.more-authors');
|
||||||
|
var more_authors_text = element.text() == '{{more_authors_hide}}' ? '{{more_authors_show}}' : '{{more_authors_hide}}';
|
||||||
|
var cursorPosition = 0;
|
||||||
|
var textAdder = setInterval(function(){
|
||||||
|
element.text(more_authors_text.substring(0, cursorPosition + 1));
|
||||||
|
element.attr('title', '');
|
||||||
|
if (++cursorPosition == more_authors_text.length){
|
||||||
|
clearInterval(textAdder);
|
||||||
|
}
|
||||||
|
}, 15);
|
||||||
|
"
|
||||||
|
>{{more_authors_hide}}</span>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Journal/Book title and date -->
|
<!-- Journal/Book title and date -->
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ layout: page
|
||||||
permalink: /publications/
|
permalink: /publications/
|
||||||
title: publications
|
title: publications
|
||||||
description: publications by categories in reversed chronological order. generated by jekyll-scholar.
|
description: publications by categories in reversed chronological order. generated by jekyll-scholar.
|
||||||
years: [1956, 1950, 1935, 1905]
|
years: [1967, 1956, 1950, 1935, 1905]
|
||||||
nav: true
|
nav: true
|
||||||
nav_order: 1
|
nav_order: 1
|
||||||
---
|
---
|
||||||
|
|
|
||||||
|
|
@ -519,6 +519,15 @@ footer.sticky-bottom {
|
||||||
border-bottom: 1px solid;
|
border-bottom: 1px solid;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
}
|
}
|
||||||
|
> span.more-authors {
|
||||||
|
color: var(--global-text-color-light);
|
||||||
|
border-bottom: 1px dashed var(--global-text-color-light);
|
||||||
|
cursor: pointer;
|
||||||
|
&:hover {
|
||||||
|
color: var(--global-text-color);
|
||||||
|
border-bottom: 1px dashed var(--global-text-color);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.links {
|
.links {
|
||||||
a.btn {
|
a.btn {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue