relaton-bib 1.12.1 → 1.12.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/relaton_bib/bibxml_parser.rb +4 -1
- data/lib/relaton_bib/contribution_info.rb +2 -2
- data/lib/relaton_bib/contributor.rb +9 -9
- data/lib/relaton_bib/document_relation_collection.rb +2 -2
- data/lib/relaton_bib/document_status.rb +2 -2
- data/lib/relaton_bib/hash_converter.rb +8 -2
- data/lib/relaton_bib/series.rb +1 -1
- data/lib/relaton_bib/technical_committee.rb +2 -4
- data/lib/relaton_bib/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af4361f2c87e045e86e3ca8dd81e4e729f88598476daf14be487d8d5972bb9c8
|
4
|
+
data.tar.gz: 962832013669c49bd25b813d003f454a552d7427b45774a1e936c2146f31c391
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cee39b14e0fe58a1db12205f3294144103c46fe8e82cf48a81c95195952d9130d999e5f8bb809ce2a500100d05fa3692d2bbf19a341598c37304f86a4f2d077c
|
7
|
+
data.tar.gz: afd5a003dc908a9bc895269ff4e3d0ca46762c16f7c3ec7d4007f86b35d150f3251994e9ee3dffd63095fe6fba75607be5ef461903064c408cbbb91230a02895
|
@@ -251,7 +251,10 @@ module RelatonBib
|
|
251
251
|
# "front/author[not(@surname)][not(@fullname)]/organization",
|
252
252
|
# ).map do |org|
|
253
253
|
org = contrib.at("./organization")
|
254
|
-
|
254
|
+
orgname = org.text.strip
|
255
|
+
return if orgname.empty?
|
256
|
+
|
257
|
+
name = ORGNAMES[orgname] || orgname
|
255
258
|
{ entity: new_org(name, org[:abbrev]), role: [contributor_role(contrib)] }
|
256
259
|
# end
|
257
260
|
end
|
@@ -59,8 +59,8 @@ module RelatonBib
|
|
59
59
|
# @param count [Integer] number of contributors
|
60
60
|
# 2return [String]
|
61
61
|
def to_asciibib(prefix = "", count = 1)
|
62
|
-
pref = prefix.empty? ? prefix : prefix
|
63
|
-
out = count > 1 ? "#{prefix}::\n" : ""
|
62
|
+
pref = prefix.empty? ? prefix : "#{prefix}."
|
63
|
+
out = count > 1 ? "#{prefix}.role::\n" : ""
|
64
64
|
description.each do |d|
|
65
65
|
out += d.to_asciibib "#{pref}role.description", description.size
|
66
66
|
end
|
@@ -46,12 +46,12 @@ module RelatonBib
|
|
46
46
|
|
47
47
|
# @return [Hash]
|
48
48
|
def to_hash # rubocop:disable Metrics/AbcSize
|
49
|
-
hash = {}
|
50
|
-
hash["street"] = street if street&.any?
|
51
|
-
hash["city"] = city
|
52
|
-
hash["state"] = state if state
|
53
|
-
hash["country"] = country
|
54
|
-
hash["postcode"] = postcode if postcode
|
49
|
+
hash = { "address" => {} }
|
50
|
+
hash["address"]["street"] = street if street&.any?
|
51
|
+
hash["address"]["city"] = city
|
52
|
+
hash["address"]["state"] = state if state
|
53
|
+
hash["address"]["country"] = country
|
54
|
+
hash["address"]["postcode"] = postcode if postcode
|
55
55
|
hash
|
56
56
|
end
|
57
57
|
|
@@ -92,7 +92,7 @@ module RelatonBib
|
|
92
92
|
|
93
93
|
# @return [Hash]
|
94
94
|
def to_hash
|
95
|
-
{
|
95
|
+
{ type => value }
|
96
96
|
end
|
97
97
|
|
98
98
|
# @param prefix [String]
|
@@ -101,8 +101,8 @@ module RelatonBib
|
|
101
101
|
def to_asciibib(prefix = "", count = 1)
|
102
102
|
pref = prefix.empty? ? prefix : "#{prefix}."
|
103
103
|
out = count > 1 ? "#{pref}contact::\n" : ""
|
104
|
-
out += "#{pref}contact.type:: #{type}\n"
|
105
|
-
out += "#{pref}contact
|
104
|
+
# out += "#{pref}contact.type:: #{type}\n"
|
105
|
+
out += "#{pref}contact.#{type}:: #{value}\n"
|
106
106
|
out
|
107
107
|
end
|
108
108
|
end
|
@@ -6,7 +6,7 @@ module RelatonBib
|
|
6
6
|
extend Forwardable
|
7
7
|
|
8
8
|
def_delegators :@array, :<<, :[], :first, :last, :empty?, :any?, :size,
|
9
|
-
:each, :detect, :map, :reduce, :length
|
9
|
+
:each, :detect, :map, :reduce, :length, :unshift
|
10
10
|
|
11
11
|
# @param relation [Array<RelatonBib::DocumentRelation, Hash>]
|
12
12
|
# @option relation [String] :type
|
@@ -32,7 +32,7 @@ module RelatonBib
|
|
32
32
|
# @param prefix [String]
|
33
33
|
# @return [String]
|
34
34
|
def to_asciibib(prefix = "")
|
35
|
-
pref = prefix.empty? ? "relation" : prefix
|
35
|
+
pref = prefix.empty? ? "relation" : "#{prefix}.relation"
|
36
36
|
out = ""
|
37
37
|
@array.each do |r|
|
38
38
|
out += size > 1 ? "#{pref}::\n" : ""
|
@@ -56,8 +56,8 @@ module RelatonBib
|
|
56
56
|
def stage_new(stg)
|
57
57
|
case stg
|
58
58
|
when Stage then stg
|
59
|
-
when Hash then Stage.new(**stg)
|
60
|
-
when String then Stage.new(value: stg)
|
59
|
+
when Hash then self.class::Stage.new(**stg)
|
60
|
+
when String then self.class::Stage.new(value: stg)
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
@@ -279,13 +279,19 @@ module RelatonBib
|
|
279
279
|
return [] unless entity[:contact]
|
280
280
|
|
281
281
|
RelatonBib.array(entity[:contact]).map do |a|
|
282
|
-
if a[:city] || a[:country]
|
282
|
+
if a[:city] || a[:country] # it's for old version compatibility, should be removed in the future
|
283
283
|
RelatonBib::Address.new(
|
284
284
|
street: Array(a[:street]), city: a[:city], postcode: a[:postcode],
|
285
285
|
country: a[:country], state: a[:state]
|
286
286
|
)
|
287
|
-
|
287
|
+
elsif a[:address]
|
288
|
+
a[:address][:street] = RelatonBib.array(a[:address][:street])
|
289
|
+
RelatonBib::Address.new(**a[:address])
|
290
|
+
elsif a[:type] # it's for old version compatibility, should be removed in the future
|
288
291
|
RelatonBib::Contact.new(type: a[:type], value: a[:value])
|
292
|
+
else
|
293
|
+
type, value = a.flatten
|
294
|
+
RelatonBib::Contact.new(type: type.to_s, value: value)
|
289
295
|
end
|
290
296
|
end
|
291
297
|
end
|
data/lib/relaton_bib/series.rb
CHANGED
@@ -37,7 +37,7 @@ module RelatonBib
|
|
37
37
|
# @param run [String, nil]
|
38
38
|
def initialize(**args)
|
39
39
|
unless args[:title].is_a?(RelatonBib::TypedTitleString)
|
40
|
-
raise ArgumentError, "argument `title` should present"
|
40
|
+
raise ArgumentError, "argument `title` should present in series"
|
41
41
|
end
|
42
42
|
|
43
43
|
# if args[:type] && !TYPES.include?(args[:type])
|
@@ -12,9 +12,7 @@ module RelatonBib
|
|
12
12
|
|
13
13
|
# @param builder [Nokogiri::XML::Builder]
|
14
14
|
def to_xml(builder)
|
15
|
-
builder.send
|
16
|
-
workgroup.to_xml b
|
17
|
-
end
|
15
|
+
builder.send(:"technical-committee") { |b| workgroup.to_xml b }
|
18
16
|
end
|
19
17
|
|
20
18
|
# @return [Hash]
|
@@ -26,7 +24,7 @@ module RelatonBib
|
|
26
24
|
# @param count [Integer] number of technical committees
|
27
25
|
# @return [String]
|
28
26
|
def to_asciibib(prefix = "", count = 1)
|
29
|
-
pref = prefix.empty? ? prefix : prefix
|
27
|
+
pref = prefix.empty? ? prefix : "#{prefix}."
|
30
28
|
pref += "technical_committee"
|
31
29
|
out = count > 1 ? "#{pref}::\n" : ""
|
32
30
|
out += workgroup.to_asciibib pref
|
data/lib/relaton_bib/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-bib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.12.
|
4
|
+
version: 1.12.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-07-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: byebug
|