relaton-nist 1.19.5 → 1.19.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 47c01d46202e813e27019c4beb5e5ccc4aa258a61dd4f6ea3b184009e6ae9e09
4
- data.tar.gz: 2dadbcee5b551aefb4f4cefe04620964d3455acb842f005944e2f30e195d94ba
3
+ metadata.gz: 255770dfd71b03dfd82eb6d6cfd9710a77fc0dab5e46f744b2a544058ef497c1
4
+ data.tar.gz: 9914dce97923f334dff7dcead5e9037135eed26d0d4c31e96a8d632f211a5699
5
5
  SHA512:
6
- metadata.gz: 3e264c34cfea0e5ef97894265d0e6917081d05e7d317142475badb242036eeae4e4caafde6cd2f19c62ae12b99560cef88d92638f40d2e9592a37a704cef8aca
7
- data.tar.gz: 262e7bf0461fbd19f9da7346128166ab2d07fdc3e8f3cffff2ec20ec5fad2b6883a8f4f85624675e5e586a29b3a17cfe28eee426b63b23ce8b7c3fc3fb83a426
6
+ metadata.gz: 54eaf26dc7f4f01f05206af204cd44b737b8b87c2a486afd18b0c4b1593420e26ef4dc38c74fdef8825ca6e62e7ecc9ce271ccb37aeef4e68bb363642f26ed04
7
+ data.tar.gz: 6cee7c2c9776dcbbf96c8868837682870a575a6ccb86831a4afad1f1ea2a88d55d47b44e113819a9d6976c53f6f1a829bcece881fdcafcb22f6a9b2d35a852a7
@@ -6,7 +6,7 @@ require_relative "mods_parser"
6
6
 
7
7
  module RelatonNist
8
8
  class DataFetcher
9
- URL = "https://github.com/usnistgov/NIST-Tech-Pubs/releases/download/Oct2024/allrecords-MODS.xml"
9
+ URL = "https://github.com/usnistgov/NIST-Tech-Pubs/releases/download/Nov2024/allrecords-MODS.xml"
10
10
 
11
11
  def initialize(output, format)
12
12
  @output = output
@@ -57,21 +57,12 @@ module RelatonNist
57
57
  #
58
58
  # @return [Array<RelatonNist::Hit>] hits
59
59
  #
60
- def search_filter # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity,Metrics/MethodLength
60
+ def search_filter
61
61
  refid = ::Pubid::Nist::Identifier.parse(@reference)
62
+ parts = exclude_parts refid
62
63
  arr = @array.select do |item|
63
64
  pubid = ::Pubid::Nist::Identifier.parse(item.hit[:code].sub(/\.$/, ""))
64
- pubid == refid
65
- # parts = doi_parts(item.hit[:json]) || code_parts(item.hit[:code])
66
- # iteration = item.hit.dig(:json, "iteration")
67
- # draft = parts[:draft] || (!iteration.nil? && iteration.match?(/\wpd/i))
68
- # refparts[:code] && [parts[:series], item.hit[:series]].include?(refparts[:series]) &&
69
- # refparts[:code].casecmp(parts[:code].upcase).zero? &&
70
- # refparts[:prt] == parts[:prt] &&
71
- # (refparts[:vol].nil? || refparts[:vol] == parts[:vol]) &&
72
- # (refparts[:ver].nil? || refparts[:ver] == parts[:ver]) &&
73
- # (refparts[:rev].nil? || refparts[:rev] == parts[:rev]) &&
74
- # refparts[:draft] == draft && refparts[:add] == parts[:add]
65
+ pubid.exclude(*parts) == refid
75
66
  rescue StandardError
76
67
  item.hit[:code] == text
77
68
  end
@@ -83,6 +74,12 @@ module RelatonNist
83
74
  return dup
84
75
  end
85
76
 
77
+ def exclude_parts(pubid)
78
+ %i[stage update].each_with_object([]) do |part, parts|
79
+ parts << part if pubid.send(part).nil?
80
+ end
81
+ end
82
+
86
83
  private
87
84
 
88
85
  def code_parts(code) # rubocop:disable Metrics/MethodLength
@@ -252,8 +249,6 @@ module RelatonNist
252
249
  else
253
250
  json["docidentifier"]
254
251
  end => id
255
- # parts = doi_parts(json) || code_parts(json["docidentifier"])
256
- # return json["docidentifier"] unless parts
257
252
 
258
253
  id.sub!(/(?:-draft\d*|\.\wpd)$/, "")
259
254
  pid = ::Pubid::Nist::Identifier.parse(id)
@@ -265,20 +260,13 @@ module RelatonNist
265
260
  when /(\w)pd/
266
261
  pid.stage = ::Pubid::Nist::Stage.new id: Regexp.last_match(1), type: "pd"
267
262
  end
263
+
264
+ /\/upd(?<upd>\d+)\// =~ json["uri"]
265
+ pid.update = Pubid::Nist::Update.new number: upd if upd
268
266
  pid.to_s
269
267
  rescue StandardError
270
268
  id += " #{json["iteration"].sub('final', 'fpd')}" if json["iteration"]
271
269
  id
272
-
273
- # id = parts[:code]
274
- # id = "NIST #{parts[:series]} #{id}" if parts[:series]
275
- # id += " Part #{parts[:prt]}" if parts[:prt]
276
- # id += " Vol. #{parts[:vol]}" if parts[:vol]
277
- # id += " Ver. #{parts[:ver]}" if parts[:ver]
278
- # id += " Rev. #{parts[:rev]}" if parts[:rev]
279
- # id += "-Add" if parts[:add]
280
- # id += " (Draft)" if parts[:draft] || @opts[:stage]
281
- # id
282
270
  end
283
271
 
284
272
  #
@@ -291,15 +279,15 @@ module RelatonNist
291
279
 
292
280
  ref = "#{refparts[:series]} #{refparts[:code]}"
293
281
  d = Date.strptime year, "%Y" if year
294
- statuses = %w[draft-public draft-prelim]
282
+ # statuses = %w[draft-public draft-prelim]
295
283
  PubsExport.instance.data.select do |doc|
296
284
  next unless match_year?(doc, d)
297
285
 
298
- if @opts[:stage]&.include?("PD")
299
- next unless statuses.include? doc["status"]
300
- else
301
- next unless doc["status"] == "final"
302
- end
286
+ # if @opts[:stage]&.include?("PD")
287
+ # next unless statuses.include? doc["status"]
288
+ # else
289
+ # next unless doc["iteration"] == "final"
290
+ # end
303
291
  doc["docidentifier"].include?(ref) || doc["docidentifier"].include?(full_ref)
304
292
  end
305
293
  end
@@ -1,3 +1,3 @@
1
1
  module RelatonNist
2
- VERSION = "1.19.5".freeze
2
+ VERSION = "1.19.7".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.19.5
4
+ version: 1.19.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-10-17 00:00:00.000000000 Z
11
+ date: 2024-11-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: base64
@@ -142,7 +142,7 @@ homepage: https://github.com/metanorma/relaton-nist
142
142
  licenses:
143
143
  - MIT
144
144
  metadata: {}
145
- post_install_message:
145
+ post_install_message:
146
146
  rdoc_options: []
147
147
  require_paths:
148
148
  - lib
@@ -157,8 +157,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
157
157
  - !ruby/object:Gem::Version
158
158
  version: '0'
159
159
  requirements: []
160
- rubygems_version: 3.3.27
161
- signing_key:
160
+ rubygems_version: 3.5.19
161
+ signing_key:
162
162
  specification_version: 4
163
163
  summary: 'RelatonNist: retrive NIST standards.'
164
164
  test_files: []