Skip to content

Commit 7886538

Browse files
authored
Support more accurate author annotation (alshedivat#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`
1 parent 420e228 commit 7886538

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

_config.yml

+1
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ plugins:
127127
scholar:
128128

129129
last_name: Einstein
130+
first_name: [Albert, A.]
130131

131132
style: apa
132133
locale: en

_layouts/bib.html

+9-3
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,21 @@
1919
<div class="title">{{entry.title}}</div>
2020
<div class="author">
2121
{% for author in entry.author_array %}
22+
{% assign author_is_self = false %}
23+
{% if author.last == site.scholar.last_name%}
24+
{% if site.scholar.first_name contains author.first%}
25+
{% assign author_is_self = true %}
26+
{% endif %}
27+
{% endif %}
2228
{% if forloop.length == 1 %}
23-
{% if author.last == site.scholar.last_name %}
29+
{% if author_is_self %}
2430
<em>{{author.last}}, {{author.first}}</em>
2531
{% else %}
2632
{{author.last}}, {{author.first}}
2733
{% endif %}
2834
{% else %}
2935
{% unless forloop.last %}
30-
{% if author.last == site.scholar.last_name %}
36+
{% if author_is_self %}
3137
<em>{{author.last}}, {{author.first}}</em>,
3238
{% else %}
3339
{% if site.data.coauthors[author.last] %}
@@ -37,7 +43,7 @@
3743
{% endif %}
3844
{% endif %}
3945
{% else %}
40-
{% if author.last == site.scholar.last_name %}
46+
{% if author_is_self %}
4147
and <em>{{author.last}}, {{author.first}}</em>
4248
{% else %}
4349
{% if site.data.coauthors[author.last] %}

0 commit comments

Comments
 (0)