relaton-nist 1.10.0 → 1.10.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: 6904cbde4499524d13afe026233d523943a7be4bd90b099c9cbf13326fea209c
4
- data.tar.gz: 952f261685119de525a3427aae8611080e4ad9cbc27f9d5a3a643b3aadbed1b0
3
+ metadata.gz: d843669047c6d1d170c7cf1e4ec20947cdb90bd888370d7f1bcab3e5eb5b7ab0
4
+ data.tar.gz: c4c62956580641d0d71ff70cc848803b203d76418e8cdb8b64f572d880f620a2
5
5
  SHA512:
6
- metadata.gz: cce2b8ebb750f482c4eb7e74856b447179756d3d8ddd1f6927657b424fb5480caec4cdacbc86c49e8e62213df3a14b7b4916eb153ffbaadbcf2bfe3197660e06
7
- data.tar.gz: 19d173f3010316364ac1712f2b30e54221c67bd137ca691f9837cf8975d93454464f7161ad6b7bee0e290966ac9ce8ebd834d1d0d2fe8861993b3cbad5b6f0d5
6
+ metadata.gz: 37bbd4792e8c866ed5dae0a703318dc7175946da4e91d223d0f010d4418a0da25380a59291edc7d7746cad8e36af54012d59b6b72cfad23d3c01d500b4724952
7
+ data.tar.gz: e44ecec41e34b5e5bd575759e08a571eb8bd4db4e102b4bfcac2c4b17f6d20410b069468d7b55de95e49d7c4747fc57ddc71fcc43a27418ccfa50e1820907a17
data/grammars/biblio.rng CHANGED
@@ -209,9 +209,6 @@
209
209
  <zeroOrMore>
210
210
  <ref name="contact"/>
211
211
  </zeroOrMore>
212
- <zeroOrMore>
213
- <ref name="uri"/>
214
- </zeroOrMore>
215
212
  </element>
216
213
  </define>
217
214
  <define name="fullname">
@@ -828,6 +825,11 @@
828
825
  <optional>
829
826
  <attribute name="scope"/>
830
827
  </optional>
828
+ <optional>
829
+ <attribute name="primary">
830
+ <data type="boolean"/>
831
+ </attribute>
832
+ </optional>
831
833
  <text/>
832
834
  </element>
833
835
  </define>
@@ -20,6 +20,7 @@ module RelatonNist
20
20
  @output = output
21
21
  @format = format
22
22
  @ext = format.sub(/^bib/, "")
23
+ @files = []
23
24
  end
24
25
 
25
26
  def parse_docid(doc) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
@@ -32,7 +33,7 @@ module RelatonNist
32
33
  # end
33
34
  # anchor = doi.split("/")[1..-1].join "/"
34
35
  [
35
- { type: "NIST", id: pub_id(doc) },
36
+ { type: "NIST", id: pub_id(doc), primary: true },
36
37
  { type: "DOI", id: doi(doc) },
37
38
  { type: "NIST", id: anchor(doc), scope: "anchor" },
38
39
  ]
@@ -191,17 +192,17 @@ module RelatonNist
191
192
  def write_file(bib) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
192
193
  id = bib.docidentifier[0].id.gsub(%r{[/\s:.]}, "_").upcase.sub(/^NIST_IR/, "NISTIR")
193
194
  file = File.join(@output, "#{id}.#{@ext}")
194
- if File.exist? file
195
+ if @files.include? file
195
196
  warn "File #{file} exists. Docid: #{bib.docidentifier[0].id}"
196
197
  # warn "Link: #{bib.link.detect { |l| l.type == 'src' }.content}"
197
- else
198
- output = case @format
199
- when "yaml" then bib.to_hash.to_yaml
200
- when "xml" then bib.to_xml bibdata: true
201
- else bib.send "to_#{@format}"
202
- end
203
- File.write file, output, encoding: "UTF-8"
198
+ else @files << file
204
199
  end
200
+ output = case @format
201
+ when "yaml" then bib.to_hash.to_yaml
202
+ when "xml" then bib.to_xml bibdata: true
203
+ else bib.send "to_#{@format}"
204
+ end
205
+ File.write file, output, encoding: "UTF-8"
205
206
  end
206
207
 
207
208
  #
@@ -15,7 +15,7 @@ module RelatonNist
15
15
  titles = fetch_titles(hit_data)
16
16
  unless /^(SP|NISTIR|FIPS) /.match? item_data[:docid][0].id
17
17
  item_data[:docid][0] = RelatonBib::DocumentIdentifier.new(
18
- id: titles[0][:content].upcase, type: "NIST",
18
+ id: titles[0][:content].upcase, type: "NIST", primary: true,
19
19
  )
20
20
  end
21
21
  item_data[:fetched] = Date.today.to_s
@@ -56,7 +56,7 @@ module RelatonNist
56
56
  item_ref = docid
57
57
  # item_ref ||= "?"
58
58
  item_ref.sub!(/\sAddendum$/, "-Add")
59
- [RelatonBib::DocumentIdentifier.new(id: item_ref, type: "NIST")]
59
+ [RelatonBib::DocumentIdentifier.new(id: item_ref, type: "NIST", primary: true)]
60
60
  end
61
61
 
62
62
  # Fetch status.
@@ -1,3 +1,3 @@
1
1
  module RelatonNist
2
- VERSION = "1.10.0".freeze
2
+ VERSION = "1.10.1".freeze
3
3
  end
data/relaton_nist.gemspec CHANGED
@@ -32,6 +32,6 @@ Gem::Specification.new do |spec|
32
32
  spec.add_development_dependency "vcr"
33
33
  spec.add_development_dependency "webmock"
34
34
 
35
- spec.add_dependency "relaton-bib", "~> 1.10.0"
35
+ spec.add_dependency "relaton-bib", "~> 1.10.1"
36
36
  spec.add_dependency "rubyzip"
37
37
  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.10.0
4
+ version: 1.10.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: 2022-01-30 00:00:00.000000000 Z
11
+ date: 2022-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: equivalent-xml
@@ -128,14 +128,14 @@ dependencies:
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: 1.10.0
131
+ version: 1.10.1
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: 1.10.0
138
+ version: 1.10.1
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: rubyzip
141
141
  requirement: !ruby/object:Gem::Requirement