Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Normalizing coauthor names before search #2057

Merged
merged 1 commit into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions _data/coauthors.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
"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":
"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

"Przibram":
"przibram":
- firstname: ["Karl"]
url: https://link.springer.com/article/10.1007/s00016-019-00242-z

"Schrödinger":
"schrodinger":
- firstname: ["Erwin"]
url: https://en.wikipedia.org/wiki/Erwin_Schr%C3%B6dinger

"Lorentz":
"lorentz":
- firstname: ["Hendrik Antoon"]
url: https://en.wikipedia.org/wiki/Hendrik_Lorentz

"Planck":
"planck":
- firstname: ["Max"]
url: https://en.wikipedia.org/wiki/Max_Planck
5 changes: 3 additions & 2 deletions _layouts/bib.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@
{%- endif -%}
{%- endif -%}
{%- assign coauthor_url = nil -%}
{%- if site.data.coauthors[author_last_name] -%}
{%- for coauthor in site.data.coauthors[author_last_name] -%}
{%- assign clean_last_name = author_last_name | downcase | remove_accents -%}
{%- if site.data.coauthors[clean_last_name] -%}
{%- for coauthor in site.data.coauthors[clean_last_name] -%}
{%- if coauthor.firstname contains author.first -%}
{%- assign coauthor_url = coauthor.url -%}
{%- break -%}
Expand Down
32 changes: 32 additions & 0 deletions _plugins/remove-accents.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# based on https://distresssignal.org/busting-css-cache-with-jekyll-md5-hash
# https://gist.github.com/BryanSchuetz/2ee8c115096d7dd98f294362f6a667db
module Jekyll
module CleanString
class RemoveAccents
require 'i18n'
I18n.config.available_locales = :en

attr_accessor :string

def initialize(string:)
self.string = string
end

def digest!
remove_accents
end

private

def remove_accents
I18n.transliterate(string)
end
end

def remove_accents(string)
RemoveAccents.new(string: string).digest!
end
end
end

Liquid::Template.register_filter(Jekyll::CleanString)