* 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>
|
2004-01-03 Alex Roitman <shura@alex.neuro.umn.edu>
|
||||||
* src/po/fr.po: Typo (named format line parameter was translated).
|
* 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.update(self.file_obj,os.path.basename(file))
|
||||||
|
|
||||||
self.search_paths = []
|
self.search_paths = []
|
||||||
|
self.source_description=""
|
||||||
|
|
||||||
try:
|
try:
|
||||||
mypaths = []
|
mypaths = []
|
||||||
@ -1056,6 +1057,7 @@ class GedcomParser:
|
|||||||
source_ref = RelLib.SourceRef()
|
source_ref = RelLib.SourceRef()
|
||||||
source_ref.setBase(self.db.findSource(matches[2],self.smap))
|
source_ref.setBase(self.db.findSource(matches[2],self.smap))
|
||||||
address.addSourceRef(source_ref)
|
address.addSourceRef(source_ref)
|
||||||
|
self.source_description = matches[2]
|
||||||
self.parse_source_reference(source_ref,level+1)
|
self.parse_source_reference(source_ref,level+1)
|
||||||
elif matches[1] == "PLAC":
|
elif matches[1] == "PLAC":
|
||||||
address.setStreet(matches[2])
|
address.setStreet(matches[2])
|
||||||
@ -1127,7 +1129,7 @@ class GedcomParser:
|
|||||||
except NameError:
|
except NameError:
|
||||||
pass
|
pass
|
||||||
elif matches[1] == "SOUR":
|
elif matches[1] == "SOUR":
|
||||||
ord.addSourceRef(self.handle_source(matches,level))
|
ord.addSourceRef(self.handle_source(matches,level+1))
|
||||||
elif matches[1] == "NOTE":
|
elif matches[1] == "NOTE":
|
||||||
note = self.parse_note(matches,ord,level+1,note)
|
note = self.parse_note(matches,ord,level+1,note)
|
||||||
elif matches[1] == "STAT":
|
elif matches[1] == "STAT":
|
||||||
@ -1377,6 +1379,10 @@ class GedcomParser:
|
|||||||
if int(matches[0]) < level:
|
if int(matches[0]) < level:
|
||||||
self.backup()
|
self.backup()
|
||||||
return
|
return
|
||||||
|
elif matches[1] in ["CONC", "CONT"]:
|
||||||
|
self.backup()
|
||||||
|
self.parse_source_description(source,level)
|
||||||
|
return
|
||||||
elif matches[1] == "PAGE":
|
elif matches[1] == "PAGE":
|
||||||
source.setPage(matches[2] + self.parse_continue_data(level+1))
|
source.setPage(matches[2] + self.parse_continue_data(level+1))
|
||||||
elif matches[1] == "DATA":
|
elif matches[1] == "DATA":
|
||||||
@ -1398,6 +1404,29 @@ class GedcomParser:
|
|||||||
else:
|
else:
|
||||||
self.barf(level+1)
|
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):
|
def parse_source_data(self,level):
|
||||||
"""Parses the source data"""
|
"""Parses the source data"""
|
||||||
date = ""
|
date = ""
|
||||||
@ -1469,6 +1498,7 @@ class GedcomParser:
|
|||||||
source_ref = RelLib.SourceRef()
|
source_ref = RelLib.SourceRef()
|
||||||
source_ref.setBase(self.db.findSource(matches[2],self.smap))
|
source_ref.setBase(self.db.findSource(matches[2],self.smap))
|
||||||
name.addSourceRef(source_ref)
|
name.addSourceRef(source_ref)
|
||||||
|
self.source_description = matches[2]
|
||||||
self.parse_source_reference(source_ref,level+1)
|
self.parse_source_reference(source_ref,level+1)
|
||||||
elif matches[1][0:4] == "NOTE":
|
elif matches[1][0:4] == "NOTE":
|
||||||
note = self.parse_note(matches,name,level+1,note)
|
note = self.parse_note(matches,name,level+1,note)
|
||||||
@ -1728,6 +1758,7 @@ class GedcomParser:
|
|||||||
self.ignore_sub_junk(2)
|
self.ignore_sub_junk(2)
|
||||||
else:
|
else:
|
||||||
source_ref.setBase(self.db.findSource(matches[2],self.smap))
|
source_ref.setBase(self.db.findSource(matches[2],self.smap))
|
||||||
|
self.source_description = matches[2]
|
||||||
self.parse_source_reference(source_ref,level)
|
self.parse_source_reference(source_ref,level)
|
||||||
return source_ref
|
return source_ref
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user