whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject [whimsy] 02/02: Allow for leading initials
Date Fri, 18 Jun 2021 14:46:36 GMT
This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git

commit 5d19c863922638610a0a3ad82b535ce140e404bb
Author: Sebb <sebb@apache.org>
AuthorDate: Fri Jun 18 15:46:26 2021 +0100

    Allow for leading initials
---
 lib/whimsy/asf/person.rb | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/whimsy/asf/person.rb b/lib/whimsy/asf/person.rb
index 041f26d..2a6d8a9 100644
--- a/lib/whimsy/asf/person.rb
+++ b/lib/whimsy/asf/person.rb
@@ -140,6 +140,10 @@ module ASF
       words = name.gsub(',', '').split(' ')
       result = {'cn' => name}
       result['title'] = words.shift if words.first == 'Dr.' or words.first == 'Dr'
+      result['initials'] = []
+      while words.first =~ %r{^[A-Z]\.?$}
+        result['initials'] << words.shift
+      end
       if words.last =~ /^Ph\.D\.?/
         title = words.pop # Always pop (||= short-circuits the pop)
         result['title'] ||= title

Mime
View raw message