Support superscripts in bibtex author names (#2512)

Implements #2511
This commit is contained in:
ariseus 2024-06-19 13:34:54 -04:00 committed by GitHub
parent 3b1c10844f
commit a25df79188
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 67 additions and 6 deletions

View File

@ -80,7 +80,7 @@ You can easily create your own collections, apps, short stories, courses, or wha
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. 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.
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`. 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`.
### Author annotation ### Author annotation
@ -124,6 +124,7 @@ There are several custom bibtex keywords that you can use to affect how the entr
- `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. - `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.
- `abstract`: Adds an "Abs" button that expands a hidden text field when clicked to show the abstract text - `abstract`: Adds an "Abs" button that expands a hidden text field when clicked to show the abstract text
- `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) - `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)
- `annotation`: Adds a popover info message to the end of the author list that can potentially be used to clarify superscripts. HTML is allowed.
- `arxiv`: Adds a link to the Arxiv website (Note: only add the arxiv identifier here - the link is generated automatically) - `arxiv`: Adds a link to the Arxiv website (Note: only add the arxiv identifier here - the link is generated automatically)
- `bibtex_show`: Adds a "Bib" button that expands a hidden text field with the full bibliography entry - `bibtex_show`: Adds a "Bib" button that expands a hidden text field with the full bibliography entry
- `blog`: Adds a "Blog" button redirecting to the specified link - `blog`: Adds a "Blog" button redirecting to the specified link

View File

@ -11,6 +11,7 @@ group :jekyll_plugins do
gem 'jekyll-link-attributes' gem 'jekyll-link-attributes'
gem 'jekyll-minifier' gem 'jekyll-minifier'
gem 'jekyll-paginate-v2' gem 'jekyll-paginate-v2'
gem 'jekyll-regex-replace'
gem 'jekyll-scholar' gem 'jekyll-scholar'
gem 'jekyll-sitemap' gem 'jekyll-sitemap'
gem 'jekyll-tabs' gem 'jekyll-tabs'

View File

@ -105,6 +105,7 @@ GEM
uglifier (~> 4.1) uglifier (~> 4.1)
jekyll-paginate-v2 (3.0.0) jekyll-paginate-v2 (3.0.0)
jekyll (>= 3.0, < 5.0) jekyll (>= 3.0, < 5.0)
jekyll-regex-replace (1.1.0)
jekyll-sass-converter (3.0.0) jekyll-sass-converter (3.0.0)
sass-embedded (~> 1.54) sass-embedded (~> 1.54)
jekyll-scholar (7.1.3) jekyll-scholar (7.1.3)
@ -205,6 +206,7 @@ DEPENDENCIES
jekyll-link-attributes jekyll-link-attributes
jekyll-minifier jekyll-minifier
jekyll-paginate-v2 jekyll-paginate-v2
jekyll-regex-replace
jekyll-scholar jekyll-scholar
jekyll-sitemap jekyll-sitemap
jekyll-tabs jekyll-tabs

View File

@ -142,6 +142,7 @@ Feel free to add your own page(s) by sending a PR.
<a href="https://jackjburnett.github.io/" target="_blank"></a> <a href="https://jackjburnett.github.io/" target="_blank"></a>
<a href="https://physics-morris.github.io/" target="_blank"></a> <a href="https://physics-morris.github.io/" target="_blank"></a>
<a href="https://sraf.ir" target="_blank"></a> <a href="https://sraf.ir" target="_blank"></a>
<a href="https://acad.garywei.dev/" target="_blank"></a>
</td> </td>
</tr> </tr>
<tr> <tr>

View File

@ -252,6 +252,7 @@ plugins:
- jekyll-link-attributes - jekyll-link-attributes
- jekyll-minifier - jekyll-minifier
- jekyll-paginate-v2 - jekyll-paginate-v2
- jekyll-regex-replace
- jekyll/scholar - jekyll/scholar
- jekyll-sitemap - jekyll-sitemap
- jekyll-tabs - jekyll-tabs
@ -338,6 +339,7 @@ filtered_bibtex_keywords:
abstract, abstract,
additional_info, additional_info,
altmetric, altmetric,
annotation,
arxiv, arxiv,
award, award,
award_name, award_name,

View File

@ -59,7 +59,8 @@
{%- for author in entry.author_array limit: author_array_limit -%} {%- for author in entry.author_array limit: author_array_limit -%}
{% assign author_is_self = false %} {% assign author_is_self = false %}
{%- assign author_last_name = author.last | remove: '¶' | remove: '&' | remove: '*' | remove: '†' | remove: '^' -%} {%- assign author_last_name = author.last | regex_replace: '[*∗†‡§¶‖&^]', '' -%}
{%- assign author_last_html = author.last | regex_replace: '([*∗†‡§¶‖&^]+)', '<sup>\1</sup>' -%}
{% if site.scholar.last_name contains author_last_name %} {% if site.scholar.last_name contains author_last_name %}
{% if site.scholar.first_name contains author.first %} {% if site.scholar.first_name contains author.first %}
{% assign author_is_self = true %} {% assign author_is_self = true %}
@ -83,17 +84,17 @@
{%- if author_is_self -%} {%- if author_is_self -%}
<em> <em>
{{- author.first }} {{- author.first }}
{{ author.last -}} {{ author_last_html -}}
</em> </em>
{%- else -%} {%- else -%}
{%- if coauthor_url -%} {%- if coauthor_url -%}
<a href="{{coauthor_url}}"> <a href="{{coauthor_url}}">
{{- author.first }} {{- author.first }}
{{ author.last -}} {{ author_last_html -}}
</a> </a>
{%- else -%} {%- else -%}
{{- author.first }} {{- author.first }}
{{ author.last -}} {{ author_last_html -}}
{% endif %} {% endif %}
{%- endif -%} {%- endif -%}
{% endfor %} {% endfor %}
@ -111,6 +112,7 @@
{% assign more_authors_show = more_authors_show | append: ', ' %} {% assign more_authors_show = more_authors_show | append: ', ' %}
{% endunless %} {% endunless %}
{%- endfor -%} {%- endfor -%}
{% assign more_authors_show = more_authors_show | regex_replace: '([*∗†‡§¶‖&^]+)', '<sup>\1</sup>' %}
, and , and
<span <span
class="more-authors" class="more-authors"
@ -121,7 +123,7 @@
var more_authors_text = element.text() == '{{more_authors_hide}}' ? '{{more_authors_show}}' : '{{more_authors_hide}}'; var more_authors_text = element.text() == '{{more_authors_hide}}' ? '{{more_authors_show}}' : '{{more_authors_hide}}';
var cursorPosition = 0; var cursorPosition = 0;
var textAdder = setInterval(function(){ var textAdder = setInterval(function(){
element.text(more_authors_text.substring(0, cursorPosition + 1)); element.html(more_authors_text.substring(0, cursorPosition + 1));
if (++cursorPosition == more_authors_text.length){ if (++cursorPosition == more_authors_text.length){
clearInterval(textAdder); clearInterval(textAdder);
} }
@ -131,6 +133,16 @@
{{- more_authors_hide -}} {{- more_authors_hide -}}
</span> </span>
{% endif %} {% endif %}
{% if entry.annotation %}
<i
class="fa-solid fa-circle-info ml-1"
data-toggle="popover"
data-placement="top"
data-html="true"
data-content="{{ entry.annotation | escape }}"
>
</i>
{% endif %}
</div> </div>
<!-- Journal/Book title and date --> <!-- Journal/Book title and date -->

View File

@ -7,6 +7,9 @@ module Jekyll
input = input.gsub(/^.*\b#{keyword}\b *= *\{.*$\n/, '') input = input.gsub(/^.*\b#{keyword}\b *= *\{.*$\n/, '')
end end
# Clean superscripts in author lists
input = input.gsub(/^.*\bauthor\b *= *\{.*$\n/) { |line| line.gsub(/[*†‡§¶‖&^]/, '') }
return input return input
end end
end end

View File

@ -1134,3 +1134,37 @@ ninja-keys::part(ninja-input) {
ninja-keys::part(ninja-input-wrapper) { ninja-keys::part(ninja-input-wrapper) {
background: var(--global-bg-color); background: var(--global-bg-color);
} }
// popover is used for annotation in bib.liquid
.popover {
background-color: var(--global-bg-color);
border-color: var(--global-divider-color);
.popover-header {
color: var(--global-text-color); // Header text color
border-bottom: 1px solid var(--global-divider-color);
}
.popover-body {
color: var(--global-text-color); // Body text color
}
}
.bs-popover-top {
// arrow fill color
.arrow::after {
border-top-color: var(--global-bg-color);
}
// arrow border color
.arrow:before {
border-top-color: var(--global-divider-color);
}
}
.bs-popover-bottom {
// arrow fill color
.arrow::after {
border-bottom-color: var(--global-bg-color);
}
// arrow border color
.arrow:before {
border-bottom-color: var(--global-divider-color);
}
}

View File

@ -51,4 +51,9 @@ $(document).ready(function () {
}); });
} }
}); });
// trigger popovers
$('[data-toggle="popover"]').popover({
trigger: "hover",
});
}); });