Skip to content

Commit

Permalink
Support more accurate author annotation (#156)
Browse files Browse the repository at this point in the history
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`
  • Loading branch information
ziruizhuang authored Dec 27, 2020
1 parent 420e228 commit 7886538
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ plugins:
scholar:

last_name: Einstein
first_name: [Albert, A.]

style: apa
locale: en
Expand Down
12 changes: 9 additions & 3 deletions _layouts/bib.html
Original file line number Diff line number Diff line change
Expand Up @@ -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] %}
Expand All @@ -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] %}
Expand Down

0 comments on commit 7886538

Please sign in to comment.