relaton-nist 1.2.2 → 1.3.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: e37bb40effbc27c40ce57904429d2f12d7aac6dfa50bc5acfab0e5f98bebf526
4
- data.tar.gz: '095ce08a137c804dc88df5d465fbf2a43180dc8b195c8db50ebe5168ce23d025'
3
+ metadata.gz: dac2975c8efc8f3fb1fe8720fb852daba9bd66fb0e7bfc5fd87e24b69ed08ff1
4
+ data.tar.gz: 84503272191f86d904c947bbe6143c4363bc5fe03d0bb4f40b56162ef45f6c7d
5
5
  SHA512:
6
- metadata.gz: f69913864ef1c4331a952430cefb2bf8eeebab49e60bb75bbd2a3fc1d44df33bb12ed4096c73e2a39eece18708067adc1ac3b0a6ec44db68bce6966d8e1301f9
7
- data.tar.gz: a5a254e8bc1d9ba8c78a1174b3e89641a937235cce439a2a488be86604229bf38022c8b809629f10437e38b88a7039bd83f2072c2cbf8dd9120aa3800ea98ce1
6
+ metadata.gz: b82763b595daf55b2d09643804f5caf2351e11f8de4f1e61b0c8f98273770da35aaa4161209ad21a137e04dbfc35fa6cc8ff14f9f15ad2e7c450e2e8bcb7e9a2
7
+ data.tar.gz: 23f6829e141eb6b2f3f90f23de5b6f8b731b8659060ca7459599727ff5652368f8f8970a1234b0c551ffd40321b1a99e4a9e212b84669c803e4483f0eba079ad
@@ -29,4 +29,5 @@ jobs:
29
29
  bundle install --jobs 4 --retry 3
30
30
  - name: Run specs
31
31
  run: |
32
+ unset JAVA_TOOL_OPTIONS
32
33
  bundle exec rake
@@ -5,6 +5,6 @@
5
5
  inherit_from:
6
6
  - https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
7
7
  AllCops:
8
- TargetRubyVersion: 2.3
8
+ TargetRubyVersion: 2.4
9
9
  Rails:
10
- Enabled: true
10
+ Enabled: false
@@ -34,5 +34,16 @@ module RelatonNist
34
34
  hash["extended"] = extended.to_s if extended
35
35
  hash
36
36
  end
37
+
38
+ # @param prefix [String]
39
+ # @return [String]
40
+ def to_asciibib(prefix)
41
+ pref = prefix.empty? ? prefix : prefix + "."
42
+ pref += "commentperiod"
43
+ out = "#{pref}.from:: #{from}\n"
44
+ out += "#{pref}.to:: #{to}\n" if to
45
+ out += "#{pref}.extended:: #{extended}\n" if extended
46
+ out
47
+ end
37
48
  end
38
49
  end
@@ -83,5 +83,13 @@ module RelatonNist
83
83
  hash["commentperiod"] = commentperiod.to_hash if commentperiod
84
84
  hash
85
85
  end
86
+
87
+ # @param prefix [String]
88
+ # @return [String]
89
+ def to_asciibib(prefix = "")
90
+ out = super
91
+ out += commentperiod.to_asciibib prefix if commentperiod
92
+ out
93
+ end
86
94
  end
87
95
  end
@@ -1,3 +1,3 @@
1
1
  module RelatonNist
2
- VERSION = "1.2.2".freeze
2
+ VERSION = "1.3.0".freeze
3
3
  end
@@ -1,28 +1,25 @@
1
1
  module RelatonNist
2
2
  class XMLParser < RelatonBib::XMLParser
3
3
  class << self
4
- def from_xml(xml)
5
- doc = Nokogiri::XML xml
6
- doc.remove_namespaces!
7
- nistitem = doc.at("/bibitem|/bibdata")
8
- if nistitem
9
- NistBibliographicItem.new(item_data(nistitem))
10
- elsif
11
- warn "[relaton-nist] can't find bibitem or bibdata element in the XML"
12
- end
13
- end
14
-
15
4
  private
16
5
 
17
- def item_data(nistitem)
6
+ # @param intem [Nokogiri::XML::Document]
7
+ # @return [Hash]
8
+ def item_data(item)
18
9
  data = super
19
- ext = nistitem.at "./ext"
10
+ ext = item.at "./ext"
20
11
  return data unless ext
21
12
 
22
13
  data[:commentperiod] = fetch_commentperiod(ext)
23
14
  data
24
15
  end
25
16
 
17
+ # @param item_hash [Hash]
18
+ # @return [RelatonNist::NistBibliographicItem]
19
+ def bib_item(item_hash)
20
+ NistBibliographicItem.new item_hash
21
+ end
22
+
26
23
  def fetch_status(item)
27
24
  status = item.at "./status"
28
25
  return unless status
@@ -47,15 +44,7 @@ module RelatonNist
47
44
  # @param item [Nokogiri::XML::Element]
48
45
  # @return [Array<RelatonBib::DocumentRelation>]
49
46
  def fetch_relations(item)
50
- item.xpath("./relation").map do |rel|
51
- DocumentRelation.new(
52
- type: rel[:type]&.empty? ? nil : rel[:type],
53
- description: relation_description(rel),
54
- bibitem: bib_item(item_data(rel.at("./bibitem"))),
55
- locality: localities(rel),
56
- source_locality: source_localities(rel),
57
- )
58
- end
47
+ super item, DocumentRelation
59
48
  end
60
49
  end
61
50
  end
@@ -34,6 +34,6 @@ Gem::Specification.new do |spec|
34
34
  spec.add_development_dependency "vcr"
35
35
  spec.add_development_dependency "webmock"
36
36
 
37
- spec.add_dependency "relaton-bib", "~> 1.2.0"
37
+ spec.add_dependency "relaton-bib", "~> 1.3.0"
38
38
  spec.add_dependency "rubyzip"
39
39
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-nist
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 1.3.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-06-29 00:00:00.000000000 Z
11
+ date: 2020-08-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: debase
@@ -156,14 +156,14 @@ dependencies:
156
156
  requirements:
157
157
  - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: 1.2.0
159
+ version: 1.3.0
160
160
  type: :runtime
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
164
  - - "~>"
165
165
  - !ruby/object:Gem::Version
166
- version: 1.2.0
166
+ version: 1.3.0
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: rubyzip
169
169
  requirement: !ruby/object:Gem::Requirement