From 1b166865f40d3e7256858b48d480f7e19d506bd2 Mon Sep 17 00:00:00 2001 From: Paul Franklin Date: Sun, 23 Mar 2014 18:43:25 -0700 Subject: [PATCH] 7476: Given Name Cloud Gramplet splits up given names into words --- gramps/plugins/gramplet/givennamegramplet.py | 6 ++++++ gramps/plugins/quickview/samesurnames.py | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/gramps/plugins/gramplet/givennamegramplet.py b/gramps/plugins/gramplet/givennamegramplet.py index c1f1366ad..364cabec7 100644 --- a/gramps/plugins/gramplet/givennamegramplet.py +++ b/gramps/plugins/gramplet/givennamegramplet.py @@ -68,6 +68,12 @@ class GivenNameCloudGramplet(Gramplet): allnames = [person.get_primary_name()] + person.get_alternate_names() allnames = set(name.get_first_name().strip() for name in allnames) for givenname in allnames: + anyNBSP = givenname.split(u'\u00A0') + if len(anyNBSP) > 1: # there was an NBSP, a non-breaking space + first_two = anyNBSP[0] + u'\u00A0' + anyNBSP[1].split()[0] + givensubnames[first_two] += 1 + representative_handle[first_two] = person.handle + givenname = ' '.join(anyNBSP[1].split()[1:]) for givensubname in givenname.split(): givensubnames[givensubname] += 1 representative_handle[givensubname] = person.handle diff --git a/gramps/plugins/quickview/samesurnames.py b/gramps/plugins/quickview/samesurnames.py index 7f9b90745..03c1d6f19 100644 --- a/gramps/plugins/quickview/samesurnames.py +++ b/gramps/plugins/quickview/samesurnames.py @@ -69,6 +69,13 @@ class SameGiven(Rule): src = self.list[0].upper() for name in [person.get_primary_name()] + person.get_alternate_names(): if name.first_name: + anyNBSP = name.first_name.split(u'\u00A0') + if len(anyNBSP) > 1: # there was an NBSP, a non-breaking space + first_two = anyNBSP[0] + u'\u00A0' + anyNBSP[1].split()[0] + if first_two.upper() == src: + return True + else: + name.first_name = ' '.join(anyNBSP[1].split()[1:]) if " " in name.first_name.strip(): for name in name.first_name.upper().strip().split(): if name == src.upper():