diff --git a/data/grampsxml.dtd b/data/grampsxml.dtd index 9a741801c..fe5e35ea5 100644 --- a/data/grampsxml.dtd +++ b/data/grampsxml.dtd @@ -133,7 +133,7 @@ GENDER has values of M, F, or U. diff --git a/data/grampsxml.rng b/data/grampsxml.rng index b73b655a5..6b9ffc72e 100644 --- a/data/grampsxml.rng +++ b/data/grampsxml.rng @@ -242,8 +242,8 @@ - 0 1 + 0 inherited diff --git a/src/gen/db/read.py b/src/gen/db/read.py index e9ffb141c..64ccd6e7f 100644 --- a/src/gen/db/read.py +++ b/src/gen/db/read.py @@ -1356,7 +1356,12 @@ class DbBsddbRead(DbReadBase, Callback): return self.__has_handle(self.source_map, handle) def __sortbyperson_key(self, person): - return locale.strxfrm(self.person_map.get(str(person))[3][5]) + surnlist = self.person_map.get(str(person))[3][5] + if surnlist: + surn = " ".join([x[0] for x in surnlist]) + else: + surn = "" + return locale.strxfrm(surn) def __sortbyplace(self, first, second): return locale.strcoll(self.place_map.get(str(first))[2], diff --git a/src/gen/lib/surname.py b/src/gen/lib/surname.py index 8f5a73d84..251f308b5 100644 --- a/src/gen/lib/surname.py +++ b/src/gen/lib/surname.py @@ -47,6 +47,7 @@ class Surname(SecondaryObject): def __init__(self, source=None, data=None): """Create a new Surname instance, copying from the source if provided. + By default a surname is created as primary, use set_primary to change """ if source: self.surname = source.surname @@ -57,7 +58,7 @@ class Surname(SecondaryObject): else: self.surname = "" self.prefix = "" - self.primary = False + self.primary = True self.origintype = NameOriginType() self.connector = "" if data: diff --git a/src/plugins/export/ExportXml.py b/src/plugins/export/ExportXml.py index f7ffee567..57a200e1a 100644 --- a/src/plugins/export/ExportXml.py +++ b/src/plugins/export/ExportXml.py @@ -738,16 +738,26 @@ class GrampsXmlWriter(UpdateCallback): if rel != "": self.g.write(' %s\n' % (sp,rel) ) - def write_last(self, name,indent=1): - p = name.get_surname_prefix() - n = name.get_surname() - g = name.get_group_as() - self.g.write('%s%s\n' % self.fix(n)) + def write_surname(self, surname, indent=1): + """ + Writes a surname of the name + """ + pre = surname.get_prefix() + con = surname.get_connector() + nam = surname.get_surname() + der = surname.get_origintype().xml_str() + pri = surname.get_primary() + self.g.write('%s%s\n' % self.fix(nam)) def write_line(self,tagname,value,indent=1): if value: @@ -870,12 +880,15 @@ class GrampsXmlWriter(UpdateCallback): if name.get_display_as() != 0: self.g.write(' display="%d"' % name.get_display_as()) self.g.write('>\n') - self.write_line("first", name.get_first_name(),index+1) - self.write_line("call", name.get_call_name(),index+1) - self.write_last(name,index+1) - self.write_line("suffix", name.get_suffix(),index+1) - self.write_line("patronymic", name.get_patronymic(),index+1) - self.write_line("title", name.get_title(),index+1) + self.write_line("first", escxml(name.get_first_name()),index+1) + self.write_line("call", escxml(name.get_call_name()),index+1) + for surname in name.get_surname_list(): + self.write_surname(surname,index+1) + self.write_line("suffix", escxml(name.get_suffix()),index+1) + self.write_line("title", escxml(name.get_title()),index+1) + self.write_line("nick", escxml(name.get_nick_name()), index+1) + self.write_line("familynick", escxml(name.get_family_nick_name()), index+1) + self.write_line("group", escxml(name.get_group_as()), index+1) if name.date: self.write_date(name.date,4) self.write_note_list(name.get_note_list(),index+1)