* src/ReadGedcom.py: fix forward referencing named notes
svn: r5192
This commit is contained in:
parent
b62eaef5fe
commit
f99f517f04
@ -1,3 +1,6 @@
|
|||||||
|
2005-09-14 Don Allingham <don@gramps-project.org>
|
||||||
|
* src/ReadGedcom.py: fix forward referencing named notes
|
||||||
|
|
||||||
2005-09-12 Don Allingham <don@gramps-project.org>
|
2005-09-12 Don Allingham <don@gramps-project.org>
|
||||||
* src/NameEdit.py: preserve custom name types
|
* src/NameEdit.py: preserve custom name types
|
||||||
* src/plugins/ScratchPad.py: handle unicode better
|
* src/plugins/ScratchPad.py: handle unicode better
|
||||||
|
@ -268,7 +268,7 @@ class GedcomParser:
|
|||||||
self.fmap = {}
|
self.fmap = {}
|
||||||
self.smap = {}
|
self.smap = {}
|
||||||
self.nmap = {}
|
self.nmap = {}
|
||||||
self.share_note = []
|
self.share_note = {}
|
||||||
self.refn = {}
|
self.refn = {}
|
||||||
self.added = {}
|
self.added = {}
|
||||||
self.gedmap = GedcomInfoDB()
|
self.gedmap = GedcomInfoDB()
|
||||||
@ -541,8 +541,12 @@ class GedcomParser:
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
def break_note_links(self):
|
def break_note_links(self):
|
||||||
for o in self.share_note:
|
for handle in self.share_note.keys():
|
||||||
o.unique_note()
|
p = self.db.get_person_from_handle(handle)
|
||||||
|
if p:
|
||||||
|
note_id = self.share_note[handle]
|
||||||
|
p.set_note_object(self.nmap[note_id])
|
||||||
|
self.db.commit_person(p,self.trans)
|
||||||
|
|
||||||
def parse_trailer(self):
|
def parse_trailer(self):
|
||||||
matches = self.get_next()
|
matches = self.get_next()
|
||||||
@ -679,13 +683,9 @@ class GedcomParser:
|
|||||||
source.set_title( matches[2][5:])
|
source.set_title( matches[2][5:])
|
||||||
self.db.commit_source(source, self.trans)
|
self.db.commit_source(source, self.trans)
|
||||||
elif matches[2][0:4] == "NOTE":
|
elif matches[2][0:4] == "NOTE":
|
||||||
if self.nmap.has_key(matches[1]):
|
noteobj = RelLib.Note()
|
||||||
noteobj = self.nmap[matches[1]]
|
self.nmap[matches[1]] = noteobj
|
||||||
else:
|
|
||||||
noteobj = RelLib.Note()
|
|
||||||
self.nmap[matches[1]] = noteobj
|
|
||||||
text = matches[2][4:]
|
text = matches[2][4:]
|
||||||
# noteobj.append(text + self.parse_continue_data(1))
|
|
||||||
noteobj.append(text + self.parse_note_continue(1))
|
noteobj.append(text + self.parse_note_continue(1))
|
||||||
self.parse_note_data(1)
|
self.parse_note_data(1)
|
||||||
elif matches[2] == "_LOC":
|
elif matches[2] == "_LOC":
|
||||||
@ -930,15 +930,8 @@ class GedcomParser:
|
|||||||
|
|
||||||
def parse_note_base(self,matches,obj,level,old_note,task):
|
def parse_note_base(self,matches,obj,level,old_note,task):
|
||||||
note = old_note
|
note = old_note
|
||||||
if matches[2] and matches[2][0] == "@":
|
if matches[2] and matches[2][0] == "@": # reference to a named note defined elsewhere
|
||||||
if self.nmap.has_key(matches[2]):
|
self.share_note[obj.get_handle()] = matches[2]
|
||||||
self.share_note.append(obj)
|
|
||||||
obj.set_note_object(self.nmap[matches[2]])
|
|
||||||
else:
|
|
||||||
noteobj = RelLib.Note()
|
|
||||||
self.nmap[matches[2]] = noteobj
|
|
||||||
self.share_note.append(obj)
|
|
||||||
obj.set_note_object(noteobj)
|
|
||||||
else:
|
else:
|
||||||
if old_note:
|
if old_note:
|
||||||
note = "%s\n%s%s" % (old_note,matches[2],self.parse_continue_data(level))
|
note = "%s\n%s%s" % (old_note,matches[2],self.parse_continue_data(level))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user