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"] - firstname: ["Edwin", "E.", "E. P.", "Edwin Plimpton"]
url: https://en.wikipedia.org/wiki/Edwin_Plimpton_Adams url: https://en.wikipedia.org/wiki/Edwin_Plimpton_Adams
"Podolsky": "podolsky":
- firstname: ["Boris", "B.", "B. Y.", "Boris Yakovlevich"] - firstname: ["Boris", "B.", "B. Y.", "Boris Yakovlevich"]
url: https://en.wikipedia.org/wiki/Boris_Podolsky url: https://en.wikipedia.org/wiki/Boris_Podolsky
"Rosen": "rosen":
- firstname: ["Nathan", "N."] - firstname: ["Nathan", "N."]
url: https://en.wikipedia.org/wiki/Nathan_Rosen url: https://en.wikipedia.org/wiki/Nathan_Rosen
"Bach": "bach":
- firstname: ["Johann Sebastian", "J. S."] - firstname: ["Johann Sebastian", "J. S."]
url: https://en.wikipedia.org/wiki/Johann_Sebastian_Bach url: https://en.wikipedia.org/wiki/Johann_Sebastian_Bach
- firstname: ["Carl Philipp Emanuel", "C. P. E."] - firstname: ["Carl Philipp Emanuel", "C. P. E."]
url: https://en.wikipedia.org/wiki/Carl_Philipp_Emanuel_Bach url: https://en.wikipedia.org/wiki/Carl_Philipp_Emanuel_Bach
"Przibram": "przibram":
- firstname: ["Karl"] - firstname: ["Karl"]
url: https://link.springer.com/article/10.1007/s00016-019-00242-z url: https://link.springer.com/article/10.1007/s00016-019-00242-z
"Schrödinger": "schrodinger":
- firstname: ["Erwin"] - firstname: ["Erwin"]
url: https://en.wikipedia.org/wiki/Erwin_Schr%C3%B6dinger url: https://en.wikipedia.org/wiki/Erwin_Schr%C3%B6dinger
"Lorentz": "lorentz":
- firstname: ["Hendrik Antoon"] - firstname: ["Hendrik Antoon"]
url: https://en.wikipedia.org/wiki/Hendrik_Lorentz url: https://en.wikipedia.org/wiki/Hendrik_Lorentz
"Planck": "planck":
- firstname: ["Max"] - firstname: ["Max"]
url: https://en.wikipedia.org/wiki/Max_Planck url: https://en.wikipedia.org/wiki/Max_Planck

View File

@ -52,8 +52,9 @@
{%- endif -%} {%- endif -%}
{%- endif -%} {%- endif -%}
{%- assign coauthor_url = nil -%} {%- assign coauthor_url = nil -%}
{%- if site.data.coauthors[author_last_name] -%} {%- assign clean_last_name = author_last_name | downcase | remove_accents -%}
{%- for coauthor in site.data.coauthors[author_last_name] -%} {%- if site.data.coauthors[clean_last_name] -%}
{%- for coauthor in site.data.coauthors[clean_last_name] -%}
{%- if coauthor.firstname contains author.first -%} {%- if coauthor.firstname contains author.first -%}
{%- assign coauthor_url = coauthor.url -%} {%- assign coauthor_url = coauthor.url -%}
{%- break -%} {%- 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)