relaton-nist 1.12.0 → 1.12.3

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: f66b74deb926d9f67db5770896b1080b16610c3996edb4a404740bd3ce558abe
4
- data.tar.gz: 6b74fb0c0bb1bf46282496fbf9e91f1a7ca0022eb4466f3be69ed1ca3da09b1c
3
+ metadata.gz: ef6eeb64c2dba6079789c3192b6c335f3726af48bd43b580bc5c05cf8c8b12f9
4
+ data.tar.gz: c58fa9cf63309bd404ad04797b92f1dd3f2cc0635cb061ee1211cfc9bf8e841c
5
5
  SHA512:
6
- metadata.gz: 97ca67f282f4131fab6f6d9da60e8f1ab350d8e5e762d843066f4236b8d5a53980d261c29559f9c233c2cab5cee44bbc185ab7a6b3feedd559df5d631a94b61c
7
- data.tar.gz: 6c2a40d739b0b2b9b2ed9587c50ac737b5a3ccb8a7c27c5b1548cab40f3409c08ea62358bb2b90d590b04ac45350e3ba671c0dac7a479399ce38d06ad9519904
6
+ metadata.gz: b59ef8bf5ce4d0b637cb0072cb6d18c4ddbfa07170a95095df0ed95395039c19cc2f59b9a28d852dd59f357e204b3ec50c8825fb30f5049106edc0705696b6da
7
+ data.tar.gz: 22e2b8ede68f9cdd45bd921d06ba4f36c824bbc8115f3a40960d8b9f8c6f03efa8ff20d310771f8b4db30a388794654fd9e58313f6e10f4677b0945f4b67e8f8
data/.gitignore CHANGED
@@ -7,7 +7,6 @@
7
7
  /spec/reports/
8
8
  /tmp/
9
9
  .vscode/
10
- /data/
11
10
  .rubocop-https---raw-githubusercontent-com-riboseinc-oss-guides-master-ci-rubocop-yml
12
11
 
13
12
  # rspec failure tracking
@@ -214,10 +214,11 @@ module RelatonNist
214
214
  def fetch_series(doc)
215
215
  series_path = File.expand_path("series.yaml", __dir__)
216
216
  series = YAML.load_file series_path
217
- prf, srs, = pub_id(doc).split
217
+ prf, srs, num = pub_id(doc).split
218
218
  sname = series[srs] || srs
219
219
  title = RelatonBib::TypedTitleString.new(content: "#{prf} #{sname}")
220
- [RelatonBib::Series.new(title: title, number: "#{prf} #{srs}")]
220
+ abbr = RelatonBib::LocalizedString.new srs
221
+ [RelatonBib::Series.new(title: title, abbreviation: abbr, number: num)]
221
222
  end
222
223
 
223
224
  #
@@ -274,7 +275,7 @@ module RelatonNist
274
275
  puts "Started at: #{t1}"
275
276
 
276
277
  docs = Nokogiri::XML OpenURI.open_uri URL
277
- FileUtils.mkdir @output unless Dir.exist? @output
278
+ FileUtils.mkdir_p @output
278
279
  FileUtils.rm Dir[File.join(@output, "*.#{@ext}")]
279
280
  docs.xpath("/body/query/doi_record/report-paper/report-paper_metadata")
280
281
  .each { |doc| parse_doc doc }
@@ -151,7 +151,7 @@ module RelatonNist
151
151
  if !ctime || ctime < OpenURI.open_uri("#{PUBS_EXPORT}.meta").last_modified
152
152
  @data = nil
153
153
  uri_open = URI.method(:open) || Kernel.method(:open)
154
- FileUtils.mkdir_p DATAFILEDIR unless Dir.exist? DATAFILEDIR
154
+ FileUtils.mkdir_p DATAFILEDIR
155
155
  IO.copy_stream(uri_open.call("#{PUBS_EXPORT}.zip"), DATAFILE)
156
156
  end
157
157
  end
@@ -14,7 +14,8 @@ module RelatonNist
14
14
  # @param text [String]
15
15
  # @return [RelatonNist::HitCollection]
16
16
  def search(text, year = nil, opts = {})
17
- HitCollection.search text, year, opts
17
+ ref = text.sub(/^NIST\sIR/, "NISTIR")
18
+ HitCollection.search ref, year, opts
18
19
  rescue OpenURI::HTTPError, SocketError, OpenSSL::SSL::SSLError => e
19
20
  raise RelatonBib::RequestError, e.message
20
21
  end
@@ -160,7 +161,7 @@ module RelatonNist
160
161
  # (\.(?<rev1>r-\d+))?
161
162
  # }x.match(code)
162
163
  matches = {
163
- serie: match(/(SP|FIPS|(NIST)?IR|ITL\sBulletin|White\sPaper)(?=\.|\s)/, code),
164
+ serie: match(/(SP|FIPS|(NIST)?\s?IR|ITL\sBulletin|White\sPaper)(?=\.|\s)/, code),
164
165
  code: match(/(?<=\.|\s)[0-9-]{3,}[A-Z]?/, code),
165
166
  prt1: match(/(?<=(\.))?pt(?(1)-)[A-Z\d]+/, code),
166
167
  vol1: match(/(?<=(\.))?v(?(1)-)\d+/, code),
@@ -198,25 +199,25 @@ module RelatonNist
198
199
  # @return [Boolean]
199
200
  def search_filter(item, matches, text) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
200
201
  %r{
201
- ^((?:NIST)\s)?
202
- ((?<serie>(SP|FIPS|NISTIR|ITL\sBulletin|White\sPaper))\s)?
202
+ ^(?:(?:NIST)\s)?
203
+ (?:(?<serie>(?:SP|FIPS|NISTIR|ITL\sBulletin|White\sPaper))\s)?
203
204
  (?<code>[0-9-]{3,}[A-Z]?)
204
205
  (?<prt1>pt\d+)?
205
206
  (?<vol1>v\d+)?
206
207
  (?<ver1>ver[\d.]+)?
207
208
  (?<rev1>r\d+)?
208
- (\s(?<prt2>Part\s\d+))?
209
- (\s(?<vol2>Vol\.\s\d+))?
210
- (\s(?<ver2>(Ver\.|Version)\s[\d.]+))?
211
- (\s(?<rev2>Rev\.\s\d+))?
212
- (\s(?<add>Add)endum)?
209
+ (?:\s(?<prt2>Part\s\d+))?
210
+ (?:\s(?<vol2>Vol\.\s\d+))?
211
+ (?:\s(?<ver2>(?:Ver\.|Version)\s[\d.]+))?
212
+ (?:\s(?<rev2>Rev\.\s\d+))?
213
+ (?:\s(?<add>Add)endum)?
213
214
  }x =~ item.hit[:code]
214
- matches[:code] && [serie, item.hit[:serie]].include?(matches[:serie]) && matches[:code] == code &&
215
+ (matches[:code] && [serie, item.hit[:serie]].include?(matches[:serie]) && matches[:code] == code &&
215
216
  long_to_short(matches[:prt1], matches[:prt2]) == long_to_short(prt1, prt2) &&
216
217
  long_to_short(matches[:vol1], matches[:vol2]) == long_to_short(vol1, vol2) &&
217
218
  long_to_short(matches[:ver1], matches[:ver2]) == long_to_short(ver1, ver2) &&
218
219
  long_to_short(matches[:rev1], matches[:rev2]) == long_to_short(rev1, rev2) &&
219
- long_to_short(matches[:add1], matches[:add2]) == add || item.hit[:title].include?(text.sub(/^NIST\s/, ""))
220
+ long_to_short(matches[:add1], matches[:add2]) == add) || item.hit[:title]&.include?(text.sub(/^NIST\s/, ""))
220
221
  end
221
222
 
222
223
  # @param short [String]
@@ -1,3 +1,3 @@
1
1
  module RelatonNist
2
- VERSION = "1.12.0".freeze
2
+ VERSION = "1.12.3".freeze
3
3
  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.12.0
4
+ version: 1.12.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-06-25 00:00:00.000000000 Z
11
+ date: 2022-07-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: equivalent-xml