Better date range parsing, and handling of adopted children on GEDCOM import
svn: r84
This commit is contained in:
parent
6d5fd5c3d1
commit
e259982e45
@ -41,12 +41,12 @@ class Date:
|
|||||||
normal = 0
|
normal = 0
|
||||||
|
|
||||||
from_str = _("(from|between|bet)")
|
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)
|
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)
|
re.IGNORECASE)
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -408,6 +408,28 @@ class GedcomParser:
|
|||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
self.barf(level+1)
|
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.family.setMother(self.db.findPerson(matches[2],self.pmap))
|
||||||
self.ignore_sub_junk(2)
|
self.ignore_sub_junk(2)
|
||||||
elif matches[1] == "CHIL":
|
elif matches[1] == "CHIL":
|
||||||
self.family.addChild(self.db.findPerson(matches[2],self.pmap))
|
type = self.parse_ftw_relations(2)
|
||||||
self.ignore_sub_junk(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":
|
elif matches[1] == "NCHI" or matches[1] == "RIN" or matches[1] == "SUBM":
|
||||||
pass
|
pass
|
||||||
elif matches[1] == "REFN" or matches[1] == "CHAN":
|
elif matches[1] == "REFN" or matches[1] == "CHAN":
|
||||||
|
Loading…
x
Reference in New Issue
Block a user