Skip to content

Commit a25df79

Browse files
authored
Support superscripts in bibtex author names (alshedivat#2512)
Implements alshedivat#2511
1 parent 3b1c108 commit a25df79

File tree

9 files changed

+67
-6
lines changed

9 files changed

+67
-6
lines changed

CUSTOMIZE.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ You can easily create your own collections, apps, short stories, courses, or wha
8080

8181
To add publications create a new entry in the [\_bibliography/papers.bib](_bibliography/papers.bib) file. You can find the BibTeX entry of a publication in Google Scholar by clicking on the quotation marks below the publication title, then clicking on "BibTeX", or also in the conference page itself. By default, the publications will be sorted by year and the most recent will be displayed first. You can change this behavior and more in the `Jekyll Scholar` section in [\_config.yml](_config.yml) file.
8282

83-
You can add extra information to a publication, like a PDF file in the `assets/pdfs/` directory and add the path to the PDF file in the BibTeX entry with the `pdf` field. Some of the supported fields are: `abstract`, `altmetric`, `arxiv`, `bibtex_show`, `blog`, `code`, `dimensions`, `doi`, `eprint`, `html`, `isbn`, `pdf`, `pmid`, `poster`, `slides`, `supp`, `video`, and `website`.
83+
You can add extra information to a publication, like a PDF file in the `assets/pdfs/` directory and add the path to the PDF file in the BibTeX entry with the `pdf` field. Some of the supported fields are: `abstract`, `altmetric`, `annotation`, `arxiv`, `bibtex_show`, `blog`, `code`, `dimensions`, `doi`, `eprint`, `html`, `isbn`, `pdf`, `pmid`, `poster`, `slides`, `supp`, `video`, and `website`.
8484

8585
### Author annotation
8686

@@ -124,6 +124,7 @@ There are several custom bibtex keywords that you can use to affect how the entr
124124
- `abbr`: Adds an abbreviation to the left of the entry. You can add links to these by creating a venue.yaml-file in the \_data folder and adding entries that match.
125125
- `abstract`: Adds an "Abs" button that expands a hidden text field when clicked to show the abstract text
126126
- `altmetric`: Adds an [Altmetric](https://www.altmetric.com/) badge (Note: if DOI is provided just use `true`, otherwise only add the altmetric identifier here - the link is generated automatically)
127+
- `annotation`: Adds a popover info message to the end of the author list that can potentially be used to clarify superscripts. HTML is allowed.
127128
- `arxiv`: Adds a link to the Arxiv website (Note: only add the arxiv identifier here - the link is generated automatically)
128129
- `bibtex_show`: Adds a "Bib" button that expands a hidden text field with the full bibliography entry
129130
- `blog`: Adds a "Blog" button redirecting to the specified link

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ group :jekyll_plugins do
1111
gem 'jekyll-link-attributes'
1212
gem 'jekyll-minifier'
1313
gem 'jekyll-paginate-v2'
14+
gem 'jekyll-regex-replace'
1415
gem 'jekyll-scholar'
1516
gem 'jekyll-sitemap'
1617
gem 'jekyll-tabs'

Gemfile.lock

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ GEM
105105
uglifier (~> 4.1)
106106
jekyll-paginate-v2 (3.0.0)
107107
jekyll (>= 3.0, < 5.0)
108+
jekyll-regex-replace (1.1.0)
108109
jekyll-sass-converter (3.0.0)
109110
sass-embedded (~> 1.54)
110111
jekyll-scholar (7.1.3)
@@ -205,6 +206,7 @@ DEPENDENCIES
205206
jekyll-link-attributes
206207
jekyll-minifier
207208
jekyll-paginate-v2
209+
jekyll-regex-replace
208210
jekyll-scholar
209211
jekyll-sitemap
210212
jekyll-tabs

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ Feel free to add your own page(s) by sending a PR.
142142
<a href="https://jackjburnett.github.io/" target="_blank">★</a>
143143
<a href="https://physics-morris.github.io/" target="_blank">★</a>
144144
<a href="https://sraf.ir" target="_blank">★</a>
145+
<a href="https://acad.garywei.dev/" target="_blank">★</a>
145146
</td>
146147
</tr>
147148
<tr>

_config.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ plugins:
252252
- jekyll-link-attributes
253253
- jekyll-minifier
254254
- jekyll-paginate-v2
255+
- jekyll-regex-replace
255256
- jekyll/scholar
256257
- jekyll-sitemap
257258
- jekyll-tabs
@@ -338,6 +339,7 @@ filtered_bibtex_keywords:
338339
abstract,
339340
additional_info,
340341
altmetric,
342+
annotation,
341343
arxiv,
342344
award,
343345
award_name,

_layouts/bib.liquid

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@
5959

6060
{%- for author in entry.author_array limit: author_array_limit -%}
6161
{% assign author_is_self = false %}
62-
{%- assign author_last_name = author.last | remove: '¶' | remove: '&' | remove: '*' | remove: '†' | remove: '^' -%}
62+
{%- assign author_last_name = author.last | regex_replace: '[*∗†‡§¶‖&^]', '' -%}
63+
{%- assign author_last_html = author.last | regex_replace: '([*∗†‡§¶‖&^]+)', '<sup>\1</sup>' -%}
6364
{% if site.scholar.last_name contains author_last_name %}
6465
{% if site.scholar.first_name contains author.first %}
6566
{% assign author_is_self = true %}
@@ -83,17 +84,17 @@
8384
{%- if author_is_self -%}
8485
<em>
8586
{{- author.first }}
86-
{{ author.last -}}
87+
{{ author_last_html -}}
8788
</em>
8889
{%- else -%}
8990
{%- if coauthor_url -%}
9091
<a href="{{coauthor_url}}">
9192
{{- author.first }}
92-
{{ author.last -}}
93+
{{ author_last_html -}}
9394
</a>
9495
{%- else -%}
9596
{{- author.first }}
96-
{{ author.last -}}
97+
{{ author_last_html -}}
9798
{% endif %}
9899
{%- endif -%}
99100
{% endfor %}
@@ -111,6 +112,7 @@
111112
{% assign more_authors_show = more_authors_show | append: ', ' %}
112113
{% endunless %}
113114
{%- endfor -%}
115+
{% assign more_authors_show = more_authors_show | regex_replace: '([*∗†‡§¶‖&^]+)', '<sup>\1</sup>' %}
114116
, and
115117
<span
116118
class="more-authors"
@@ -121,7 +123,7 @@
121123
var more_authors_text = element.text() == '{{more_authors_hide}}' ? '{{more_authors_show}}' : '{{more_authors_hide}}';
122124
var cursorPosition = 0;
123125
var textAdder = setInterval(function(){
124-
element.text(more_authors_text.substring(0, cursorPosition + 1));
126+
element.html(more_authors_text.substring(0, cursorPosition + 1));
125127
if (++cursorPosition == more_authors_text.length){
126128
clearInterval(textAdder);
127129
}
@@ -131,6 +133,16 @@
131133
{{- more_authors_hide -}}
132134
</span>
133135
{% endif %}
136+
{% if entry.annotation %}
137+
<i
138+
class="fa-solid fa-circle-info ml-1"
139+
data-toggle="popover"
140+
data-placement="top"
141+
data-html="true"
142+
data-content="{{ entry.annotation | escape }}"
143+
>
144+
</i>
145+
{% endif %}
134146
</div>
135147

136148
<!-- Journal/Book title and date -->

_plugins/hide-custom-bibtex.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ def hideCustomBibtex(input)
77
input = input.gsub(/^.*\b#{keyword}\b *= *\{.*$\n/, '')
88
end
99

10+
# Clean superscripts in author lists
11+
input = input.gsub(/^.*\bauthor\b *= *\{.*$\n/) { |line| line.gsub(/[*†‡§¶‖&^]/, '') }
12+
1013
return input
1114
end
1215
end

_sass/_base.scss

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1134,3 +1134,37 @@ ninja-keys::part(ninja-input) {
11341134
ninja-keys::part(ninja-input-wrapper) {
11351135
background: var(--global-bg-color);
11361136
}
1137+
1138+
// popover is used for annotation in bib.liquid
1139+
.popover {
1140+
background-color: var(--global-bg-color);
1141+
border-color: var(--global-divider-color);
1142+
1143+
.popover-header {
1144+
color: var(--global-text-color); // Header text color
1145+
border-bottom: 1px solid var(--global-divider-color);
1146+
}
1147+
.popover-body {
1148+
color: var(--global-text-color); // Body text color
1149+
}
1150+
}
1151+
.bs-popover-top {
1152+
// arrow fill color
1153+
.arrow::after {
1154+
border-top-color: var(--global-bg-color);
1155+
}
1156+
// arrow border color
1157+
.arrow:before {
1158+
border-top-color: var(--global-divider-color);
1159+
}
1160+
}
1161+
.bs-popover-bottom {
1162+
// arrow fill color
1163+
.arrow::after {
1164+
border-bottom-color: var(--global-bg-color);
1165+
}
1166+
// arrow border color
1167+
.arrow:before {
1168+
border-bottom-color: var(--global-divider-color);
1169+
}
1170+
}

assets/js/common.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,9 @@ $(document).ready(function () {
5151
});
5252
}
5353
});
54+
55+
// trigger popovers
56+
$('[data-toggle="popover"]').popover({
57+
trigger: "hover",
58+
});
5459
});

0 commit comments

Comments
 (0)