Fixed ansel encoding (assuming that illegal ANSEL characters are latin), and

fixed event name handling.


svn: r225
This commit is contained in:
Unknown 2001-07-04 16:52:24 +00:00
parent ed0432f400
commit c63c94cc48
2 changed files with 16 additions and 3 deletions

View File

@ -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:]

View File

@ -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":