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/21 21:42:48 UTC

[whimsy] branch master updated: givenName is optional

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


The following commit(s) were added to refs/heads/master by this push:
     new 2ffeac4  givenName is optional
2ffeac4 is described below

commit 2ffeac4630b7ae107f9a0200430dabc9a56b94c0
Author: Sebb <se...@apache.org>
AuthorDate: Mon Jun 21 22:42:39 2021 +0100

    givenName is optional
---
 lib/whimsy/asf/person.rb | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/whimsy/asf/person.rb b/lib/whimsy/asf/person.rb
index e98ee25..4980b68 100644
--- a/lib/whimsy/asf/person.rb
+++ b/lib/whimsy/asf/person.rb
@@ -149,7 +149,8 @@ module ASF
         result['title'] ||= title
       end
       result['generationQualifier'] = words.pop if words.last =~ SUFFIXES
-      result['givenName'] = words.shift # TODO does gn allow multiple words?
+      result['givenName'] = words.shift if words.size > 1 # don't use remaining word as it must be sn
+      # TODO givenName can have multiple entries
       # extract surnames like van Gogh etc
       if words.size >= 3 and DOUBLE_PFX.include? words[-3..-2].join(' ')
         result['sn'] = words[-3..-1].join(' ')