Fixed ansel encoding (assuming that illegal ANSEL characters are latin), and
fixed event name handling. svn: r225
This commit is contained in:
parent
2a4149b561
commit
50ce392cb5
@ -89,7 +89,7 @@ def ansel_to_latin(s):
|
|||||||
except Exception,e:
|
except Exception,e:
|
||||||
from traceback import print_exc
|
from traceback import print_exc
|
||||||
print_exc()
|
print_exc()
|
||||||
head = ''
|
head = s[0]
|
||||||
s = s[1:0]
|
s = s[1:0]
|
||||||
buff.write(head)
|
buff.write(head)
|
||||||
ans = buff.getvalue()
|
ans = buff.getvalue()
|
||||||
@ -138,5 +138,8 @@ def ansel_to_code(s):
|
|||||||
if c0 >= 0xE0:
|
if c0 >= 0xE0:
|
||||||
return chr(_s1[c0][c1]),s[2:]
|
return chr(_s1[c0][c1]),s[2:]
|
||||||
else:
|
else:
|
||||||
|
try:
|
||||||
return chr(_s0[c0]), s[1:]
|
return chr(_s0[c0]), s[1:]
|
||||||
|
except:
|
||||||
|
return s[0], s[1:]
|
||||||
|
|
||||||
|
@ -543,7 +543,11 @@ class GedcomParser:
|
|||||||
return
|
return
|
||||||
elif matches[1] == "NAME":
|
elif matches[1] == "NAME":
|
||||||
name = Name()
|
name = Name()
|
||||||
|
try:
|
||||||
names = nameRegexp.match(matches[2]).groups()
|
names = nameRegexp.match(matches[2]).groups()
|
||||||
|
except:
|
||||||
|
print matches
|
||||||
|
print self.index
|
||||||
if names[0]:
|
if names[0]:
|
||||||
name.setFirstName(names[0])
|
name.setFirstName(names[0])
|
||||||
if names[1]:
|
if names[1]:
|
||||||
@ -644,6 +648,8 @@ class GedcomParser:
|
|||||||
event.setName(ged2rel[matches[1]])
|
event.setName(ged2rel[matches[1]])
|
||||||
except:
|
except:
|
||||||
event.setName(matches[1])
|
event.setName(matches[1])
|
||||||
|
if matches[2] != None:
|
||||||
|
event.setDescription(matches[2])
|
||||||
self.person.addEvent(event)
|
self.person.addEvent(event)
|
||||||
self.parse_person_event(event,2)
|
self.parse_person_event(event,2)
|
||||||
|
|
||||||
@ -881,6 +887,8 @@ class GedcomParser:
|
|||||||
event.setName(name)
|
event.setName(name)
|
||||||
elif matches[1] == "DATE":
|
elif matches[1] == "DATE":
|
||||||
event.setDate(matches[2])
|
event.setDate(matches[2])
|
||||||
|
elif matches[1] == "TIME":
|
||||||
|
self.ignore_sub_junk(level+1)
|
||||||
elif matches[1] == "AGE" or matches[1] == "AGNC":
|
elif matches[1] == "AGE" or matches[1] == "AGNC":
|
||||||
self.ignore_sub_junk(level+1)
|
self.ignore_sub_junk(level+1)
|
||||||
elif matches[1] == "CAUS" or matches[1] == "ADDR":
|
elif matches[1] == "CAUS" or matches[1] == "ADDR":
|
||||||
@ -941,6 +949,8 @@ class GedcomParser:
|
|||||||
event.setName(matches[2])
|
event.setName(matches[2])
|
||||||
elif matches[1] == "DATE":
|
elif matches[1] == "DATE":
|
||||||
event.setDate(matches[2])
|
event.setDate(matches[2])
|
||||||
|
elif matches[1] == "TIME":
|
||||||
|
self.ignore_sub_junk(level+1)
|
||||||
elif matches[1] == "AGE" or matches[1] == "AGNC":
|
elif matches[1] == "AGE" or matches[1] == "AGNC":
|
||||||
self.ignore_sub_junk(level+1)
|
self.ignore_sub_junk(level+1)
|
||||||
elif matches[1] == "CAUS" or matches[1] == "ADDR":
|
elif matches[1] == "CAUS" or matches[1] == "ADDR":
|
||||||
|
Loading…
Reference in New Issue
Block a user