* src/ReadGedcom.py (parse_trailer): Catch EOF to warn about premature EOF only once; Always close file;
(parse_record): Properly catch premature EOF instead of unknown level 0 records; Support single line SOUR records; (parse_address): Support PHON and NOTE, ignore _NAME. svn: r4601
This commit is contained in:
parent
8165bf3974
commit
e4e817de57
@ -1,3 +1,9 @@
|
|||||||
|
2005-05-16 Martin Hawlisch <Martin.Hawlisch@gmx.de>
|
||||||
|
* src/ReadGedcom.py (parse_trailer): Catch EOF to warn about premature
|
||||||
|
EOF only once; Always close file; (parse_record): Properly catch
|
||||||
|
premature EOF instead of unknown level 0 records; Support single line
|
||||||
|
SOUR records; (parse_address): Support PHON and NOTE, ignore _NAME.
|
||||||
|
|
||||||
2005-05-16 Alex Roitman <shura@gramps-project.org>
|
2005-05-16 Alex Roitman <shura@gramps-project.org>
|
||||||
* src/ansel_utf8.py: Convert to Unix end-of-line.
|
* src/ansel_utf8.py: Convert to Unix end-of-line.
|
||||||
|
|
||||||
|
@ -528,7 +528,7 @@ class GedcomParser:
|
|||||||
|
|
||||||
def parse_trailer(self):
|
def parse_trailer(self):
|
||||||
matches = self.get_next()
|
matches = self.get_next()
|
||||||
if matches[1] != "TRLR":
|
if matches[0] >= 0 and matches[1] != "TRLR":
|
||||||
self.barf(0)
|
self.barf(0)
|
||||||
self.f.close()
|
self.f.close()
|
||||||
|
|
||||||
@ -654,6 +654,12 @@ class GedcomParser:
|
|||||||
self.ignore_sub_junk(1)
|
self.ignore_sub_junk(1)
|
||||||
elif matches[2] == "SOUR":
|
elif matches[2] == "SOUR":
|
||||||
self.parse_source(matches[1],1)
|
self.parse_source(matches[1],1)
|
||||||
|
elif matches[2].startswith("SOUR "):
|
||||||
|
# A source formatted in a single line, for example:
|
||||||
|
# 0 @S62@ SOUR This is the title of the source
|
||||||
|
source = self.find_or_create_source(matches[1][1:-1])
|
||||||
|
source.set_title( matches[2][5:])
|
||||||
|
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]):
|
if self.nmap.has_key(matches[1]):
|
||||||
noteobj = self.nmap[matches[1]]
|
noteobj = self.nmap[matches[1]]
|
||||||
@ -668,7 +674,7 @@ class GedcomParser:
|
|||||||
# TODO: Add support for extended Locations.
|
# TODO: Add support for extended Locations.
|
||||||
# See: http://en.wiki.genealogy.net/index.php/Gedcom_5.5EL
|
# See: http://en.wiki.genealogy.net/index.php/Gedcom_5.5EL
|
||||||
self.ignore_sub_junk(1)
|
self.ignore_sub_junk(1)
|
||||||
elif matches[0] < 1 or matches[1] == "TRLR":
|
elif matches[0] < 0 or matches[1] == "TRLR":
|
||||||
self.backup()
|
self.backup()
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
@ -1296,8 +1302,14 @@ class GedcomParser:
|
|||||||
address.set_postal_code(matches[2])
|
address.set_postal_code(matches[2])
|
||||||
elif matches[1] == "CTRY":
|
elif matches[1] == "CTRY":
|
||||||
address.set_country(matches[2])
|
address.set_country(matches[2])
|
||||||
|
elif matches[1] == "PHON":
|
||||||
|
address.set_phone(matches[2])
|
||||||
|
elif matches[1] == "NOTE":
|
||||||
|
note = self.parse_note(matches,address,level+1,note)
|
||||||
elif matches[1] == "_LOC":
|
elif matches[1] == "_LOC":
|
||||||
pass # ignore unsupported extended location syntax
|
pass # ignore unsupported extended location syntax
|
||||||
|
elif matches[1] == "_NAME":
|
||||||
|
pass # ignore
|
||||||
else:
|
else:
|
||||||
self.barf(level+1)
|
self.barf(level+1)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user