* src/plugins/ReadGedcom.py: More source parsing cleanups.

svn: r2588
This commit is contained in:
Alex Roitman 2004-01-05 20:39:09 +00:00
parent 7bb94c7b3a
commit 576b6a3f7f
2 changed files with 9 additions and 6 deletions

View File

@ -1,3 +1,6 @@
2004-01-05 Alex Roitman <shura@alex.neuro.umn.edu>
* src/plugins/ReadGedcom.py: More source parsing cleanups.
2004-01-04 Alex Roitman <shura@alex.neuro.umn.edu>
* src/plugins/ReadGedcom.py: Correct level in parsing LDS ordinance
source references. Support for source description-type references.

View File

@ -259,7 +259,6 @@ class GedcomParser:
self.update(self.file_obj,os.path.basename(file))
self.search_paths = []
self.source_description=""
try:
mypaths = []
@ -465,6 +464,7 @@ class GedcomParser:
elif matches[1] == "NOTE":
note = self.parse_note(matches,self.source,level+1,note)
elif matches[1] == "TEXT":
note = self.source.getNote()
d = self.parse_continue_data(level+1)
if note:
note = "%s\n%s %s%s" % (note,matches[1],matches[2],d)
@ -473,6 +473,7 @@ class GedcomParser:
elif matches[1] == "ABBR":
self.source.setAbbrev(matches[2] + self.parse_continue_data(level+1))
else:
note = self.source.getNote()
if note:
note = "%s\n%s %s" % (note,matches[1],matches[2])
else:
@ -547,7 +548,7 @@ class GedcomParser:
self.backup()
return
elif matches[1] == "SOUR":
event.addSourceRef(self.handle_source(matches,level))
event.addSourceRef(self.handle_source(matches,level+1))
else:
self.barf(1)
@ -904,7 +905,7 @@ class GedcomParser:
elif matches[1] == "PEDI":
type = matches[2]
elif matches[1] == "SOUR":
source_ref = self.handle_source(matches,level)
source_ref = self.handle_source(matches,level+1)
self.person.getPrimaryName().addSourceRef(source_ref)
elif matches[1] == "_PRIMARY":
type = matches[1]
@ -1211,7 +1212,7 @@ class GedcomParser:
elif matches[1] in ["TIME","ADDR","AGE","AGNC","STAT","TEMP","OBJE"]:
self.ignore_sub_junk(level+1)
elif matches[1] == "SOUR":
event.addSourceRef(self.handle_source(matches,level))
event.addSourceRef(self.handle_source(matches,level+1))
elif matches[1] == "FAMC":
family = self.db.findFamily(matches[2],self.fmap)
mrel,frel = self.parse_adopt_famc(level+1);
@ -1291,7 +1292,7 @@ class GedcomParser:
elif matches[1] in ["CAUS", "DATE","TIME","ADDR","AGE","AGNC","STAT","TEMP","OBJE"]:
self.ignore_sub_junk(level+1)
elif matches[1] == "SOUR":
attr.addSourceRef(self.handle_source(matches,level))
attr.addSourceRef(self.handle_source(matches,level+1))
elif matches[1] == "PLAC":
val = matches[2]
if attr.getValue() == "":
@ -1723,7 +1724,6 @@ class GedcomParser:
self.ignore_sub_junk(level+1)
else:
source_ref.setBase(self.db.findSource(matches[2],self.smap))
self.source_description = matches[2]
self.parse_source_reference(source_ref,level)
return source_ref