relaton-nist 1.6.0 → 1.7.4
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 +46 -0
- data/README.adoc +37 -8
- data/grammars/isodoc.rng +14 -43
- data/grammars/nist.rng +1 -0
- data/lib/relaton_nist/hash_converter.rb +3 -3
- data/lib/relaton_nist/hit_collection.rb +5 -3
- data/lib/relaton_nist/nist_bibliographic_item.rb +7 -0
- data/lib/relaton_nist/nist_bibliography.rb +96 -13
- data/lib/relaton_nist/processor.rb +1 -2
- data/lib/relaton_nist/scrapper.rb +2 -1
- data/lib/relaton_nist/version.rb +1 -1
- data/lib/relaton_nist/xml_parser.rb +1 -1
- data/relaton_nist.gemspec +3 -3
- metadata +6 -36
- data/.github/workflows/macos.yml +0 -34
- data/.github/workflows/ubuntu.yml +0 -33
- data/.github/workflows/windows.yml +0 -35
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e3f5d2a6df121410526e937f065b269da4da79a07a1f5262a825f2e1a9ff6a79
|
4
|
+
data.tar.gz: 5c6bf3f1fae325da2888c3c4323ce1ef8d98c52bde46a124c5b88fd6b8490eeb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c4f9f739ea073f0fae94f9a8ec9a792d82f618221fd3a6ecc345e9020b59159f1ef723ed5b933e0754d162c7a6c7ac1f64a07640f6d849f0224a684bd5686a5b
|
7
|
+
data.tar.gz: e3085821ff86c2b50d4953e4330395c999674b1fec7c290b88140576b1179cfae56f684269a010e20647ab530814d959c7685489ec11c04a5e7aabff036573d8
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# Auto-generated by Cimas: Do not edit it manually!
|
2
|
+
# See https://github.com/metanorma/cimas
|
3
|
+
name: rake
|
4
|
+
|
5
|
+
on:
|
6
|
+
push:
|
7
|
+
branches: [ master, main ]
|
8
|
+
tags: [ v* ]
|
9
|
+
pull_request:
|
10
|
+
|
11
|
+
jobs:
|
12
|
+
rake:
|
13
|
+
name: Test on Ruby ${{ matrix.ruby }} ${{ matrix.os }}
|
14
|
+
runs-on: ${{ matrix.os }}
|
15
|
+
continue-on-error: ${{ matrix.experimental }}
|
16
|
+
strategy:
|
17
|
+
fail-fast: false
|
18
|
+
matrix:
|
19
|
+
ruby: [ '2.7', '2.6', '2.5', '2.4' ]
|
20
|
+
os: [ ubuntu-latest, windows-latest, macos-latest ]
|
21
|
+
experimental: [ false ]
|
22
|
+
include:
|
23
|
+
- ruby: '3.0'
|
24
|
+
os: 'ubuntu-latest'
|
25
|
+
experimental: true
|
26
|
+
- ruby: '3.0'
|
27
|
+
os: 'windows-latest'
|
28
|
+
experimental: true
|
29
|
+
- ruby: '3.0'
|
30
|
+
os: 'macos-latest'
|
31
|
+
experimental: true
|
32
|
+
steps:
|
33
|
+
- uses: actions/checkout@v2
|
34
|
+
with:
|
35
|
+
submodules: true
|
36
|
+
|
37
|
+
# https://github.com/ruby-debug/debase/issues/89#issuecomment-686827382
|
38
|
+
- if: matrix.os == 'macos-latest' && matrix.ruby == '2.5'
|
39
|
+
run: echo BUNDLE_BUILD__DEBASE="--with-cflags=\"-Wno-error=implicit-function-declaration\"" >> $GITHUB_ENV
|
40
|
+
|
41
|
+
- uses: ruby/setup-ruby@v1
|
42
|
+
with:
|
43
|
+
ruby-version: ${{ matrix.ruby }}
|
44
|
+
bundler-cache: true
|
45
|
+
|
46
|
+
- run: bundle exec rake
|
data/README.adoc
CHANGED
@@ -91,11 +91,14 @@ RelatonNist::NistBibliography.get("8200", "2018", {})
|
|
91
91
|
=== Get short citation
|
92
92
|
Short citation is a convetion about a citation's format. The format for NIST publications is:
|
93
93
|
----
|
94
|
-
NIST {abbrev(series)} {docnumber} {(edition), optional} {(stage),
|
94
|
+
NIST {abbrev(series)} {docnumber} {(edition), optional} {(stage), optional}
|
95
95
|
# or
|
96
|
-
{abbrev(series)} {docnumber} {(edition), optional} {(stage),
|
96
|
+
{abbrev(series)} {docnumber} {(edition), optional} {(stage), optional}
|
97
97
|
----
|
98
|
-
- `(stage)` is empty if the state is "final" (published)
|
98
|
+
- `(stage)` is empty if the state is "final" (published). In case state is "draft" it shoud be:
|
99
|
+
* PD for public draft
|
100
|
+
* IPD for initial iteration public draft or 2PD, 3PD and so one for following iterations
|
101
|
+
* FPD for final public draft
|
99
102
|
- `(edition)` is the date of publication or update
|
100
103
|
- `docnumber` is the full NIST number, including revision, e.g., 800-52
|
101
104
|
|
@@ -114,6 +117,36 @@ RelatonNist::NistBibliography.get("SP 800-205 (February 2019) (PD)")
|
|
114
117
|
...
|
115
118
|
----
|
116
119
|
|
120
|
+
=== Get specific part, volume, version, revision, and addendum
|
121
|
+
|
122
|
+
Referehces can contain optional parameters `{ptN}{vN}{verN}{rN}{/Add}`:
|
123
|
+
- Part is specified as `ptN` (SP 800-57pt1)
|
124
|
+
- Volume is specified as `vN` (SP 800-60v1)
|
125
|
+
- Version is specified as `verN` (SP 800-45ver2)
|
126
|
+
- Revision is specified as `rN` (SP 800-40r3)
|
127
|
+
- Addendum is specified as `/Add` (SP 800-38A/Add)
|
128
|
+
|
129
|
+
[source,ruby]
|
130
|
+
----
|
131
|
+
item = RelatonNist::NistBibliography.get 'SP 800-67r3'
|
132
|
+
[relaton-nist] ("SP 800-67r3") fetching...
|
133
|
+
[relaton-nist] ("SP 800-67r3") found SP 800-67 Rev. 3
|
134
|
+
=> #<RelatonNist::NistBibliographicItem:0x007fd87bbe9460
|
135
|
+
...
|
136
|
+
|
137
|
+
item.docidentifier.first.id
|
138
|
+
=> "SP 800-67 Rev. 3"
|
139
|
+
|
140
|
+
RelatonNist::NistBibliography.get 'SP 800-38A/Add'
|
141
|
+
[relaton-nist] ("SP 800-38A/Add") fetching...
|
142
|
+
[relaton-nist] ("SP 800-38A/Add") found SP 800-38A-Add
|
143
|
+
=> #<RelatonNist::NistBibliographicItem:0x007fd88c21d880
|
144
|
+
...
|
145
|
+
|
146
|
+
item.docidentifier.first.id
|
147
|
+
=> "SP 800-38A-Add"
|
148
|
+
----
|
149
|
+
|
117
150
|
=== Create bibliographic item from YAML
|
118
151
|
[source,ruby]
|
119
152
|
----
|
@@ -121,11 +154,7 @@ hash = YAML.load_file 'spec/examples/nist_bib_item.yml'
|
|
121
154
|
=> {"id"=>"NISTIR 8011 Vol. 3",
|
122
155
|
...
|
123
156
|
|
124
|
-
|
125
|
-
=> {:id=>"NISTIR 8011 Vol. 3",
|
126
|
-
...
|
127
|
-
|
128
|
-
RelatonNist::NistBibliographicItem.new bib_hash
|
157
|
+
RelatonNist::NistBibliographicItem.from_hash hash
|
129
158
|
=> #<RelatonNist::NistBibliographicItem:0x007f8b708505b8
|
130
159
|
...
|
131
160
|
----
|
data/grammars/isodoc.rng
CHANGED
@@ -24,6 +24,14 @@
|
|
24
24
|
<start>
|
25
25
|
<ref name="standard-document"/>
|
26
26
|
</start>
|
27
|
+
<define name="doctype">
|
28
|
+
<element name="doctype">
|
29
|
+
<optional>
|
30
|
+
<attribute name="abbreviation"/>
|
31
|
+
</optional>
|
32
|
+
<ref name="DocumentType"/>
|
33
|
+
</element>
|
34
|
+
</define>
|
27
35
|
<define name="hyperlink">
|
28
36
|
<element name="link">
|
29
37
|
<attribute name="target">
|
@@ -141,6 +149,11 @@
|
|
141
149
|
<data type="boolean"/>
|
142
150
|
</attribute>
|
143
151
|
</optional>
|
152
|
+
<optional>
|
153
|
+
<attribute name="key">
|
154
|
+
<data type="boolean"/>
|
155
|
+
</attribute>
|
156
|
+
</optional>
|
144
157
|
<oneOrMore>
|
145
158
|
<ref name="dt"/>
|
146
159
|
<ref name="dd"/>
|
@@ -1164,49 +1177,7 @@
|
|
1164
1177
|
</define>
|
1165
1178
|
<define name="annex">
|
1166
1179
|
<element name="annex">
|
1167
|
-
<
|
1168
|
-
<attribute name="id">
|
1169
|
-
<data type="ID"/>
|
1170
|
-
</attribute>
|
1171
|
-
</optional>
|
1172
|
-
<optional>
|
1173
|
-
<attribute name="language"/>
|
1174
|
-
</optional>
|
1175
|
-
<optional>
|
1176
|
-
<attribute name="script"/>
|
1177
|
-
</optional>
|
1178
|
-
<optional>
|
1179
|
-
<attribute name="inline-header">
|
1180
|
-
<data type="boolean"/>
|
1181
|
-
</attribute>
|
1182
|
-
</optional>
|
1183
|
-
<attribute name="obligation">
|
1184
|
-
<choice>
|
1185
|
-
<value>normative</value>
|
1186
|
-
<value>informative</value>
|
1187
|
-
</choice>
|
1188
|
-
</attribute>
|
1189
|
-
<optional>
|
1190
|
-
<ref name="section-title"/>
|
1191
|
-
</optional>
|
1192
|
-
<group>
|
1193
|
-
<group>
|
1194
|
-
<zeroOrMore>
|
1195
|
-
<ref name="BasicBlock"/>
|
1196
|
-
</zeroOrMore>
|
1197
|
-
<zeroOrMore>
|
1198
|
-
<ref name="note"/>
|
1199
|
-
</zeroOrMore>
|
1200
|
-
</group>
|
1201
|
-
<zeroOrMore>
|
1202
|
-
<choice>
|
1203
|
-
<ref name="annex-subsection"/>
|
1204
|
-
<ref name="terms"/>
|
1205
|
-
<ref name="definitions"/>
|
1206
|
-
<ref name="references"/>
|
1207
|
-
</choice>
|
1208
|
-
</zeroOrMore>
|
1209
|
-
</group>
|
1180
|
+
<ref name="Annex-Section"/>
|
1210
1181
|
</element>
|
1211
1182
|
</define>
|
1212
1183
|
<define name="terms">
|
data/grammars/nist.rng
CHANGED
@@ -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|
|
@@ -21,8 +21,9 @@ module RelatonNist
|
|
21
21
|
def initialize(ref_nbr, year = nil, opts = {}) # rubocop:disable Metrics/AbcSize
|
22
22
|
super ref_nbr, year
|
23
23
|
|
24
|
-
/(?<docid>(SP|FIPS)\s[0-9-]
|
24
|
+
/(?<docid>(SP|FIPS)\s[0-9-]+)/ =~ text
|
25
25
|
@array = docid ? from_json(docid, **opts) : from_csrc(**opts)
|
26
|
+
@array = from_csrc(**opts) unless @array.any?
|
26
27
|
|
27
28
|
@array.sort! do |a, b|
|
28
29
|
if a.sort_value != b.sort_value
|
@@ -94,8 +95,9 @@ module RelatonNist
|
|
94
95
|
# @param stage [String]
|
95
96
|
# @return [Array<Hach>]
|
96
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')
|
97
99
|
d = Date.strptime year, "%Y" if year
|
98
|
-
didrx = Regexp.new(docid)
|
100
|
+
# didrx = Regexp.new(docid)
|
99
101
|
data.select do |doc|
|
100
102
|
next unless match_year?(doc, d)
|
101
103
|
|
@@ -104,7 +106,7 @@ module RelatonNist
|
|
104
106
|
else
|
105
107
|
next unless doc["status"] == "final"
|
106
108
|
end
|
107
|
-
doc["docidentifier"]
|
109
|
+
doc["docidentifier"].include? docid
|
108
110
|
end
|
109
111
|
end
|
110
112
|
|
@@ -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
|
@@ -29,15 +29,16 @@ module RelatonNist
|
|
29
29
|
#
|
30
30
|
# @return [String] Relaton XML serialisation of reference
|
31
31
|
def get(code, year = nil, opts = {})
|
32
|
-
return fetch_ref_err(code, year, []) if code
|
32
|
+
return fetch_ref_err(code, year, []) if code.match? /\sEP$/
|
33
33
|
|
34
34
|
/^(?<code2>[^\(]+)(\((?<date2>\w+\s(\d{2},\s)?\d{4})\))?\s?\(?((?<=\()(?<stage>[^\)]+))?/ =~ code
|
35
|
+
stage ||= /(?<=\.)PD-\w+(?=\.)/.match(code)&.to_s
|
35
36
|
if code2
|
36
37
|
code = code2.strip
|
37
38
|
if date2
|
38
|
-
if /\w+\s\d{4}
|
39
|
+
if /\w+\s\d{4}/.match? date2
|
39
40
|
opts[:issued_date] = Date.strptime date2, "%B %Y"
|
40
|
-
elsif /\w+\s\d{2},\s\d{4}
|
41
|
+
elsif /\w+\s\d{2},\s\d{4}/.match? date2
|
41
42
|
opts[:updated_date] = Date.strptime date2, "%B %d, %Y"
|
42
43
|
end
|
43
44
|
end
|
@@ -81,10 +82,10 @@ module RelatonNist
|
|
81
82
|
# @option opts [Time] :issued_date
|
82
83
|
# @option opts [String] :stage
|
83
84
|
#
|
84
|
-
# @
|
85
|
+
# @return [Hash]
|
85
86
|
def nistbib_results_filter(result, year, opts)
|
86
87
|
missed_years = []
|
87
|
-
iter = opts[:stage]&.
|
88
|
+
iter = /\w+(?=PD)|(?<=PD-)\w+/.match(opts[:stage])&.to_s
|
88
89
|
iteration = case iter
|
89
90
|
when "I" then "1"
|
90
91
|
when "F" then "final"
|
@@ -116,6 +117,9 @@ module RelatonNist
|
|
116
117
|
{ years: missed_years }
|
117
118
|
end
|
118
119
|
|
120
|
+
# @param hits [RelatonNist::HitCollection]
|
121
|
+
# @param threads [Integer]
|
122
|
+
# @return [Array<RelatonNist::NistBibliographicItem>]
|
119
123
|
def fetch_pages(hits, threads)
|
120
124
|
workers = RelatonBib::WorkersPool.new threads
|
121
125
|
workers.worker { |w| { i: w[:i], hit: w[:hit].fetch } }
|
@@ -124,15 +128,94 @@ module RelatonNist
|
|
124
128
|
workers.result.sort_by { |a| a[:i] }.map { |x| x[:hit] }
|
125
129
|
end
|
126
130
|
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
+
# @param code [String]
|
132
|
+
# @param year [String, nil]
|
133
|
+
# @param opts [Hash]
|
134
|
+
# @return [RelatonNist::HitCollection]
|
135
|
+
def nistbib_search_filter(code, year, opts) # rubocop:disable Metrics/MethodLength
|
131
136
|
warn "[relaton-nist] (\"#{code}\") fetching..."
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
137
|
+
# match = %r{
|
138
|
+
# ^((?:NIST)\s)?
|
139
|
+
# (?<serie>(SP|FIPS|NISTIR|ITL\sBulletin|White\sPaper))\s
|
140
|
+
# (?<code>[0-9-]{3,}[A-Z]?)
|
141
|
+
# (?<prt1>pt\d+)?
|
142
|
+
# (?<vol1>v\d+)?
|
143
|
+
# (?<ver1>ver[\d\.]+)?
|
144
|
+
# (?<rev1>r\d+)?
|
145
|
+
# (\s(?<prt2>Part\s\d+))?
|
146
|
+
# (\s(?<vol2>Vol\.\s\d+))?
|
147
|
+
# (\s(?<ver2>(Ver\.|Version)\s[\d\.]+))?
|
148
|
+
# (\s(?<rev2>Rev\.\s\d+))?
|
149
|
+
# (\/(?<upd>Add))?
|
150
|
+
# }x.match(code)
|
151
|
+
# match ||= %r{
|
152
|
+
# ^NIST\.
|
153
|
+
# (?<serie>(SP|FIPS|IR|ITL\sBulletin|White\sPaper))\.
|
154
|
+
# ((PD-\d+|PUB)\.)?
|
155
|
+
# (?<code>[0-9-]{3,}[A-Z]?)
|
156
|
+
# (\.(?<prt1>pt-\d+))?
|
157
|
+
# (\.(?<vol1>v-\d+))?
|
158
|
+
# (\.(?<ver1>ver-[\d\.]+))?
|
159
|
+
# (\.(?<rev1>r-\d+))?
|
160
|
+
# }x.match(code)
|
161
|
+
matches = {
|
162
|
+
serie: match(/(SP|FIPS|(NIST)?IR|ITL\sBulletin|White\sPaper)(?=\.|\s)/, code),
|
163
|
+
code: match(/(?<=\.|\s)[0-9-]{3,}[A-Z]?/, code),
|
164
|
+
prt1: match(/(?<=(\.))?pt(?(1)-)[A-Z\d]+/, code),
|
165
|
+
vol1: match(/(?<=(\.))?v(?(1)-)\d+/, code),
|
166
|
+
ver1: match(/(?<=(\.))?ver(?(1)[-\d]|[\.\d])+/, code)&.gsub(/-/, "."),
|
167
|
+
rev1: match(/(?<=[^a-z])(?<=(\.))?r(?(1)-)\d+/, code),
|
168
|
+
add1: match(/(?<=(\.))?add(?(1)-)\d+/, code),
|
169
|
+
prt2: match(/(?<=\s)Part\s[A-Z\d]+/, code),
|
170
|
+
vol2: match(/(?<=\s)Vol\.\s\d+/, code),
|
171
|
+
ver2: match(/(?<=\s)Ver\.\s\d+/, code),
|
172
|
+
rev2: match(/(?<=\s)Rev\.\s\d+/, code),
|
173
|
+
add2: match(/(?<=\/)Add/, code),
|
174
|
+
}
|
175
|
+
ref = matches[:code] ? "#{matches[:serie]} #{matches[:code]}" : code
|
176
|
+
result = search(ref, year, opts)
|
177
|
+
result.select { |i| search_filter i, matches, code }
|
178
|
+
end
|
179
|
+
|
180
|
+
def match(regex, code)
|
181
|
+
regex.match(code)&.to_s
|
182
|
+
end
|
183
|
+
|
184
|
+
# @param item [RelatonNist::Hit]
|
185
|
+
# @param matches [Hash]
|
186
|
+
# @param text [String]
|
187
|
+
# @return [Boolean]
|
188
|
+
def search_filter(item, matches, text) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
|
189
|
+
%r{
|
190
|
+
^((?:NIST)\s)?
|
191
|
+
((?<serie>(SP|FIPS|NISTIR|ITL\sBulletin|White\sPaper))\s)?
|
192
|
+
(?<code>[0-9-]{3,}[A-Z]?)
|
193
|
+
(?<prt1>pt\d+)?
|
194
|
+
(?<vol1>v\d+)?
|
195
|
+
(?<ver1>ver[\d\.]+)?
|
196
|
+
(?<rev1>r\d+)?
|
197
|
+
(\s(?<prt2>Part\s\d+))?
|
198
|
+
(\s(?<vol2>Vol\.\s\d+))?
|
199
|
+
(\s(?<ver2>(Ver\.|Version)\s[\d\.]+))?
|
200
|
+
(\s(?<rev2>Rev\.\s\d+))?
|
201
|
+
(\s(?<add>Add)endum)?
|
202
|
+
}x =~ item.hit[:code]
|
203
|
+
matches[:code] && [serie, item.hit[:serie]].include?(matches[:serie]) && matches[:code] == code &&
|
204
|
+
long_to_short(matches[:prt1], matches[:prt2]) == long_to_short(prt1, prt2) &&
|
205
|
+
long_to_short(matches[:vol1], matches[:vol2]) == long_to_short(vol1, vol2) &&
|
206
|
+
long_to_short(matches[:ver1], matches[:ver2]) == long_to_short(ver1, ver2) &&
|
207
|
+
long_to_short(matches[:rev1], matches[:rev2]) == long_to_short(rev1, rev2) &&
|
208
|
+
long_to_short(matches[:add1], matches[:add2]) == add || item.hit[:title].include?(text.sub(/^NIST\s/, ""))
|
209
|
+
end
|
210
|
+
|
211
|
+
# @param short [String]
|
212
|
+
# @param long [String]
|
213
|
+
# @return [String, nil]
|
214
|
+
def long_to_short(short, long)
|
215
|
+
return short.sub(/-/, "") if short
|
216
|
+
return unless long
|
217
|
+
|
218
|
+
long.sub(/Part\s/, "pt").sub(/Vol\.\s/, "v").sub(/Rev\.\s/, "r").sub(/(Ver\.|Version)\s/, "ver")
|
136
219
|
end
|
137
220
|
|
138
221
|
def fetch_ref_err(code, year, missed_years)
|
@@ -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
|
@@ -110,9 +110,10 @@ module RelatonNist
|
|
110
110
|
"//div[contains(@class, 'publications-detail')]/h3"
|
111
111
|
)&.text&.strip&.sub(/(?<=\w)\([^\)]+\)$/) do |m|
|
112
112
|
" " + m.upcase
|
113
|
-
end&.squeeze(" ")&.gsub
|
113
|
+
end&.squeeze(" ")&.gsub(/ |\n|\r/, "")
|
114
114
|
end
|
115
115
|
item_ref ||= "?"
|
116
|
+
item_ref.sub! /\sAddendum$/, "-Add"
|
116
117
|
[RelatonBib::DocumentIdentifier.new(id: item_ref, type: "NIST")]
|
117
118
|
end
|
118
119
|
|
data/lib/relaton_nist/version.rb
CHANGED
data/relaton_nist.gemspec
CHANGED
@@ -23,17 +23,17 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.require_paths = ["lib"]
|
24
24
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
|
25
25
|
|
26
|
-
spec.add_development_dependency "debase"
|
26
|
+
# spec.add_development_dependency "debase"
|
27
27
|
spec.add_development_dependency "equivalent-xml", "~> 0.6"
|
28
28
|
spec.add_development_dependency "pry-byebug"
|
29
29
|
spec.add_development_dependency "rake", "~> 10.0"
|
30
30
|
spec.add_development_dependency "rspec", "~> 3.0"
|
31
|
-
spec.add_development_dependency "ruby-debug-ide"
|
31
|
+
# spec.add_development_dependency "ruby-debug-ide"
|
32
32
|
spec.add_development_dependency "ruby-jing"
|
33
33
|
spec.add_development_dependency "simplecov"
|
34
34
|
spec.add_development_dependency "vcr"
|
35
35
|
spec.add_development_dependency "webmock"
|
36
36
|
|
37
|
-
spec.add_dependency "relaton-bib", "~> 1.
|
37
|
+
spec.add_dependency "relaton-bib", "~> 1.7.0"
|
38
38
|
spec.add_dependency "rubyzip"
|
39
39
|
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.7.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:
|
11
|
+
date: 2021-03-19 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.7.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.7.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"
|
@@ -236,7 +206,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
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
|