relaton-nist 1.7.0 → 1.7.1

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: 6ff4cb4caf1123510595e7804b6b44a6765d6e8db953e73e97afe038baad2d94
4
- data.tar.gz: 0b7592d2538165dc71ab73a3c7aa709f8b64f78d61d560eded5a700faeac48dd
3
+ metadata.gz: 86fbfc1190f5174be69a4e51bb6b791328c1d432143e8eb6d2aab6f644ae5100
4
+ data.tar.gz: 2aa468017a4bcf5ab9369e2f4fca85543fd641ac5ba2b35399e60e96769c996d
5
5
  SHA512:
6
- metadata.gz: 0a379a5571e757ae64f6c17c87b21fb9bb4e33145ce4078b78eb25eea8863fc0ff3aeebc5885e35892d312afc2415fd5b72bd9e90583aa000272bd8d211ab4e2
7
- data.tar.gz: 57e44c8738be6f399fa263516d5ed7ad4fce62b1559d8d88bb59950bdc908af866c5e5ab7c3783d9237ed1a7df2fe69496d82c55845b0296bb53bb922d4e65bd
6
+ metadata.gz: 9bb703e914559d9e8359ef6442f089d76fb3dc84fedb273e046893989b7e035825d7990235e1b9c95f14f1c916e0ffff24d9cc1e6b177ae027bcc403480ac2be
7
+ data.tar.gz: b1b0857eff72431fb9ae953af25dfedd49a1fa459b05fdd85c2285e642182ceb3a58d407bdcd8986153fad5f9f162e6115bd0c9d804d2956ed65de700d830158
@@ -29,15 +29,15 @@ 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 =~ /\sEP$/
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
35
  if code2
36
36
  code = code2.strip
37
37
  if date2
38
- if /\w+\s\d{4}/ =~ date2
38
+ if /\w+\s\d{4}/.match? date2
39
39
  opts[:issued_date] = Date.strptime date2, "%B %Y"
40
- elsif /\w+\s\d{2},\s\d{4}/ =~ date2
40
+ elsif /\w+\s\d{2},\s\d{4}/.match? date2
41
41
  opts[:updated_date] = Date.strptime date2, "%B %d, %Y"
42
42
  end
43
43
  end
@@ -125,13 +125,22 @@ module RelatonNist
125
125
  end
126
126
 
127
127
  def nistbib_search_filter(code, year, opts)
128
- idregex = %r{[0-9-]{3,}\w?}
129
- docid = code.match(idregex).to_s
130
- serie = code.match(%r{(FISP|SP|NISTIR)(?=\s)})
128
+ %r{
129
+ ^((?:NIST)\s)?
130
+ (?<serie1>(SP|FIPS|NISTIR|ITL\sBulletin|White\sPaper))\s
131
+ (?<code1>[0-9-]{3,}\w?)
132
+ (\/(?<upd1>Add))?
133
+ }x =~ code
131
134
  warn "[relaton-nist] (\"#{code}\") fetching..."
132
135
  result = search(code, year, opts)
133
136
  result.select do |i|
134
- i.hit[:code]&.match(idregex).to_s == docid && (!serie || i.hit[:serie] == serie.to_s)
137
+ %r{
138
+ ^((?:NIST)\s)?
139
+ ((?<serie2>(SP|FIPS|NISTIR|ITL\sBulletin|White\sPaper))\s)?
140
+ (?<code2>[0-9-]{3,}\w?)
141
+ (\s(?<upd2>Add)endum)?
142
+ }x =~ i.hit[:code]
143
+ [serie2, i.hit[:serie]].include?(serie1) && code1 == code2 && upd1 == upd2
135
144
  end
136
145
  end
137
146
 
@@ -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 /&#13;|\n|\r/, ""
113
+ end&.squeeze(" ")&.gsub(/&#13;|\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
 
@@ -1,3 +1,3 @@
1
1
  module RelatonNist
2
- VERSION = "1.7.0".freeze
2
+ VERSION = "1.7.1".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.7.0
4
+ version: 1.7.1
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-27 00:00:00.000000000 Z
11
+ date: 2020-12-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: debase