You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by se...@apache.org on 2021/06/18 14:46:36 UTC

[whimsy] 02/02: Allow for leading initials

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