Skip to content

Commit 60a09ed

Browse files
authored
Normalizing coauthor names before search (#2057)
Signed-off-by: George Araújo <[email protected]>
1 parent 4ea7f5b commit 60a09ed

File tree

3 files changed

+43
-10
lines changed

3 files changed

+43
-10
lines changed

_data/coauthors.yml

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
1-
"Adams":
1+
"adams":
22
- firstname: ["Edwin", "E.", "E. P.", "Edwin Plimpton"]
33
url: https://en.wikipedia.org/wiki/Edwin_Plimpton_Adams
44

5-
"Podolsky":
5+
"podolsky":
66
- firstname: ["Boris", "B.", "B. Y.", "Boris Yakovlevich"]
77
url: https://en.wikipedia.org/wiki/Boris_Podolsky
88

9-
"Rosen":
9+
"rosen":
1010
- firstname: ["Nathan", "N."]
1111
url: https://en.wikipedia.org/wiki/Nathan_Rosen
1212

13-
"Bach":
13+
"bach":
1414
- firstname: ["Johann Sebastian", "J. S."]
1515
url: https://en.wikipedia.org/wiki/Johann_Sebastian_Bach
1616

1717
- firstname: ["Carl Philipp Emanuel", "C. P. E."]
1818
url: https://en.wikipedia.org/wiki/Carl_Philipp_Emanuel_Bach
1919

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

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

28-
"Lorentz":
28+
"lorentz":
2929
- firstname: ["Hendrik Antoon"]
3030
url: https://en.wikipedia.org/wiki/Hendrik_Lorentz
3131

32-
"Planck":
32+
"planck":
3333
- firstname: ["Max"]
3434
url: https://en.wikipedia.org/wiki/Max_Planck

_layouts/bib.html

+3-2
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,9 @@
5252
{%- endif -%}
5353
{%- endif -%}
5454
{%- assign coauthor_url = nil -%}
55-
{%- if site.data.coauthors[author_last_name] -%}
56-
{%- for coauthor in site.data.coauthors[author_last_name] -%}
55+
{%- assign clean_last_name = author_last_name | downcase | remove_accents -%}
56+
{%- if site.data.coauthors[clean_last_name] -%}
57+
{%- for coauthor in site.data.coauthors[clean_last_name] -%}
5758
{%- if coauthor.firstname contains author.first -%}
5859
{%- assign coauthor_url = coauthor.url -%}
5960
{%- break -%}

_plugins/remove-accents.rb

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# based on https://distresssignal.org/busting-css-cache-with-jekyll-md5-hash
2+
# https://gist.github.com/BryanSchuetz/2ee8c115096d7dd98f294362f6a667db
3+
module Jekyll
4+
module CleanString
5+
class RemoveAccents
6+
require 'i18n'
7+
I18n.config.available_locales = :en
8+
9+
attr_accessor :string
10+
11+
def initialize(string:)
12+
self.string = string
13+
end
14+
15+
def digest!
16+
remove_accents
17+
end
18+
19+
private
20+
21+
def remove_accents
22+
I18n.transliterate(string)
23+
end
24+
end
25+
26+
def remove_accents(string)
27+
RemoveAccents.new(string: string).digest!
28+
end
29+
end
30+
end
31+
32+
Liquid::Template.register_filter(Jekyll::CleanString)

0 commit comments

Comments
 (0)