relaton-nist 1.7.2 → 1.9.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/rake.yml +36 -0
- data/.rubocop.yml +1 -1
- data/README.adoc +1 -5
- data/grammars/basicdoc.rng +165 -20
- data/grammars/biblio.rng +5 -6
- data/grammars/isodoc.rng +532 -16
- data/grammars/nist.rng +9 -0
- data/grammars/reqt.rng +31 -2
- data/lib/relaton_nist/hash_converter.rb +3 -3
- data/lib/relaton_nist/hit_collection.rb +9 -10
- data/lib/relaton_nist/nist_bibliographic_item.rb +7 -0
- data/lib/relaton_nist/processor.rb +1 -2
- data/lib/relaton_nist/version.rb +1 -1
- data/lib/relaton_nist/xml_parser.rb +1 -1
- data/relaton_nist.gemspec +2 -4
- metadata +7 -37
- data/.github/workflows/macos.yml +0 -34
- data/.github/workflows/ubuntu.yml +0 -33
- data/.github/workflows/windows.yml +0 -35
data/grammars/nist.rng
CHANGED
@@ -65,6 +65,9 @@
|
|
65
65
|
<optional>
|
66
66
|
<ref name="doctype"/>
|
67
67
|
</optional>
|
68
|
+
<optional>
|
69
|
+
<ref name="docsubtype"/>
|
70
|
+
</optional>
|
68
71
|
<optional>
|
69
72
|
<ref name="editorialgroup"/>
|
70
73
|
</optional>
|
@@ -194,6 +197,9 @@
|
|
194
197
|
<zeroOrMore>
|
195
198
|
<ref name="termdocsource"/>
|
196
199
|
</zeroOrMore>
|
200
|
+
<optional>
|
201
|
+
<ref name="misccontainer"/>
|
202
|
+
</optional>
|
197
203
|
<optional>
|
198
204
|
<ref name="boilerplate"/>
|
199
205
|
</optional>
|
@@ -207,6 +213,9 @@
|
|
207
213
|
<optional>
|
208
214
|
<ref name="bibliography"/>
|
209
215
|
</optional>
|
216
|
+
<zeroOrMore>
|
217
|
+
<ref name="indexsect"/>
|
218
|
+
</zeroOrMore>
|
210
219
|
</element>
|
211
220
|
</define>
|
212
221
|
</grammar>
|
data/grammars/reqt.rng
CHANGED
@@ -30,15 +30,34 @@
|
|
30
30
|
<data type="boolean"/>
|
31
31
|
</attribute>
|
32
32
|
</optional>
|
33
|
+
<optional>
|
34
|
+
<attribute name="number"/>
|
35
|
+
</optional>
|
33
36
|
<optional>
|
34
37
|
<attribute name="subsequence"/>
|
35
38
|
</optional>
|
39
|
+
<optional>
|
40
|
+
<attribute name="keep-with-next">
|
41
|
+
<data type="boolean"/>
|
42
|
+
</attribute>
|
43
|
+
</optional>
|
44
|
+
<optional>
|
45
|
+
<attribute name="keep-lines-together">
|
46
|
+
<data type="boolean"/>
|
47
|
+
</attribute>
|
48
|
+
</optional>
|
36
49
|
<attribute name="id">
|
37
50
|
<data type="ID"/>
|
38
51
|
</attribute>
|
39
52
|
<optional>
|
40
53
|
<attribute name="filename"/>
|
41
54
|
</optional>
|
55
|
+
<optional>
|
56
|
+
<attribute name="model"/>
|
57
|
+
</optional>
|
58
|
+
<optional>
|
59
|
+
<attribute name="type"/>
|
60
|
+
</optional>
|
42
61
|
<optional>
|
43
62
|
<ref name="reqtitle"/>
|
44
63
|
</optional>
|
@@ -48,9 +67,9 @@
|
|
48
67
|
<optional>
|
49
68
|
<ref name="subject"/>
|
50
69
|
</optional>
|
51
|
-
<
|
70
|
+
<zeroOrMore>
|
52
71
|
<ref name="reqinherit"/>
|
53
|
-
</
|
72
|
+
</zeroOrMore>
|
54
73
|
<zeroOrMore>
|
55
74
|
<ref name="classification"/>
|
56
75
|
</zeroOrMore>
|
@@ -135,6 +154,16 @@
|
|
135
154
|
<data type="boolean"/>
|
136
155
|
</attribute>
|
137
156
|
</optional>
|
157
|
+
<optional>
|
158
|
+
<attribute name="keep-with-next">
|
159
|
+
<data type="boolean"/>
|
160
|
+
</attribute>
|
161
|
+
</optional>
|
162
|
+
<optional>
|
163
|
+
<attribute name="keep-lines-together">
|
164
|
+
<data type="boolean"/>
|
165
|
+
</attribute>
|
166
|
+
</optional>
|
138
167
|
<oneOrMore>
|
139
168
|
<ref name="BasicBlock"/>
|
140
169
|
</oneOrMore>
|
@@ -18,13 +18,13 @@ module RelatonNist
|
|
18
18
|
# @param item_hash [Hash]
|
19
19
|
# @return [RelatonNist::NistBibliographicItem]
|
20
20
|
def bib_item(item_hash)
|
21
|
-
NistBibliographicItem.new item_hash
|
21
|
+
NistBibliographicItem.new **item_hash
|
22
22
|
end
|
23
23
|
|
24
24
|
def commentperiod_hash_to_bib(ret)
|
25
25
|
return unless ret[:commentperiod]
|
26
26
|
|
27
|
-
ret[:commentperiod] = CommentPeriod.new ret[:commentperiod]
|
27
|
+
ret[:commentperiod] = CommentPeriod.new **ret[:commentperiod]
|
28
28
|
end
|
29
29
|
|
30
30
|
# @param ret [Hash]
|
@@ -32,7 +32,7 @@ module RelatonNist
|
|
32
32
|
super
|
33
33
|
return unless ret[:relation]
|
34
34
|
|
35
|
-
ret[:relation] = ret[:relation].map { |r| DocumentRelation.new r }
|
35
|
+
ret[:relation] = ret[:relation].map { |r| DocumentRelation.new **r }
|
36
36
|
|
37
37
|
# ret[:relation] = array(ret[:relation])
|
38
38
|
# ret[:relation]&.each do |r|
|
@@ -18,18 +18,18 @@ module RelatonNist
|
|
18
18
|
# @param year [String]
|
19
19
|
# @param opts [Hash]
|
20
20
|
# @option opts [String] :stage
|
21
|
-
def initialize(ref_nbr, year = nil, opts = {}) # rubocop:disable Metrics/AbcSize
|
21
|
+
def initialize(ref_nbr, year = nil, opts = {}) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
|
22
22
|
super ref_nbr, year
|
23
23
|
|
24
|
-
/(?<docid>(SP|FIPS)\s[0-9-]+)/ =~ text
|
24
|
+
/(?<docid>(?:SP|FIPS)\s[0-9-]+)/ =~ text
|
25
25
|
@array = docid ? from_json(docid, **opts) : from_csrc(**opts)
|
26
26
|
@array = from_csrc(**opts) unless @array.any?
|
27
27
|
|
28
28
|
@array.sort! do |a, b|
|
29
|
-
if a.sort_value
|
30
|
-
b.sort_value - a.sort_value
|
31
|
-
else
|
29
|
+
if a.sort_value == b.sort_value
|
32
30
|
(b.hit[:release_date] - a.hit[:release_date]).to_i
|
31
|
+
else
|
32
|
+
b.sort_value - a.sort_value
|
33
33
|
end
|
34
34
|
end
|
35
35
|
end
|
@@ -95,14 +95,13 @@ module RelatonNist
|
|
95
95
|
# @param stage [String]
|
96
96
|
# @return [Array<Hach>]
|
97
97
|
def select_data(docid, **opts) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength,Metrics/PerceivedComplexity
|
98
|
-
# ref = docid.sub(/(?<=\d{3}-\d{2})r(\d+)/, ' Rev. \1')
|
99
98
|
d = Date.strptime year, "%Y" if year
|
100
|
-
|
99
|
+
statuses = %w[draft-public draft-prelim]
|
101
100
|
data.select do |doc|
|
102
101
|
next unless match_year?(doc, d)
|
103
102
|
|
104
103
|
if /PD/.match? opts[:stage]
|
105
|
-
next unless
|
104
|
+
next unless statuses.include? doc["status"]
|
106
105
|
else
|
107
106
|
next unless doc["status"] == "final"
|
108
107
|
end
|
@@ -134,8 +133,8 @@ module RelatonNist
|
|
134
133
|
#
|
135
134
|
# @prarm ctime [Time, NilClass]
|
136
135
|
def fetch_data(ctime)
|
137
|
-
resp = OpenURI.open_uri("#{PUBS_EXPORT}.meta")
|
138
|
-
if !ctime || ctime <
|
136
|
+
# resp = OpenURI.open_uri("#{PUBS_EXPORT}.meta")
|
137
|
+
if !ctime || ctime < OpenURI.open_uri("#{PUBS_EXPORT}.meta").last_modified
|
139
138
|
@data = nil
|
140
139
|
uri_open = URI.method(:open) || Kernel.method(:open)
|
141
140
|
FileUtils.mkdir_p DATAFILEDIR unless Dir.exist? DATAFILEDIR
|
@@ -63,6 +63,13 @@ module RelatonNist
|
|
63
63
|
super
|
64
64
|
end
|
65
65
|
|
66
|
+
# @param hash [Hash]
|
67
|
+
# @return [RelatonNist::GbBibliographicItem]
|
68
|
+
def self.from_hash(hash)
|
69
|
+
item_hash = RelatonNist::HashConverter.hash_to_bib(hash)
|
70
|
+
new **item_hash
|
71
|
+
end
|
72
|
+
|
66
73
|
# @param opts [Hash]
|
67
74
|
# @option opts [Nokogiri::XML::Builder] :builder XML builder
|
68
75
|
# @option opts [Boolean] :bibdata
|
@@ -26,8 +26,7 @@ module RelatonNist
|
|
26
26
|
# @param hash [Hash]
|
27
27
|
# @return [RelatonNist::GbBibliographicItem]
|
28
28
|
def hash_to_bib(hash)
|
29
|
-
|
30
|
-
::RelatonNist::NistBibliographicItem.new item_hash
|
29
|
+
::RelatonNist::NistBibliographicItem.from_hash hash
|
31
30
|
end
|
32
31
|
|
33
32
|
# Returns hash of XML grammar
|
data/lib/relaton_nist/version.rb
CHANGED
data/relaton_nist.gemspec
CHANGED
@@ -21,19 +21,17 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.bindir = "exe"
|
22
22
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
23
|
spec.require_paths = ["lib"]
|
24
|
-
spec.required_ruby_version = Gem::Requirement.new(">= 2.
|
24
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
|
25
25
|
|
26
|
-
spec.add_development_dependency "debase"
|
27
26
|
spec.add_development_dependency "equivalent-xml", "~> 0.6"
|
28
27
|
spec.add_development_dependency "pry-byebug"
|
29
28
|
spec.add_development_dependency "rake", "~> 10.0"
|
30
29
|
spec.add_development_dependency "rspec", "~> 3.0"
|
31
|
-
spec.add_development_dependency "ruby-debug-ide"
|
32
30
|
spec.add_development_dependency "ruby-jing"
|
33
31
|
spec.add_development_dependency "simplecov"
|
34
32
|
spec.add_development_dependency "vcr"
|
35
33
|
spec.add_development_dependency "webmock"
|
36
34
|
|
37
|
-
spec.add_dependency "relaton-bib", "~> 1.
|
35
|
+
spec.add_dependency "relaton-bib", "~> 1.9.0"
|
38
36
|
spec.add_dependency "rubyzip"
|
39
37
|
end
|
metadata
CHANGED
@@ -1,29 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-nist
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.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:
|
11
|
+
date: 2021-08-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: debase
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: equivalent-xml
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,20 +66,6 @@ dependencies:
|
|
80
66
|
- - "~>"
|
81
67
|
- !ruby/object:Gem::Version
|
82
68
|
version: '3.0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: ruby-debug-ide
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ">="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
97
69
|
- !ruby/object:Gem::Dependency
|
98
70
|
name: ruby-jing
|
99
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -156,14 +128,14 @@ dependencies:
|
|
156
128
|
requirements:
|
157
129
|
- - "~>"
|
158
130
|
- !ruby/object:Gem::Version
|
159
|
-
version: 1.
|
131
|
+
version: 1.9.0
|
160
132
|
type: :runtime
|
161
133
|
prerelease: false
|
162
134
|
version_requirements: !ruby/object:Gem::Requirement
|
163
135
|
requirements:
|
164
136
|
- - "~>"
|
165
137
|
- !ruby/object:Gem::Version
|
166
|
-
version: 1.
|
138
|
+
version: 1.9.0
|
167
139
|
- !ruby/object:Gem::Dependency
|
168
140
|
name: rubyzip
|
169
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -185,9 +157,7 @@ executables: []
|
|
185
157
|
extensions: []
|
186
158
|
extra_rdoc_files: []
|
187
159
|
files:
|
188
|
-
- ".github/workflows/
|
189
|
-
- ".github/workflows/ubuntu.yml"
|
190
|
-
- ".github/workflows/windows.yml"
|
160
|
+
- ".github/workflows/rake.yml"
|
191
161
|
- ".gitignore"
|
192
162
|
- ".rspec"
|
193
163
|
- ".rubocop.yml"
|
@@ -229,14 +199,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
229
199
|
requirements:
|
230
200
|
- - ">="
|
231
201
|
- !ruby/object:Gem::Version
|
232
|
-
version: 2.
|
202
|
+
version: 2.5.0
|
233
203
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
234
204
|
requirements:
|
235
205
|
- - ">="
|
236
206
|
- !ruby/object:Gem::Version
|
237
207
|
version: '0'
|
238
208
|
requirements: []
|
239
|
-
rubygems_version: 3.
|
209
|
+
rubygems_version: 3.2.3
|
240
210
|
signing_key:
|
241
211
|
specification_version: 4
|
242
212
|
summary: 'RelatonNist: retrive NIST standards.'
|
data/.github/workflows/macos.yml
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
# Auto-generated by Cimas: Do not edit it manually!
|
2
|
-
# See https://github.com/metanorma/cimas
|
3
|
-
name: macos
|
4
|
-
|
5
|
-
on:
|
6
|
-
push:
|
7
|
-
branches: [ master ]
|
8
|
-
pull_request:
|
9
|
-
branches: [ '**' ]
|
10
|
-
|
11
|
-
jobs:
|
12
|
-
test-macos:
|
13
|
-
name: Test on Ruby ${{ matrix.ruby }} macOS
|
14
|
-
runs-on: macos-latest
|
15
|
-
strategy:
|
16
|
-
fail-fast: false
|
17
|
-
matrix:
|
18
|
-
ruby: [ '2.6', '2.5', '2.4' ]
|
19
|
-
steps:
|
20
|
-
- uses: actions/checkout@master
|
21
|
-
- name: Use Ruby
|
22
|
-
uses: actions/setup-ruby@v1
|
23
|
-
with:
|
24
|
-
ruby-version: ${{ matrix.ruby }}
|
25
|
-
architecture: 'x64'
|
26
|
-
- name: Update gems
|
27
|
-
run: |
|
28
|
-
sudo gem install bundler --force
|
29
|
-
ruby -v | grep 2.5 && bundle config set build.debase --with-cflags="-Wno-error=implicit-function-declaration"
|
30
|
-
ruby -v | grep 2.5 && bundle config set build.ruby-debug-ide --with-cflags="-Wno-error=implicit-function-declaration"
|
31
|
-
bundle install --jobs 4 --retry 3
|
32
|
-
- name: Run specs
|
33
|
-
run: |
|
34
|
-
bundle exec rake
|
@@ -1,33 +0,0 @@
|
|
1
|
-
# Auto-generated by Cimas: Do not edit it manually!
|
2
|
-
# See https://github.com/metanorma/cimas
|
3
|
-
name: ubuntu
|
4
|
-
|
5
|
-
on:
|
6
|
-
push:
|
7
|
-
branches: [ master ]
|
8
|
-
pull_request:
|
9
|
-
branches: [ '**' ]
|
10
|
-
|
11
|
-
jobs:
|
12
|
-
test-linux:
|
13
|
-
name: Test on Ruby ${{ matrix.ruby }} Ubuntu
|
14
|
-
runs-on: ubuntu-latest
|
15
|
-
strategy:
|
16
|
-
fail-fast: false
|
17
|
-
matrix:
|
18
|
-
ruby: [ '2.6', '2.5', '2.4' ]
|
19
|
-
steps:
|
20
|
-
- uses: actions/checkout@master
|
21
|
-
- name: Use Ruby
|
22
|
-
uses: actions/setup-ruby@v1
|
23
|
-
with:
|
24
|
-
ruby-version: ${{ matrix.ruby }}
|
25
|
-
architecture: 'x64'
|
26
|
-
- name: Update gems
|
27
|
-
run: |
|
28
|
-
gem install bundler
|
29
|
-
bundle install --jobs 4 --retry 3
|
30
|
-
- name: Run specs
|
31
|
-
run: |
|
32
|
-
unset JAVA_TOOL_OPTIONS
|
33
|
-
bundle exec rake
|
@@ -1,35 +0,0 @@
|
|
1
|
-
# Auto-generated by Cimas: Do not edit it manually!
|
2
|
-
# See https://github.com/metanorma/cimas
|
3
|
-
name: windows
|
4
|
-
|
5
|
-
on:
|
6
|
-
push:
|
7
|
-
branches: [ master ]
|
8
|
-
pull_request:
|
9
|
-
branches: [ '**' ]
|
10
|
-
|
11
|
-
jobs:
|
12
|
-
test-windows:
|
13
|
-
name: Test on Ruby ${{ matrix.ruby }} Windows
|
14
|
-
runs-on: windows-latest
|
15
|
-
strategy:
|
16
|
-
fail-fast: false
|
17
|
-
matrix:
|
18
|
-
ruby: [ '2.6', '2.5', '2.4' ]
|
19
|
-
steps:
|
20
|
-
- uses: actions/checkout@master
|
21
|
-
- name: Use Ruby
|
22
|
-
uses: actions/setup-ruby@v1
|
23
|
-
with:
|
24
|
-
ruby-version: ${{ matrix.ruby }}
|
25
|
-
architecture: 'x64'
|
26
|
-
- name: Update gems
|
27
|
-
shell: pwsh
|
28
|
-
run: |
|
29
|
-
gem install bundler
|
30
|
-
bundle config --local path vendor/bundle
|
31
|
-
bundle update
|
32
|
-
bundle install --jobs 4 --retry 3
|
33
|
-
- name: Run specs
|
34
|
-
run: |
|
35
|
-
bundle exec rake
|