Skip to content

Commit

Permalink
add coauthor annotation (#175)
Browse files Browse the repository at this point in the history
* add coauthor annotation

* fix typo in coauthors.yml

* add brief author annotation tutorial in README.md

* change to combined data structure

Coauthors are grouped by their last names. Within each group, using flat format (array of {firstnames, url}).

* Update _layouts/bib.html

stylistic changes

Co-authored-by: Maruan <alshedivat@users.noreply.github.com>

* Update _layouts/bib.html

stylistic changes

Co-authored-by: Maruan <alshedivat@users.noreply.github.com>

* Update _layouts/bib.html

stylistic changes

Co-authored-by: Maruan <alshedivat@users.noreply.github.com>

* Update _layouts/bib.html

stylistic changes

Co-authored-by: Maruan <alshedivat@users.noreply.github.com>

Co-authored-by: Maruan <alshedivat@users.noreply.github.com>
  • Loading branch information
ziruizhuang and alshedivat committed Jan 12, 2021
1 parent dc254f7 commit 6b28f90
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 7 deletions.
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,36 @@ Your publications page is generated automatically from your BibTex bibliography.
Simply edit `_bibliography/papers.bib`.
You can also add new `*.bib` files and customize the look of your publications however you like by editing `_pages/publications.md`.

#### Author Annotation
In publications, the author entry for your self is identified by string `scholar:last_name` and string array `scholar:first_name` in `_config.yml`. If the entry matches the last name and one form of the first names, it will be underlined.
```
scholar:
last_name: Einstein
first_name: [Albert, A.]
```
Keep meta-information about your co-authors in `_data/coauthors.yml` and Jekyll will insert links to their webpages automatically.
The coauthor data format in `_data/coauthors.yml` is as follows,
```
"Adams":
- firstname: ["Edwin", "E.", "E. P.", "Edwin Plimpton"]
url: https://en.wikipedia.org/wiki/Edwin_Plimpton_Adams
"Podolsky":
- firstname: ["Boris", "B.", "B. Y.", "Boris Yakovlevich"]
url: https://en.wikipedia.org/wiki/Boris_Podolsky
"Rosen":
- firstname: ["Nathan", "N."]
url: https://en.wikipedia.org/wiki/Nathan_Rosen
"Bach":
- firstname: ["Johann Sebastian", "J. S."]
url: https://en.wikipedia.org/wiki/Johann_Sebastian_Bach
- firstname: ["Carl Philipp Emanuel", "C. P. E."]
url: https://en.wikipedia.org/wiki/Carl_Philipp_Emanuel_Bach
```
If the entry matches one of the combinations of the last names and the first names, it will be highlighted and linked to the url provided.

<p align="center"><img src="assets/img/publications-screenshot.png" width=800></p>

Expand Down
16 changes: 13 additions & 3 deletions _data/coauthors.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
Adams:
"Adams":
- firstname: ["Edwin", "E.", "E. P.", "Edwin Plimpton"]
url: https://en.wikipedia.org/wiki/Edwin_Plimpton_Adams

Podolsky:
"Podolsky":
- firstname: ["Boris", "B.", "B. Y.", "Boris Yakovlevich"]
url: https://en.wikipedia.org/wiki/Boris_Podolsky

Rosen:
"Rosen":
- firstname: ["Nathan", "N."]
url: https://en.wikipedia.org/wiki/Nathan_Rosen

"Bach":
- firstname: ["Johann Sebastian", "J. S."]
url: https://en.wikipedia.org/wiki/Johann_Sebastian_Bach

- firstname: ["Carl Philipp Emanuel", "C. P. E."]
url: https://en.wikipedia.org/wiki/Carl_Philipp_Emanuel_Bach
18 changes: 14 additions & 4 deletions _layouts/bib.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@
{% assign author_is_self = true %}
{% endif %}
{% endif %}
{% assign coauthor_url = nil %}
{% if site.data.coauthors[author.last] %}
{% for coauthor in site.data.coauthors[author.last] %}
{% if coauthor.firstname contains author.first %}
{% assign coauthor_url = coauthor.url %}
{% break %}
{% endif %}
{% endfor %}
{% endif %}

{% if forloop.length == 1 %}
{% if author_is_self %}
<em>{{author.last}}, {{author.first}}</em>
Expand All @@ -36,8 +46,8 @@
{% if author_is_self %}
<em>{{author.last}}, {{author.first}}</em>,
{% else %}
{% if site.data.coauthors[author.last] %}
<a href="{{site.data.coauthors[author.last].url}}" target="_blank">{{author.last}}, {{author.first}}</a>,
{% if coauthor_url %}
<a href="{{coauthor_url}}" target="_blank">{{author.last}}, {{author.first}}</a>,
{% else %}
{{author.last}}, {{author.first}},
{% endif %}
Expand All @@ -46,8 +56,8 @@
{% if author_is_self %}
and <em>{{author.last}}, {{author.first}}</em>
{% else %}
{% if site.data.coauthors[author.last] %}
and <a href="{{site.data.coauthors[author.last].url}}" target="_blank">{{author.last}}, {{author.first}}</a>
{% if coauthor_url %}
and <a href="{{coauthor_url}}" target="_blank">{{author.last}}, {{author.first}}</a>
{% else %}
and {{author.last}}, {{author.first}}
{% endif %}
Expand Down

0 comments on commit 6b28f90

Please sign in to comment.