From 78865389925a3870b44031b024d2e4802b48b9d0 Mon Sep 17 00:00:00 2001 From: Zirui Zhuang Date: Sun, 27 Dec 2020 10:52:15 +0800 Subject: [PATCH] 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` --- _config.yml | 1 + _layouts/bib.html | 12 +++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/_config.yml b/_config.yml index db8e770..3a78cdc 100644 --- a/_config.yml +++ b/_config.yml @@ -127,6 +127,7 @@ plugins: scholar: last_name: Einstein + first_name: [Albert, A.] style: apa locale: en diff --git a/_layouts/bib.html b/_layouts/bib.html index 35cd677..241ac1c 100644 --- a/_layouts/bib.html +++ b/_layouts/bib.html @@ -19,15 +19,21 @@
{{entry.title}}
{% 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 %} {{author.last}}, {{author.first}} {% else %} {{author.last}}, {{author.first}} {% endif %} {% else %} {% unless forloop.last %} - {% if author.last == site.scholar.last_name %} + {% if author_is_self %} {{author.last}}, {{author.first}}, {% 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 {{author.last}}, {{author.first}} {% else %} {% if site.data.coauthors[author.last] %}