From c63c94cc480d259ba7d8fc60b57f41c79dd927ff Mon Sep 17 00:00:00 2001 From: Unknown Date: Wed, 4 Jul 2001 16:52:24 +0000 Subject: [PATCH] Fixed ansel encoding (assuming that illegal ANSEL characters are latin), and fixed event name handling. svn: r225 --- src/latin_ansel.py | 7 +++++-- src/plugins/ReadGedcom.py | 12 +++++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/latin_ansel.py b/src/latin_ansel.py index 4dec1f3c4..e69325890 100644 --- a/src/latin_ansel.py +++ b/src/latin_ansel.py @@ -89,7 +89,7 @@ def ansel_to_latin(s): except Exception,e: from traceback import print_exc print_exc() - head = '' + head = s[0] s = s[1:0] buff.write(head) ans = buff.getvalue() @@ -138,5 +138,8 @@ def ansel_to_code(s): if c0 >= 0xE0: return chr(_s1[c0][c1]),s[2:] else: - return chr(_s0[c0]), s[1:] + try: + return chr(_s0[c0]), s[1:] + except: + return s[0], s[1:] diff --git a/src/plugins/ReadGedcom.py b/src/plugins/ReadGedcom.py index 91d25a197..9e143bd41 100644 --- a/src/plugins/ReadGedcom.py +++ b/src/plugins/ReadGedcom.py @@ -543,7 +543,11 @@ class GedcomParser: return elif matches[1] == "NAME": name = Name() - names = nameRegexp.match(matches[2]).groups() + try: + names = nameRegexp.match(matches[2]).groups() + except: + print matches + print self.index if names[0]: name.setFirstName(names[0]) if names[1]: @@ -644,6 +648,8 @@ class GedcomParser: event.setName(ged2rel[matches[1]]) except: event.setName(matches[1]) + if matches[2] != None: + event.setDescription(matches[2]) self.person.addEvent(event) self.parse_person_event(event,2) @@ -881,6 +887,8 @@ class GedcomParser: event.setName(name) elif matches[1] == "DATE": event.setDate(matches[2]) + elif matches[1] == "TIME": + self.ignore_sub_junk(level+1) elif matches[1] == "AGE" or matches[1] == "AGNC": self.ignore_sub_junk(level+1) elif matches[1] == "CAUS" or matches[1] == "ADDR": @@ -941,6 +949,8 @@ class GedcomParser: event.setName(matches[2]) elif matches[1] == "DATE": event.setDate(matches[2]) + elif matches[1] == "TIME": + self.ignore_sub_junk(level+1) elif matches[1] == "AGE" or matches[1] == "AGNC": self.ignore_sub_junk(level+1) elif matches[1] == "CAUS" or matches[1] == "ADDR":