Support more accurate author annotation (#156)

added a list `scholar: first_name` in `_config.yml`
updated `_layouts/bib.html` template
supports more accurate author annotation by both matching the last name and one form of first name in the `_config.yml/scholar: first_name`
This commit is contained in:
Zirui Zhuang 2020-12-27 10:52:15 +08:00 committed by GitHub
parent 420e2280eb
commit 7886538992
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 3 deletions

View File

@ -127,6 +127,7 @@ plugins:
scholar:
last_name: Einstein
first_name: [Albert, A.]
style: apa
locale: en

View File

@ -19,15 +19,21 @@
<div class="title">{{entry.title}}</div>
<div class="author">
{% for author in entry.author_array %}
{% assign author_is_self = false %}
{% if author.last == site.scholar.last_name%}
{% if site.scholar.first_name contains author.first%}
{% assign author_is_self = true %}
{% endif %}
{% endif %}
{% if forloop.length == 1 %}
{% if author.last == site.scholar.last_name %}
{% if author_is_self %}
<em>{{author.last}}, {{author.first}}</em>
{% else %}
{{author.last}}, {{author.first}}
{% endif %}
{% else %}
{% unless forloop.last %}
{% if author.last == site.scholar.last_name %}
{% if author_is_self %}
<em>{{author.last}}, {{author.first}}</em>,
{% else %}
{% if site.data.coauthors[author.last] %}
@ -37,7 +43,7 @@
{% endif %}
{% endif %}
{% else %}
{% if author.last == site.scholar.last_name %}
{% if author_is_self %}
and <em>{{author.last}}, {{author.first}}</em>
{% else %}
{% if site.data.coauthors[author.last] %}