relaton-bib 0.3.3 → 0.3.8
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.
- checksums.yaml +5 -5
- data/Gemfile.lock +5 -5
- data/docs/hash.adoc +298 -34
- data/lib/relaton_bib.rb +33 -1
- data/lib/relaton_bib/bib_item_locality.rb +12 -5
- data/lib/relaton_bib/biblio_note.rb +15 -5
- data/lib/relaton_bib/biblio_version.rb +12 -2
- data/lib/relaton_bib/bibliographic_date.rb +18 -24
- data/lib/relaton_bib/bibliographic_item.rb +49 -11
- data/lib/relaton_bib/classification.rb +7 -0
- data/lib/relaton_bib/contribution_info.rb +26 -4
- data/lib/relaton_bib/contributor.rb +42 -4
- data/lib/relaton_bib/copyright_association.rb +12 -5
- data/lib/relaton_bib/document_identifier.rb +7 -0
- data/lib/relaton_bib/document_relation.rb +9 -0
- data/lib/relaton_bib/document_status.rb +8 -0
- data/lib/relaton_bib/formatted_string.rb +12 -2
- data/lib/relaton_bib/hash_converter.rb +164 -101
- data/lib/relaton_bib/hit.rb +32 -0
- data/lib/relaton_bib/hit_collection.rb +34 -0
- data/lib/relaton_bib/localized_string.rb +16 -6
- data/lib/relaton_bib/medium.rb +9 -0
- data/lib/relaton_bib/organization.rb +36 -26
- data/lib/relaton_bib/person.rb +28 -1
- data/lib/relaton_bib/series.rb +16 -0
- data/lib/relaton_bib/typed_title_string.rb +14 -0
- data/lib/relaton_bib/typed_uri.rb +6 -0
- data/lib/relaton_bib/validity.rb +14 -4
- data/lib/relaton_bib/version.rb +1 -1
- data/lib/relaton_bib/xml_parser.rb +20 -6
- data/relaton-bib.gemspec +2 -2
- metadata +10 -8
@@ -1,10 +1,10 @@
|
|
1
1
|
module RelatonBib
|
2
2
|
# Copyright association.
|
3
3
|
class CopyrightAssociation
|
4
|
-
# @return [
|
4
|
+
# @return [Date]
|
5
5
|
attr_reader :from
|
6
6
|
|
7
|
-
# @return [
|
7
|
+
# @return [Date, NilClass]
|
8
8
|
attr_reader :to
|
9
9
|
|
10
10
|
# @return [RelatonBib::ContributionInfo]
|
@@ -22,17 +22,24 @@ module RelatonBib
|
|
22
22
|
else owner
|
23
23
|
end
|
24
24
|
|
25
|
-
@from =
|
26
|
-
@to =
|
25
|
+
@from = Date.strptime(from.to_s, "%Y") if from.to_s =~ /\d{4}/
|
26
|
+
@to = Date.strptime(to.to_s, "%Y") unless to.to_s.empty?
|
27
27
|
end
|
28
28
|
|
29
29
|
# @param builder [Nokogiri::XML::Builder]
|
30
30
|
def to_xml(builder)
|
31
31
|
builder.copyright do
|
32
|
-
builder.from from.year
|
32
|
+
builder.from from ? from.year : "unknown"
|
33
33
|
builder.to to.year if to
|
34
34
|
builder.owner { owner.to_xml builder }
|
35
35
|
end
|
36
36
|
end
|
37
|
+
|
38
|
+
# @return [Hash]
|
39
|
+
def to_hash
|
40
|
+
hash = { "owner" => owner.to_hash["organization"], "from" => from.year.to_s }
|
41
|
+
hash["to"] = to.year.to_s if to
|
42
|
+
hash
|
43
|
+
end
|
37
44
|
end
|
38
45
|
end
|
@@ -14,6 +14,8 @@ module RelatonBib
|
|
14
14
|
|
15
15
|
# Documett relation
|
16
16
|
class DocumentRelation
|
17
|
+
include RelatonBib
|
18
|
+
|
17
19
|
# @return [String]
|
18
20
|
attr_reader :type
|
19
21
|
|
@@ -47,5 +49,12 @@ module RelatonBib
|
|
47
49
|
end
|
48
50
|
end
|
49
51
|
end
|
52
|
+
|
53
|
+
# @return [Hash]
|
54
|
+
def to_hash
|
55
|
+
hash = { "type" => type, "bibitem" => bibitem.to_hash }
|
56
|
+
hash["bib_locality"] = single_element_array(bib_locality) if bib_locality&.any?
|
57
|
+
hash
|
58
|
+
end
|
50
59
|
end
|
51
60
|
end
|
@@ -32,5 +32,13 @@ module RelatonBib
|
|
32
32
|
builder.iteration iteration unless iteration.to_s.empty?
|
33
33
|
end
|
34
34
|
end
|
35
|
+
|
36
|
+
# @return [Hash]
|
37
|
+
def to_hash
|
38
|
+
hash = { "stage" => stage }
|
39
|
+
hash["substage"] = substage if substage
|
40
|
+
hash["iteration"] = iteration if iteration
|
41
|
+
hash
|
42
|
+
end
|
35
43
|
end
|
36
44
|
end
|
@@ -13,8 +13,8 @@ module RelatonBib
|
|
13
13
|
attr_reader :format
|
14
14
|
|
15
15
|
# @param content [String]
|
16
|
-
# @param language [String] language code Iso639
|
17
|
-
# @param script [String] script code Iso15924
|
16
|
+
# @param language [String, NilClass] language code Iso639
|
17
|
+
# @param script [String, NilClass] script code Iso15924
|
18
18
|
# @param format [String] the content type
|
19
19
|
def initialize(content:, language: nil, script: nil, format: "text/plain")
|
20
20
|
# if format && !FORMATS.include?(format)
|
@@ -30,5 +30,15 @@ module RelatonBib
|
|
30
30
|
builder.parent["format"] = format if format
|
31
31
|
super
|
32
32
|
end
|
33
|
+
|
34
|
+
# @return [Hash]
|
35
|
+
def to_hash
|
36
|
+
hash = super
|
37
|
+
return hash unless format
|
38
|
+
|
39
|
+
hash = { "content" => hash } if hash.is_a? String
|
40
|
+
hash["format"] = format if format
|
41
|
+
hash
|
42
|
+
end
|
33
43
|
end
|
34
44
|
end
|
@@ -35,6 +35,7 @@ module RelatonBib
|
|
35
35
|
|
36
36
|
def extent_hash_to_bib(ret)
|
37
37
|
return unless ret[:extent]
|
38
|
+
|
38
39
|
ret[:extent] = array(ret[:extent])
|
39
40
|
ret[:extent]&.each_with_index do |e, i|
|
40
41
|
ret[:extent][i] = BibItemLocality.new(e[:type], e[:reference_from],
|
@@ -44,45 +45,57 @@ module RelatonBib
|
|
44
45
|
|
45
46
|
def title_hash_to_bib(ret)
|
46
47
|
return unless ret[:title]
|
48
|
+
|
47
49
|
ret[:title] = array(ret[:title])
|
48
50
|
ret[:title] = ret[:title].map do |t|
|
49
|
-
t.is_a?(Hash)
|
50
|
-
|
51
|
+
if t.is_a?(Hash) then t
|
52
|
+
else
|
53
|
+
{ content: t, language: "en", script: "Latn", format: "text/plain", type: "main" }
|
54
|
+
end
|
51
55
|
end
|
52
56
|
end
|
53
57
|
|
54
58
|
def language_hash_to_bib(ret)
|
55
59
|
return unless ret[:language]
|
60
|
+
|
56
61
|
ret[:language] = array(ret[:language])
|
57
62
|
end
|
58
63
|
|
59
64
|
def script_hash_to_bib(ret)
|
60
65
|
return unless ret[:script]
|
66
|
+
|
61
67
|
ret[:script] = array(ret[:script])
|
62
68
|
end
|
63
69
|
|
64
70
|
def abstract_hash_to_bib(ret)
|
65
71
|
return unless ret[:abstract]
|
66
|
-
|
72
|
+
|
73
|
+
ret[:abstract] = array(ret[:abstract]).map do |a|
|
74
|
+
a.is_a?(String) ? FormattedString.new(content: a) : a
|
75
|
+
end
|
67
76
|
end
|
68
77
|
|
69
78
|
def link_hash_to_bib(ret)
|
70
79
|
return unless ret[:link]
|
80
|
+
|
71
81
|
ret[:link] = array(ret[:link])
|
72
82
|
end
|
73
83
|
|
74
84
|
def place_hash_to_bib(ret)
|
75
85
|
return unless ret[:place]
|
86
|
+
|
76
87
|
ret[:place] = array(ret[:place])
|
77
88
|
end
|
78
89
|
|
79
90
|
def accesslocation_hash_to_bib(ret)
|
80
91
|
return unless ret[:accesslocation]
|
92
|
+
|
81
93
|
ret[:accesslocation] = array(ret[:accesslocation])
|
82
94
|
end
|
83
95
|
|
84
96
|
def dates_hash_to_bib(ret)
|
85
97
|
return unless ret[:date]
|
98
|
+
|
86
99
|
ret[:date] = array(ret[:date])
|
87
100
|
ret[:date].each_with_index do |d, i|
|
88
101
|
# value is synonym of on: it is reserved word in YAML
|
@@ -95,6 +108,7 @@ module RelatonBib
|
|
95
108
|
|
96
109
|
def docid_hash_to_bib(ret)
|
97
110
|
return unless ret[:docid]
|
111
|
+
|
98
112
|
ret[:docid] = array(ret[:docid])
|
99
113
|
ret[:docid]&.each_with_index do |id, i|
|
100
114
|
ret[:docid][i] = DocumentIdentifier.new(id: id[:id], type: id[:type])
|
@@ -103,118 +117,135 @@ module RelatonBib
|
|
103
117
|
|
104
118
|
def version_hash_to_bib(ret)
|
105
119
|
return unless ret[:version]
|
120
|
+
|
106
121
|
ret[:version][:draft] = array(ret[:version][:draft])
|
107
|
-
ret[:version]
|
108
|
-
|
122
|
+
ret[:version] && ret[:version] = BibliographicItem::Version.new(
|
123
|
+
ret[:version][:revision_date], ret[:version][:draft]
|
124
|
+
)
|
109
125
|
end
|
110
126
|
|
111
127
|
def biblionote_hash_to_bib(ret)
|
112
128
|
return unless ret[:biblionote]
|
129
|
+
|
113
130
|
ret[:biblionote] = array(ret[:biblionote])
|
114
131
|
(ret[:biblionote])&.each_with_index do |n, i|
|
115
|
-
ret[:biblionote][i] =
|
116
|
-
|
117
|
-
|
118
|
-
|
132
|
+
ret[:biblionote][i] = BiblioNote.new(
|
133
|
+
content: n[:content], type: n[:type], language: n[:language],
|
134
|
+
script: n[:script], format: n[:format]
|
135
|
+
)
|
119
136
|
end
|
120
137
|
end
|
121
138
|
|
122
139
|
def formattedref_hash_to_bib(ret)
|
123
|
-
ret[:formattedref]
|
124
|
-
formattedref(ret[:formattedref])
|
140
|
+
ret[:formattedref] && ret[:formattedref] = formattedref(ret[:formattedref])
|
125
141
|
end
|
126
142
|
|
127
143
|
def docstatus_hash_to_bib(ret)
|
128
|
-
ret[:docstatus]
|
129
|
-
|
130
|
-
|
131
|
-
|
144
|
+
ret[:docstatus] && ret[:docstatus] = DocumentStatus.new(
|
145
|
+
stage: ret[:docstatus][:stage],
|
146
|
+
substage: ret[:docstatus][:substage],
|
147
|
+
iteration: ret[:docstatus][:iteration],
|
148
|
+
)
|
132
149
|
end
|
133
150
|
|
134
151
|
def contributors_hash_to_bib(ret)
|
135
152
|
return unless ret[:contributor]
|
153
|
+
|
136
154
|
ret[:contributor] = array(ret[:contributor])
|
137
155
|
ret[:contributor]&.each_with_index do |c, i|
|
138
156
|
roles = array(ret[:contributor][i][:role]).map do |r|
|
139
157
|
if r.is_a? Hash
|
140
158
|
{ type: r[:type], description: array(r[:description]) }
|
141
|
-
elsif r.is_a? Array
|
142
|
-
|
159
|
+
# elsif r.is_a? Array
|
160
|
+
# { type: r[0], description: r.fetch(1) }
|
143
161
|
else
|
144
162
|
{ type: r }
|
145
163
|
end
|
146
164
|
end
|
147
165
|
ret[:contributor][i][:role] = roles
|
148
|
-
ret[:contributor][i][:entity] = c[:person]
|
149
|
-
|
166
|
+
ret[:contributor][i][:entity] = if c[:person]
|
167
|
+
person_hash_to_bib(c[:person])
|
168
|
+
else
|
169
|
+
org_hash_to_bib(c[:organization])
|
170
|
+
end
|
150
171
|
ret[:contributor][i].delete(:person)
|
151
172
|
ret[:contributor][i].delete(:organization)
|
152
173
|
end
|
153
174
|
end
|
154
175
|
|
155
|
-
def org_hash_to_bib(
|
156
|
-
return nil if
|
157
|
-
|
176
|
+
def org_hash_to_bib(org)
|
177
|
+
return nil if org.nil?
|
178
|
+
|
179
|
+
org[:identifier] = array(org[:identifier])&.map do |a|
|
158
180
|
OrgIdentifier.new(a[:type], a[:id])
|
159
181
|
end
|
160
|
-
|
182
|
+
org
|
161
183
|
end
|
162
184
|
|
163
|
-
def person_hash_to_bib(
|
185
|
+
def person_hash_to_bib(person)
|
164
186
|
Person.new(
|
165
|
-
name: fullname_hash_to_bib(
|
166
|
-
affiliation: affiliation_hash_to_bib(
|
167
|
-
contact: contacts_hash_to_bib(
|
168
|
-
identifier: person_identifiers_hash_to_bib(
|
187
|
+
name: fullname_hash_to_bib(person),
|
188
|
+
affiliation: affiliation_hash_to_bib(person),
|
189
|
+
contact: contacts_hash_to_bib(person),
|
190
|
+
identifier: person_identifiers_hash_to_bib(person),
|
169
191
|
)
|
170
192
|
end
|
171
193
|
|
172
|
-
def fullname_hash_to_bib(
|
173
|
-
n =
|
194
|
+
def fullname_hash_to_bib(person)
|
195
|
+
n = person[:name]
|
174
196
|
FullName.new(
|
175
|
-
forename: array(n[:forename])&.map { |f| localname(f,
|
176
|
-
initial: array(n[:initial])&.map { |f| localname(f,
|
177
|
-
addition: array(n[:addition])&.map { |f| localname(f,
|
178
|
-
prefix: array(n[:prefix])&.map { |f| localname(f,
|
179
|
-
surname: localname(n[:surname],
|
180
|
-
completename: localname(n[:completename],
|
197
|
+
forename: array(n[:forename])&.map { |f| localname(f, person) },
|
198
|
+
initial: array(n[:initial])&.map { |f| localname(f, person) },
|
199
|
+
addition: array(n[:addition])&.map { |f| localname(f, person) },
|
200
|
+
prefix: array(n[:prefix])&.map { |f| localname(f, person) },
|
201
|
+
surname: localname(n[:surname], person),
|
202
|
+
completename: localname(n[:completename], person),
|
181
203
|
)
|
182
204
|
end
|
183
205
|
|
184
|
-
def person_identifiers_hash_to_bib(
|
185
|
-
array(
|
206
|
+
def person_identifiers_hash_to_bib(person)
|
207
|
+
array(person[:identifier])&.map do |a|
|
186
208
|
PersonIdentifier.new(a[:type], a[:id])
|
187
209
|
end
|
188
210
|
end
|
189
211
|
|
190
|
-
def affiliation_hash_to_bib(
|
191
|
-
return [] unless
|
192
|
-
|
212
|
+
def affiliation_hash_to_bib(person)
|
213
|
+
return [] unless person[:affiliation]
|
214
|
+
|
215
|
+
array(person[:affiliation]).map do |a|
|
193
216
|
a[:description] = array(a[:description])&.map do |d|
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
217
|
+
cnt = if d.is_a?(Hash)
|
218
|
+
{ content: d[:content], language: d[:language],
|
219
|
+
script: d[:script], format: d[:format] }
|
220
|
+
else { content: d }
|
221
|
+
end
|
222
|
+
FormattedString.new cnt
|
199
223
|
end
|
200
224
|
Affilation.new(
|
201
|
-
Organization.new(org_hash_to_bib(a[:organization])),
|
225
|
+
organization: Organization.new(org_hash_to_bib(a[:organization])),
|
226
|
+
description: a[:description],
|
227
|
+
)
|
202
228
|
end
|
203
229
|
end
|
204
230
|
|
205
|
-
def contacts_hash_to_bib(
|
206
|
-
return [] unless
|
207
|
-
|
208
|
-
|
231
|
+
def contacts_hash_to_bib(person)
|
232
|
+
return [] unless person[:contact]
|
233
|
+
|
234
|
+
array(person[:contact]).map do |a|
|
235
|
+
if a[:city] || a[:country]
|
209
236
|
RelatonBib::Address.new(
|
210
237
|
street: Array(a[:street]), city: a[:city], postcode: a[:postcode],
|
211
|
-
country: a[:country], state: a[:state]
|
212
|
-
|
238
|
+
country: a[:country], state: a[:state]
|
239
|
+
)
|
240
|
+
else
|
241
|
+
RelatonBib::Contact.new(type: a[:type], value: a[:value])
|
242
|
+
end
|
213
243
|
end
|
214
244
|
end
|
215
245
|
|
216
246
|
def relations_hash_to_bib(ret)
|
217
247
|
return unless ret[:relation]
|
248
|
+
|
218
249
|
ret[:relation] = array(ret[:relation])
|
219
250
|
ret[:relation]&.each_with_index do |r, i|
|
220
251
|
relation_bibitem_hash_to_bib(ret, r, i)
|
@@ -222,91 +253,123 @@ module RelatonBib
|
|
222
253
|
end
|
223
254
|
end
|
224
255
|
|
225
|
-
|
226
|
-
|
227
|
-
|
256
|
+
# @param ret [Hash]
|
257
|
+
# @param rel [Hash] relation
|
258
|
+
# @param idx [Integr] index of relation
|
259
|
+
def relation_bibitem_hash_to_bib(ret, rel, idx)
|
260
|
+
if rel[:bibitem]
|
261
|
+
ret[:relation][idx][:bibitem] = bib_item(hash_to_bib(rel[:bibitem], true))
|
228
262
|
else
|
229
|
-
warn "bibitem missing: #{
|
230
|
-
ret[:relation][
|
263
|
+
warn "bibitem missing: #{rel}"
|
264
|
+
ret[:relation][idx][:bibitem] = nil
|
231
265
|
end
|
232
266
|
end
|
233
267
|
|
234
|
-
|
235
|
-
|
236
|
-
|
268
|
+
# @param item [Hash]
|
269
|
+
# @retirn [RelatonBib::BibliographicItem]
|
270
|
+
def bib_item(item)
|
271
|
+
BibliographicItem.new(item)
|
272
|
+
end
|
273
|
+
|
274
|
+
def relation_biblocality_hash_to_bib(ret, rel, idx)
|
275
|
+
ret[:relation][idx][:bib_locality] =
|
276
|
+
array(rel[:bib_locality])&.map do |bl|
|
237
277
|
BibItemLocality.new(bl[:type], bl[:reference_from],
|
238
278
|
bl[:reference_to])
|
239
279
|
end
|
240
280
|
end
|
241
281
|
|
242
282
|
def series_hash_to_bib(ret)
|
243
|
-
array(ret[:series])&.
|
244
|
-
s[:formattedref]
|
283
|
+
ret[:series] = array(ret[:series])&.map do |s|
|
284
|
+
s[:formattedref] && s[:formattedref] = formattedref(s[:formattedref])
|
245
285
|
if s[:title]
|
246
286
|
s[:title] = { content: s[:title] } unless s.is_a?(Hash)
|
247
|
-
s[:title] =
|
287
|
+
s[:title] = typed_title_strig(s[:title])
|
248
288
|
end
|
249
|
-
s[:abbreviation]
|
250
|
-
|
251
|
-
ret[:series][i] = Series.new(s)
|
289
|
+
s[:abbreviation] && s[:abbreviation] = localizedstring(s[:abbreviation])
|
290
|
+
Series.new(s)
|
252
291
|
end
|
253
292
|
end
|
254
293
|
|
294
|
+
# @param title [Hash]
|
295
|
+
# @return [RelatonBib::TypedTitleString]
|
296
|
+
def typed_title_strig(title)
|
297
|
+
TypedTitleString.new title
|
298
|
+
end
|
299
|
+
|
255
300
|
def medium_hash_to_bib(ret)
|
256
|
-
ret[:medium]
|
301
|
+
ret[:medium] = Medium.new(ret[:medium]) if ret[:medium]
|
257
302
|
end
|
258
303
|
|
259
304
|
def classification_hash_to_bib(ret)
|
260
|
-
#ret[:classification] = [ret[:classification]] unless ret[:classification].is_a?(Array)
|
261
|
-
#ret[:classification]&.each_with_index do |c, i|
|
262
|
-
#ret[:classification][i] = RelatonBib::Classification.new(c)
|
263
|
-
#end
|
264
|
-
ret[:classification]
|
305
|
+
# ret[:classification] = [ret[:classification]] unless ret[:classification].is_a?(Array)
|
306
|
+
# ret[:classification]&.each_with_index do |c, i|
|
307
|
+
# ret[:classification][i] = RelatonBib::Classification.new(c)
|
308
|
+
# end
|
309
|
+
if ret[:classification]
|
265
310
|
ret[:classification] = Classification.new(ret[:classification])
|
311
|
+
end
|
266
312
|
end
|
267
313
|
|
268
314
|
def validity_hash_to_bib(ret)
|
269
315
|
return unless ret[:validity]
|
270
|
-
|
271
|
-
ret[:validity][:
|
272
|
-
ret[:validity][:
|
316
|
+
|
317
|
+
ret[:validity][:begins] && b = Time.parse(ret[:validity][:begins])
|
318
|
+
ret[:validity][:ends] && e = Time.parse(ret[:validity][:ends])
|
319
|
+
ret[:validity][:revision] && r = Time.parse(ret[:validity][:revision])
|
273
320
|
ret[:validity] = Validity.new(begins: b, ends: e, revision: r)
|
274
321
|
end
|
275
322
|
|
323
|
+
# @param ogj [Hash, Array, String]
|
324
|
+
# @return [Hash, Array, String]
|
276
325
|
def symbolize(obj)
|
277
|
-
obj.is_a? Hash
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
326
|
+
if obj.is_a? Hash
|
327
|
+
obj.reduce({}) do |memo, (k, v)|
|
328
|
+
memo[k.to_sym] = symbolize(v)
|
329
|
+
memo
|
330
|
+
end
|
331
|
+
elsif obj.is_a? Array
|
332
|
+
obj.reduce([]) { |memo, v| memo << symbolize(v) }
|
333
|
+
else
|
334
|
+
obj
|
335
|
+
end
|
282
336
|
end
|
283
337
|
|
284
|
-
def array(
|
285
|
-
return [] unless
|
286
|
-
return [
|
287
|
-
|
338
|
+
def array(arr)
|
339
|
+
return [] unless arr
|
340
|
+
return [arr] unless arr.is_a?(Array)
|
341
|
+
|
342
|
+
arr
|
288
343
|
end
|
289
344
|
|
290
|
-
def localname(
|
291
|
-
return nil if
|
292
|
-
|
293
|
-
lang
|
294
|
-
|
295
|
-
script
|
296
|
-
|
297
|
-
|
298
|
-
RelatonBib::LocalizedString.new(
|
345
|
+
def localname(name, person)
|
346
|
+
return nil if name.nil?
|
347
|
+
|
348
|
+
lang = name[:language] if name.is_a?(Hash)
|
349
|
+
lang ||= person[:name][:language]
|
350
|
+
script = name[:script] if name.is_a?(Hash)
|
351
|
+
script ||= person[:name][:script]
|
352
|
+
if name.is_a?(Hash)
|
353
|
+
RelatonBib::LocalizedString.new(name[:content], lang, script)
|
354
|
+
else
|
355
|
+
RelatonBib::LocalizedString.new(name, lang, script)
|
356
|
+
end
|
299
357
|
end
|
300
358
|
|
301
|
-
def localizedstring(
|
302
|
-
|
303
|
-
RelatonBib::LocalizedString.new(
|
304
|
-
|
359
|
+
def localizedstring(lst)
|
360
|
+
if lst.is_a?(Hash)
|
361
|
+
RelatonBib::LocalizedString.new(lst[:content], lst[:language], lst[:script])
|
362
|
+
else
|
363
|
+
RelatonBib::LocalizedString.new(lst)
|
364
|
+
end
|
305
365
|
end
|
306
366
|
|
307
|
-
def formattedref(
|
308
|
-
|
309
|
-
RelatonBib::FormattedRef.new(
|
367
|
+
def formattedref(frf)
|
368
|
+
if frf.is_a?(Hash)
|
369
|
+
RelatonBib::FormattedRef.new(frf)
|
370
|
+
else
|
371
|
+
RelatonBib::FormattedRef.new(content: frf)
|
372
|
+
end
|
310
373
|
end
|
311
374
|
end
|
312
375
|
end
|