gedcom 0.9.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.
- data/History.txt +4 -0
- data/Manifest.txt +74 -0
- data/README.txt +129 -0
- data/Rakefile +13 -0
- data/lib/gedcom.rb +105 -0
- data/lib/gedcom/address_record.rb +77 -0
- data/lib/gedcom/adoption_record.rb +57 -0
- data/lib/gedcom/association_record.rb +79 -0
- data/lib/gedcom/cause_record.rb +45 -0
- data/lib/gedcom/change_date_record.rb +39 -0
- data/lib/gedcom/character_set_record.rb +41 -0
- data/lib/gedcom/citation_data_record.rb +49 -0
- data/lib/gedcom/citation_event_type_record.rb +42 -0
- data/lib/gedcom/corporate_record.rb +36 -0
- data/lib/gedcom/date_record.rb +206 -0
- data/lib/gedcom/encoded_line_record.rb +34 -0
- data/lib/gedcom/event_age_record.rb +36 -0
- data/lib/gedcom/event_record.rb +258 -0
- data/lib/gedcom/events_list_record.rb +61 -0
- data/lib/gedcom/families_individuals.rb +79 -0
- data/lib/gedcom/family_record.rb +89 -0
- data/lib/gedcom/gedcom_all.rb +41 -0
- data/lib/gedcom/gedcom_base.rb +337 -0
- data/lib/gedcom/gedcom_record.rb +44 -0
- data/lib/gedcom/header_data_record.rb +49 -0
- data/lib/gedcom/header_record.rb +75 -0
- data/lib/gedcom/header_source_record.rb +42 -0
- data/lib/gedcom/individual_attribute_record.rb +86 -0
- data/lib/gedcom/individual_record.rb +128 -0
- data/lib/gedcom/multimedia_citation_record.rb +55 -0
- data/lib/gedcom/multimedia_record.rb +72 -0
- data/lib/gedcom/name_record.rb +58 -0
- data/lib/gedcom/note_citation_record.rb +37 -0
- data/lib/gedcom/note_record.rb +61 -0
- data/lib/gedcom/place_record.rb +46 -0
- data/lib/gedcom/refn_record.rb +32 -0
- data/lib/gedcom/repository_caln.rb +33 -0
- data/lib/gedcom/repository_citation_record.rb +43 -0
- data/lib/gedcom/repository_record.rb +41 -0
- data/lib/gedcom/source_citation_record.rb +74 -0
- data/lib/gedcom/source_record.rb +84 -0
- data/lib/gedcom/source_scope_record.rb +35 -0
- data/lib/gedcom/submission_record.rb +53 -0
- data/lib/gedcom/submitter_record.rb +53 -0
- data/lib/gedcom/text_record.rb +31 -0
- data/lib/gedcom/trailer_record.rb +22 -0
- data/lib/gedcom/transmission.rb +103 -0
- data/lib/gedcom/transmission_base.rb +267 -0
- data/lib/parser/class_tracker.rb +33 -0
- data/lib/parser/ged_line.rb +99 -0
- data/lib/parser/gedcom_parser.rb +798 -0
- data/lib/parser/instruction.rb +14 -0
- data/lib/parser/parse_state.rb +49 -0
- data/test/test_gedcom.rb +7 -0
- data/test_data/Document.RTF +1 -0
- data/test_data/Document.tex +1 -0
- data/test_data/ImgFile.BMP +0 -0
- data/test_data/ImgFile.GIF +0 -0
- data/test_data/ImgFile.JPG +0 -0
- data/test_data/ImgFile.MAC +0 -0
- data/test_data/ImgFile.PCX +0 -0
- data/test_data/ImgFile.PIC +0 -0
- data/test_data/ImgFile.PNG +0 -0
- data/test_data/ImgFile.PSD +0 -0
- data/test_data/ImgFile.TGA +0 -0
- data/test_data/ImgFile.TIF +0 -0
- data/test_data/README.txt +1 -16
- data/test_data/TGC551.ged +1 -0
- data/test_data/TGC551LF.ged +2162 -0
- data/test_data/TGC55C.ged +1 -0
- data/test_data/TGC55CLF.ged +2202 -0
- data/test_data/force.wav +0 -0
- data/test_data/suntun.mov +0 -0
- data/test_data/top.mpg +0 -0
- metadata +140 -0
data/History.txt
ADDED
data/Manifest.txt
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
History.txt
|
2
|
+
Manifest.txt
|
3
|
+
README.txt
|
4
|
+
Rakefile
|
5
|
+
lib/gedcom/address_record.rb
|
6
|
+
lib/gedcom/adoption_record.rb
|
7
|
+
lib/gedcom/cause_record.rb
|
8
|
+
lib/gedcom/change_date_record.rb
|
9
|
+
lib/gedcom/character_set_record.rb
|
10
|
+
lib/gedcom/citation_data_record.rb
|
11
|
+
lib/gedcom/citation_event_type_record.rb
|
12
|
+
lib/gedcom/corporate_record.rb
|
13
|
+
lib/gedcom/date_record.rb
|
14
|
+
lib/gedcom/encoded_line_record.rb
|
15
|
+
lib/gedcom/event_age_record.rb
|
16
|
+
lib/gedcom/event_record.rb
|
17
|
+
lib/gedcom/events_list_record.rb
|
18
|
+
lib/gedcom/families_individuals.rb
|
19
|
+
lib/gedcom/family_record.rb
|
20
|
+
lib/gedcom/gedcom_all.rb
|
21
|
+
lib/gedcom/gedcom_base.rb
|
22
|
+
lib/gedcom/gedcom_record.rb
|
23
|
+
lib/gedcom/header_data_record.rb
|
24
|
+
lib/gedcom/header_record.rb
|
25
|
+
lib/gedcom/header_source_record.rb
|
26
|
+
lib/gedcom/individual_attribute_record.rb
|
27
|
+
lib/gedcom/individual_record.rb
|
28
|
+
lib/gedcom/association_record.rb
|
29
|
+
lib/gedcom/multimedia_citation_record.rb
|
30
|
+
lib/gedcom/multimedia_record.rb
|
31
|
+
lib/gedcom/name_record.rb
|
32
|
+
lib/gedcom/note_citation_record.rb
|
33
|
+
lib/gedcom/note_record.rb
|
34
|
+
lib/gedcom/place_record.rb
|
35
|
+
lib/gedcom/refn_record.rb
|
36
|
+
lib/gedcom/repository_caln.rb
|
37
|
+
lib/gedcom/repository_citation_record.rb
|
38
|
+
lib/gedcom/repository_record.rb
|
39
|
+
lib/gedcom/source_citation_record.rb
|
40
|
+
lib/gedcom/source_record.rb
|
41
|
+
lib/gedcom/source_scope_record.rb
|
42
|
+
lib/gedcom/submission_record.rb
|
43
|
+
lib/gedcom/submitter_record.rb
|
44
|
+
lib/gedcom/text_record.rb
|
45
|
+
lib/gedcom/trailer_record.rb
|
46
|
+
lib/gedcom/transmission.rb
|
47
|
+
lib/gedcom/transmission_base.rb
|
48
|
+
lib/gedcom.rb
|
49
|
+
lib/parser/class_tracker.rb
|
50
|
+
lib/parser/ged_line.rb
|
51
|
+
lib/parser/gedcom_parser.rb
|
52
|
+
lib/parser/instruction.rb
|
53
|
+
lib/parser/parse_state.rb
|
54
|
+
test/test_gedcom.rb
|
55
|
+
test_data/Document.RTF
|
56
|
+
test_data/Document.tex
|
57
|
+
test_data/ImgFile.BMP
|
58
|
+
test_data/ImgFile.GIF
|
59
|
+
test_data/ImgFile.JPG
|
60
|
+
test_data/ImgFile.MAC
|
61
|
+
test_data/ImgFile.PCX
|
62
|
+
test_data/ImgFile.PIC
|
63
|
+
test_data/ImgFile.PNG
|
64
|
+
test_data/ImgFile.PSD
|
65
|
+
test_data/ImgFile.TGA
|
66
|
+
test_data/ImgFile.TIF
|
67
|
+
test_data/README.txt
|
68
|
+
test_data/TGC551.ged
|
69
|
+
test_data/TGC551LF.ged
|
70
|
+
test_data/TGC55C.ged
|
71
|
+
test_data/TGC55CLF.ged
|
72
|
+
test_data/force.wav
|
73
|
+
test_data/suntun.mov
|
74
|
+
test_data/top.mpg
|
data/README.txt
ADDED
@@ -0,0 +1,129 @@
|
|
1
|
+
= gedcom
|
2
|
+
|
3
|
+
* http://rubyforge.org/projects/gedcom/
|
4
|
+
|
5
|
+
== DESCRIPTION:
|
6
|
+
|
7
|
+
A Ruby GEDCOM text file parser and producer, that produces a tree of objects from each of the
|
8
|
+
GEDCOM file types and subtypes. Understands the full GEDCOM 5.5.1 grammar, and will handle
|
9
|
+
unknown tags hierarchies as a Note class.
|
10
|
+
|
11
|
+
|
12
|
+
== FEATURES/PROBLEMS:
|
13
|
+
|
14
|
+
* Gedcom multicharacter ANSEL encoding is currently not understood when reading and writing, but is preserved if the file is opened as ASCII-8BIT.
|
15
|
+
* CR line termination causes issues for systems with native LF line termination (CRLF is fine).
|
16
|
+
* Dates are currently just strings, but I want to parse these and test their validatity.
|
17
|
+
This is not as easy as it may seem at first, as dates may be in many formats,
|
18
|
+
they may be partial, or may actually be strings decribing the date.
|
19
|
+
* For my own use, I bend the GEDCOM 5.5 standard by allowing the reading of the following types in non-standard ways.
|
20
|
+
These will not affect the reading and writing of valid GEDCOM 5.5.
|
21
|
+
* * 'NOTE' type to appear in places it is not defined to exist in GEDCOM.
|
22
|
+
This is necessary in order to be able to convert user defined tags into NOTE records.
|
23
|
+
* * 'RESN' type to appear in places it is not defined to exist in GEDCOM.
|
24
|
+
I wanted to be able to mark any record as restricted.
|
25
|
+
* * 'SUBM' type to appear in 'EVEN' records.
|
26
|
+
I wanted to be able to track where I got the event information from.
|
27
|
+
* * 'SEX' type to appear multiple times in an 'INDI' record,
|
28
|
+
as a person's sex can now be changed.
|
29
|
+
* * 'SEX' type to allow more than 'M', 'F' and 'U',
|
30
|
+
to allow for the XXY, XXXY and X and other genetic anomolies associated with gender.
|
31
|
+
* * 'NAME' type allows event details ( eg 'DATE') ,
|
32
|
+
as names changes are events, not just an attribute.
|
33
|
+
* * 'ADDR' type allows a 'TYPE' entry
|
34
|
+
to qualify what the address is for (e.g. home, work, ...) .
|
35
|
+
* User defined tags are converted to the NOTE type, with sublevels being CONT lines.
|
36
|
+
These are recognised as any tag starting with '_'.
|
37
|
+
* Haven't yet merged in the code to pretty print a family tree.
|
38
|
+
* Want to add a merge option, to take multiple transmission and make a single one from them.
|
39
|
+
* save/load (to/from a database) is yet to be ported. GedcomBase#to_db is a dummy function.
|
40
|
+
|
41
|
+
== SYNOPSIS:
|
42
|
+
|
43
|
+
require 'gedcom'
|
44
|
+
|
45
|
+
puts "parse TGC551LF.ged"
|
46
|
+
g = Gedcom.file("../test_data/TGC551LF.ged", "r:ASCII-8BIT") #OK with LF line endings.
|
47
|
+
g.transmissions[0].summary
|
48
|
+
puts
|
49
|
+
puts "parse TGC55CLF.ged"
|
50
|
+
g.file("../test_data/TGC55CLF.ged", "r:ASCII-8BIT") #Ok with CR LF line endings.
|
51
|
+
g.transmissions[1].summary
|
52
|
+
|
53
|
+
|
54
|
+
#print the parsed file to see if it matches the source file.
|
55
|
+
#Note CONT and CONC breaks may end up in different places
|
56
|
+
#Note Order of TAGS at the same level may be different
|
57
|
+
#Note User TAGS are output as Notes.
|
58
|
+
File.open( "../test_data/TGC551LF.out", "w:ASCII-8BIT") do |file|
|
59
|
+
file.print g.transmissions[0].to_gedcom
|
60
|
+
end
|
61
|
+
File.open( "../test_data/TGC55CLF.out", "w:ASCII-8BIT") do |file|
|
62
|
+
file.print g.transmissions[1].to_gedcom
|
63
|
+
end
|
64
|
+
puts "\nComplete"
|
65
|
+
|
66
|
+
|
67
|
+
== REQUIREMENTS:
|
68
|
+
|
69
|
+
* require 'rubygems'
|
70
|
+
|
71
|
+
== INSTALL:
|
72
|
+
|
73
|
+
* sudo gem install gedcom
|
74
|
+
|
75
|
+
== LICENSE:
|
76
|
+
|
77
|
+
Distributed under the Ruby License.
|
78
|
+
|
79
|
+
Copyright (c) 2009
|
80
|
+
|
81
|
+
1. You may make and give away verbatim copies of the source form of the
|
82
|
+
software without restriction, provided that you duplicate all of the
|
83
|
+
original copyright notices and associated disclaimers.
|
84
|
+
|
85
|
+
2. You may modify your copy of the software in any way, provided that
|
86
|
+
you do at least ONE of the following:
|
87
|
+
|
88
|
+
a) place your modifications in the Public Domain or otherwise
|
89
|
+
make them Freely Available, such as by posting said
|
90
|
+
modifications to Usenet or an equivalent medium, or by allowing
|
91
|
+
the author to include your modifications in the software.
|
92
|
+
|
93
|
+
b) use the modified software only within your corporation or
|
94
|
+
organization.
|
95
|
+
|
96
|
+
c) rename any non-standard executables so the names do not conflict
|
97
|
+
with standard executables, which must also be provided.
|
98
|
+
|
99
|
+
d) make other distribution arrangements with the author.
|
100
|
+
|
101
|
+
3. You may distribute the software in object code or executable
|
102
|
+
form, provided that you do at least ONE of the following:
|
103
|
+
|
104
|
+
a) distribute the executables and library files of the software,
|
105
|
+
together with instructions (in the manual page or equivalent)
|
106
|
+
on where to get the original distribution.
|
107
|
+
|
108
|
+
b) accompany the distribution with the machine-readable source of
|
109
|
+
the software.
|
110
|
+
|
111
|
+
c) give non-standard executables non-standard names, with
|
112
|
+
instructions on where to get the original software distribution.
|
113
|
+
|
114
|
+
d) make other distribution arrangements with the author.
|
115
|
+
|
116
|
+
4. You may modify and include the part of the software into any other
|
117
|
+
software (possibly commercial). But some files in the distribution
|
118
|
+
may not written by the author, so that they are not under this terms.
|
119
|
+
|
120
|
+
5. The scripts and library files supplied as input to or produced as
|
121
|
+
output from the software do not automatically fall under the
|
122
|
+
copyright of the software, but belong to whomever generated them,
|
123
|
+
and may be sold commercially, and may be aggregated with this
|
124
|
+
software.
|
125
|
+
|
126
|
+
6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
127
|
+
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
128
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
129
|
+
PURPOSE.
|
data/Rakefile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'hoe'
|
5
|
+
require 'lib/gedcom.rb'
|
6
|
+
|
7
|
+
Hoe.new('gedcom', Gedcom::VERSION) do |p|
|
8
|
+
p.rubyforge_name = "gedcom"
|
9
|
+
p.developer( "Rob Burrowes","rob@burrowes.org")
|
10
|
+
p.remote_rdoc_dir = '' # Release to root
|
11
|
+
end
|
12
|
+
|
13
|
+
# vim: syntax=Ruby
|
data/lib/gedcom.rb
ADDED
@@ -0,0 +1,105 @@
|
|
1
|
+
#Gedcom class holds an array of GEDCOM transmissions (that is parsed GEDCOM files)
|
2
|
+
#Each transmission relates to the loading of a GEDCOM text file, parsing it into
|
3
|
+
#a tree, starting with a Transmission class at its root. Within the Transmission
|
4
|
+
#class are arrays for each of the level 0 GEDCOM record types of these classes:
|
5
|
+
# * Header_record
|
6
|
+
# * Submission_record
|
7
|
+
# * Submitter_record
|
8
|
+
# * Individual_record
|
9
|
+
# * Family_record
|
10
|
+
# * Source_record
|
11
|
+
# * Repository_record
|
12
|
+
# * Multimedia_record
|
13
|
+
# * Note_record
|
14
|
+
# * Trailer_record
|
15
|
+
#
|
16
|
+
#Each of these classes has arrays for each of the Level 1 Gedcom records types
|
17
|
+
#associated with the Level 0 type. Some of these are attributes, that is they contain
|
18
|
+
#the actual data, while others are classes that contain attributes and/or classes
|
19
|
+
#e.g. an Individual_record class object could have any or all of these:
|
20
|
+
#
|
21
|
+
# * individual_ref ( that is individual_ref = 'I42' if the GEDCOM line is '0 INDI @I42@')
|
22
|
+
# Then 1 level down it is possible to get local attributes for this object
|
23
|
+
# * restriction (from the GEDCOM "1 RESN restriction_value" )
|
24
|
+
# * registered_ref_id (from the GEDCOM "1 RFN registered_ref_id" )
|
25
|
+
# * lds_ancestral_file_no (from the GEDCOM "1 AFN lds_ancestral_file_no" )
|
26
|
+
# * automated_record_id (from the GEDCOM "1 RIN automated_record_id" )
|
27
|
+
# Also arrays of classes may exist for these:
|
28
|
+
# * Name_record (from the GEDCOM "1 NAME ..." )
|
29
|
+
# * Individual_attribute_record (from the GEDCOM "1 [SEX | TITL | ... ] ...")
|
30
|
+
# * Event_record (from the GEDCOM "1 [BIRT | DEAT | ... ] ... ")
|
31
|
+
# * Families_individuals (from the GEDCOM "1 [FAMC | FAMS] ...")
|
32
|
+
# * Individuals_individuals (from the GEDCOM "1 [ANCI | DESO | ASSO] ...")
|
33
|
+
# * Multimedia_citation_record (from the GEDCOM "1 OBJE ...")
|
34
|
+
# * Source_citation_record (from the GEDCOM "1 SOUR ...")
|
35
|
+
# * Note_citation_record (from the GEDCOM "1 NOTE ...")
|
36
|
+
# * Refn_record (from the GEDCOM "1 REFN ...")
|
37
|
+
# * Change_date_record (from the GEDCOM "1 CHAN ...")
|
38
|
+
# And References to other record types:
|
39
|
+
# * alias_ref (from the GEDCOM "1 ALIA alias_ref" )
|
40
|
+
# * submitter_ref (from the GEDCOM "1 SUBM submitter_ref" )
|
41
|
+
#
|
42
|
+
# Below say an Event object in an Individual_record object, you could get further arrays of
|
43
|
+
# attributes and other objects holding further levels of the GEDCOM hierarchy.
|
44
|
+
#
|
45
|
+
#These can all be seen in the TAGS hash in parser/gedcom_parser.rb, which defines
|
46
|
+
#what TAGS are valid when, and what action to take when a particular tag is encountered
|
47
|
+
#in the input stream.
|
48
|
+
#
|
49
|
+
#The reverse, that is the conversion back to GEDCOM format is not a simple reversal of the
|
50
|
+
#TAGS entries. The generation of GEDCOM from the objects is done recursively, by calling the
|
51
|
+
#objects to_gedcom() method. This can occur at any level, from Transmission downward.
|
52
|
+
#
|
53
|
+
|
54
|
+
def path(s,fs='/')
|
55
|
+
last_fs = s.rindex(fs)
|
56
|
+
last_fs ? s[0..last_fs] : ""
|
57
|
+
end
|
58
|
+
|
59
|
+
$: << "#{path(__FILE__)}gedcom"
|
60
|
+
$: << "#{path(__FILE__)}parser"
|
61
|
+
|
62
|
+
require 'gedcom_parser.rb'
|
63
|
+
|
64
|
+
class Gedcom
|
65
|
+
VERSION = '0.9.0'
|
66
|
+
attr_accessor :transmissions
|
67
|
+
|
68
|
+
def initialize(transmission = nil)
|
69
|
+
@transmissions = []
|
70
|
+
add_transmission(transmission) if transmission != nil
|
71
|
+
end
|
72
|
+
|
73
|
+
def self.file(*a)
|
74
|
+
g = Gedcom.new
|
75
|
+
g.file(*a)
|
76
|
+
return g
|
77
|
+
end
|
78
|
+
|
79
|
+
def file(*a)
|
80
|
+
transmission = Transmission.new
|
81
|
+
gedcom_parser = GedcomParser.new(transmission)
|
82
|
+
|
83
|
+
File.open(*a) do |file|
|
84
|
+
file.each_line("\n") do |line|
|
85
|
+
begin
|
86
|
+
gedcom_parser.parse( file.lineno, line )
|
87
|
+
rescue => exception
|
88
|
+
puts "#{file.lineno}: #{exception} - " + line
|
89
|
+
# raise exception
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
@transmissions << transmission
|
95
|
+
|
96
|
+
end
|
97
|
+
|
98
|
+
def add_transmission(transmission)
|
99
|
+
@transmissions << transmission
|
100
|
+
end
|
101
|
+
|
102
|
+
def each
|
103
|
+
@transmissions.each { |t| yield t }
|
104
|
+
end
|
105
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
require 'gedcom_base.rb'
|
2
|
+
|
3
|
+
#Address_record a sub-record of HEAD, REPO, SUBM and all types of Event records.
|
4
|
+
#
|
5
|
+
#ADDRESS_STRUCTURE:=
|
6
|
+
# n ADDR <ADDRESS_LINE> {0:1}
|
7
|
+
# +1 CONT <ADDRESS_LINE> {0:M}
|
8
|
+
# +1 ADR1 <ADDRESS_LINE1> {0:1}
|
9
|
+
# +1 ADR2 <ADDRESS_LINE2> {0:1}
|
10
|
+
# +1 CITY <ADDRESS_CITY> {0:1}
|
11
|
+
# +1 STAE <ADDRESS_STATE> {0:1}
|
12
|
+
# +1 POST <ADDRESS_POSTAL_CODE> {0:1}
|
13
|
+
# +1 CTRY <ADDRESS_COUNTRY> {0:1}
|
14
|
+
#
|
15
|
+
# I have not included the Phone number from Address_record, and include it in the parent
|
16
|
+
# records that include ADDRESS_STRUCTURE. This is functionally equivalent, as PHON is not
|
17
|
+
# a sub-record of ADDR, but at the same level.
|
18
|
+
#
|
19
|
+
# n PHON <PHONE_NUMBER> {0:3}
|
20
|
+
#
|
21
|
+
#==ADDRESS_CITY:= {Size=1:60}
|
22
|
+
# The name of the city used in the address. Isolated for sorting or indexing.
|
23
|
+
#
|
24
|
+
#==ADDRESS_COUNTRY:= {Size=1:60}
|
25
|
+
# The name of the country that pertains to the associated address. Isolated by some systems for sorting
|
26
|
+
# or indexing. Used in most cases to facilitate automatic sorting of mail.
|
27
|
+
#
|
28
|
+
#==ADDRESS_LINE:= {Size=1:60}
|
29
|
+
# Address information that, when combined with NAME and CONTinuation lines, meets requirements
|
30
|
+
# for sending communications through the mail.
|
31
|
+
#
|
32
|
+
#==ADDRESS_LINE1:= {Size=1:60}
|
33
|
+
# The first line of the address used for indexing. This corresponds to the ADDRESS_LINE value of the
|
34
|
+
# ADDR line in the address structure.
|
35
|
+
#
|
36
|
+
#==ADDRESS_LINE2:= {Size=1:60}
|
37
|
+
# The second line of the address used for indexing. This corresponds to the ADDRESS_LINE value of
|
38
|
+
# the first CONT line subordinate to the ADDR tag in the address structure.
|
39
|
+
#
|
40
|
+
#==ADDRESS_POSTAL_CODE:= {Size=1:10}
|
41
|
+
# The ZIP or postal code used by the various localities in handling of mail. Isolated for sorting or
|
42
|
+
# indexing.
|
43
|
+
#
|
44
|
+
#==ADDRESS_STATE:= {Size=1:60}
|
45
|
+
# The name of the state used in the address. Isolated for sorting or indexing.
|
46
|
+
#
|
47
|
+
# The address structure should be formed as it would appear on a mailing label using the ADDR and
|
48
|
+
# ADDR.CONT lines. These lines are required if an ADDRess is present. Optionally, additional
|
49
|
+
# structure is provided for systems that have structured their addresses for indexing and sorting.
|
50
|
+
#
|
51
|
+
#The attributes are all arrays for the level +1 tags/records.
|
52
|
+
#* Those ending in _ref are GEDCOM XREF index keys
|
53
|
+
#* Those ending in _record are array of classes of that type.
|
54
|
+
#* The remainder are arrays of attributes that could be present in this record.
|
55
|
+
class Address_record < GEDCOMBase
|
56
|
+
attr_accessor :address, :address_line1, :address_line2, :city, :state, :post_code, :country, :address_type
|
57
|
+
attr_accessor :note_citation_record
|
58
|
+
|
59
|
+
ClassTracker << :Address_record
|
60
|
+
|
61
|
+
#new sets up the state engine arrays @this_level and @sub_level, which drive the to_gedcom method generating GEDCOM output.
|
62
|
+
def initialize(*a)
|
63
|
+
super(*a)
|
64
|
+
@this_level = [ [:cont, "ADDR", :address] ]
|
65
|
+
@sub_level = [ #level + 1
|
66
|
+
[:print, "ADR1", :address_line1],
|
67
|
+
[:print, "ADR2", :address_line2],
|
68
|
+
[:print, "CITY", :city],
|
69
|
+
[:print, "STAE", :state],
|
70
|
+
[:print, "POST", :post_code],
|
71
|
+
[:print, "CTRY", :country],
|
72
|
+
[:print, "TYPE", :address_type], #non standard.
|
73
|
+
[:walk, nil, :note_citation_record],
|
74
|
+
]
|
75
|
+
end
|
76
|
+
|
77
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require 'gedcom_base.rb'
|
2
|
+
|
3
|
+
#Adoption_record is a rarely seen sub-record of FAMC in Individual Event_record.
|
4
|
+
#These can occur is Event_record BIRT and ADOP event types.
|
5
|
+
#
|
6
|
+
#=INDIVIDUAL_EVENT_STRUCTURE:=
|
7
|
+
# ...
|
8
|
+
# -1 ADOP [Y|<NULL>] {1:1} (Not this ADOP record. This is the event.)
|
9
|
+
# ...
|
10
|
+
# n FAMC @<XREF:FAM>@ {0:1} (This FAMC and its ADOP record.)
|
11
|
+
# +1 ADOP <ADOPTED_BY_WHICH_PARENT> {0:1}
|
12
|
+
# ...
|
13
|
+
# n BIRT [Y|<NULL>] {1:1}
|
14
|
+
# ...
|
15
|
+
# +1 FAMC @<XREF:FAM>@ {0:1} (And this FAMC in the BIRT Event.)
|
16
|
+
# ...
|
17
|
+
#
|
18
|
+
#==ADOPTED_BY_WHICH_PARENT:= {Size=1:4}
|
19
|
+
# HUSB | WIFE | BOTH
|
20
|
+
#
|
21
|
+
# A code which shows which parent in the associated family record adopted this person.
|
22
|
+
# Where:
|
23
|
+
# HUSB:: The HUSBand in the associated family adopted this person.
|
24
|
+
# WIFE:: The WIFE in the associated family adopted this person.
|
25
|
+
# BOTH:: Both HUSBand and WIFE adopted this person.
|
26
|
+
#
|
27
|
+
# Linkage between a child and the family they belonged to at the time of an event can also optionally
|
28
|
+
# be shown by a FAMC pointer subordinate to the appropriate event. For example, a FAMC pointer
|
29
|
+
# subordinate to an adoption event would show which family adopted this individual. Biological parent
|
30
|
+
# or parents can be indicated by a FAMC pointer subordinate to the birth event. The FAMC tag can
|
31
|
+
# also optionally be used subordinate to an ADOPtion, or BIRTh event to differentiate which set of
|
32
|
+
# parents were related by adoption, sealing, or birth.
|
33
|
+
#
|
34
|
+
#The attributes are all arrays for the level +1 tags/records.
|
35
|
+
#* Those ending in _ref are GEDCOM XREF index keys
|
36
|
+
#* Those ending in _record are array of classes of that type.
|
37
|
+
#* The remainder are arrays of attributes that could be present in this record.
|
38
|
+
class Adoption_record < GEDCOMBase
|
39
|
+
attr_accessor :birth_family_ref, :adopt_family_ref, :adopted_by
|
40
|
+
attr_accessor :note_citation_record
|
41
|
+
|
42
|
+
ClassTracker << :Adoption_record
|
43
|
+
|
44
|
+
#new sets up the state engine arrays @this_level and @sub_level, which drive the to_gedcom method generating GEDCOM output.
|
45
|
+
def initialize(*a)
|
46
|
+
super(*a)
|
47
|
+
@this_level = [ [:xref, "FAMC", :birth_family_ref ], #Only adopted family version of birth event record
|
48
|
+
[:xref, "FAMC", :adopt_family_ref] #Adopted family version of ADOP event record
|
49
|
+
]
|
50
|
+
@sub_level = [ #level 1
|
51
|
+
[:print, "ADOP", :adopted_by], #Only adopted family version of ADOP event record
|
52
|
+
[:walk, nil, :note_citation_record ]
|
53
|
+
]
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
|