Skip to content

Commit

Permalink
Normalizing coauthor names before search (alshedivat#2057)
Browse files Browse the repository at this point in the history
Signed-off-by: George Araújo <[email protected]>
  • Loading branch information
george-gca authored Jan 9, 2024
1 parent 4ea7f5b commit 60a09ed
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 10 deletions.
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)

0 comments on commit 60a09ed

Please sign in to comment.