diff --git a/data/tests/exp_sample.gramps b/data/tests/exp_sample.gramps index 4104ebc0a..c7bd069b2 100644 --- a/data/tests/exp_sample.gramps +++ b/data/tests/exp_sample.gramps @@ -774,6 +774,7 @@ Amber Marie Smith + Marie diff --git a/data/tests/exp_sample.vcf b/data/tests/exp_sample.vcf index 590ea44fc..c3edc4655 100644 --- a/data/tests/exp_sample.vcf +++ b/data/tests/exp_sample.vcf @@ -122,7 +122,7 @@ BEGIN:VCARD VERSION:3.0 PRODID:-//Gramps//NONSGML Gramps 5.0.0-alpha1//EN FN:Amber Marie Smith -N:Smith;Amber;Marie;; +N:Smith;Marie;Amber;; SORT-STRING:Smith Amber Marie X-GENDER:Female BDAY:1998-04-12 diff --git a/data/tests/exp_sample_ged.ged b/data/tests/exp_sample_ged.ged index b513608d4..c92836f9f 100644 --- a/data/tests/exp_sample_ged.ged +++ b/data/tests/exp_sample_ged.ged @@ -65,6 +65,7 @@ 2 TYPE birth 2 GIVN Amber Marie 2 SURN Smith +2 _RUFNAME Marie 1 SEX F 1 BIRT 2 TYPE Birth of Amber Marie Smith @@ -984,6 +985,7 @@ 2 GIVN Fake 2 SPFX von 2 SURN Person +2 _RUFNAME Person 2 NSFX I 2 NPFX Fake person 2 NICK Fake diff --git a/gramps/plugins/export/exportgedcom.py b/gramps/plugins/export/exportgedcom.py index d6d64bfcd..66d9ec54e 100644 --- a/gramps/plugins/export/exportgedcom.py +++ b/gramps/plugins/export/exportgedcom.py @@ -1304,6 +1304,7 @@ class GedcomWriter(UpdateCallback): suffix = name.get_suffix() title = name.get_title() nick = name.get_nick_name() + call = name.get_call_name() if nick.strip() == '': nick = attr_nick @@ -1323,6 +1324,8 @@ class GedcomWriter(UpdateCallback): self._writeln(2, 'SPFX', surprefix) if surname: self._writeln(2, 'SURN', surname) + if call: + self._writeln(2, '_RUFNAME', call) if name.get_suffix(): self._writeln(2, 'NSFX', suffix) if name.get_title(): diff --git a/gramps/plugins/lib/libgedcom.py b/gramps/plugins/lib/libgedcom.py index 4e7e0eaa4..d180dce1a 100644 --- a/gramps/plugins/lib/libgedcom.py +++ b/gramps/plugins/lib/libgedcom.py @@ -276,6 +276,7 @@ TOKEN__JUST = 135 TOKEN__TEXT = 136 TOKEN__DATE = 137 TOKEN__APID = 138 +TOKEN__CALLNAME = 139 TOKENS = { "_ADPN" : TOKEN__ADPN, @@ -316,6 +317,7 @@ TOKENS = { "_PRIMARY" : TOKEN__PRIMARY, "_PRIV" : TOKEN__PRIV, "_PUBLISHER" : TOKEN_IGNORE, + "_RUFNAME" : TOKEN__CALLNAME, "_SCBK" : TOKEN_IGNORE, "_SCHEMA" : TOKEN__SCHEMA, "_SSHOW" : TOKEN_IGNORE, @@ -2091,6 +2093,8 @@ class GedcomParser(UpdateCallback): TOKEN_GIVN : self.__name_givn, # NICK {0:1} TOKEN_NICK : self.__name_nick, + # _RUFNAME {0:1} + TOKEN__CALLNAME: self.__name_call, # +1 SPFX {0:1} @@ -4424,6 +4428,19 @@ class GedcomParser(UpdateCallback): state.name.set_nick_name(line.data.strip()) self.__skip_subordinate_levels(state.level + 1, state) + def __name_call(self, line, state): + """ + This parses the inofficial _RUFNAME tag that indicates which part + of a person's given name is commonly used to address them. + + @param line: The current line in GedLine format + @type line: GedLine + @param state: The current state + @type state: CurrentState + """ + state.name.set_call_name(line.data.strip()) + self.__skip_subordinate_levels(state.level + 1, state) + def __name_aka(self, line, state): """ This parses the non-standard GEDCOM tags _AKA or _AKAN as a subsidiary