relaton-iso-bib 0.8.1 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a3acae9aa049444f9d5a9eb512612b1d085e888e6a8bd32088a2d5137e68fe26
4
- data.tar.gz: 94fc512c1479bf2fff43fd50af5162c4519e96f697f86103c75c9ea50f804b5a
3
+ metadata.gz: 37a38b9000e8034daff4b1fab3d50864d3108d702f295680e0972b8a818654ab
4
+ data.tar.gz: d3ab1f5959c9163be823a9a949ba106ede91b7685bb3b9f7d3b29da31827aa72
5
5
  SHA512:
6
- metadata.gz: dcf76383c923649831cb0b390aa679c45da075d57b77c7c3e6cbe5cb18d1df768028134da6c96bd8518d86a50b5a69c7f3eb5ed89644dae5d7052a212f45dd0b
7
- data.tar.gz: 3ca5df2eba1b03ad1c2b8bc264e660df2f10f4196ab52d2e641fe9aa89e442877adb03c86eb939de49e8e8e27b1b5fdc35d8bce26a9515f8f58f5a1057a767a8
6
+ metadata.gz: 73a12f687a93b9b2b7bd574e7d1b8ece381d3c20352d77e9b02e079ec6edd7932773eb96382cdf035eca96be315f903c7e9cf4005049912dc4058a4746484abe
7
+ data.tar.gz: 7abf89d3b3181c6f055d87f5c82fdb303047e7b137f975bacee2c8b0411f091242143bbdddaf2e5cf49cee00b1af3119658eb26960bb0883891fca87994fdb35
@@ -2,7 +2,6 @@
2
2
 
3
3
  require "nokogiri"
4
4
  require "isoics"
5
- # require "deep_clone"
6
5
  require "relaton_bib"
7
6
  require "relaton_iso_bib/typed_title_string"
8
7
  require "relaton_iso_bib/editorial_group"
@@ -44,6 +43,9 @@ module RelatonIsoBib
44
43
  # @return [Array<RelatonIsoBib::Ics>]
45
44
  attr_reader :ics
46
45
 
46
+ # @return [TrueClass, FalseClass, NilClass]
47
+ attr_accessor :all_parts
48
+
47
49
  # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity
48
50
  # rubocop:disable Metrics/MethodLength, Metrics/PerceivedComplexity
49
51
 
@@ -156,9 +158,6 @@ module RelatonIsoBib
156
158
  @structuredidentifier = args[:structuredidentifier]
157
159
  @doctype ||= args[:doctype]
158
160
  @ics = args.fetch(:ics, []).map { |i| i.is_a?(Hash) ? Ics.new(i) : i }
159
- # @link = args.fetch(:link, []).map do |s|
160
- # s.is_a?(Hash) ? RelatonBib::TypedUri.new(s) : s
161
- # end
162
161
  @id_attribute = true
163
162
  end
164
163
  # rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity
@@ -172,23 +171,28 @@ module RelatonIsoBib
172
171
  def to_all_parts
173
172
  me = deep_clone
174
173
  me.disable_id_attribute
175
- @relation << RelatonBib::DocumentRelation.new(
176
- type: "instance", bibitem: me,
174
+ me.relation << RelatonBib::DocumentRelation.new(
175
+ type: "instance", bibitem: self,
177
176
  )
178
- @language.each do |l|
179
- @title.delete_if { |t| t.type == "title-part" }
180
- ttl = @title.select { |t| t.type != "main" && t.title.language.include?(l) }
177
+ me.language.each do |l|
178
+ me.title.delete_if { |t| t.type == "title-part" }
179
+ ttl = me.title.select { |t| t.type != "main" && t.title.language.include?(l) }
181
180
  tm_en = ttl.map { |t| t.title.content }.join " – "
182
- @title.detect { |t| t.type == "main" && t.title.language.include?(l) }&.title&.content = tm_en
181
+ me.title.detect { |t| t.type == "main" && t.title.language.include?(l) }&.title&.content = tm_en
183
182
  end
184
- @abstract = []
185
- @docidentifier.each(&:remove_part)
186
- @docidentifier.each(&:all_parts)
187
- @structuredidentifier.remove_part
188
- @structuredidentifier.all_parts
189
- @docidentifier.each &:remove_date
190
- @structuredidentifier&.remove_date
191
- @all_parts = true
183
+ me.abstract = []
184
+ me.docidentifier.each(&:remove_part)
185
+ me.docidentifier.each(&:all_parts)
186
+ me.structuredidentifier.remove_part
187
+ me.structuredidentifier.all_parts
188
+ me.docidentifier.each &:remove_date
189
+ me.structuredidentifier&.remove_date
190
+ me.all_parts = true
191
+ me
192
+ end
193
+
194
+ def abstract=(value)
195
+ @abstract = value
192
196
  end
193
197
 
194
198
  def deep_clone
@@ -202,13 +206,14 @@ module RelatonIsoBib
202
206
  # of the redacated document
203
207
  def to_most_recent_reference
204
208
  me = deep_clone
205
- me.disable_id_attribute
206
- @relation << RelatonBib::DocumentRelation.new(type: "instance", bibitem: me)
207
- @abstract = []
208
- @date = []
209
- @docidentifier.each &:remove_date
210
- @structuredidentifier&.remove_date
211
- @id&.sub! /-[12]\d\d\d/, ""
209
+ self.disable_id_attribute
210
+ me.relation << RelatonBib::DocumentRelation.new(type: "instance", bibitem: self)
211
+ me.abstract = []
212
+ me.date = []
213
+ me.docidentifier.each &:remove_date
214
+ me.structuredidentifier&.remove_date
215
+ me.id&.sub! /-[12]\d\d\d/, ""
216
+ me
212
217
  end
213
218
 
214
219
  # @param lang [String] language code Iso639
@@ -289,7 +294,7 @@ module RelatonIsoBib
289
294
  # @raise ArgumentError
290
295
  def check_doctype(doctype)
291
296
  if doctype && !self.class::TYPES.include?(doctype)
292
- warn "Invalid doctype: #{doctype}"
297
+ warn "[relaton-iso-bib] invalid doctype: #{doctype}"
293
298
  end
294
299
  end
295
300
 
@@ -1,6 +1,6 @@
1
1
  module RelatonIsoBib
2
2
  class TypedTitleString < RelatonBib::TypedTitleString
3
- TITLE_TYPES = %w[title-main title-intro title-part main].freeze
3
+ # TITLE_TYPES = %w[title-main title-intro title-part main].freeze
4
4
 
5
5
  # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
6
6
 
@@ -10,9 +10,9 @@ module RelatonIsoBib
10
10
  # @param language [String]
11
11
  # @param script [String]
12
12
  def initialize(**args)
13
- if args[:type] && !TITLE_TYPES.include?(args[:type])
14
- raise ArgumentError, %{The type #{args[:type]} is invalid.}
15
- end
13
+ # if args[:type] && !TITLE_TYPES.include?(args[:type])
14
+ # raise ArgumentError, %{The type #{args[:type]} is invalid.}
15
+ # end
16
16
 
17
17
  unless args[:title] || args[:content]
18
18
  raise ArgumentError, %{Keyword "title" or "content" should be passed.}
@@ -1,3 +1,3 @@
1
1
  module RelatonIsoBib
2
- VERSION = "0.8.1".freeze
2
+ VERSION = "0.9.0".freeze
3
3
  end
@@ -13,7 +13,7 @@ module RelatonIsoBib
13
13
  if isoitem
14
14
  IsoBibliographicItem.new item_data(isoitem)
15
15
  else
16
- warn "[relato-bib] can't find bibitem or bibdata element in the XML"
16
+ warn "[relato-iso-bib] can't find bibitem or bibdata element in the XML"
17
17
  end
18
18
  end
19
19
 
@@ -25,15 +25,15 @@ Gem::Specification.new do |spec|
25
25
  spec.require_paths = ["lib"]
26
26
  spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
27
27
 
28
+ spec.add_development_dependency "debase"
29
+ spec.add_development_dependency "equivalent-xml", "~> 0.6"
28
30
  spec.add_development_dependency "pry-byebug"
29
31
  spec.add_development_dependency "rake", "~> 10.0"
30
32
  spec.add_development_dependency "rspec", "~> 3.0"
31
- spec.add_development_dependency 'simplecov'
32
- spec.add_development_dependency "equivalent-xml", "~> 0.6"
33
33
  spec.add_development_dependency "ruby-debug-ide"
34
- spec.add_development_dependency "debase"
35
34
  spec.add_development_dependency "ruby-jing"
35
+ spec.add_development_dependency "simplecov"
36
36
 
37
37
  spec.add_dependency "isoics", "~> 0.1.6"
38
- spec.add_dependency "relaton-bib", "~>0.8.0"
38
+ spec.add_dependency "relaton-bib", "~> 0.9.0"
39
39
  end
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-iso-bib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-02-26 00:00:00.000000000 Z
11
+ date: 2020-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: pry-byebug
14
+ name: debase
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
@@ -25,61 +25,61 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: rake
28
+ name: equivalent-xml
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: '0.6'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '10.0'
40
+ version: '0.6'
41
41
  - !ruby/object:Gem::Dependency
42
- name: rspec
42
+ name: pry-byebug
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '3.0'
47
+ version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '3.0'
54
+ version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: simplecov
56
+ name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: '10.0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '0'
68
+ version: '10.0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: equivalent-xml
70
+ name: rspec
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '0.6'
75
+ version: '3.0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '0.6'
82
+ version: '3.0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: ruby-debug-ide
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -95,7 +95,7 @@ dependencies:
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
- name: debase
98
+ name: ruby-jing
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - ">="
@@ -109,7 +109,7 @@ dependencies:
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
- name: ruby-jing
112
+ name: simplecov
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - ">="
@@ -142,14 +142,14 @@ dependencies:
142
142
  requirements:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: 0.8.0
145
+ version: 0.9.0
146
146
  type: :runtime
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: 0.8.0
152
+ version: 0.9.0
153
153
  description: 'RelatonIsoBib: Ruby ISOXMLDOC impementation.'
154
154
  email:
155
155
  - open.source@ribose.com