From 417afd70ab7e21ab1060e056d67df843d8b6b649 Mon Sep 17 00:00:00 2001 From: prculley Date: Tue, 30 Aug 2016 11:07:23 -0500 Subject: [PATCH] Gedcom import Notes get NoteType appropriate to object --- data/tests/imp_CustTags.gramps | 62 ++-- data/tests/imp_FTM_16dec2015a-mod1.gramps | 48 ++-- data/tests/imp_FTM_PHOTO.gramps | 44 +-- data/tests/imp_Latin_1_CR.gramps | 17 +- data/tests/imp_Latin_1_CRLF.gramps | 17 +- data/tests/imp_Latin_1_LF.gramps | 17 +- data/tests/imp_MediaTest.gramps | 79 +++--- data/tests/imp_MixInlineXrefNote.gramps | 31 +- data/tests/imp_PhonFax_dfs.gramps | 54 ++-- data/tests/imp_bug_8322_test.gramps | 195 ++++++------- data/tests/imp_cp1252_CR.gramps | 17 +- data/tests/imp_cp1252_CRLF.gramps | 17 +- data/tests/imp_cp1252_LF.gramps | 17 +- data/tests/imp_notetest_dfs.ged | 6 +- data/tests/imp_notetest_dfs.gramps | 331 +++++++++++----------- data/tests/imp_sample.gramps | 256 ++++++++--------- gramps/plugins/lib/libgedcom.py | 146 +++++----- 17 files changed, 643 insertions(+), 711 deletions(-) diff --git a/data/tests/imp_CustTags.gramps b/data/tests/imp_CustTags.gramps index 8415cfdf8..40cc7b00a 100644 --- a/data/tests/imp_CustTags.gramps +++ b/data/tests/imp_CustTags.gramps @@ -3,7 +3,7 @@ "http://gramps-project.org/xml/1.7.1/grampsxml.dtd">
- + The Subm /Tester/ 123 Main St. @@ -13,56 +13,56 @@
- + Birth - + Circumcision - + Elected Small town - + _XYZ He should keep his zipper closed - + Independence Day Celebration - + Residence - + Marriage - + _INFIDELITY - + Separation - + U The @@ -76,7 +76,7 @@ - + U Mrs @@ -85,7 +85,7 @@ - + U Tom @@ -95,7 +95,7 @@ - + @@ -106,7 +106,7 @@ - + 777, record for The Tester 2 @@ -114,67 +114,67 @@ - + Ohio Births, 1958-2002 - + 123 High St, Cleveland, Cuyahoga, Ohio, USA, 44140 44140 - + 456 Main St, Cleveland, Cuyahoga, Ohio, USA, 44140 44140 - + Littetown, Smallcounty, Ohio, USA - + 123 Main St., Winslow, PA, 12345 - + St Rafaels Church, Bay Village, Cuyahoga, Ohio, USA - + Of Ill Repute, Shaker Heights, Ohio, USA - + Cuyahoga, OHIO, USA - + USA - + Ohio, USA - + Cuyahoga, Ohio, USA - + Cleveland, Cuyahoga, Ohio, USA - + Testers Repository Library
@@ -184,13 +184,13 @@ - + Because it’s good - + Address as event is legal, with PHON,FAX,EMAIL,WWW - + Testers Repository Record diff --git a/data/tests/imp_FTM_16dec2015a-mod1.gramps b/data/tests/imp_FTM_16dec2015a-mod1.gramps index 2edc28c6b..7ae656e37 100644 --- a/data/tests/imp_FTM_16dec2015a-mod1.gramps +++ b/data/tests/imp_FTM_16dec2015a-mod1.gramps @@ -3,41 +3,41 @@ "http://gramps-project.org/xml/1.7.1/grampsxml.dtd">
- +
- + Birth - + Residence - + Death - + Marriage - + Marriage - + M Andrew @@ -54,13 +54,13 @@ - + - + @@ -68,19 +68,19 @@ - + Year: 1850; Census Place: District 14, Cape Girardeau, Missouri; Roll: M432_394; Page: 435B; Image: 248 2 - + Year: 1850; Census Place: District 14, Cape Girardeau, Missouri; Roll: M432_394; Page: 435B; Image: 248 2 - + Year: 1850; Census Place: District 14, Cape Girardeau, Missouri; Roll: M432_394; Page: 435B; Image: 248 2 @@ -88,7 +88,7 @@ - + 1850 United States Federal Census Ancestry.com Name: Ancestry.com Operations, Inc.; Location: Provo, UT, USA; Date: 2009; @@ -96,42 +96,42 @@ - + Tennessee, USA - + District 14, Cape Girardeau, Missouri, USA - + Bollinger Co. MO - + Union Co.?, IL - + Wayne, Missouri, United States - + - + - + - + Ancestry.com Library
@@ -140,10 +140,10 @@ - + Year: 1850; Census Place: District 14, Cape Girardeau, Missouri; Roll: M432_394; Page: 435B; Image: 248 - + Records not imported into OBJE (multi-media object) Gramps ID M159: Could not import 1850 United States Federal Census(11)-1.jpg Line 70: 1 FILE 1850 United States Federal Census(11)-1.jpg diff --git a/data/tests/imp_FTM_PHOTO.gramps b/data/tests/imp_FTM_PHOTO.gramps index a05ec5a4f..ec144dc5a 100644 --- a/data/tests/imp_FTM_PHOTO.gramps +++ b/data/tests/imp_FTM_PHOTO.gramps @@ -3,12 +3,12 @@ "http://gramps-project.org/xml/1.7.1/grampsxml.dtd">
- +
- + U The @@ -21,7 +21,7 @@ - + U She @@ -35,7 +35,7 @@ - + U Edwin @@ -49,44 +49,44 @@ - + - + - + - + - + - + - + - + - + The primary photo should be a male Sourpuss in a Hat 03.jpg or Gid:M3 - + The primary photo should be a girl eating 04.jpg or Gid:M4 - + Records not imported into INDI (individual) Gramps ID I0002: Line ignored as not understood Line 35: 3 WHAT ??? @@ -94,7 +94,7 @@ Line ignored as not understood Line 35: - + Records not imported into OBJE (multi-media object) Gramps ID M1: Could not import O1.jpg Line 38: 1 FILE O1.jpg @@ -102,7 +102,7 @@ Could not import O1.jpg Line 38: - + Records not imported into OBJE (multi-media object) Gramps ID M2: Could not import O2.jpg Line 41: 1 FILE O2.jpg @@ -110,7 +110,7 @@ Could not import O2.jpg Line 41: - + Records not imported into OBJE (multi-media object) Gramps ID M3: Could not import O3.jpg Line 44: 1 FILE O3.jpg @@ -118,7 +118,7 @@ Could not import O3.jpg Line 44: - + Records not imported into OBJE (multi-media object) Gramps ID M4: Could not import O4.jpg Line 47: 1 FILE O4.jpg @@ -126,7 +126,7 @@ Could not import O4.jpg Line 47: - + Records not imported into OBJE (multi-media object) Gramps ID M5: Could not import O5.jpg Line 50: 1 FILE O5.jpg @@ -134,10 +134,10 @@ Could not import O5.jpg Line 50: - + The primary photo should be a male of pair 05.jpg - + Records not imported into INDI (individual) Gramps ID I0003: Could not import O3.jpg Line 55: 1 OBJE diff --git a/data/tests/imp_Latin_1_CR.gramps b/data/tests/imp_Latin_1_CR.gramps index 99d113d6c..8324268db 100644 --- a/data/tests/imp_Latin_1_CR.gramps +++ b/data/tests/imp_Latin_1_CR.gramps @@ -3,29 +3,22 @@ "http://gramps-project.org/xml/1.7.1/grampsxml.dtd">
- + - Paul Culley - 11210 Olde Mint House Ln - Tomball - Tx - USA - 77375 - paulr2787@gmail.com
- + Birth - + Death - + M Paul @@ -37,7 +30,7 @@ - + Table of Latin_1, ISO-8859-1 characters 32 [ ] 33 [!] diff --git a/data/tests/imp_Latin_1_CRLF.gramps b/data/tests/imp_Latin_1_CRLF.gramps index 99d113d6c..8324268db 100644 --- a/data/tests/imp_Latin_1_CRLF.gramps +++ b/data/tests/imp_Latin_1_CRLF.gramps @@ -3,29 +3,22 @@ "http://gramps-project.org/xml/1.7.1/grampsxml.dtd">
- + - Paul Culley - 11210 Olde Mint House Ln - Tomball - Tx - USA - 77375 - paulr2787@gmail.com
- + Birth - + Death - + M Paul @@ -37,7 +30,7 @@ - + Table of Latin_1, ISO-8859-1 characters 32 [ ] 33 [!] diff --git a/data/tests/imp_Latin_1_LF.gramps b/data/tests/imp_Latin_1_LF.gramps index 99d113d6c..3b074f8e2 100644 --- a/data/tests/imp_Latin_1_LF.gramps +++ b/data/tests/imp_Latin_1_LF.gramps @@ -3,29 +3,22 @@ "http://gramps-project.org/xml/1.7.1/grampsxml.dtd">
- + - Paul Culley - 11210 Olde Mint House Ln - Tomball - Tx - USA - 77375 - paulr2787@gmail.com
- + Birth - + Death - + M Paul @@ -37,7 +30,7 @@ - + Table of Latin_1, ISO-8859-1 characters 32 [ ] 33 [!] diff --git a/data/tests/imp_MediaTest.gramps b/data/tests/imp_MediaTest.gramps index bc27ee3b8..d95009a86 100644 --- a/data/tests/imp_MediaTest.gramps +++ b/data/tests/imp_MediaTest.gramps @@ -3,19 +3,12 @@ "http://gramps-project.org/xml/1.7.1/grampsxml.dtd">
- + - Paul Culley - 11210 Olde Mint House Ln - Tomball - Tx - USA - 77375 - paulr2787@gmail.com
- + U The @@ -36,12 +29,12 @@ - + 0 - + 77, 78 discussion of multimedia link with two files 4 @@ -50,17 +43,17 @@ - + A Great Photographer - + The Testers personal files The Tester Name: Tester Publishing Operations, Inc.; Location: OSF world - + @@ -89,12 +82,12 @@ - + - + @@ -112,25 +105,25 @@ - + - + - + - + - + Media note test: Multimedia link embedded form v5.5 n OBJE {1:1} p.55 +1 FORM <MULTIMEDIA_FORMAT> {1:1} p.48 @@ -138,7 +131,7 @@ n OBJE {1:1} p.55 +1 FILE <MULTIMEDIA_FILE_REFERENCE> {1:1} p.47 +1 <<NOTE_STRUCTURE>> {0:M} p.33 - + Media note test: Multimedia link embedded form v5.5.1 This note is not in the 5.5.1 spec, but is an obvious extrapolation from 5.5. n OBJE @@ -147,10 +140,10 @@ n OBJE +3 MEDI <SOURCE_MEDIA_TYPE> {0:1} p.62 +1 TITL <DESCRIPTIVE_TITLE> {0:1} p.48 - + Multimedia embedded 2nd copy v5.5 - + Records not imported into INDI (individual) Gramps ID I0001: Could not import test_emb_55.jpg Line 18: 1 OBJE @@ -160,10 +153,10 @@ Could not import test_emb_55.jpg Line 34: - + SOMETEXT - + Media note test: Multimedia link to linked form v5.5 blob n @XREF:OBJE@ OBJE {1:1} +1 FORM <MULTIMEDIA_FORMAT> {1:1} p.48 @@ -177,7 +170,7 @@ n @XREF:OBJE@ OBJE {1:1} +1 RIN <AUTOMATED_RECORD_ID> {0:1} p.38 +1 <<CHANGE_DATE>> {0:1} p.29 - + Records not imported into OBJE (multi-media object) Gramps ID M1: Tag recognized but not supported Line 49: 1 BLOB @@ -194,7 +187,7 @@ Filename omitted Line 46: - + Records not imported into OBJE (multi-media object) Gramps ID M2: Tag recognized but not supported Line 68: 1 BLOB @@ -204,7 +197,7 @@ Filename omitted Line 65: - + Media note test: Multimedia link to linked form Gramps style v5.5ish file n @XREF:OBJE@ OBJE {1:1} +1 FORM <MULTIMEDIA_FORMAT> {1:1} p.48 @@ -212,7 +205,7 @@ n @XREF:OBJE@ OBJE {1:1} +1 FILE <MULTIMEDIA_FILE_REFERENCE> {1:1} p.47 +1 <<NOTE_STRUCTURE>> {0:M} p.33 - + Records not imported into OBJE (multi-media object) Gramps ID M3: Could not import test.jpg Line 73: 1 FILE test.jpg @@ -220,10 +213,10 @@ Could not import test.jpg Line 73: - + SOMETEXT - + Media note test: Multimedia link to linked form v5.5.1 file n @XREF:OBJE@ OBJE {1:1} +1 FILE <MULTIMEDIA_FILE_REFN> {1:M} p.54 @@ -237,10 +230,10 @@ n @XREF:OBJE@ OBJE {1:1} +1 <<SOURCE_CITATION>> {0:M} p.39 +1 <<CHANGE_DATE>> {0:1} p.31 - + who shall remain un-named - + Records not imported into OBJE (multi-media object) Gramps ID M4: Could not import test.jpg Line 79: 1 FILE test.jpg @@ -248,14 +241,14 @@ Could not import test.jpg Line 79: - + A fine gentelman was he, upstanding in his community and a great believer in the testing of open source software. - + A note on the FTM media, to see how this integrates... The DATE line is bad; it doesnt follow Gedcom standard at all, and includes the time. The TEXT line comes from the FTM media description. This is the media Note. - + Multimedia link to linked form FTM style n @XREF:OBJE@ OBJE {1:1} +1 FILE <MULTIMEDIA_FILE_REFN> {1:M} p.54 @@ -264,7 +257,7 @@ n @XREF:OBJE@ OBJE {1:1} +2 TEXT text string from FTM media description sometimes populated from exif comments +1 <<NOTE_STRUCTURE>> {0:M} p.33 - + Records not imported into OBJE (multi-media object) Gramps ID M5: Could not import test.jpg Line 94: 1 FILE test.jpg @@ -272,16 +265,16 @@ Could not import test.jpg Line 94: - + SOMETEXT - + Multimedia link to linked form v5.5.1 with two files - + A source who shall remain un-named - + Records not imported into OBJE (multi-media object) Gramps ID M6: Could not import test.jpg Line 102: 1 FILE test.jpg @@ -293,7 +286,7 @@ Skipped subordinate line Line 109: - + Records not imported into OBJE (multi-media object) Gramps ID M8: Could not import No_path_No_Title_NoForm.jpg Line 129: 1 FILE No_path_No_Title_NoForm.jpg diff --git a/data/tests/imp_MixInlineXrefNote.gramps b/data/tests/imp_MixInlineXrefNote.gramps index 57e91ac0e..9685b86bf 100644 --- a/data/tests/imp_MixInlineXrefNote.gramps +++ b/data/tests/imp_MixInlineXrefNote.gramps @@ -3,19 +3,12 @@ "http://gramps-project.org/xml/1.7.1/grampsxml.dtd">
- + - Paul Culley - 11210 Olde Mint House Ln - Tomball - Tx - USA - 77375 - paulr2787@gmail.com
- + M Living1 @@ -25,7 +18,7 @@ - + M Living01 @@ -34,37 +27,37 @@ - + 2 - + 2 - + Inline Source 1 - + inline Source 2 - + Source S1 - + Source S01 - + Inline 0 - + XREF N0 - + Inline 1 diff --git a/data/tests/imp_PhonFax_dfs.gramps b/data/tests/imp_PhonFax_dfs.gramps index c2c341fa6..debc342e0 100644 --- a/data/tests/imp_PhonFax_dfs.gramps +++ b/data/tests/imp_PhonFax_dfs.gramps @@ -3,7 +3,7 @@ "http://gramps-project.org/xml/1.7.1/grampsxml.dtd">
- + The Subm /Tester/ 123 Main St. @@ -15,7 +15,7 @@
- + Birth @@ -25,7 +25,7 @@ - + Residence @@ -35,7 +35,7 @@ - + Residence @@ -45,7 +45,7 @@ - + U The @@ -54,7 +54,7 @@ - + U Mrs @@ -75,7 +75,7 @@ - + U Tom @@ -86,21 +86,21 @@ - + 2 - + 2 - + 2 - + Import from imp_FTM_LINK.ged @@ -112,45 +112,45 @@ - + Ohio Births, 1958-2002 - + 123 High St, Cleveland, Cuyahoga, Ohio, USA, 44140 44140 - + 123 Main St., Winslow, PA, 12345 - + USA - + Ohio, USA - + Cuyahoga, Ohio, USA - + Cleveland, Cuyahoga, Ohio, USA - + Business that produced the product: Ancestry.com GEDCOM data
@@ -161,7 +161,7 @@ - + SUBM (Submitter): (@SUBM@) The Subm /Tester/ GEDCOM data
@@ -176,7 +176,7 @@ - + Testers Repository Library
@@ -191,7 +191,7 @@ - + Records not imported into HEAD (header): Only one phone number supported Line 9: 3 PHON (800) 705-7000 @@ -199,7 +199,7 @@ Only one phone number supported Line 9: - + Records not imported into SUBM (Submitter): (@SUBM@) The Subm /Tester/: Only one phone number supported Line 29: 1 PHON 800-871-3401 @@ -207,16 +207,16 @@ Only one phone number supported Line 29: - + Address with PHON,FAX,EMAIL,WWW. attached directly to person is not legal Gedcom, but allowed here. - + Address as event is legal, with PHON,FAX,EMAIL,WWW - + The repository record - + Records not imported into REPO (repository) Gramps ID R0002: Only one phone number supported Line 87: 1 PHON 800-765-4321 diff --git a/data/tests/imp_bug_8322_test.gramps b/data/tests/imp_bug_8322_test.gramps index 8be3cf23c..3a0edbd35 100644 --- a/data/tests/imp_bug_8322_test.gramps +++ b/data/tests/imp_bug_8322_test.gramps @@ -3,169 +3,162 @@ "http://gramps-project.org/xml/1.7.1/grampsxml.dtd">
- + - Paul Culley - 11210 Olde Mint House Ln - Tomball - Tx - USA - 77375 - paulr2787@gmail.com
- + Residence - + Residence - + Residence - + Residence - + Residence - + Residence - + Residence - + Residence - + Residence - + Residence - + Residence - + Residence - + Residence - + Residence - + Residence - + Residence - + Residence - + Residence - + Residence - + Residence - + Residence - + Residence - + Residence - + Residence - + Residence - + Residence - + Residence - + Residence - + Residence - + Residence - + Residence @@ -213,76 +206,76 @@ - + the place - + the address - + the address - + another address - + another address - + the place - + the address - + the address - + second address - + the place 2 - + second address - + a third address ignored again - + place test @@ -291,203 +284,203 @@ - + address place test - + different place test - + address place test - + a new place - + address place test - + plus an address just for good measure also ignored - + address with no place - + Woerden, Zuid-Holland, Netherlands - + Kromwijkerkade 63 - + Hasselt, Overijssel, Netherlands - + Prinsenstraat 69 - + Enschede, Overijssel, Netherlands - + Calslaan 26-52 - + Calslaan 26-44 - + Enschede, Overijssel, Netherlands - + Calslaan 26-61 - + Amsterdam, Noord-Holland, Netherlands - + Papendrechtstraat 37 - + Olympiaplein 46-2 - + Papendrechtstraat 37 - + Amsterdam, Noord-Holland, Netherlands - + the place created not previously used so changed to add the address; __event_addr(len==0, place is None) - + check that this note is retained when the place is deleted. it should be merged into place - + the place created and then deleted and old data reused; __event_addr(len==0, place is not None) - + setup the place - + the place already exists; but now set doesn't match ; __event_addr(len!=0, place is None) - + the place already exists but now set matches; __event_addr(len!=0, place is not None) - + the address created, then destroyed as we find a matching set; __event_addr(no place_handle, create place) - + address reused, then destroyed as we find a matching set; __event_addr(no place_handle, place found) - + second address ignored - + second address ignored again - + ADDR created; __event_place finds it but place does not match; __event_place(len==0, place is None) - + this note is stored with the old address and then merged into the matching place - + ADDR created; __event_place finds it and now place does match; __event_place(len==0, place is not None) - + setup address place test - + address place test found; place exists and can be reused; __event_place(len!=0, place is not None) - + address place test found; but matching addr/plac not found; __event_place(len!=0, place is not None) - + PLAC occurs first; matching entry found; __event_place(no place handle, place is not None) - + PLAC occurs first; matching entry not found; __event_place(no place handle, place is None) - + note is stashed with a Place, and then merged into the address - + Place note - + ADDR note - + PLAC previously encountered, new ADDR, so new Place - + ADDR before PLAC (check ADDR is removed) - + ADDR before PLAC (address matches previous one, then needs to be reassigned) - + PLAC and no ADDR - + PLAC matches previous one, then when ADDR is read need to create a new Place - + PLAC and ADDR match, use existing one - + Records not imported into INDI (individual) Gramps ID I0310: A second PLAC ignored Line 109: 2 PLAC a second PLACe ignored diff --git a/data/tests/imp_cp1252_CR.gramps b/data/tests/imp_cp1252_CR.gramps index 1bbeee04c..735e0dfca 100644 --- a/data/tests/imp_cp1252_CR.gramps +++ b/data/tests/imp_cp1252_CR.gramps @@ -3,29 +3,22 @@ "http://gramps-project.org/xml/1.7.1/grampsxml.dtd">
- + - Paul Culley - 11210 Olde Mint House Ln - Tomball - Tx - USA - 77375 - paulr2787@gmail.com
- + Birth - + Death - + F Jean @@ -37,7 +30,7 @@ - + Table de caractères Windows cp1252 32 [ ] 33 [!] diff --git a/data/tests/imp_cp1252_CRLF.gramps b/data/tests/imp_cp1252_CRLF.gramps index 1bbeee04c..735e0dfca 100644 --- a/data/tests/imp_cp1252_CRLF.gramps +++ b/data/tests/imp_cp1252_CRLF.gramps @@ -3,29 +3,22 @@ "http://gramps-project.org/xml/1.7.1/grampsxml.dtd">
- + - Paul Culley - 11210 Olde Mint House Ln - Tomball - Tx - USA - 77375 - paulr2787@gmail.com
- + Birth - + Death - + F Jean @@ -37,7 +30,7 @@ - + Table de caractères Windows cp1252 32 [ ] 33 [!] diff --git a/data/tests/imp_cp1252_LF.gramps b/data/tests/imp_cp1252_LF.gramps index 1bbeee04c..735e0dfca 100644 --- a/data/tests/imp_cp1252_LF.gramps +++ b/data/tests/imp_cp1252_LF.gramps @@ -3,29 +3,22 @@ "http://gramps-project.org/xml/1.7.1/grampsxml.dtd">
- + - Paul Culley - 11210 Olde Mint House Ln - Tomball - Tx - USA - 77375 - paulr2787@gmail.com
- + Birth - + Death - + F Jean @@ -37,7 +30,7 @@ - + Table de caractères Windows cp1252 32 [ ] 33 [!] diff --git a/data/tests/imp_notetest_dfs.ged b/data/tests/imp_notetest_dfs.ged index 08d8612d2..7b0c4c2fb 100644 --- a/data/tests/imp_notetest_dfs.ged +++ b/data/tests/imp_notetest_dfs.ged @@ -86,6 +86,9 @@ 3 TEST Empty Note 2 NOTE Media Note 3 TEST 123456 Note +2 NOTE @N6@ +2 NOTE +3 TEST Empty Note 1 RIN 123456 Person 1 REFN 98765 for PERSON 2 TEST REFN @@ -93,9 +96,6 @@ 1 CHAN 2 DATE 11 Jan 2001 3 TIME 16:00:06 -2 NOTE @N6@ -2 NOTE -3 TEST Empty Note 1 OBJE @M1@ 0 @N4@ NOTE Tom Tester xref note 0 @N5@ NOTE Death Event xref note diff --git a/data/tests/imp_notetest_dfs.gramps b/data/tests/imp_notetest_dfs.gramps index 0fea2a86b..07927735d 100644 --- a/data/tests/imp_notetest_dfs.gramps +++ b/data/tests/imp_notetest_dfs.gramps @@ -9,174 +9,176 @@ - + TEST person - + Birth - - + + - + Death - + - + Who knows OBJE REFN TYPE REFN - + Birth - + Death - + Birth - + Death - + TEST family - + M Tom Tester - - - - - + + + + + - - - + - - + + + + - + F Mrs Tester - - - - + + + - + + - + M Ed Tester Eddie - + - - + + - - - - - - - + + + + + + + - - + + - + U George Testee - + - + - + - - - - - - - - - + + + + + + + + + - + 2 - + 2 - + 2 - + 2 - + - + 2 - + 2 - + 2 - + - + 42 0 - - - + + + - + Import from imp_notetest.ged Tom Tester 2016 + + @@ -190,69 +192,71 @@ - + - + @SOURCE1@ - + Note Test file Source: Tester - - - - + + + + - + 123 main, Norwalk, Ohio, USA - - + + - + Salt Lake City - + - + - - + + - + Business that produced the product: RSAC Software GEDCOM data - + SUBM (Submitter): (@SUBMITTER@) John A. Tester GEDCOM data
+ +
- + The Testers repository Library - - + +
- + Header note - + Records not imported into HEAD (header): Line ignored as not understood Line 18: 2 TEST Header Note @@ -262,23 +266,24 @@ Skipped subordinate line Line 20: - - Records not imported into Top Level: - -Line ignored as not understood Line 25: 1 NOTE Submission Note -Skipped subordinate line Line 26: 2 TEST Submission Note -Line ignored as not understood Line 27: 1 NOTE -Skipped subordinate line Line 28: 2 TEST Empty Note -Line ignored as not understood Line 29: 1 TEST submission -Line ignored as not understood Line 30: 1 NOTE N2 - + + Submission Note - + Submission xref note - + + Records not imported into Top Level: + +Line ignored as not understood Line 26: 2 TEST Submission Note +Empty note ignored Line 27: 1 NOTE +Skipped subordinate line Line 28: 2 TEST Empty Note +Line ignored as not understood Line 29: 1 TEST submission + + + Records not imported into NOTE Gramps ID N0003: Tag recognized but not supported Line 32: 1 RIN Submission Note RIN @@ -290,61 +295,65 @@ Line ignored as not understood Line 39: - - Records not imported into SUBM (Submitter): (@SUBMITTER@) John A. Tester: - -Line ignored as not understood Line 42: 1 NOTE Submitter Note -Skipped subordinate line Line 43: 2 TEST Submitter Note -Line ignored as not understood Line 44: 1 NOTE -Skipped subordinate line Line 45: 2 TEST Empty Note -Line ignored as not understood Line 46: 1 TEST Submitter -Line ignored as not understood Line 47: 1 NOTE N3 - + + Submitter Note - + Submitter xref note - + + Records not imported into SUBM (Submitter): (@SUBMITTER@) John A. Tester: + +Line ignored as not understood Line 43: 2 TEST Submitter Note +Empty note ignored Line 44: 1 NOTE +Skipped subordinate line Line 45: 2 TEST Empty Note +Line ignored as not understood Line 46: 1 TEST Submitter + + + Birth Event note - + Location Note - + Location Note 2 - + Death Event xref note - + FAMS Note - + FAMS Note 2 - + Tom Tester xref note - + Tom Tester Note - + Media Note - + + Media xref note + + Records not imported into INDI (individual) Gramps ID I0001: -Empty event note ignored Line 54: 2 NOTE +Empty note ignored Line 54: 2 NOTE Skipped subordinate line Line 55: 3 NOTE Empty note subordinate (Should be skipped) Skipped subordinate line Line 56: 3 TEST Empty Note -Skipped subordinate line Line 58: 3 TEST 123456 Event Note +Line ignored as not understood Line 58: 3 TEST 123456 Event Note Line ignored as not understood Line 62: 4 TEST Location Note Line ignored as not understood Line 63: 3 TEST Location -Empty event note ignored Line 66: 2 NOTE +Empty note ignored Line 66: 2 NOTE Skipped subordinate line Line 67: 3 TEST Empty Note -Empty event note ignored Line 68: 2 NOTE +Empty note ignored Line 68: 2 NOTE Skipped subordinate line Line 69: 3 TEST Empty Note Line ignored as not understood Line 73: 3 TEST FAMS Note Skipped subordinate line Line 74: 4 TEST skip on FAMS Note @@ -354,32 +363,30 @@ Line ignored as not understood Line 82: Empty note ignored Line 85: 2 NOTE Skipped subordinate line Line 86: 3 TEST Empty Note Line ignored as not understood Line 88: 3 TEST 123456 Note -Line ignored as not understood Line 96: 2 NOTE N6 -Skipped subordinate line Line 98: 3 TEST Empty Note +Empty note ignored Line 90: 2 NOTE +Skipped subordinate line Line 91: 3 TEST Empty Note - - Media xref note - - - Records not imported into NOTE Gramps ID N0017: + + Records not imported into NOTE Gramps ID N0018: Tag recognized but not supported Line 103: 1 RIN 123456 Tag recognized but not supported Line 104: 1 REFN 98765 Skipped subordinate line Line 105: 2 TYPE Who knows REFN TYPE +Tag recognized but not supported Line 109: 2 NOTE Note on a change on a note!!! Skipped subordinate line Line 110: 3 CHAN Skipped subordinate line Line 111: 4 DATE 2001-01-11 Skipped subordinate line Line 112: 5 TIME 16:00:06 - + Who knows REFN TYPE - + Records not imported into OBJE (multi-media object) Gramps ID M1: Could not import photo.jpg Line 114: 1 FILE photo.jpg @@ -387,10 +394,10 @@ Could not import photo.jpg Line 114: - + Family Spouse reference Note - + Records not imported into INDI (individual) Gramps ID I0002: Empty note ignored Line 132: 2 NOTE @@ -399,19 +406,19 @@ Skipped subordinate line Line 133: - + Name note - + Place note - + LDS xref note - + Association link note - + Records not imported into INDI (individual) Gramps ID I0003: Empty note ignored Line 141: 2 NOTE @@ -423,25 +430,25 @@ Skipped subordinate line Line 168: - + Just for association - + Family xref note - + Family note - + Citation Data Note - + A sample text from a source of this family - + A note this citation is on the FAMILY record. - + Records not imported into FAM (family) Gramps ID F0001: Line ignored as not understood Line 183: 2 TEST Family Note @@ -454,13 +461,13 @@ Line ignored as not understood Line 196: - + A short note about the repository link. - + note embedded in the SOURCE Record - + Records not imported into SOUR (source) Gramps ID S0001: Line ignored as not understood Line 206: 1 TEST source @@ -472,10 +479,10 @@ Skipped subordinate line Line 215: - + Repository Note - + Records not imported into REPO (repository) Gramps ID R0002: Line ignored as not understood Line 223: 1 TEST Repo diff --git a/data/tests/imp_sample.gramps b/data/tests/imp_sample.gramps index e338b9100..f02190cea 100644 --- a/data/tests/imp_sample.gramps +++ b/data/tests/imp_sample.gramps @@ -3,533 +3,533 @@ "http://gramps-project.org/xml/1.7.1/grampsxml.dtd">
- + Alex Roitman,,, Not Provided
- + Birth Birth of Anna Hansdotter - + Death Death of Anna Hansdotter - + Birth Birth of Keith Lloyd Smith - + Birth Birth of Hans Peter Smith - + Death Death of Hans Peter Smith - + Birth Birth of Hanna Smith - + Birth Birth of Herman Julius Nielsen - + Death Death of Herman Julius Nielsen - + Birth Birth of Evelyn Michaels - + Birth Birth of Marjorie Lee Smith - + Birth Birth of Gus Smith - + Death Death of Gus Smith - + Birth Birth of Jennifer Anderson - + Death Death of Jennifer Anderson - + Birth Birth of Lillie Harriet Jones - + Death Death of Lillie Harriet Jones - + Birth Birth of John Hjalmar Smith - + Birth Birth of Eric Lloyd Smith - + Adopted - + Birth Birth of Amber Marie Smith - + Christening Christening of Amber Marie Smith - + Birth Birth of Carl Emil Smith - + Death Death of Carl Emil Smith - + Birth Birth of Hjalmar Smith - + Death Death of Hjalmar Smith - + Birth Birth of Martin Smith - + Death Death of Martin Smith - + Baptism Baptism of Martin Smith - + Birth Birth of Astrid Shermanna Augusta Smith - + Death Death of Astrid Shermanna Augusta Smith - + Birth Birth of Gustaf Smith, Sr. - + Death Death of Gustaf Smith, Sr. - + Immi - + Christening Christening of Gustaf Smith, Sr. - + Birth Birth of Marta Ericsdotter - + Birth Birth of Kirsti Marie Smith - + Death Death of Kirsti Marie Smith - + Birth Birth of Ingeman Smith - + Birth Birth of Anna Streiffert - + Death Death of Anna Streiffert - + Birth Birth of Craig Peter Smith - + Census Census of Craig Peter Smith - + Birth Birth of Magnes Smith - + Death Death of Magnes Smith - + Birth Birth of Janice Ann Adams - + Occupation Retail Manager - + Degree Business Management - + Birth Birth of Marjorie Ohman - + Death Death of Marjorie Ohman - + Birth Birth of Darcy Horne - + Birth Birth of Lloyd Smith - + Birth Birth of Alice Paula Perkins - + Birth Birth of Lars Peter Smith - + Adopted - + Birth Birth of Elna Jefferson - + Death Death of Elna Jefferson - + Christening Christening of Elna Jefferson - + Birth Birth of Edwin Michael Smith - + Occupation Software Engineer - + Education Education of Edwin Michael Smith - + Degree B.S.E.E. - + Birth Birth of Kerstina Hansdotter - + Death Death of Kerstina Hansdotter - + Birth Birth of Martin Smith - + Death Death of Martin Smith - + Birth Birth of Ingeman Smith - + Birth Birth of Marjorie Alice Smith - + Birth Birth of Janis Elaine Green - + Birth Birth of Mason Michael Smith - + Christening Christening of Mason Michael Smith - + Birth Birth of Edwin Willard - + Birth Birth of Ingar Smith - + Birth Birth of Hjalmar Smith - + Death Death of Hjalmar Smith - + Baptism Baptism of Hjalmar Smith - + Immi - + Birth Birth of Emil Smith - + Marriage Marriage of Martin Smith and Elna Jefferson - + Marriage Marriage of Ingeman Smith and Marta Ericsdotter - + Marriage Marriage of Eric Lloyd Smith and Darcy Horne - + Marriage Marriage of Magnes Smith and Anna Streiffert - + Marriage Marriage of John Hjalmar Smith and Alice Paula Perkins - + Marriage Marriage of Edwin Michael Smith and Janice Ann Adams - + Engagement Engagement of Edwin Michael Smith and Janice Ann Adams - + Marriage Marriage of Martin Smith and Kerstina Hansdotter - + Marriage Marriage of Gustaf Smith, Sr. and Anna Hansdotter - + Marriage Marriage of Edwin Willard and Kirsti Marie Smith - + Marriage Marriage of Herman Julius Nielsen and Astrid Shermanna Augusta Smith - + Marriage Marriage of Hjalmar Smith and Marjorie Ohman - + Marriage Marriage of Gus Smith and Evelyn Michaels - + Marriage @@ -1089,15 +1089,15 @@ - + 2 - + 2 - + 2 @@ -1121,105 +1121,105 @@ - + Löderup, Malmöhus Län, Sweden - + Sparks, Washoe Co., NV - + San Francisco, San Francisco Co., CA - + Rønne, Bornholm, Denmark - + Gladsax, Kristianstad Län, Sweden - + Reno, Washoe Co., NV - + Hayward, Alameda Co., CA - + Community Presbyterian Church, Danville, CA - + Sweden - + Grostorp, Kristianstad Län, Sweden - + Copenhagen, Denmark - + Hoya/Jona/Hoia, Sweden - + Simrishamn, Kristianstad Län, Sweden - + Fremont, Alameda Co., CA - + Denver, Denver Co., CO - + Sacramento, Sacramento Co., CA - + Santa Rosa, Sonoma Co., CA - + San Jose, Santa Clara Co., CA - + UC Berkeley - + Smestorp, Kristianstad Län, Sweden - + Tommarp, Kristianstad Län, Sweden - + Rønne Bornholm, Denmark - + Woodland, Yolo Co., CA - + San Ramon, Conta Costa Co., CA - + New York Public Library Library
@@ -1230,7 +1230,7 @@ 11111
- + Aunt Martha's Attic Library
@@ -1244,30 +1244,30 @@ - + BIOGRAPHY Martin was listed as being a Husman, (owning a house as opposed to a farm) in the house records of Gladsax. - + Witness name: John Doe Witness comment: This is a simple test. - + Witness name: No Name - + BIOGRAPHY Hjalmar sailed from Copenhagen, Denmark on the OSCAR II, 14 November 1912 arriving in New York 27 November 1912. He was seventeen years old. On the ship passenger list his trade was listed as a Blacksmith. He came to Reno, Nevada and lived with his sister Marie for a time before settling in Sparks. He worked for Southern Pacific Railroad as a car inspector for a time, then went to work for Standard Oil Company. He enlisted in the army at Sparks 7 December 1917 and served as a Corporal in the Medical Corp until his discharge 12 August 1919 at the Presidio in San Francisco, California. Both he and Marjorie are buried in the Masonic Memorial Gardens Mausoleum in Reno, he the 30th June 1975, and she the 25th of June 1980. - + But Aunt Martha still keeps the original! - + The repository reference from the source is important - + Some note on the repo diff --git a/gramps/plugins/lib/libgedcom.py b/gramps/plugins/lib/libgedcom.py index f37e44293..e2164ed96 100644 --- a/gramps/plugins/lib/libgedcom.py +++ b/gramps/plugins/lib/libgedcom.py @@ -5,6 +5,7 @@ # Copyright (C) 2009-2010 Gary Burton # Copyright (C) 2010 Nick Hall # Copyright (C) 2011 Tim G L Lyons +# Copyright (C) 2016 Paul R. Culley # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -461,6 +462,23 @@ MEDIA_MAP = { 'video' : SourceMediaType.VIDEO, } +OBJ_NOTETYPE = { + "Attribute": NoteType.ATTRIBUTE, + "Address": NoteType.ADDRESS, + "Citation": NoteType.CITATION, + "Event": NoteType.EVENT, + "Family": NoteType.FAMILY, + "LdsOrd": NoteType.LDS, + "Media": NoteType.MEDIA, + "Name": NoteType.GENERAL, + "Place": NoteType.PLACE, + "Person": NoteType.PERSON, + "Repository": NoteType.REPO, + "RepoRef": NoteType.REPOREF, + "Source": NoteType.SOURCE, + "PersonRef": NoteType.ASSOCIATION, + } + #------------------------------------------------------------------------- # # Integer to GEDCOM tag mappings for constants @@ -1750,6 +1768,7 @@ class GedcomParser(UpdateCallback): self.place_parser = PlaceParser() self.inline_srcs = OrderedDict() self.media_map = {} + self.note_type_map = {} self.genby = "" self.genvers = "" self.subm = "" @@ -1818,6 +1837,7 @@ class GedcomParser(UpdateCallback): # +1 <> {0:1} # +1 <> {0:M} # +1 LANG {0:3} + # +1 <> {0:M} # +1 RFN {0:1} # +1 RIN {0:1} # +1 <> {0:1} @@ -1834,6 +1854,9 @@ class GedcomParser(UpdateCallback): TOKEN_FAX : self.__repo_fax, # +1 <> # +1 LANG + # +1 <> + TOKEN_NOTE: self.__repo_note, + TOKEN_RNOTE: self.__repo_note, # +1 RFN # +1 RIN # +1 <> @@ -3397,7 +3420,7 @@ class GedcomParser(UpdateCallback): elif key in ("SUBM", "SUBMITTER"): self.__parse_submitter(line) elif key in ("SUBN"): - state = CurrentState() + state = CurrentState(level=1) self.__parse_submission(line, state) self.__check_msgs(_("Top Level"), state, None) elif line.token in (TOKEN_SUBM, TOKEN_SUBN, TOKEN_IGNORE): @@ -3676,7 +3699,6 @@ class GedcomParser(UpdateCallback): """ self.__obje(line, state, state.person) - def __person_photo(self, line, state): """ This handles the FTM _PHOTO feature, which identifies an OBJE to use @@ -3891,7 +3913,7 @@ class GedcomParser(UpdateCallback): @param state: The current state @type state: CurrentState """ - self.__parse_note(line, state.person, 1, state) + self.__parse_note(line, state.person, state) def __person_rnote(self, line, state): """ @@ -3902,7 +3924,7 @@ class GedcomParser(UpdateCallback): @param state: The current state @type state: CurrentState """ - self.__parse_note(line, state.person, 1, state) + self.__parse_note(line, state.person, state) def __person_addr(self, line, state): """ @@ -4063,7 +4085,7 @@ class GedcomParser(UpdateCallback): @param state: The current state @type state: CurrentState """ - self.__parse_note(line, state.name, state.level+1, state) + self.__parse_note(line, state.name, state) def __name_alia(self, line, state): """ @@ -4501,7 +4523,7 @@ class GedcomParser(UpdateCallback): @param state: The current state @type state: CurrentState """ - self.__parse_note(line, state.lds_ord, state.level+1, state) + self.__parse_note(line, state.lds_ord, state) def __lds_stat(self, line, state): """ @@ -4598,7 +4620,7 @@ class GedcomParser(UpdateCallback): @param state: The current state @type state: CurrentState """ - self.__parse_note(line, state.person, state.level+1, state) + self.__parse_note(line, state.person, state) def __person_famc_primary(self, line, state): """ @@ -4721,7 +4743,7 @@ class GedcomParser(UpdateCallback): @param state: The current state @type state: CurrentState """ - self.__parse_note(line, state.ref, state.level, state) + self.__parse_note(line, state.ref, state) #------------------------------------------------------------------- # @@ -5026,7 +5048,6 @@ class GedcomParser(UpdateCallback): """ self.__obje(line, state, state.family) - def __family_comm(self, line, state): """ @param line: The current line in GedLine format @@ -5047,7 +5068,7 @@ class GedcomParser(UpdateCallback): @param state: The current state @type state: CurrentState """ - self.__parse_note(line, state.family, state.level, state) + self.__parse_note(line, state.family, state) def __family_chan(self, line, state): """ @@ -5256,39 +5277,11 @@ class GedcomParser(UpdateCallback): @param state: The current state @type state: CurrentState """ - # This code pretty much duplicates the code in __parse_note. In - # __parse_note, we already know the object to which the note is to be - # attached, so we can directly add the note to the object. however, in - # the case of a media object, the media object is not constructed till - # the end of processing, so we just remember the handle of the note. - if line.token == TOKEN_RNOTE: - # reference to a named note defined elsewhere - #NOTE_STRUCTURE: = - # n NOTE @@ {1:1} - # +1 SOUR @@ {0:M} - state.note = self.__find_note_handle(self.nid_map[line.data]) - else: - # Embedded note - #NOTE_STRUCTURE: = - # n NOTE [ | ] {1:1} - # +1 [ CONC | CONT ] {0:M} - # +1 SOUR @@ {0:M} - if not line.data: - self.__add_msg(_("Empty note ignored"), line, state) - self.__skip_subordinate_levels(state.level+1, state) - else: - new_note = Note(line.data) - new_note.set_gramps_id(self.nid_map[""]) - new_note.set_handle(create_id()) - - sub_state = CurrentState(level=state.level+1) - sub_state.note = new_note - self.__parse_level(sub_state, self.note_parse_tbl, - self.__undefined) - state.msg += sub_state.msg - - self.dbase.commit_note(new_note, self.trans, new_note.change) - state.note = new_note.get_handle() + obj = Media() + self.__parse_note(line, obj, state) + nlist = obj.get_note_list() + if nlist: + state.note = nlist[0] def __media_ref_prim(self, line, state): """ @@ -5362,7 +5355,6 @@ class GedcomParser(UpdateCallback): """ self.__obje(line, state, state.event) - def __event_type(self, line, state): """ Parses the TYPE line for an event. @@ -5457,7 +5449,7 @@ class GedcomParser(UpdateCallback): @param state: The current state @type state: CurrentState """ - self.__parse_note(line, state.place, state.level+1, state) + self.__parse_note(line, state.place, state) def __event_place_form(self, line, state): """ @@ -5477,7 +5469,6 @@ class GedcomParser(UpdateCallback): """ self.__obje(line, state, state.place) - def __event_place_sour(self, line, state): """ @param line: The current line in GedLine format @@ -5635,7 +5626,7 @@ class GedcomParser(UpdateCallback): @param state: The current state @type state: CurrentState """ - self.__parse_note(line, state.event, state.level+1, state) + self.__parse_note(line, state.event, state) def __event_inline_note(self, line, state): """ @@ -5647,17 +5638,7 @@ class GedcomParser(UpdateCallback): if line.data[0:13] == "Description: ": state.event.set_description(line.data[13:]) else: - if not line.data: - # empty: discard, with warning and skip subs - # Note: level+2 - self.__add_msg(_("Empty event note ignored"), line, state) - self.__skip_subordinate_levels(line.level+1, state) - else: - new_note = Note(line.data) - new_note.set_handle(create_id()) - self.dbase.add_note(new_note, self.trans) - self.__skip_subordinate_levels(line.level+1, state) - state.event.add_note(new_note.get_handle()) + self.__parse_note(line, state.event, state) def __event_source(self, line, state): """ @@ -6070,7 +6051,7 @@ class GedcomParser(UpdateCallback): @param state: The current state @type state: CurrentState """ - self.__parse_note(line, state.addr, state.level+1, state) + self.__parse_note(line, state.addr, state) def __citation_page(self, line, state): """ @@ -6162,7 +6143,7 @@ class GedcomParser(UpdateCallback): state.citation.add_note(note.get_handle()) def __citation_data_note(self, line, state): - self.__parse_note(line, state.citation, state.level, state) + self.__parse_note(line, state.citation, state) def __citation_obje(self, line, state): """ @@ -6175,7 +6156,6 @@ class GedcomParser(UpdateCallback): """ self.__obje(line, state, state.citation) - def __citation_refn(self, line, state): """ Parses the REFN line of an SOUR instance tag @@ -6250,7 +6230,7 @@ class GedcomParser(UpdateCallback): @param state: The current state @type state: CurrentState """ - self.__parse_note(line, state.citation, state.level+1, state) + self.__parse_note(line, state.citation, state) #---------------------------------------------------------------------- # @@ -6315,7 +6295,6 @@ class GedcomParser(UpdateCallback): """ self.__obje(line, state, state.source) - def __source_chan(self, line, state): """ @param line: The current line in GedLine format @@ -6409,7 +6388,7 @@ class GedcomParser(UpdateCallback): @param state: The current state @type state: CurrentState """ - self.__parse_note(line, state.repo_ref, state.level+1, state) + self.__parse_note(line, state.repo_ref, state) def __repo_chan(self, line, state): """ @@ -6448,7 +6427,7 @@ class GedcomParser(UpdateCallback): @param state: The current state @type state: CurrentState """ - self.__parse_note(line, state.source, state.level+1, state) + self.__parse_note(line, state.source, state) def __source_auth(self, line, state): """ @@ -6626,7 +6605,7 @@ class GedcomParser(UpdateCallback): @param state: The current state @type state: CurrentState """ - self.__parse_note(line, state.media, state.level+1, state) + self.__parse_note(line, state.media, state) def __obje_sour(self, line, state): """ @@ -6745,7 +6724,7 @@ class GedcomParser(UpdateCallback): @param state: The current state @type state: CurrentState """ - self.__parse_note(line, state.attr, state.level+1, state) + self.__parse_note(line, state.attr, state) #---------------------------------------------------------------------- # @@ -6790,7 +6769,7 @@ class GedcomParser(UpdateCallback): @param state: The current state @type state: CurrentState """ - self.__parse_note(line, state.repo, state.level+1, state) + self.__parse_note(line, state.repo, state) def __repo_addr(self, line, state): """ @@ -6958,7 +6937,7 @@ class GedcomParser(UpdateCallback): @type state: CurrentState """ if state.event: - self.__parse_note(line, state.place, state.level, state) + self.__parse_note(line, state.place, state) else: # This causes notes below SUBMitter to be ignored self.__not_recognized(line, state) @@ -6970,7 +6949,7 @@ class GedcomParser(UpdateCallback): @param state: The current state @type state: CurrentState """ - self.__parse_note(line, state.obj, state.level, state) + self.__parse_note(line, state.obj, state) #---------------------------------------------------------------------- # @@ -7372,7 +7351,7 @@ class GedcomParser(UpdateCallback): @type state: CurrentState """ if self.use_def_src: - self.__parse_note(line, self.def_src, 2, state) + self.__parse_note(line, self.def_src, state) def __header_subm_name(self, line, state): """ @@ -7384,13 +7363,16 @@ class GedcomParser(UpdateCallback): if self.use_def_src: self.def_src.set_author(line.data) - def __parse_note(self, line, obj, level, state): + def __parse_note(self, line, obj, state): if line.token == TOKEN_RNOTE: # reference to a named note defined elsewhere #NOTE_STRUCTURE: = # n NOTE @@ {1:1} - # +1 SOUR @@ {0:M} - obj.add_note(self.__find_note_handle(self.nid_map[line.data])) + # +1 SOUR @@ {0:M} # 5.5 only, not in 5.5.1 + handle = self.__find_note_handle(self.nid_map[line.data]) + obj.add_note(handle) + self.note_type_map[handle] = OBJ_NOTETYPE.get(type(obj).__name__, + NoteType.GENERAL) else: # Embedded note #NOTE_STRUCTURE: = @@ -7413,7 +7395,9 @@ class GedcomParser(UpdateCallback): # Add a default tag if provided self.__add_default_tag(new_note) - + # Set the type of the note + new_note.set_type(OBJ_NOTETYPE.get(type(obj).__name__, + NoteType.GENERAL)) self.dbase.commit_note(new_note, self.trans, new_note.change) obj.add_note(new_note.get_handle()) @@ -7446,7 +7430,8 @@ class GedcomParser(UpdateCallback): new_note = Note(line.data) new_note.set_handle(handle) new_note.set_gramps_id(gid) - + if handle in self.note_type_map: + new_note.set_type(self.note_type_map[handle]) sub_state = CurrentState(level=state.level) sub_state.note = new_note self.__parse_level(sub_state, self.note_parse_tbl, self.__undefined) @@ -7496,11 +7481,12 @@ class GedcomParser(UpdateCallback): +1 DESC {0:1} +1 ORDI {0:1} +1 RIN {0:1} + +1 NOTE {0:m} """ while True: line = self.__get_next_line() msg = "" - if self.__level_is_finished(line, state.level+1): + if self.__level_is_finished(line, state.level): break elif line.token == TOKEN_SUBM: msg = _("Submission: Submitter") @@ -7514,6 +7500,8 @@ class GedcomParser(UpdateCallback): msg = _("Submission: Generations of descendants") elif line.token == TOKEN_UNKNOWN and line.token_text == "ORDI": msg = _("Submission: Ordinance process flag") + elif line.token == TOKEN_NOTE or line.token == TOKEN_RNOTE: + self.__parse_note(line, self.def_src, state) else: self.__not_recognized(line, state) continue @@ -7582,8 +7570,8 @@ class GedcomParser(UpdateCallback): elif line.token == TOKEN_DATE: #Lexer converted already to Date object dobj = line.data - elif line.token == TOKEN_NOTE: - self.__skip_subordinate_levels(level+1, state) + elif line.token == TOKEN_NOTE or line.token == TOKEN_RNOTE: + self.__ignore(line, state) else: self.__not_recognized(line, state)