gedspec 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,11 @@
1
+ 0 @F5@ FAM
2
+ 1 HUSB @I9@
3
+ 1 WIFE @I15@
4
+ 1 CHIL @I10@
5
+ 1 CHIL @I11@
6
+ 1 CHIL @I12@
7
+ 1 NOTE @N36@
8
+ 1 RIN 5
9
+ 1 CHAN
10
+ 2 DATE 11 Jan 2001
11
+ 3 TIME 16:50:37
@@ -0,0 +1,147 @@
1
+ 0 HEAD
2
+ 1 SOUR GEDitCOM
3
+ 2 NAME GEDitCOM
4
+ 2 VERS 2.9.4
5
+ 2 CORP RSAC Software
6
+ 3 ADDR 7108 South Pine Cone Street
7
+ 4 CONT Salt Lake City, UT 84121
8
+ 4 CONT USA
9
+ 4 ADR1 RSAC Software
10
+ 4 ADR2 7108 South Pine Cone Street
11
+ 4 CITY Salt Lake City
12
+ 4 STAE UT
13
+ 4 POST 84121
14
+ 4 CTRY USA
15
+ 3 PHON +1-801-942-7768
16
+ 3 PHON +1-801-555-1212
17
+ 3 PHON +1-801-942-1148 (FAX) (last one!)
18
+ 2 DATA Name of source data
19
+ 3 DATE 1 JAN 1998
20
+ 3 COPR Copyright of source data
21
+ 1 SUBM @SUBMITTER@
22
+ 1 SUBN @SUBMISSION@
23
+ 1 _HME @PERSON1@
24
+ 1 DEST ANSTFILE
25
+ 1 DATE 1 JAN 1998
26
+ 2 TIME 13:57:24.80
27
+ 1 FILE TGC55C.ged
28
+ 1 COPR � 1997 by H. Eichmann, parts � 1999-2000 by J. A. Nairn.
29
+ 1 GEDC
30
+ 2 VERS 5.5
31
+ 2 FORM LINEAGE-LINKED
32
+ 1 LANG English
33
+ 1 CHAR ANSEL
34
+ 2 VERS ANSI Z39.47-1985
35
+ 1 PLAC
36
+ 2 FORM City, County, State, Country
37
+ 1 NOTE This file demonstrates all tags that are allowed in GEDCOM 5.5. Here are some comments about the HEADER record
38
+ 2 CONC and comments about where to look for information on the other 9 types of GEDCOM records. Most other records will
39
+ 2 CONC have their own notes that describe what to look for in that record and what to hope the importing software will find.
40
+ 2 CONT
41
+ 2 CONT Many applications will fail to import these notes. The notes are therefore also provided with the files as a plain-text
42
+ 2 CONC "Read-Me" file.
43
+ 2 CONT
44
+ 2 CONT --------------------------
45
+ 2 CONT The HEADER Record:
46
+ 2 CONT This record has all possible tags for a HEADER record. In uses one custom tag ("_HME") to see what the software
47
+ 2 CONC will say about custom tags.
48
+ 2 CONT
49
+ 2 CONT --------------------------
50
+ 2 CONT INDIVIDUAL Records:
51
+ 2 CONT This file has a small number of INDIVIDUAL records. The record named "Joseph Tag Torture" has all possible
52
+ 2 CONC tags for an INDIVIDUAL record. All remaining individuals have less tags. Some test specific features; for example:
53
+ 2 CONT
54
+ 2 CONT Name: Standard GEDCOM Filelinks
55
+ 2 CONT Name: Nonstandard Multimedia Filelinks
56
+ 2 CONT Name: General Custom Filelinks
57
+ 2 CONT Name: Extra URL Filelinks
58
+ 2 CONT These records link to multimedia files mentioned by the GEDCOM standard and to a variety of other types of
59
+ 2 CONC multimedia files, general files, or URL names.
60
+ 2 CONT
61
+ 2 CONT Name: Chris Locked Torture
62
+ 2 CONT Has a "locked" restriction (RESN) tag - should not be able to edit this record it. This record has one set of notes
63
+ 2 CONC that is used to test line breaking in notes and a few other text-parsing features of the GEDCOM software. Read those
64
+ 2 CONC notes to see what they are testing.
65
+ 2 CONT
66
+ 2 CONT Name: Sandy Privacy Torture
67
+ 2 CONT Has a "privacy" restriction (RESN) tag. Is the tag recognized and how is the record displayed and/or printed?
68
+ 2 CONT
69
+ 2 CONT Name: Chris Locked Torture
70
+ 2 CONT Name: Sandy Privacy Torture
71
+ 2 CONT Name: Pat Smith Torture
72
+ 2 CONT The three children in this file have unknown sex (no SEX tag). An ancestor tree from each should give five
73
+ 2 CONC generations of ancestors.
74
+ 2 CONT
75
+ 2 CONT Name: Charlie Accented ANSEL
76
+ 2 CONT Name: Lucy Special ANSEL
77
+ 2 CONT The notes in these records use all possible special characters in the ANSEL character set. The header of this file
78
+ 2 CONC denotes this file as using the ANSEL character set. The importing software should handle these special characters in a
79
+ 2 CONC reasonable way.
80
+ 2 CONT
81
+ 2 CONT Name: Torture GEDCOM Matriarch
82
+ 2 CONT All individuals in this file are related and all are descendants (or spouses of descendants) of Torture GEDCOM
83
+ 2 CONC Matriarch. A descendant tree or report from this individual should show five generations of descendants.
84
+ 2 CONT
85
+ 2 CONT --------------------------
86
+ 2 CONT FAMILY Records:
87
+ 2 CONT The FAMILY record for "Joseph Tag Torture" (husband) and "Mary First Jones" (wife) has all tags allowed in
88
+ 2 CONC family records. All other family records use only a few tags and are used to provide records for extra family links in
89
+ 2 CONC other records.
90
+ 2 CONT
91
+ 2 CONT --------------------------
92
+ 2 CONT SOURCE Records:
93
+ 2 CONT There are two SOURCE records in this file. The "Everything You Every Wanted to Know about GEDCOM Tags"
94
+ 2 CONC source has all possible GEDCOM tags for a SOURCE record. The other source only has only a few tags.
95
+ 2 CONT
96
+ 2 CONT --------------------------
97
+ 2 CONT REPOSITORY Record:
98
+ 2 CONT There is just one REPOSITORY record and it uses all possible tags for such a record.
99
+ 2 CONT
100
+ 2 CONT --------------------------
101
+ 2 CONT SUBMITTER Records:
102
+ 2 CONT This file has three SUBMITTER records. The "John A. Nairn" record has all tags allowed in such records. The
103
+ 2 CONC second and third submitter are to test how programs input files with multiple submitters. The GEDCOM standard does
104
+ 2 CONC not allow for notes in SUBMITTER records. Look in the "Main Submitter" to verify all address data comes through,
105
+ 2 CONC that all three phone numbers appear, and that the multimedia file link is preserved.
106
+ 2 CONT
107
+ 2 CONT --------------------------
108
+ 2 CONT MULTIMEDIA OBJECT Record:
109
+ 2 CONT The one MULTIMEDIA record has all possible tags and even has encoded data for a small image of a flower. There
110
+ 2 CONC are no known GEDCOM programs that can read or write such records. The record is included here to test how
111
+ 2 CONC programs might respond to finding multimedia records present. There are possible plans to eliminate encoded
112
+ 2 CONC multimedia objects in the next version of GEDCOM. In the future all multimedia will be included by links to other files.
113
+ 2 CONC To test current file links and extended file links, see the "Filelinks" family records described above.
114
+ 2 CONT
115
+ 2 CONT --------------------------
116
+ 2 CONT SUBMISSION Record:
117
+ 2 CONT The one (maximum allowed) SUBMISSION record in this file has all possible tags for such a record.
118
+ 2 CONT
119
+ 2 CONT --------------------------
120
+ 2 CONT NOTE Records:
121
+ 2 CONT This file has many NOTE records. These are all linked to other records.
122
+ 2 CONT
123
+ 2 CONT --------------------------
124
+ 2 CONT TRLR Records:
125
+ 2 CONT This file ends in the standard TRLR record.
126
+ 2 CONT
127
+ 2 CONT --------------------------
128
+ 2 CONT ADDITIONAL NOTES
129
+ 2 CONT This file was originally created by H. Eichmann at <h.eichmann@@mbox.iqo.uni-hannover.de> and posted on the
130
+ 2 CONC Internet.
131
+ 2 CONT
132
+ 2 CONT (NOTE: email addresses are listed here with double "at" signs. A rule of GEDCOM parsing is that these should be
133
+ 2 CONC converted to single "at" at signs, but not many programs follow that rule. In addition, that rule is not needed and may be
134
+ 2 CONC abandoned in a future version of GEDCOM).
135
+ 2 CONT
136
+ 2 CONT This original file was extensively modified by J. A. Nairn using GEDitCOM 2.9.4 (1999-2001) at
137
+ 2 CONC <support@@geditcom.com> and posted on the Internet at <http://www.geditcom.com>. Some changes included many
138
+ 2 CONC more notes, the use or more tags, extensive testing of multimedia file links, and some notes to test all special ANSEL
139
+ 2 CONC characters.
140
+ 2 CONT
141
+ 2 CONT Feel free to copy and use this GEDCOM file for any non-commercial purpose.
142
+ 2 CONT
143
+ 2 CONT For selecting the allowed tags, the GEDCOM standard Release 5.5 (2 JAN 1996) was used. Copyright: The Church of
144
+ 2 CONC Jesus Christ of Latter-Day Saints, <gedcom@@gedcom.org>.
145
+ 2 CONT
146
+ 2 CONT You can download the GEDCOM 5.5 specs from: <ftp.gedcom.com/pub/genealogy/gedcom>. You can read the
147
+ 2 CONC GEDCOM 5.5 specs on the Internet at <http://homepages.rootsweb.com/~pmcbride/gedcom/55gctoc.htm>.
@@ -0,0 +1,13 @@
1
+ 0 @I13@ INDI
2
+ 1 NAME Lucy Special /ANSEL/
3
+ 1 SEX F
4
+ 1 BIRT
5
+ 2 DATE 12 AUG 1905
6
+ 1 DEAT
7
+ 2 DATE 31 DEC 1990
8
+ 1 FAMS @F6@
9
+ 1 NOTE @N25@
10
+ 1 CHAN
11
+ 2 DATE 11 Jan 2001
12
+ 3 TIME 16:00:23
13
+ 1 RIN 2
@@ -0,0 +1,19 @@
1
+ 0 @M1@ OBJE
2
+ 1 TITL Dummy Multimedia Object
3
+ 1 FORM PICT
4
+ 1 BLOB
5
+ 2 CONT .HM.......k.1..F.jwA.Dzzzzw............A....1.........0U.66..E.8
6
+ 2 CONT .......A..k.a6.A.......A..k.........../6....G.......0../..U.....
7
+ 2 CONT .w1/m........HC0..../...zzzzzzzz..5zzk..AnA..U..W6U....2rRrRrRrR
8
+ 2 CONT .Dw...............k.1.......1..A...5ykE/zzzx/.g//.Hxzk6/.Tzy/.k1
9
+ 2 CONT /Dw/.Tvz.E5zzUE9/kHz.Tw2/DzzzEEA.kE2zk5yzk2/zzs21.U2/Dw/.Tw/.Tzy
10
+ 2 CONT /.fy/.HzzkHzzzo21Ds00.E2.UE2.U62/.k./Ds0.UE0/Do0..E8/UE2.U62.U9w
11
+ 2 CONT /.Tx/.20.jg2/jo2..9u/.0U.6A.zk
12
+ 1 NOTE Here are some notes on this multimedia object.
13
+ 2 CONT If decoded it should be an image of a flower.
14
+ 1 REFN User Reference Number
15
+ 2 TYPE User Reference Type
16
+ 1 RIN 1
17
+ 1 CHAN
18
+ 2 DATE 14 Jan 2001
19
+ 3 TIME 14:10:31
@@ -0,0 +1,20 @@
1
+ 0 @N2@ NOTE
2
+ 1 CONC Comments on "Family History Library" REPOSITORY Record.
3
+ 1 CONT
4
+ 1 CONT This record uses all possible GEDCOM tags for a REPOSITORY record. Some
5
+ 1 CONC things to look for are:
6
+ 1 CONT
7
+ 1 CONT 1. The address is specified twice. Once in a multi-line address record and once in
8
+ 1 CONC separate lines. The first method is usually enough. The second method is to be more
9
+ 1 CONC specific about parts of the address. Is everything imported?
10
+ 1 CONT
11
+ 1 CONT 2. There are multiple phone numbers. Are they all imported?
12
+ 1 SOUR @SOURCE1@
13
+ 2 PAGE 1
14
+ 2 DATA
15
+ 3 DATE 1 MAY 1999
16
+ 3 TEXT Text from the source about this repository.
17
+ 2 QUAY 3
18
+ 1 CHAN
19
+ 2 DATE 12 Mar 2000
20
+ 3 TIME 11:44:05
@@ -0,0 +1,21 @@
1
+ 0 @R1@ REPO
2
+ 1 NAME Family History Library
3
+ 1 ADDR 35 North West Temple
4
+ 2 CONT Salt Lake City, UT 84111
5
+ 2 CONT USA
6
+ 2 ADR1 35 North West Temple
7
+ 2 ADR2 Across the street from Temple Square
8
+ 2 CITY Salt Lake City
9
+ 2 STAE Utah
10
+ 2 POST 84111
11
+ 2 CTRY USA
12
+ 1 PHON +1-801-240-2331 (information)
13
+ 1 PHON +1-801-240-1278 (gifts & donations)
14
+ 1 PHON +1-801-240-2584 (support)
15
+ 1 NOTE @N2@
16
+ 1 REFN User Ref Number
17
+ 2 TYPE Sample
18
+ 1 RIN 1
19
+ 1 CHAN
20
+ 2 DATE 12 Mar 2000
21
+ 3 TIME 10:36:02
@@ -0,0 +1,9 @@
1
+ 0 @SM2@ SUBM
2
+ 1 NAME Secondary Submitter
3
+ 1 ADDR Secondary Submitter Address 1
4
+ 2 CONT Secondary Submitter Address 2
5
+ 1 LANG English
6
+ 1 CHAN
7
+ 2 DATE 12 Mar 2000
8
+ 3 TIME 10:38:33
9
+ 1 RIN 2
@@ -0,0 +1,9 @@
1
+ 0 @SR2@ SOUR
2
+ 1 TITL All I Know About GEDCOM, I Learned on the Internet
3
+ 1 ABBR What I Know About GEDCOM
4
+ 1 AUTH Second Source Author
5
+ 1 NOTE @N16@
6
+ 1 CHAN
7
+ 2 DATE 11 Jan 2001
8
+ 3 TIME 16:21:39
9
+ 1 RIN 2
@@ -0,0 +1,72 @@
1
+ require 'spec_helper'
2
+
3
+ describe Gedspec::Gedcom::File do
4
+ let(:file) { Gedspec::Gedcom::File.new(fixture_file('/tcg551.ged')) }
5
+
6
+ it 'extracts head snippet' do
7
+ expect(file.head.to_gedcom).to eq fixture_content('tcg551_head.ged')
8
+ end
9
+
10
+ it 'extracts a specific subm snippet' do
11
+ expect(file.subm('SM2')).to eq fixture_content('tcg551_sm2.ged')
12
+ end
13
+
14
+ it 'extracts all subm snippets' do
15
+ expect(file.subm.size).to eq 3
16
+ expect(file.subm).to include(fixture_content('tcg551_sm2.ged'))
17
+ end
18
+
19
+ it 'extracts a specific indi snippet' do
20
+ expect(file.indi('I13')).to eq fixture_content('tcg551_i13.ged')
21
+ end
22
+
23
+ it 'extracts all indi snippets' do
24
+ expect(file.indi.size).to eq 15
25
+ expect(file.indi).to include(fixture_content('tcg551_i13.ged'))
26
+ end
27
+
28
+ it 'extracts a specific fam snippet' do
29
+ expect(file.fam('F5')).to eq fixture_content('tcg551_f5.ged')
30
+ end
31
+
32
+ it 'extracts all fam snippets' do
33
+ expect(file.fam.size).to eq 7
34
+ expect(file.fam).to include(fixture_content('tcg551_f5.ged'))
35
+ end
36
+
37
+ it 'extracts a specific repo snippet' do
38
+ expect(file.repo('R1')).to eq fixture_content('tcg551_r1.ged')
39
+ end
40
+
41
+ it 'extracts all repo snippets' do
42
+ expect(file.repo.size).to eq 455
43
+ expect(file.repo).to include(fixture_content('tcg551_r1.ged'))
44
+ end
45
+
46
+ it 'extracts a specific sour snippet' do
47
+ expect(file.sour('SR2')).to eq fixture_content('tcg551_sr2.ged')
48
+ end
49
+
50
+ it 'extracts all sour snippets' do
51
+ expect(file.sour.size).to eq 2
52
+ expect(file.sour).to include(fixture_content('tcg551_sr2.ged'))
53
+ end
54
+
55
+ it 'extracts a specific note snippet' do
56
+ expect(file.note('N2')).to eq fixture_content('tcg551_n2.ged')
57
+ end
58
+
59
+ it 'extracts all note snippets' do
60
+ expect(file.note.size).to eq 33
61
+ expect(file.note).to include(fixture_content('tcg551_n2.ged'))
62
+ end
63
+
64
+ it 'extracts a specific obje snippet' do
65
+ expect(file.obje('M1')).to eq fixture_content('tcg551_m1.ged')
66
+ end
67
+
68
+ it 'extracts all obje snippets' do
69
+ expect(file.obje.size).to eq 745
70
+ expect(file.obje).to include(fixture_content('tcg551_m1.ged'))
71
+ end
72
+ end
@@ -0,0 +1,25 @@
1
+ require 'spec_helper'
2
+
3
+ describe Gedspec::Gedcom::Structure do
4
+ let(:structure) { Gedspec::Gedcom::Structure.new }
5
+
6
+ describe '#get_level' do
7
+ describe 'when the input string contains a digit character (0123456789)' do
8
+ it 'returns the first digit character as an integer', :shared => true do
9
+ expect(structure.get_level('0 @I1@ INDI')).to eq 0
10
+ end
11
+ end
12
+
13
+ describe 'when the input string contains white-space before the digit' do
14
+ it 'returns the first digit character as an integer' do
15
+ expect(structure.get_level(' 0 @I1@ INDI')).to eq 0
16
+ end
17
+ end
18
+
19
+ describe 'when the input string does not contain a digit character' do
20
+ it 'should be nil if the the string does not contain a number' do
21
+ expect(structure.get_level('INDI')).to be_nil
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,48 @@
1
+ require 'spec_helper'
2
+
3
+ describe Gedspec::Header do
4
+ let(:head) do
5
+ Gedspec::Header.new <<-END
6
+ 0 HEAD
7
+ 1 SOUR GEDitCOM
8
+ 2 NAME GEDitCOM
9
+ 2 VERS 2.9.4
10
+ 2 CORP RSAC Software
11
+ 3 ADDR 7108 South Pine Cone Street
12
+ 4 CONT Salt Lake City, UT 84121
13
+ 4 CONT USA
14
+ 4 ADR1 RSAC Software
15
+ 4 ADR2 7108 South Pine Cone Street
16
+ 4 CITY Salt Lake City
17
+ 4 STAE UT
18
+ 4 POST 84121
19
+ 4 CTRY USA
20
+ 3 PHON +1-801-942-7768
21
+ 3 PHON +1-801-555-1212
22
+ 3 PHON +1-801-942-1148 (FAX) (last one!)
23
+ 2 DATA Name of source data
24
+ 3 DATE 1 JAN 1998
25
+ 3 COPR Copyright of source data
26
+ 1 SUBM @SUBMITTER@
27
+ 1 SUBN @SUBMISSION@
28
+ 1 _HME @PERSON1@
29
+ 1 DEST ANSTFILE
30
+ 1 DATE 1 JAN 1998
31
+ 2 TIME 13:57:24.80
32
+ 1 FILE TGC55C.ged
33
+ 1 COPR � 1997 by H. Eichmann, parts � 1999-2000 by J. A. Nairn.
34
+ 1 GEDC
35
+ 2 VERS 5.5
36
+ 2 FORM LINEAGE-LINKED
37
+ 1 LANG English
38
+ 1 CHAR ANSEL
39
+ 2 VERS ANSI Z39.47-1985
40
+ 1 PLAC
41
+ 2 FORM City, County, State, Country
42
+ END
43
+ end
44
+
45
+ it 'parses char' do
46
+ expect(head.char).to eq 'ANSEL'
47
+ end
48
+ end
@@ -0,0 +1,53 @@
1
+ require 'spec_helper'
2
+
3
+ describe Gedspec::Individual do
4
+ let(:indi) do
5
+ Gedspec::Individual.new <<-END
6
+ 0 @I1@ INDI
7
+ 1 RESN locked
8
+ 1 SEX M
9
+ 1 RFN R55
10
+ 1 AFN AFN4
11
+ 1 REFN T13
12
+ 1 REFN L98
13
+ 1 RIN A1
14
+ 1 NAME John /Hancock/
15
+ END
16
+ end
17
+
18
+ it 'has many names' do
19
+ expect(indi.name).to eq 'John /Hancock/'
20
+ end
21
+
22
+ it 'parses xref' do
23
+ expect(indi.xref).to eq '@I1@'
24
+ end
25
+
26
+ it 'parses resn' do
27
+ expect(indi.resn).to eq 'locked'
28
+ end
29
+
30
+ it 'parses sex' do
31
+ expect(indi.sex).to eq 'M'
32
+ end
33
+
34
+ it 'parses rfn' do
35
+ expect(indi.rfn).to eq 'R55'
36
+ end
37
+
38
+ it 'parses afn' do
39
+ expect(indi.afn).to eq 'AFN4'
40
+ end
41
+
42
+ it 'parses refn' do
43
+ expect(indi.refn).to eq ['T13', 'L98']
44
+ end
45
+
46
+ it 'parses rin' do
47
+ expect(indi.rin).to eq 'A1'
48
+ end
49
+
50
+ it 'parses name' do
51
+ expect(indi.name).to eq 'John /Hancock/'
52
+ end
53
+ end