From a467e045f99a8d892dc187921dceddf0558d63f4 Mon Sep 17 00:00:00 2001 From: ariseus <33930674+garywei944@users.noreply.github.com> Date: Wed, 19 Jun 2024 13:34:54 -0400 Subject: [PATCH] Support superscripts in bibtex author names (#2512) Implements #2511 --- CUSTOMIZE.md | 3 ++- Gemfile | 1 + Gemfile.lock | 2 ++ README.md | 1 + _config.yml | 2 ++ _layouts/bib.liquid | 22 +++++++++++++++++----- _plugins/hide-custom-bibtex.rb | 3 +++ _sass/_base.scss | 34 ++++++++++++++++++++++++++++++++++ assets/js/common.js | 5 +++++ 9 files changed, 67 insertions(+), 6 deletions(-) diff --git a/CUSTOMIZE.md b/CUSTOMIZE.md index 7c63511..bdc4b47 100644 --- a/CUSTOMIZE.md +++ b/CUSTOMIZE.md @@ -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. -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 @@ -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. - `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) +- `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) - `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 diff --git a/Gemfile b/Gemfile index 453c17e..fa34c96 100644 --- a/Gemfile +++ b/Gemfile @@ -11,6 +11,7 @@ group :jekyll_plugins do gem 'jekyll-link-attributes' gem 'jekyll-minifier' gem 'jekyll-paginate-v2' + gem 'jekyll-regex-replace' gem 'jekyll-scholar' gem 'jekyll-sitemap' gem 'jekyll-tabs' diff --git a/Gemfile.lock b/Gemfile.lock index 48c266a..33a53ae 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -105,6 +105,7 @@ GEM uglifier (~> 4.1) jekyll-paginate-v2 (3.0.0) jekyll (>= 3.0, < 5.0) + jekyll-regex-replace (1.1.0) jekyll-sass-converter (3.0.0) sass-embedded (~> 1.54) jekyll-scholar (7.1.3) @@ -205,6 +206,7 @@ DEPENDENCIES jekyll-link-attributes jekyll-minifier jekyll-paginate-v2 + jekyll-regex-replace jekyll-scholar jekyll-sitemap jekyll-tabs diff --git a/README.md b/README.md index e2898ca..9d50fe6 100644 --- a/README.md +++ b/README.md @@ -142,6 +142,7 @@ Feel free to add your own page(s) by sending a PR. + diff --git a/_config.yml b/_config.yml index 2177c4a..edc4027 100644 --- a/_config.yml +++ b/_config.yml @@ -252,6 +252,7 @@ plugins: - jekyll-link-attributes - jekyll-minifier - jekyll-paginate-v2 + - jekyll-regex-replace - jekyll/scholar - jekyll-sitemap - jekyll-tabs @@ -338,6 +339,7 @@ filtered_bibtex_keywords: abstract, additional_info, altmetric, + annotation, arxiv, award, award_name, diff --git a/_layouts/bib.liquid b/_layouts/bib.liquid index 076f09b..a54aaa6 100644 --- a/_layouts/bib.liquid +++ b/_layouts/bib.liquid @@ -59,7 +59,8 @@ {%- for author in entry.author_array limit: author_array_limit -%} {% 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: '([*∗†‡§¶‖&^]+)', '\1' -%} {% if site.scholar.last_name contains author_last_name %} {% if site.scholar.first_name contains author.first %} {% assign author_is_self = true %} @@ -83,17 +84,17 @@ {%- if author_is_self -%} {{- author.first }} - {{ author.last -}} + {{ author_last_html -}} {%- else -%} {%- if coauthor_url -%} {{- author.first }} - {{ author.last -}} + {{ author_last_html -}} {%- else -%} {{- author.first }} - {{ author.last -}} + {{ author_last_html -}} {% endif %} {%- endif -%} {% endfor %} @@ -111,6 +112,7 @@ {% assign more_authors_show = more_authors_show | append: ', ' %} {% endunless %} {%- endfor -%} + {% assign more_authors_show = more_authors_show | regex_replace: '([*∗†‡§¶‖&^]+)', '\1' %} , and {% endif %} + {% if entry.annotation %} + + + {% endif %} diff --git a/_plugins/hide-custom-bibtex.rb b/_plugins/hide-custom-bibtex.rb index 6325b28..4d517f7 100644 --- a/_plugins/hide-custom-bibtex.rb +++ b/_plugins/hide-custom-bibtex.rb @@ -7,6 +7,9 @@ def hideCustomBibtex(input) input = input.gsub(/^.*\b#{keyword}\b *= *\{.*$\n/, '') end + # Clean superscripts in author lists + input = input.gsub(/^.*\bauthor\b *= *\{.*$\n/) { |line| line.gsub(/[*†‡§¶‖&^]/, '') } + return input end end diff --git a/_sass/_base.scss b/_sass/_base.scss index f863d53..ba47b09 100644 --- a/_sass/_base.scss +++ b/_sass/_base.scss @@ -1134,3 +1134,37 @@ ninja-keys::part(ninja-input) { ninja-keys::part(ninja-input-wrapper) { 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); + } +} diff --git a/assets/js/common.js b/assets/js/common.js index 4134ddb..a2088c3 100644 --- a/assets/js/common.js +++ b/assets/js/common.js @@ -51,4 +51,9 @@ $(document).ready(function () { }); } }); + + // trigger popovers + $('[data-toggle="popover"]').popover({ + trigger: "hover", + }); });