From aa92fa55a97a90bbc2eae3d4e66321f9bb85ec76 Mon Sep 17 00:00:00 2001 From: prculley Date: Fri, 15 Jul 2016 16:29:38 -0500 Subject: [PATCH 1/2] bug 9581 Gedcom import of FTM .ged file containing _LINK tags not supported --- data/tests/imp_FTM_LINK.ged | 41 ++++++++++++++++++++ data/tests/imp_FTM_LINK.gramps | 67 +++++++++++++++++++++++++++++++++ gramps/plugins/lib/libgedcom.py | 20 +++++++++- 3 files changed, 127 insertions(+), 1 deletion(-) create mode 100644 data/tests/imp_FTM_LINK.ged create mode 100644 data/tests/imp_FTM_LINK.gramps diff --git a/data/tests/imp_FTM_LINK.ged b/data/tests/imp_FTM_LINK.ged new file mode 100644 index 000000000..c05b35378 --- /dev/null +++ b/data/tests/imp_FTM_LINK.ged @@ -0,0 +1,41 @@ +0 HEAD +1 SOUR FTM +2 VERS Family Tree Maker (22.0.0.1410) +2 NAME Family Tree Maker for Windows +2 CORP Ancestry.com +3 ADDR 360 W 4800 N +4 CONT Provo, UT 84604 +3 PHON (801) 705-7000 +1 DEST GED55 +1 DATE 01 MAR 2016 +1 CHAR UTF-8 +1 FILE D:\Family Tree Maker\imp_FTM_LINK.ged +1 SUBM @SUBM@ +1 GEDC +2 VERS 5.5 +2 FORM LINEAGE-LINKED +0 @SUBM@ SUBM +0 @I937@ INDI +1 NAME François Joseph /Raffath/ +2 SOUR @S241@ +3 _LINK http://gw.geneanet.org/danynogue2?lang=en&pz=anny+lise+marie&nz=le+vaillant&ocz=0&p=francois+joseph&n=raffath&oc=6 +0 @I1@ INDI +1 NAME Michael /Sullivan/ +2 SOUR @S118@ +3 PAGE GS Film number: 2342492 Frame Number: Digital Folder Number: +4 CONC 4208243 Image Number: 339 Reference ID: p 493 rn 9850 +3 DATA +4 TEXT Name: Michael Sullivan Race (Original): Age (Expanded): 25 years +5 CONC Birth Year: 1866 Birthplace: Ireland Spouse's Name: Nellie +5 CONC Moynahan Spouse's Race (Original): Spouse's Age +5 CONC (Expanded): 25 years Spouse's Birth Year: 1866 Spouse's +5 CONC Birthplace: Ireland Event Date: 04 Nov 1891 Event Place: Wayne, +5 CONC Michigan Father's Name: Michael Sullivan Mother's Name: +5 CONC Julia Brosnahan Spouse's Father's Name: Mich. Moynahan +5 CONC Spouse's Mother's Name: Ellen Quinlan +3 _LINK https://familysearch.org/pal:/MM9.1.1/N3XS-1BL +0 @S118@ SOUR +1 TITL Michigan, Marriages, 1868-1925 +0 @S241@ SOUR +1 TITL Daniel NOGUE family tree +0 TRLR diff --git a/data/tests/imp_FTM_LINK.gramps b/data/tests/imp_FTM_LINK.gramps new file mode 100644 index 000000000..ac66fa0ac --- /dev/null +++ b/data/tests/imp_FTM_LINK.gramps @@ -0,0 +1,67 @@ + + + +
+ + + +
+ + + U + + François Joseph + Raffath + + + + + U + + Michael + Sullivan + + + + + + + 2 + + + + + GS Film number: 2342492 Frame Number: Digital Folder Number:4208243 Image Number: 339 Reference ID: p 493 rn 9850 + 2 + + + + + + + + Daniel NOGUE family tree + + + Michigan, Marriages, 1868-1925 + + + + + http://gw.geneanet.org/danynogue2?lang=en&pz=anny+lise+marie&nz=le+vaillant&ocz=0&p=francois+joseph&n=raffath&oc=6 + + + + Name: Michael Sullivan Race (Original): Age (Expanded): 25 yearsBirth Year: 1866 Birthplace: Ireland Spouse's Name: Nellie Moynahan Spouse's Race (Original): Spouse's Age (Expanded): 25 years Spouse's Birth Year: 1866 Spouse's Birthplace: Ireland Event Date: 04 Nov 1891 Event Place: Wayne, Michigan Father's Name: Michael Sullivan Mother's Name: Julia Brosnahan Spouse's Father's Name: Mich. Moynahan Spouse's Mother's Name: Ellen Quinlan + + + https://familysearch.org/pal:/MM9.1.1/N3XS-1BL + + + +
diff --git a/gramps/plugins/lib/libgedcom.py b/gramps/plugins/lib/libgedcom.py index 2bc6007aa..019b5ed56 100755 --- a/gramps/plugins/lib/libgedcom.py +++ b/gramps/plugins/lib/libgedcom.py @@ -268,6 +268,7 @@ TOKEN__MARN = 129 TOKEN__ADPN = 130 TOKEN__FSFTID = 131 TOKEN__PHOTO = 132 +TOKEN__LINK = 133 TOKENS = { "HEAD" : TOKEN_HEAD, "MEDI" : TOKEN_MEDI, @@ -374,7 +375,7 @@ TOKENS = { "_URL" : TOKEN_URL, "URL" : TOKEN_URL, "_MAR" : TOKEN__MAR, "_MARN" : TOKEN__MARN, "_ADPN" : TOKEN__ADPN, "_FSFTID" : TOKEN__FSFTID, - "_PHOTO" : TOKEN__PHOTO, + "_LINK" : TOKEN__LINK, "_PHOTO" : TOKEN__PHOTO, } ADOPT_NONE = 0 @@ -2313,6 +2314,7 @@ class GedcomParser(UpdateCallback): TOKEN_NOTE : self.__citation_note, TOKEN_RNOTE : self.__citation_note, TOKEN_TEXT : self.__citation_data_text, + TOKEN__LINK : self.__citation_link, } self.func_list.append(self.citation_parse_tbl) @@ -6170,6 +6172,22 @@ class GedcomParser(UpdateCallback): state.citation.add_note(note.get_handle()) + def __citation_link(self, line, state): + """ + Not legal GEDCOM - added to support FTM, converts the _LINK tag to a + note with styled text so link can be followed in reports etc. + """ + note = Note() + tags = StyledTextTag(StyledTextTagType.LINK, + line.data, + [(0, len(line.data))]) + note.set_styledtext(StyledText(line.data, [tags])) + gramps_id = self.dbase.find_next_note_gramps_id() + note.set_gramps_id(gramps_id) + note.set_type(NoteType.CITATION) + self.dbase.add_note(note, self.trans) + state.citation.add_note(note.get_handle()) + def __citation_data_note(self, line, state): self.__parse_note(line, state.citation, state.level, state) From a3c6ce1c30d39fca992c7432be55d7a6d09ee9ef Mon Sep 17 00:00:00 2001 From: prculley Date: Sat, 16 Jul 2016 12:02:20 -0500 Subject: [PATCH 2/2] rebase --- data/tests/imp_FTM_LINK.gramps | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/data/tests/imp_FTM_LINK.gramps b/data/tests/imp_FTM_LINK.gramps index ac66fa0ac..429941a09 100644 --- a/data/tests/imp_FTM_LINK.gramps +++ b/data/tests/imp_FTM_LINK.gramps @@ -3,12 +3,12 @@ "http://gramps-project.org/xml/1.7.1/grampsxml.dtd">
- +
- + U François Joseph @@ -16,7 +16,7 @@ - + U Michael @@ -26,13 +26,13 @@ - + 2 - - GS Film number: 2342492 Frame Number: Digital Folder Number:4208243 Image Number: 339 Reference ID: p 493 rn 9850 + + GS Film number: 2342492 Frame Number: Digital Folder Number: 4208243 Image Number: 339 Reference ID: p 493 rn 9850 2 @@ -40,24 +40,24 @@ - + Daniel NOGUE family tree - + Michigan, Marriages, 1868-1925 - + http://gw.geneanet.org/danynogue2?lang=en&pz=anny+lise+marie&nz=le+vaillant&ocz=0&p=francois+joseph&n=raffath&oc=6 - - Name: Michael Sullivan Race (Original): Age (Expanded): 25 yearsBirth Year: 1866 Birthplace: Ireland Spouse's Name: Nellie Moynahan Spouse's Race (Original): Spouse's Age (Expanded): 25 years Spouse's Birth Year: 1866 Spouse's Birthplace: Ireland Event Date: 04 Nov 1891 Event Place: Wayne, Michigan Father's Name: Michael Sullivan Mother's Name: Julia Brosnahan Spouse's Father's Name: Mich. Moynahan Spouse's Mother's Name: Ellen Quinlan + + Name: Michael Sullivan Race (Original): Age (Expanded): 25 years Birth Year: 1866 Birthplace: Ireland Spouse's Name: Nellie Moynahan Spouse's Race (Original): Spouse's Age (Expanded): 25 years Spouse's Birth Year: 1866 Spouse's Birthplace: Ireland Event Date: 04 Nov 1891 Event Place: Wayne, Michigan Father's Name: Michael Sullivan Mother's Name: Julia Brosnahan Spouse's Father's Name: Mich. Moynahan Spouse's Mother's Name: Ellen Quinlan - + https://familysearch.org/pal:/MM9.1.1/N3XS-1BL