diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 7c6ac232b..a1efffe89 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,4 +1,7 @@ 2006-08-22 Don Allingham + * src/GrampsDb/_ReadGedcom.py: RESN support + * src/GrampsDb/_WriteGedcom.py: RESN support + * src/GrampsDb/_GedTokens.py: RESN support * src/GrampsDb/_WriteGedcom.py: apply event type string conversion fix to family types diff --git a/gramps2/src/GrampsDb/_GedTokens.py b/gramps2/src/GrampsDb/_GedTokens.py index e80f46a47..f08b6635d 100644 --- a/gramps2/src/GrampsDb/_GedTokens.py +++ b/gramps2/src/GrampsDb/_GedTokens.py @@ -130,6 +130,7 @@ TOKEN_BLOB = 110 TOKEN_CONL = 111 TOKEN_AGE = 112 TOKEN_AGNC = 113 +TOKEN_RESN = 114 tokens = { "HEAD" : TOKEN_HEAD, "MEDI" : TOKEN_MEDI, @@ -221,5 +222,5 @@ tokens = { "_SCBK" : TOKEN_IGNORE,"_TYPE" : TOKEN_IGNORE, "_PRIM" : TOKEN_IGNORE,"_SSHOW" : TOKEN_IGNORE, "_PAREN" : TOKEN_IGNORE,"BLOB" : TOKEN_BLOB, - "CONL" : TOKEN_CONL, + "CONL" : TOKEN_CONL, "RESN" : TOKEN_RESN, } diff --git a/gramps2/src/GrampsDb/_ReadGedcom.py b/gramps2/src/GrampsDb/_ReadGedcom.py index f27e5b7fa..4abb74a02 100644 --- a/gramps2/src/GrampsDb/_ReadGedcom.py +++ b/gramps2/src/GrampsDb/_ReadGedcom.py @@ -624,6 +624,7 @@ class GedcomParser(UpdateCallback): TOKEN_EVEN : self.func_person_even, TOKEN_SOUR : self.func_person_sour, TOKEN_REFN : self.func_person_refn, + TOKEN_RESN : self.func_person_resn, TOKEN_AFN : self.func_person_attr, TOKEN_RFN : self.func_person_attr, TOKEN__UID : self.func_person_attr, @@ -2949,6 +2950,11 @@ class GedcomParser(UpdateCallback): attr.set_value(matches[2]) state.person.add_attribute(attr) + def func_person_resn(self,matches,state): + attr = RelLib.Attribute() + attr.set_type((RelLib.AttributeType.CUSTOM, 'RESN')) + state.person.add_attribute(attr) + def func_person_event(self,matches,state): n = matches[3].strip() if self.gedattr.has_key(n): diff --git a/gramps2/src/GrampsDb/_WriteGedcom.py b/gramps2/src/GrampsDb/_WriteGedcom.py index f0b30ffaf..1d261eb6f 100644 --- a/gramps2/src/GrampsDb/_WriteGedcom.py +++ b/gramps2/src/GrampsDb/_WriteGedcom.py @@ -1023,11 +1023,16 @@ class GedcomWriter(UpdateCallback): t = int(attr.get_type()) name = GedcomInfo.personalConstantAttributes.get(t) + key = str(attr.get_type()) value = self.cnvtxt(attr.get_value().strip()).replace('\r',' ') -# if name in ["AFN", "RFN", "_UID"]: -# self.writeln("1 %s %s" % (name,value)) -# continue + if key in ("AFN", "RFN", "_UID"): + self.writeln("1 %s %s" % (name,value)) + continue + + if key == "RESN": + self.writeln("1 RESN") + continue if name and name.strip(): self.writeln("1 %s %s" % (name,value))