* src/plugins/ReadGedcom.py: Correct level in parsing LDS ordinance
source references. Support for source description-type references. svn: r2586
This commit is contained in:
parent
8bf5f5b12a
commit
2a92fac355
@ -1,3 +1,7 @@
|
||||
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.
|
||||
|
||||
2004-01-03 Alex Roitman <shura@alex.neuro.umn.edu>
|
||||
* src/po/fr.po: Typo (named format line parameter was translated).
|
||||
|
||||
|
@ -259,6 +259,7 @@ class GedcomParser:
|
||||
self.update(self.file_obj,os.path.basename(file))
|
||||
|
||||
self.search_paths = []
|
||||
self.source_description=""
|
||||
|
||||
try:
|
||||
mypaths = []
|
||||
@ -1056,6 +1057,7 @@ class GedcomParser:
|
||||
source_ref = RelLib.SourceRef()
|
||||
source_ref.setBase(self.db.findSource(matches[2],self.smap))
|
||||
address.addSourceRef(source_ref)
|
||||
self.source_description = matches[2]
|
||||
self.parse_source_reference(source_ref,level+1)
|
||||
elif matches[1] == "PLAC":
|
||||
address.setStreet(matches[2])
|
||||
@ -1127,7 +1129,7 @@ class GedcomParser:
|
||||
except NameError:
|
||||
pass
|
||||
elif matches[1] == "SOUR":
|
||||
ord.addSourceRef(self.handle_source(matches,level))
|
||||
ord.addSourceRef(self.handle_source(matches,level+1))
|
||||
elif matches[1] == "NOTE":
|
||||
note = self.parse_note(matches,ord,level+1,note)
|
||||
elif matches[1] == "STAT":
|
||||
@ -1377,6 +1379,10 @@ class GedcomParser:
|
||||
if int(matches[0]) < level:
|
||||
self.backup()
|
||||
return
|
||||
elif matches[1] in ["CONC", "CONT"]:
|
||||
self.backup()
|
||||
self.parse_source_description(source,level)
|
||||
return
|
||||
elif matches[1] == "PAGE":
|
||||
source.setPage(matches[2] + self.parse_continue_data(level+1))
|
||||
elif matches[1] == "DATA":
|
||||
@ -1398,6 +1404,29 @@ class GedcomParser:
|
||||
else:
|
||||
self.barf(level+1)
|
||||
|
||||
def parse_source_description(self,source,level):
|
||||
"""Reads the data associated with a SOUR description-reference"""
|
||||
note = ""
|
||||
while 1:
|
||||
matches = self.get_next()
|
||||
|
||||
if int(matches[0]) < level:
|
||||
self.backup()
|
||||
return
|
||||
elif matches[1] in ["CONC", "CONT"]: # must be a source description
|
||||
self.backup()
|
||||
comment = self.parse_continue_data(level)
|
||||
source.setComments(comment)
|
||||
comment = "%s\n%s" % (source.getBase().getNote(),comment)
|
||||
source.getBase().setNote(comment)
|
||||
source.getBase().setTitle(self.source_description)
|
||||
elif matches[1] == "NOTE":
|
||||
note = self.parse_comment(matches,source,level+1,note)
|
||||
elif matches[1] == "TEXT":
|
||||
self.ignore_sub_junk(level+1)
|
||||
else:
|
||||
self.barf(level+1)
|
||||
|
||||
def parse_source_data(self,level):
|
||||
"""Parses the source data"""
|
||||
date = ""
|
||||
@ -1469,6 +1498,7 @@ class GedcomParser:
|
||||
source_ref = RelLib.SourceRef()
|
||||
source_ref.setBase(self.db.findSource(matches[2],self.smap))
|
||||
name.addSourceRef(source_ref)
|
||||
self.source_description = matches[2]
|
||||
self.parse_source_reference(source_ref,level+1)
|
||||
elif matches[1][0:4] == "NOTE":
|
||||
note = self.parse_note(matches,name,level+1,note)
|
||||
@ -1728,6 +1758,7 @@ class GedcomParser:
|
||||
self.ignore_sub_junk(2)
|
||||
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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user