Better date range parsing, and handling of adopted children on GEDCOM import

svn: r84
This commit is contained in:
Don Allingham 2001-06-03 23:18:07 +00:00
parent 6d5fd5c3d1
commit e259982e45
2 changed files with 32 additions and 5 deletions

View File

@ -41,12 +41,12 @@ class Date:
normal = 0
from_str = _("(from|between|bet)")
to_str = _("(and|to)")
to_str = _("(and|to|-)")
efmt = re.compile(r"\s*(from|between|bet)\s+(.+)\s+(and|to)\s+(.+)\s*$",
efmt = re.compile(r"\s*(from|between|bet)\.?\s+(.+)\s+(and|to)\s+(.+)\s*$",
re.IGNORECASE)
fmt = re.compile(r"\s*" + from_str + r"\s+(.+)\s+" + to_str + r"\s+(.+)\s*$",
fmt = re.compile(r"\s*" + from_str + r"\.?\s+(.+)\s+" + to_str + r"\s+(.+)\s*$",
re.IGNORECASE)
def __init__(self):

View File

@ -409,6 +409,28 @@ class GedcomParser:
else:
self.barf(level+1)
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def parse_ftw_relations(self,level):
retval = ""
while 1:
matches = self.get_next()
if int(matches[0]) < level:
self.backup()
return retval
elif matches[1] == "_FREL":
if string.lower(matches[2]) != "natural":
retval = matches[2]
elif matches[1] == "_MREL":
if string.lower(matches[2]) != "natural":
retval = matches[2]
else:
self.barf(level+1)
#---------------------------------------------------------------------
#
#
@ -428,8 +450,13 @@ class GedcomParser:
self.family.setMother(self.db.findPerson(matches[2],self.pmap))
self.ignore_sub_junk(2)
elif matches[1] == "CHIL":
self.family.addChild(self.db.findPerson(matches[2],self.pmap))
self.ignore_sub_junk(2)
type = self.parse_ftw_relations(2)
child = self.db.findPerson(matches[2],self.pmap)
self.family.addChild(child)
if type != "":
if child.getMainFamily() == self.family:
child.setMainFamily(None)
child.addAltFamily(self.family,type)
elif matches[1] == "NCHI" or matches[1] == "RIN" or matches[1] == "SUBM":
pass
elif matches[1] == "REFN" or matches[1] == "CHAN":