Normalizing coauthor names before search (#2057)

Signed-off-by: George Araújo <george.gcac@gmail.com>
This commit is contained in:
George 2024-01-09 14:13:33 -03:00 committed by GitHub
parent 4ea7f5ba57
commit 60a09ed25c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 43 additions and 10 deletions

View File

@ -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

View File

@ -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 -%}

View File

@ -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)