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 +4 -4
- data/.github/workflows/ubuntu.yml +1 -0
- data/.rubocop.yml +2 -2
- data/lib/relaton_nist/comment_period.rb +11 -0
- data/lib/relaton_nist/nist_bibliographic_item.rb +8 -0
- data/lib/relaton_nist/version.rb +1 -1
- data/lib/relaton_nist/xml_parser.rb +11 -22
- data/relaton_nist.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dac2975c8efc8f3fb1fe8720fb852daba9bd66fb0e7bfc5fd87e24b69ed08ff1
|
4
|
+
data.tar.gz: 84503272191f86d904c947bbe6143c4363bc5fe03d0bb4f40b56162ef45f6c7d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b82763b595daf55b2d09643804f5caf2351e11f8de4f1e61b0c8f98273770da35aaa4161209ad21a137e04dbfc35fa6cc8ff14f9f15ad2e7c450e2e8bcb7e9a2
|
7
|
+
data.tar.gz: 23f6829e141eb6b2f3f90f23de5b6f8b731b8659060ca7459599727ff5652368f8f8970a1234b0c551ffd40321b1a99e4a9e212b84669c803e4483f0eba079ad
|
data/.rubocop.yml
CHANGED
@@ -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
|
data/lib/relaton_nist/version.rb
CHANGED
@@ -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
|
-
|
6
|
+
# @param intem [Nokogiri::XML::Document]
|
7
|
+
# @return [Hash]
|
8
|
+
def item_data(item)
|
18
9
|
data = super
|
19
|
-
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
|
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
|
data/relaton_nist.gemspec
CHANGED
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.
|
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-
|
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.
|
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.
|
166
|
+
version: 1.3.0
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
168
|
name: rubyzip
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|