gedcom 0.9.2 → 0.9.3
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +2 -0
- data/Manifest.txt +8 -0
- data/lib/gedcom.rb +1 -1
- data/lib/gedcom/address_record.rb +20 -0
- data/lib/gedcom/copyright_record.rb +45 -0
- data/lib/gedcom/corporate_record.rb +23 -0
- data/lib/gedcom/date_record.rb +3 -7
- data/lib/gedcom/event_record.rb +25 -1
- data/lib/gedcom/families_individuals.rb +2 -0
- data/lib/gedcom/gedcom_all.rb +13 -3
- data/lib/gedcom/gedcom_base.rb +4 -0
- data/lib/gedcom/header_data_record.rb +8 -2
- data/lib/gedcom/header_record.rb +2 -1
- data/lib/gedcom/individual_attribute_record.rb +1 -0
- data/lib/gedcom/multimedia_citation_record.rb +7 -2
- data/lib/gedcom/multimedia_file_record.rb +80 -0
- data/lib/gedcom/multimedia_format_record.rb +82 -0
- data/lib/gedcom/multimedia_record.rb +61 -13
- data/lib/gedcom/name_phonetic_record.rb +70 -0
- data/lib/gedcom/name_record.rb +38 -2
- data/lib/gedcom/name_romanized_record.rb +72 -0
- data/lib/gedcom/place_record.rb +9 -1
- data/lib/gedcom/placename_map_record.rb +39 -0
- data/lib/gedcom/placename_phonetic_record.rb +30 -0
- data/lib/gedcom/placename_romanized_record.rb +30 -0
- data/lib/gedcom/repository_record.rb +23 -0
- data/lib/gedcom/submission_record.rb +1 -0
- data/lib/gedcom/submitter_record.rb +23 -0
- data/lib/parser/gedcom_parser.rb +199 -28
- data/test/lds_gedcom_test.rb +7 -8
- data/test/ruby_version.rb +3 -0
- data/test/test_gedcom.rb +1 -0
- data/test_data/TGC551LF.ged +15 -0
- metadata +10 -2
@@ -0,0 +1,82 @@
|
|
1
|
+
require 'gedcom_base.rb'
|
2
|
+
|
3
|
+
#
|
4
|
+
#=GEDCOM 5.5.1
|
5
|
+
#=MULTIMEDIA_LINK:=
|
6
|
+
# n OBJE <XREF> {1:1} is a reference to level 0 multimedia record.
|
7
|
+
# |
|
8
|
+
# n OBJE {1:1} is inline reference to an external file, rather than multimedia record.
|
9
|
+
# +1 FILE <MULTIMEDIA_FILE_REFN> {1:M} Now 1:M in 5.5.1, was 1:1 in 5.5
|
10
|
+
# +2 FORM <MULTIMEDIA_FORMAT> {1:1} Was as level 1 in GEDCOM 5.5
|
11
|
+
# +3 MEDI <SOURCE_MEDIA_TYPE> {0:1} New in 5.5.1
|
12
|
+
# +1 TITL <DESCRIPTIVE_TITLE> {0:1}
|
13
|
+
#
|
14
|
+
# No blobs in 5.5.1
|
15
|
+
#
|
16
|
+
#
|
17
|
+
#The attributes are all arrays for the level +1 tags/records.
|
18
|
+
#* Those ending in _ref are GEDCOM XREF index keys
|
19
|
+
#* Those ending in _record are array of classes of that type.
|
20
|
+
#* The remainder are arrays of attributes that could be present in this record.
|
21
|
+
|
22
|
+
class Multimedia_format_record < GEDCOMBase
|
23
|
+
attr_accessor :media_type, :format
|
24
|
+
attr_accessor :note_citation_record #for user defined tags
|
25
|
+
|
26
|
+
ClassTracker << :Multimedia_format_record
|
27
|
+
|
28
|
+
def to_gedcom(level=0)
|
29
|
+
|
30
|
+
@this_level = [ [:print, "FORM", :format]]
|
31
|
+
@sub_level = [#level 1
|
32
|
+
[:print, "MEDI", :media_type ],
|
33
|
+
[:walk, nil, :note_citation_record ], #for user defined tags
|
34
|
+
]
|
35
|
+
|
36
|
+
super(level)
|
37
|
+
end
|
38
|
+
|
39
|
+
def type
|
40
|
+
:media_type
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
|
45
|
+
#Almost the same structure inline in OBJE record.
|
46
|
+
# Note TITL subordinate to FILE, rather than at same level.
|
47
|
+
# TYPE used, where MEDI used in Link version.
|
48
|
+
#=MULTIMEDIA_RECORD:=
|
49
|
+
# 0 @XREF:OBJE@ OBJE {0:M}
|
50
|
+
# +1 FILE <MULTIMEDIA_FILE_REFN> {1:M} New in 5.5.1
|
51
|
+
# +2 FORM <MULTIMEDIA_FORMAT> {1:1} Was as level 1 in GEDCOM 5.5
|
52
|
+
# +3 TYPE <SOURCE_MEDIA_TYPE> {0:1} New in 5.5.1
|
53
|
+
# +2 TITL <DESCRIPTIVE_TITLE> {0:1} Was as level 1 in GEDCOM 5.5
|
54
|
+
# ....
|
55
|
+
#The attributes are all arrays for the level +1 tags/records.
|
56
|
+
#* Those ending in _ref are GEDCOM XREF index keys
|
57
|
+
#* Those ending in _record are array of classes of that type.
|
58
|
+
#* The remainder are arrays of attributes that could be present in this record.
|
59
|
+
|
60
|
+
class Multimedia_obje_format_record < GEDCOMBase
|
61
|
+
attr_accessor :media_type, :format
|
62
|
+
attr_accessor :note_citation_record #for user defined tags
|
63
|
+
|
64
|
+
ClassTracker << :Multimedia_obje_format_record
|
65
|
+
|
66
|
+
def to_gedcom(level=0)
|
67
|
+
|
68
|
+
@this_level = [ [:print, "FORM", :format]]
|
69
|
+
@sub_level = [#level 1
|
70
|
+
[:print, "TYPE", :media_type ],
|
71
|
+
[:walk, nil, :note_citation_record ], #for user defined tags
|
72
|
+
]
|
73
|
+
|
74
|
+
super(level)
|
75
|
+
end
|
76
|
+
|
77
|
+
def type
|
78
|
+
:media_type
|
79
|
+
end
|
80
|
+
|
81
|
+
end
|
82
|
+
|
@@ -3,7 +3,7 @@ require 'gedcom_base.rb'
|
|
3
3
|
#Internal representation of the GEDCOM OBJE record type
|
4
4
|
#GEDCOM has both inline OBJE records and references to level 0 OBJE records.
|
5
5
|
#both are stored here and referenced through a Multimedia_citation_record class.
|
6
|
-
|
6
|
+
#=GEDCOM 5.5
|
7
7
|
#=MULTIMEDIA_RECORD:=
|
8
8
|
# 0 @XREF:OBJE@ OBJE {0:M}
|
9
9
|
# +1 FORM <MULTIMEDIA_FORMAT> {1:1}
|
@@ -22,7 +22,10 @@ require 'gedcom_base.rb'
|
|
22
22
|
# subordinate OBJE tag to chain to the next <MULTIMEDIA_RECORD> fragment. This will allow
|
23
23
|
# GEDCOM records to be maintained below the 32K limit for use in systems with limited resources.
|
24
24
|
#
|
25
|
-
|
25
|
+
#=MULTIMEDIA_LINK:=
|
26
|
+
# n OBJE <XREF> {1:1} is a reference to level 0 multimedia record.
|
27
|
+
# |
|
28
|
+
# n OBJE {1:1} is a reference to an external file, rather than inline blob.
|
26
29
|
# +1 FORM <MULTIMEDIA_FORMAT> {1:1}
|
27
30
|
# +1 TITL <DESCRIPTIVE_TITLE> {0:1}
|
28
31
|
# +1 FILE <MULTIMEDIA_FILE_REFERENCE> {1:1}
|
@@ -37,14 +40,40 @@ require 'gedcom_base.rb'
|
|
37
40
|
# the GEDCOM file in context, but the maintenance and transfer of the multimedia files are external to
|
38
41
|
# GEDCOM. The parser can just treat this as a comment and doesn't check for the file being present.
|
39
42
|
#
|
43
|
+
#=GEDCOM 5.5.1
|
44
|
+
#=MULTIMEDIA_RECORD:=
|
45
|
+
# 0 @XREF:OBJE@ OBJE {0:M}
|
46
|
+
# +1 FILE <MULTIMEDIA_FILE_REFN> {1:M} New in 5.5.1
|
47
|
+
# +2 FORM <MULTIMEDIA_FORMAT> {1:1} Was as level 1 in GEDCOM 5.5
|
48
|
+
# +3 TYPE <SOURCE_MEDIA_TYPE> {0:1} New in 5.5.1
|
49
|
+
# +2 TITL <DESCRIPTIVE_TITLE> {0:1} Was as level 1 in GEDCOM 5.5
|
50
|
+
# +1 <<NOTE_STRUCTURE>> {0:M}
|
51
|
+
# +1 <<SOURCE_CITATION>> {0:M} New in 5.5.1
|
52
|
+
# +1 REFN <USER_REFERENCE_NUMBER> {0:M}
|
53
|
+
# +2 TYPE <USER_REFERENCE_TYPE> {0:1}
|
54
|
+
# +1 RIN <AUTOMATED_RECORD_ID> {0:1}
|
55
|
+
# +1 <<CHANGE_DATE>> {0:1}
|
56
|
+
#
|
57
|
+
#=MULTIMEDIA_LINK:=
|
58
|
+
# n OBJE <XREF> {1:1} is a reference to level 0 multimedia record.
|
59
|
+
# |
|
60
|
+
# n OBJE {1:1} is inline reference to an external file, rather than multimedia record.
|
61
|
+
# +1 FILE <MULTIMEDIA_FILE_REFN> {1:M} Now 1:M in 5.5.1, was 1:1 in 5.5
|
62
|
+
# +2 FORM <MULTIMEDIA_FORMAT> {1:1} Was as level 1 in GEDCOM 5.5
|
63
|
+
# +3 TYPE <SOURCE_MEDIA_TYPE> {0:1} New in 5.5.1
|
64
|
+
# +1 TITL <DESCRIPTIVE_TITLE> {0:1}
|
65
|
+
#
|
40
66
|
#The attributes are all arrays for the level +1 tags/records.
|
41
67
|
#* Those ending in _ref are GEDCOM XREF index keys
|
42
68
|
#* Those ending in _record are array of classes of that type.
|
43
69
|
#* The remainder are arrays of attributes that could be present in this record.
|
44
70
|
class Multimedia_record < GEDCOMBase
|
45
|
-
attr_accessor :multimedia_ref, :
|
71
|
+
attr_accessor :multimedia_ref, :title, :encoded_line_record, :next_multimedia_ref
|
46
72
|
attr_accessor :refn_record, :automated_record_id, :note_citation_record, :change_date_record
|
47
|
-
|
73
|
+
attr_accessor :multimedia_obje_file_record #GEDCOM 5.5.1, though some 5.5 variants need this too.
|
74
|
+
attr_accessor :multimedia_file_record, :multimedia_format_record #GEDCOM 5.5.1, though some 5.5 variants need this too.
|
75
|
+
attr_accessor :source_citation_record #Gedcom 5.5.1
|
76
|
+
|
48
77
|
ClassTracker << :Multimedia_record
|
49
78
|
|
50
79
|
def to_gedcom(level=0)
|
@@ -56,17 +85,36 @@ class Multimedia_record < GEDCOMBase
|
|
56
85
|
end
|
57
86
|
|
58
87
|
@sub_level = [#level 1
|
59
|
-
[:
|
60
|
-
[:
|
61
|
-
[:
|
62
|
-
[:
|
63
|
-
[:
|
64
|
-
[:
|
65
|
-
[:walk, nil,
|
66
|
-
[:
|
88
|
+
[:walk, nil, :multimedia_obje_file_record ], #"FILE", GEDCOM 5.5.1, FILE reference, rather than blobs.
|
89
|
+
[:walk, nil, :multimedia_file_record ], #"FILE", GEDCOM 5.5.1, FILE reference, rather than blobs.
|
90
|
+
[:print, "TITL",:title ], #GEDCOM 5.5, Subordinate to FILE in 5.5.1
|
91
|
+
[:walk, nil, :multimedia_format_record ], # "FORM", GEDCOM 5.5, Subordinate to FILE in 5.5.1
|
92
|
+
[:walk, nil, :encoded_line_record ], #GEDCOM 5.5 BLOB
|
93
|
+
[:xref, nil, :next_multimedia_ref ], #GEDCOM 5.5 OBJE, Next BLOB reference.
|
94
|
+
[:walk, nil, :source_citation_record], #GEDCOM 5.5.1
|
95
|
+
[:walk, nil, :note_citation_record ],
|
96
|
+
[:walk, nil, :refn_record ],
|
97
|
+
[:print, "RIN", :automated_record_id ],
|
67
98
|
[:walk, nil, :change_date_record ],
|
68
99
|
]
|
69
|
-
|
100
|
+
|
70
101
|
super(level)
|
71
102
|
end
|
103
|
+
|
104
|
+
#Replacing :filename with multimedia_file_record could break some code,
|
105
|
+
#so def filename returns the filename in the first multimedia_file_record's filename field.
|
106
|
+
def filename
|
107
|
+
#ALL Tag values get stored in arrays, as there could be more than one instance of a Tag
|
108
|
+
#Hence the 'first' is added.
|
109
|
+
multimedia_obj_file_record != nil ? multimedia_obj_file_record.first.filename : nil
|
110
|
+
end
|
111
|
+
|
112
|
+
#Replacing :format with multimedia_format_record could break some code,
|
113
|
+
#so def format returns the format in the first multimedia_format_record's format field.
|
114
|
+
def format
|
115
|
+
#ALL Tag values get stored in arrays, as there could be more than one instance of a Tag
|
116
|
+
#Hence the 'first' is added.
|
117
|
+
multimedia_obj_format_record != nil ? multimedia_obj_format_record.first.format : nil
|
118
|
+
end
|
119
|
+
|
72
120
|
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
require 'gedcom_base.rb'
|
2
|
+
|
3
|
+
#GEDCOM 5.5.1 Draft adds as subordinate to NAME
|
4
|
+
#
|
5
|
+
# +1 FONE <NAME_PHONETIC_VARIATION>
|
6
|
+
# +2 TYPE <PHONETIC_TYPE>
|
7
|
+
# +2 <<PERSONAL_NAME_PIECES>>
|
8
|
+
#
|
9
|
+
#==NAME_PHONETIC_VARIATION:= {Size=1:120}
|
10
|
+
# PHONETIC_TYPE [<user defined> | hangul | kana] {Size=5:30}
|
11
|
+
#The phonetic variation of the name is written in the same form as the was the name used in the superior <NAME_PERSONAL> primitive,
|
12
|
+
# but phonetically written using the method indicated by the subordinate <PHONETIC_TYPE> value, for example if hiragana was used
|
13
|
+
#to provide a reading of a name written in kanji, then the <PHONETIC_TYPE> value would indicate 'kana'.
|
14
|
+
#
|
15
|
+
|
16
|
+
class Name_phonetic_record < GEDCOMBase
|
17
|
+
#Phonetic Name is stored in phonetic_name and recovered via def name, or the alias phonetic_name
|
18
|
+
attr_writer :phonetic_name
|
19
|
+
attr_accessor :prefix, :given, :nickname, :surname_prefix, :surname, :suffix
|
20
|
+
attr_accessor :restriction, :source_citation_record, :note_citation_record
|
21
|
+
ClassTracker << :Name_phonetic_record
|
22
|
+
|
23
|
+
def initialize(*a)
|
24
|
+
super(*a)
|
25
|
+
@this_level = [ [:print, "FONE", :phonetic_name] ]
|
26
|
+
@sub_level = [
|
27
|
+
[:print, "NPFX", :prefix ],
|
28
|
+
[:print, "GIVN", :given ],
|
29
|
+
[:print, "NICK", :nickname ],
|
30
|
+
[:print, "SPFX", :surname_prefix ],
|
31
|
+
[:print, "SURN", :surname ],
|
32
|
+
[:print, "NSFX", :suffix ],
|
33
|
+
[:walk, nil, :source_citation_record],
|
34
|
+
[:walk, nil, :note_citation_record],
|
35
|
+
[:print, "RESN", :restriction],
|
36
|
+
]
|
37
|
+
end
|
38
|
+
|
39
|
+
#return the name as a string. It might be returned be the #phonetic_name method.
|
40
|
+
# or it might need to be contructed from the Name_phonetic_record personal name pieces attributes.
|
41
|
+
def name
|
42
|
+
if (name = phonetic_name) == nil
|
43
|
+
name = "" #could be what we return if none of the Name_record attributes are set
|
44
|
+
if @prefix
|
45
|
+
name += @prefix.first
|
46
|
+
name += ' ' if @given || @nickname || @surname_prefix || @surname || @suffix
|
47
|
+
end
|
48
|
+
if @given
|
49
|
+
name += @given.first
|
50
|
+
name += ' ' if @nickname || @surname_prefix || @surname || @suffix
|
51
|
+
end
|
52
|
+
if @nickname
|
53
|
+
name += '(' + @nickname.first + ')'
|
54
|
+
name += ' ' if @surname_prefix || @surname || @suffix
|
55
|
+
end
|
56
|
+
if @surname_prefix
|
57
|
+
name += @surname_prefix.first
|
58
|
+
name += ' ' if @surname || @suffix
|
59
|
+
end
|
60
|
+
if @surname
|
61
|
+
name += ( '/' + @surname.first + '/' )
|
62
|
+
name += ' ' if @suffix
|
63
|
+
end
|
64
|
+
name += @suffix.first if @suffix
|
65
|
+
end
|
66
|
+
return name.first
|
67
|
+
end
|
68
|
+
|
69
|
+
alias :phonetic_name :name
|
70
|
+
end
|
data/lib/gedcom/name_record.rb
CHANGED
@@ -32,10 +32,10 @@ require 'individual_attribute_record.rb'
|
|
32
32
|
#
|
33
33
|
# The surname of an individual, if known, is enclosed between two slash (/) characters. The order of the
|
34
34
|
# name parts should be the order that the person would, by custom of their culture, have used when
|
35
|
-
# giving it to a recorder. Early versions of Personal Ancestral File and other products did not use the
|
35
|
+
# giving it to a recorder. Early versions of Personal Ancestral File and other products did not use the (R)
|
36
36
|
# trailing slash when the surname was the last element of the name. If part of name is illegible, that part
|
37
37
|
# is indicated by an ellipsis (...). Capitalize the name of a person or place in the conventional
|
38
|
-
# manner
|
38
|
+
# manner-capitalize the first letter of each part and lowercase the other letters, unless conventional
|
39
39
|
# usage is otherwise. For example: McMurray.
|
40
40
|
# Examples:
|
41
41
|
# 1 NAME William Lee (given name only or surname not known)
|
@@ -69,8 +69,40 @@ require 'individual_attribute_record.rb'
|
|
69
69
|
#* Those ending in _ref are GEDCOM XREF index keys
|
70
70
|
#* Those ending in _record are array of classes of that type.
|
71
71
|
#* The remainder are arrays of attributes that could be present in this record.
|
72
|
+
#
|
73
|
+
#GEDCOM 5.5.1 Draft adds
|
74
|
+
#
|
75
|
+
# +1 TYPE <NAME_TYPE>
|
76
|
+
# +1 FONE <NAME_PHONETIC_VARIATION>
|
77
|
+
# +2 TYPE <PHONETIC_TYPE>
|
78
|
+
# +2 <<PERSONAL_NAME_PIECES>>
|
79
|
+
# +1 ROMN <NAME_ROMANIZED_VARIATION>
|
80
|
+
# +2 TYPE <ROMANIZED_TYPE>
|
81
|
+
# +2 <<PERSONAL_NAME_PIECES>>
|
82
|
+
#
|
83
|
+
#==NAME_TYPE:= {Size=5:30}
|
84
|
+
# [ aka | birth | immigrant | maiden | married | <user defined> ]
|
85
|
+
#Indicates the name type, for example the name issued or assumed as an immigrant.
|
86
|
+
#e.g. birth indicates name given on birth certificate.
|
87
|
+
#
|
88
|
+
#==NAME_PHONETIC_VARIATION:= {Size=1:120}
|
89
|
+
# PHONETIC_TYPE [<user defined> | hangul | kana] {Size=5:30}
|
90
|
+
#The phonetic variation of the name is written in the same form as the was the name used in the superior <NAME_PERSONAL> primitive,
|
91
|
+
# but phonetically written using the method indicated by the subordinate <PHONETIC_TYPE> value, for example if hiragana was used
|
92
|
+
#to provide a reading of a name written in kanji, then the <PHONETIC_TYPE> value would indicate 'kana'.
|
93
|
+
#
|
94
|
+
#==NAME_ROMANIZED_VARIATION:= {Size=1:120}
|
95
|
+
# ROMANIZED_TYPE [<user defined> | pinyin | romaji | wadegiles] {Size=5:30}
|
96
|
+
#The romanized variation of the name is written in the same form prescribed for the name used in the superior <NAME_PERSONAL> context.
|
97
|
+
#The method used to romanize the name is indicated by the line_value of the subordinate <ROMANIZED_TYPE>, for example
|
98
|
+
#if romaji was used to provide a reading of a name written in kanji, then the ROMANIZED_TYPE subordinate to the ROMN tag
|
99
|
+
#would indicate romaji.
|
100
|
+
#==TYPE:=
|
72
101
|
class Name_record < Individual_attribute_record
|
102
|
+
#Name stored in field "value", as this is an individual_attribute_record subtype.
|
103
|
+
#Value of attribute "type" is set to NAME
|
73
104
|
attr_accessor :prefix, :given, :nickname, :surname_prefix, :surname, :suffix
|
105
|
+
attr_accessor :name_type, :name_phonetic_record, :name_romanized_record #GEDCOM 5.5.1
|
74
106
|
ClassTracker << :Name_record
|
75
107
|
|
76
108
|
def initialize(*a)
|
@@ -82,9 +114,13 @@ class Name_record < Individual_attribute_record
|
|
82
114
|
[:print, "SPFX", :surname_prefix ],
|
83
115
|
[:print, "SURN", :surname ],
|
84
116
|
[:print, "NSFX", :suffix ],
|
117
|
+
[:print, "TYPE", :name_type ], #5.5.1
|
118
|
+
[:walk, "FONE", :name_phonetic_record],
|
119
|
+
[:walk, "ROMN", :name_romanized_record],
|
85
120
|
] + @sub_level
|
86
121
|
end
|
87
122
|
|
123
|
+
#Attributes and Events have a common class, as they are essentially identical.
|
88
124
|
def event_tag(tag)
|
89
125
|
case tag
|
90
126
|
when "NAME" then tag
|
@@ -0,0 +1,72 @@
|
|
1
|
+
require 'gedcom_base.rb'
|
2
|
+
|
3
|
+
#GEDCOM 5.5.1 Draft adds as subordinate to NAME
|
4
|
+
#
|
5
|
+
# +1 ROMN <NAME_ROMANIZED_VARIATION>
|
6
|
+
# +2 TYPE <ROMANIZED_TYPE>
|
7
|
+
# +2 <<PERSONAL_NAME_PIECES>>
|
8
|
+
#
|
9
|
+
#
|
10
|
+
#
|
11
|
+
#==NAME_ROMANIZED_VARIATION:= {Size=1:120}
|
12
|
+
# ROMANIZED_TYPE [<user defined> | pinyin | romaji | wadegiles] {Size=5:30}
|
13
|
+
#The romanized variation of the name is written in the same form prescribed for the name used in the superior <NAME_PERSONAL> context.
|
14
|
+
#The method used to romanize the name is indicated by the line_value of the subordinate <ROMANIZED_TYPE>, for example
|
15
|
+
#if romaji was used to provide a reading of a name written in kanji, then the ROMANIZED_TYPE subordinate to the ROMN tag
|
16
|
+
#would indicate romaji.
|
17
|
+
|
18
|
+
class Name_romanized_record < GEDCOMBase
|
19
|
+
#romanized Name is stored in romanized_name and recovered via def name, or the alias romanized_name
|
20
|
+
attr_writer :romanized_name
|
21
|
+
attr_accessor :prefix, :given, :nickname, :surname_prefix, :surname, :suffix
|
22
|
+
attr_accessor :restriction, :source_citation_record, :note_citation_record
|
23
|
+
ClassTracker << :Name_romanized_record
|
24
|
+
|
25
|
+
def initialize(*a)
|
26
|
+
super(*a)
|
27
|
+
@this_level = [ [:print, "ROMN", :romanized_name] ]
|
28
|
+
@sub_level = [
|
29
|
+
[:print, "NPFX", :prefix ],
|
30
|
+
[:print, "GIVN", :given ],
|
31
|
+
[:print, "NICK", :nickname ],
|
32
|
+
[:print, "SPFX", :surname_prefix ],
|
33
|
+
[:print, "SURN", :surname ],
|
34
|
+
[:print, "NSFX", :suffix ],
|
35
|
+
[:walk, nil, :source_citation_record],
|
36
|
+
[:walk, nil, :note_citation_record],
|
37
|
+
[:print, "RESN", :restriction],
|
38
|
+
]
|
39
|
+
end
|
40
|
+
|
41
|
+
#return the name as a string. It might be returned be the romanized_name method.
|
42
|
+
# or it might need to be contructed from the Name_romanized_record personal name pieces attributes.
|
43
|
+
def name
|
44
|
+
if (name = romanized_name) == nil
|
45
|
+
name = "" #could be what we return if none of the Name_record attributes are set
|
46
|
+
if @prefix
|
47
|
+
name += @prefix.first
|
48
|
+
name += ' ' if @given || @nickname || @surname_prefix || @surname || @suffix
|
49
|
+
end
|
50
|
+
if @given
|
51
|
+
name += @given.first
|
52
|
+
name += ' ' if @nickname || @surname_prefix || @surname || @suffix
|
53
|
+
end
|
54
|
+
if @nickname
|
55
|
+
name += '(' + @nickname.first + ')'
|
56
|
+
name += ' ' if @surname_prefix || @surname || @suffix
|
57
|
+
end
|
58
|
+
if @surname_prefix
|
59
|
+
name += @surname_prefix.first
|
60
|
+
name += ' ' if @surname || @suffix
|
61
|
+
end
|
62
|
+
if @surname
|
63
|
+
name += ( '/' + @surname.first + '/' )
|
64
|
+
name += ' ' if @suffix
|
65
|
+
end
|
66
|
+
name += @suffix.first if @suffix
|
67
|
+
end
|
68
|
+
return name.first
|
69
|
+
end
|
70
|
+
|
71
|
+
alias :romanized_name :name
|
72
|
+
end
|
data/lib/gedcom/place_record.rb
CHANGED
@@ -21,7 +21,9 @@ require 'gedcom_base.rb'
|
|
21
21
|
#* Those ending in _record are array of classes of that type.
|
22
22
|
#* The remainder are arrays of attributes that could be present in the PLAC records.
|
23
23
|
class Place_record < GEDCOMBase
|
24
|
-
attr_accessor :place_value, :place_hierachy
|
24
|
+
attr_accessor :place_value, :place_hierachy
|
25
|
+
attr_accessor :source_citation_record, :note_citation_record
|
26
|
+
attr_accessor :placename_phonetic_record, :placename_romanized_record, :placename_map_record
|
25
27
|
|
26
28
|
ClassTracker << :Place_record
|
27
29
|
|
@@ -30,6 +32,9 @@ class Place_record < GEDCOMBase
|
|
30
32
|
@this_level = [ [:print, "PLAC", :place_value] ]
|
31
33
|
@sub_level = [ #level + 1
|
32
34
|
[:print, "FORM", :place_hierachy],
|
35
|
+
[:print, "FONE", :placename_phonetic_record],
|
36
|
+
[:print, "ROMN", :placename_romanized_record],
|
37
|
+
[:print, "MAP", :placename_map_record],
|
33
38
|
[:walk, nil, :source_citation_record],
|
34
39
|
[:walk, nil, :note_citation_record],
|
35
40
|
]
|
@@ -37,6 +42,9 @@ class Place_record < GEDCOMBase
|
|
37
42
|
@this_level = [ [:nodata, "PLAC", nil] ]
|
38
43
|
@sub_level = [ #level + 1
|
39
44
|
[:print, "FORM", :place_hierachy],
|
45
|
+
[:print, "FONE", :placename_phonetic_record],
|
46
|
+
[:print, "ROMN", :placename_romanized_record],
|
47
|
+
[:print, "MAP", :placename_map_record],
|
40
48
|
[:walk, nil, :source_citation_record],
|
41
49
|
[:walk, nil, :note_citation_record],
|
42
50
|
]
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'gedcom_base.rb'
|
2
|
+
|
3
|
+
#=Placename_map_record
|
4
|
+
#GEDCOM 5.5.1 Draft adds as subordinate to PLAC
|
5
|
+
#
|
6
|
+
# +1 MAP
|
7
|
+
# +2 LATI <PLACE_LATITUDE>
|
8
|
+
# +2 LONG <PLACE_LONGITUDE>
|
9
|
+
#
|
10
|
+
#==PLACE_LATITUDE:= {Size=5:8}
|
11
|
+
# The value specifying the latitudinal coordinate of the place name. The latitude coordinate is
|
12
|
+
#the direction North or South from the equator in degrees and fraction of degrees carried out to give
|
13
|
+
#the desired accuracy. For example: 18 degrees, 9 minutes, and 3.4 seconds North would be formatted
|
14
|
+
#as N18.150944. Minutes and seconds are converted by dividing the minutes value by 60 and the seconds
|
15
|
+
#value by 3600 and adding the results together. This sum becomes the fractional part of the degree's value.
|
16
|
+
#
|
17
|
+
#==PLACE_LONGITUDE:= {Size=5:8}
|
18
|
+
#The value specifying the longitudinal coordinate of the place name. The longitude coordinate is Degrees
|
19
|
+
#and fraction of degrees east or west of the zero or base meridian coordinate. For example: 168 degrees,
|
20
|
+
#9 minutes, and 3.4 seconds East would be formatted as E168.150944.
|
21
|
+
#
|
22
|
+
#I allow a NOTE record too, to cope with user defined tags
|
23
|
+
|
24
|
+
class Placename_map_record < GEDCOMBase
|
25
|
+
attr_accessor :latitude, :longitude
|
26
|
+
attr_accessor :note_citation_record
|
27
|
+
ClassTracker << :Placename_map_record
|
28
|
+
|
29
|
+
def initialize(*a)
|
30
|
+
super(*a)
|
31
|
+
@this_level = [ [:print, "MAP", nil] ]
|
32
|
+
@sub_level = [
|
33
|
+
[:print, "LATI", :latitude],
|
34
|
+
[:print, "LONG", :longitude], #Not standard
|
35
|
+
[:walk, nil, :note_citation_record],
|
36
|
+
]
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|