relaton-nist 1.17.0 → 1.19.0

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: 4dcfa351621f17ad754376d1c7d3b593fdfda7bb1fdd91624cb357f1655d2eed
4
- data.tar.gz: b4d12a7e12b1c8356683e457904f571133fe353e74b30ff012664d8f45f88dad
3
+ metadata.gz: cd31209270fb62d1b7dabbddf7f379eb7b33a21832f3e290dd9ed49c94d715c4
4
+ data.tar.gz: 8f15ad43f7d1edfd0a9135a6b750bf1414c3fd24216fd30c730586b9cd342f5c
5
5
  SHA512:
6
- metadata.gz: 77bf2aabe8e5be940d974da17cf4e07433ced3b2b7eae49a9930087b46b5f4fca80dc4f4771f93922adb5c8eb5bca2a0ff124b5a6c6d1e847a08280a8a369ea1
7
- data.tar.gz: 9ed7ce8b419bfefcb6d3c5ee4034720e7fc24220e392a7a2d5edd5f6b12ffa5dad459f14c4fe54920f9f5468768357cdfa10778580fc0811153c5f30493496f7
6
+ metadata.gz: ea6daf8959d56b98ab2e02e63315c2ecf7bd483824ec2ad0832fc9239e32d57e556942d86edbaa4c88655904d2e04e9a05c50cb4bbf38486773ab3cb0986c851
7
+ data.tar.gz: 2ca580e13556eb72455cc61f9a783d30894675d3f98630dd2de589a3a2a894380bc96a26453eb345e727eec37a7ecb8535b35aa011b34cab9580b858fc0e70ae
@@ -10,4 +10,4 @@ on:
10
10
 
11
11
  jobs:
12
12
  rake:
13
- uses: relaton/support/.github/workflows/rake.yml@master
13
+ uses: relaton/support/.github/workflows/rake.yml@main
@@ -17,7 +17,7 @@ on:
17
17
 
18
18
  jobs:
19
19
  release:
20
- uses: relaton/support/.github/workflows/release.yml@master
20
+ uses: relaton/support/.github/workflows/release.yml@main
21
21
  with:
22
22
  next_version: ${{ github.event.inputs.next_version }}
23
23
  secrets:
data/README.adoc CHANGED
@@ -71,24 +71,13 @@ Or install it yourself as:
71
71
 
72
72
  == Usage
73
73
 
74
- === Configuration
75
-
76
- Configuration is optional. The available option is `logger` which is a `Logger` instance. By default, the logger is `Logger.new($stderr)` with `Logger::WARN` level. To change the logger level, use `RelatonNist.configure` block.
74
+ === Search for a standard using keywords
77
75
 
78
76
  [source,ruby]
79
77
  ----
80
78
  require 'relaton_nist'
81
79
  => true
82
80
 
83
- RelatonNist.configure do |config|
84
- config.logger.level = Logger::DEBUG
85
- end
86
- ----
87
-
88
- === Search for a standard using keywords
89
-
90
- [source,ruby]
91
- ----
92
81
  hit_collection = RelatonNist::NistBibliography.search("NISTIR 8200")
93
82
  [relaton-nist] (NIST IR 8200) Fetching from csrc.nist.gov ...
94
83
  [relaton-nist] (NIST IR 8200) Fetching from Relaton repository ...
@@ -103,7 +92,7 @@ item = hit_collection[0].fetch
103
92
  [source,ruby]
104
93
  ----
105
94
  item.to_xml
106
- => "<bibitem id="NISTIR8200" type="standard" schema-version="v1.2.5">
95
+ => "<bibitem id="NISTIR8200" type="standard" schema-version="v1.2.9">
107
96
  <fetched>2023-10-16</fetched>
108
97
  <title format="text/plain" language="en" script="Latn">Interagency report on the status of international cybersecurity standardization for the internet of things (IoT)</title>
109
98
  ...
@@ -113,7 +102,7 @@ With argument `bibdata: true` it outputs XML wrapped by `bibdata` element and ad
113
102
  [source,ruby]
114
103
  ----
115
104
  item.to_xml bibdata: true
116
- => "<bibdata type="standard" schema-version="v1.2.5">
105
+ => "<bibdata type="standard" schema-version="v1.2.9">
117
106
  <fetched>2023-10-16</fetched>
118
107
  <title format="text/plain" language="en" script="Latn">Interagency report on the status of international cybersecurity standardization for the internet of things (IoT)</title>
119
108
  ...
@@ -239,6 +228,10 @@ Done in: 42 sec.
239
228
  => nil
240
229
  ----
241
230
 
231
+ === Logging
232
+
233
+ RelatonNist uses the relaton-logger gem for logging. By default, it logs to STDOUT. To change the log levels and add other loggers, read the https://github.com/relaton/relaton-logger#usage[relaton-logger] documentation.
234
+
242
235
  == Development
243
236
 
244
237
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -95,8 +95,89 @@
95
95
  <ref name="pagebreak"/>
96
96
  <ref name="hr"/>
97
97
  <ref name="bookmark"/>
98
+ <ref name="amend"/>
98
99
  </choice>
99
100
  </define>
101
+ <define name="amend">
102
+ <element name="amend">
103
+ <ref name="AmendType"/>
104
+ </element>
105
+ </define>
106
+ <define name="AmendType">
107
+ <optional>
108
+ <attribute name="id">
109
+ <data type="ID"/>
110
+ </attribute>
111
+ </optional>
112
+ <attribute name="change">
113
+ <choice>
114
+ <value>add</value>
115
+ <value>modify</value>
116
+ <value>delete</value>
117
+ <value>replace</value>
118
+ </choice>
119
+ </attribute>
120
+ <optional>
121
+ <attribute name="path"/>
122
+ </optional>
123
+ <optional>
124
+ <attribute name="path_end"/>
125
+ </optional>
126
+ <optional>
127
+ <attribute name="title"/>
128
+ </optional>
129
+ <optional>
130
+ <element name="location">
131
+ <zeroOrMore>
132
+ <choice>
133
+ <ref name="locality"/>
134
+ <ref name="localityStack"/>
135
+ </choice>
136
+ </zeroOrMore>
137
+ </element>
138
+ </optional>
139
+ <optional>
140
+ <element name="description">
141
+ <zeroOrMore>
142
+ <ref name="BasicBlock"/>
143
+ </zeroOrMore>
144
+ </element>
145
+ </optional>
146
+ <optional>
147
+ <element name="newcontent">
148
+ <optional>
149
+ <attribute name="id">
150
+ <data type="ID"/>
151
+ </attribute>
152
+ </optional>
153
+ <zeroOrMore>
154
+ <ref name="BasicBlock"/>
155
+ </zeroOrMore>
156
+ </element>
157
+ </optional>
158
+ <zeroOrMore>
159
+ <ref name="classification"/>
160
+ </zeroOrMore>
161
+ <zeroOrMore>
162
+ <ref name="contributor"/>
163
+ </zeroOrMore>
164
+ </define>
165
+ <define name="classification">
166
+ <element name="classification">
167
+ <ref name="classification_tag"/>
168
+ <ref name="classification_value"/>
169
+ </element>
170
+ </define>
171
+ <define name="classification_tag">
172
+ <element name="tag">
173
+ <text/>
174
+ </element>
175
+ </define>
176
+ <define name="classification_value">
177
+ <element name="value">
178
+ <text/>
179
+ </element>
180
+ </define>
100
181
  <define name="paragraph">
101
182
  <element name="p">
102
183
  <ref name="ParagraphType"/>
@@ -163,6 +244,9 @@
163
244
  <data type="ID"/>
164
245
  </attribute>
165
246
  <attribute name="reviewer"/>
247
+ <optional>
248
+ <attribute name="type"/>
249
+ </optional>
166
250
  <optional>
167
251
  <attribute name="date">
168
252
  <data type="dateTime"/>
@@ -715,27 +799,36 @@
715
799
  </define>
716
800
  <define name="ruby">
717
801
  <element name="ruby">
718
- <zeroOrMore>
719
- <choice>
720
- <ref name="PureTextElement"/>
721
- <ref name="rp"/>
722
- <ref name="rt"/>
723
- </choice>
724
- </zeroOrMore>
802
+ <choice>
803
+ <ref name="ruby_pronunciation"/>
804
+ <ref name="ruby_annotation"/>
805
+ </choice>
806
+ <choice>
807
+ <text/>
808
+ <ref name="ruby"/>
809
+ </choice>
725
810
  </element>
726
811
  </define>
727
- <define name="rp">
728
- <element name="rp">
729
- <zeroOrMore>
730
- <ref name="PureTextElement"/>
731
- </zeroOrMore>
812
+ <define name="ruby_pronunciation">
813
+ <element name="pronunciation">
814
+ <attribute name="value"/>
815
+ <optional>
816
+ <attribute name="script"/>
817
+ </optional>
818
+ <optional>
819
+ <attribute name="lang"/>
820
+ </optional>
732
821
  </element>
733
822
  </define>
734
- <define name="rt">
735
- <element name="rt">
736
- <zeroOrMore>
737
- <ref name="PureTextElement"/>
738
- </zeroOrMore>
823
+ <define name="ruby_annotation">
824
+ <element name="annotation">
825
+ <attribute name="value"/>
826
+ <optional>
827
+ <attribute name="script"/>
828
+ </optional>
829
+ <optional>
830
+ <attribute name="lang"/>
831
+ </optional>
739
832
  </element>
740
833
  </define>
741
834
  <define name="br">
@@ -914,44 +1007,49 @@
914
1007
  -->
915
1008
  <define name="image">
916
1009
  <element name="image">
917
- <attribute name="id">
918
- <data type="ID"/>
1010
+ <ref name="Image"/>
1011
+ </element>
1012
+ </define>
1013
+ <define name="Image">
1014
+ <attribute name="id">
1015
+ <data type="ID"/>
1016
+ </attribute>
1017
+ <attribute name="src">
1018
+ <data type="anyURI"/>
1019
+ </attribute>
1020
+ <attribute name="mimetype"/>
1021
+ <optional>
1022
+ <attribute name="filename"/>
1023
+ </optional>
1024
+ <optional>
1025
+ <attribute name="width">
1026
+ <ref name="ImageSize"/>
919
1027
  </attribute>
920
- <attribute name="src">
1028
+ </optional>
1029
+ <optional>
1030
+ <attribute name="height">
1031
+ <ref name="ImageSize"/>
1032
+ </attribute>
1033
+ </optional>
1034
+ <optional>
1035
+ <attribute name="alt"/>
1036
+ </optional>
1037
+ <optional>
1038
+ <attribute name="title"/>
1039
+ </optional>
1040
+ <optional>
1041
+ <attribute name="longdesc">
921
1042
  <data type="anyURI"/>
922
1043
  </attribute>
923
- <attribute name="mimetype"/>
924
- <optional>
925
- <attribute name="filename"/>
926
- </optional>
927
- <optional>
928
- <attribute name="width">
929
- <choice>
930
- <data type="int"/>
931
- <value>auto</value>
932
- </choice>
933
- </attribute>
934
- </optional>
935
- <optional>
936
- <attribute name="height">
937
- <choice>
938
- <data type="int"/>
939
- <value>auto</value>
940
- </choice>
941
- </attribute>
942
- </optional>
943
- <optional>
944
- <attribute name="alt"/>
945
- </optional>
946
- <optional>
947
- <attribute name="title"/>
948
- </optional>
949
- <optional>
950
- <attribute name="longdesc">
951
- <data type="anyURI"/>
952
- </attribute>
953
- </optional>
954
- </element>
1044
+ </optional>
1045
+ </define>
1046
+ <define name="ImageSize">
1047
+ <choice>
1048
+ <data type="string">
1049
+ <param name="pattern">\d+([.]\d+)?(%?)</param>
1050
+ </data>
1051
+ <value>auto</value>
1052
+ </choice>
955
1053
  </define>
956
1054
  <define name="video">
957
1055
  <element name="video">
@@ -9,11 +9,42 @@
9
9
  -->
10
10
  <include href="biblio.rng">
11
11
  <define name="BibData">
12
- <ref name="BibliographicItem"/>
12
+ <ref name="StandardBibliographicItem"/>
13
13
  <optional>
14
14
  <ref name="ext"/>
15
15
  </optional>
16
16
  </define>
17
+ <define name="docrelation">
18
+ <element name="relation">
19
+ <attribute name="type">
20
+ <ref name="DocRelationType"/>
21
+ </attribute>
22
+ <optional>
23
+ <element name="description">
24
+ <ref name="FormattedString"/>
25
+ </element>
26
+ </optional>
27
+ <element name="bibitem">
28
+ <ref name="StandardReducedBibliographicItem"/>
29
+ </element>
30
+ <choice>
31
+ <zeroOrMore>
32
+ <ref name="locality"/>
33
+ </zeroOrMore>
34
+ <zeroOrMore>
35
+ <ref name="localityStack"/>
36
+ </zeroOrMore>
37
+ </choice>
38
+ <choice>
39
+ <zeroOrMore>
40
+ <ref name="sourceLocality"/>
41
+ </zeroOrMore>
42
+ <zeroOrMore>
43
+ <ref name="sourceLocalityStack"/>
44
+ </zeroOrMore>
45
+ </choice>
46
+ </element>
47
+ </define>
17
48
  </include>
18
49
  <define name="ext">
19
50
  <element name="ext">
@@ -161,4 +192,16 @@
161
192
  </optional>
162
193
  </element>
163
194
  </define>
195
+ <define name="StandardBibliographicItem">
196
+ <ref name="BibliographicItem"/>
197
+ <zeroOrMore>
198
+ <ref name="amend"/>
199
+ </zeroOrMore>
200
+ </define>
201
+ <define name="StandardReducedBibliographicItem">
202
+ <ref name="ReducedBibliographicItem"/>
203
+ <zeroOrMore>
204
+ <ref name="amend"/>
205
+ </zeroOrMore>
206
+ </define>
164
207
  </grammar>
data/grammars/biblio.rng CHANGED
@@ -241,6 +241,9 @@
241
241
  </element>
242
242
  </define>
243
243
  <define name="FullNameType">
244
+ <optional>
245
+ <ref name="name_abbreviation"/>
246
+ </optional>
244
247
  <choice>
245
248
  <group>
246
249
  <zeroOrMore>
@@ -266,6 +269,11 @@
266
269
  <ref name="variantname"/>
267
270
  </zeroOrMore>
268
271
  </define>
272
+ <define name="name_abbreviation">
273
+ <element name="abbreviation">
274
+ <ref name="LocalizedString"/>
275
+ </element>
276
+ </define>
269
277
  <define name="prefix">
270
278
  <element name="prefix">
271
279
  <ref name="LocalizedString"/>
@@ -348,6 +356,9 @@
348
356
  <zeroOrMore>
349
357
  <ref name="contact"/>
350
358
  </zeroOrMore>
359
+ <optional>
360
+ <ref name="logo"/>
361
+ </optional>
351
362
  </element>
352
363
  </define>
353
364
  <define name="orgname">
@@ -366,6 +377,21 @@
366
377
  </choice>
367
378
  </element>
368
379
  </define>
380
+ <define name="logo">
381
+ <element name="logo">
382
+ <ref name="image"/>
383
+ </element>
384
+ </define>
385
+ <define name="depiction">
386
+ <element name="depiction">
387
+ <optional>
388
+ <attribute name="scope"/>
389
+ </optional>
390
+ <zeroOrMore>
391
+ <ref name="image"/>
392
+ </zeroOrMore>
393
+ </element>
394
+ </define>
369
395
  <define name="NameWithVariants">
370
396
  <element name="primary">
371
397
  <ref name="LocalizedString"/>
@@ -752,6 +778,9 @@
752
778
  <optional>
753
779
  <ref name="validity"/>
754
780
  </optional>
781
+ <optional>
782
+ <ref name="depiction"/>
783
+ </optional>
755
784
  </define>
756
785
  <define name="ReducedBibliographicItem">
757
786
  <optional>
@@ -849,6 +878,9 @@
849
878
  <optional>
850
879
  <ref name="validity"/>
851
880
  </optional>
881
+ <optional>
882
+ <ref name="depiction"/>
883
+ </optional>
852
884
  </define>
853
885
  <define name="btitle">
854
886
  <element name="title">
@@ -30,7 +30,7 @@ module RelatonNist
30
30
  id = bib.docidentifier[0].id.gsub(%r{[/\s:.]}, "_").upcase.sub(/^NIST_IR/, "NISTIR")
31
31
  file = File.join(@output, "#{id}.#{@ext}")
32
32
  if @files.include? file
33
- warn "File #{file} exists. Docid: #{bib.docidentifier[0].id}"
33
+ Util.warn "File #{file} exists. Docid: #{bib.docidentifier[0].id}"
34
34
  # warn "Link: #{bib.link.detect { |l| l.type == 'src' }.content}"
35
35
  else @files << file
36
36
  end
@@ -64,8 +64,7 @@ module RelatonNist
64
64
  puts "Stopped at: #{t2}"
65
65
  puts "Done in: #{(t2 - t1).round} sec."
66
66
  rescue StandardError => e
67
- warn e.message
68
- warn e.backtrace[0..5].join("\n")
67
+ Util.error "#{e.message}\n#{e.backtrace[0..5].join("\n")}"
69
68
  end
70
69
 
71
70
  def fetch_tech_pubs
@@ -190,7 +190,7 @@ module RelatonNist
190
190
  # @raise [OpenURI::HTTPError] if GitHub repo is not available
191
191
  #
192
192
  def from_ga # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
193
- Util.warn "(#{@reference}) Fetching from Relaton repository ..."
193
+ Util.info "Fetching from Relaton repository ...", key: @reference
194
194
  ref = full_ref
195
195
  return [] if ref.empty?
196
196
 
@@ -222,7 +222,7 @@ module RelatonNist
222
222
  # @return [Array<RelatonNist::Hit>] hits
223
223
  #
224
224
  def from_json # rubocop:disable Metrics/AbcSize
225
- Util.warn "(#{@reference}) Fetching from csrc.nist.gov ..."
225
+ Util.info "Fetching from csrc.nist.gov ...", key: @reference
226
226
  select_data.map do |h|
227
227
  /(?<series>(?<=-)\w+$)/ =~ h["series"]
228
228
  title = [h["title-main"], h["title-sub"]].compact.join " - "
@@ -3,32 +3,32 @@ module RelatonNist
3
3
  # @return [Array<RelatonNist::Keyword>]
4
4
  # attr_reader :keyword
5
5
 
6
- # @return [RelatonNist::CommentPeriod, NilClass]
6
+ # @return [RelatonNist::CommentPeriod, nil]
7
7
  attr_reader :commentperiod
8
8
 
9
- # @param id [String, NilClass]
9
+ # @param id [String, nil]
10
10
  # @param title [Array<RelatonBib::TypedTitleString>]
11
- # @param formattedref [RelatonBib::FormattedRef, NilClass]
12
- # @param type [String, NilClass]
11
+ # @param formattedref [RelatonBib::FormattedRef, nil]
12
+ # @param type [String, nil]
13
13
  # @param docid [Array<RelatonBib::DocumentIdentifier>]
14
- # @param docnumber [String, NilClass]
14
+ # @param docnumber [String, nil]
15
15
  # @param language [Arra<String>]
16
16
  # @param script [Array<String>]
17
- # @param docstatus [RelatonNist::DocumentStatus, NilClass]
18
- # @param edition [String, NilClass]
19
- # @param version [RelatonBib::BibliographicItem::Version, NilClass]
17
+ # @param docstatus [RelatonNist::DocumentStatus, nil]
18
+ # @param edition [String, nil]
19
+ # @param version [RelatonBib::BibliographicItem::Version, nil]
20
20
  # @param biblionote [Array<RelatonBib::FormattedStrong>]
21
21
  # @param series [Array<RelatonBib::Series>]
22
22
  # @param medium [RelatonBib::Medium, NilClas]
23
23
  # @param place [Array<String>]
24
24
  # @param extent [Array<Relaton::BibItemLocality>]
25
25
  # @param accesslocation [Array<String>]
26
- # @param classification [RelatonBib::Classification, NilClass]
27
- # @param validity [RelatonBib:Validity, NilClass]
28
- # @param fetched [Date, NilClass] default nil
29
- # @param doctype [String]
26
+ # @param classification [RelatonBib::Classification, nil]
27
+ # @param validity [RelatonBib:Validity, nil]
28
+ # @param fetched [Date, nil] default nil
29
+ # @param doctype [RelatonBib::DocumentType, nil]
30
30
  # @param keyword [Array<RelatonBib::Keyword>]
31
- # @param commentperiod [RelatonNist::CommentPeriod, NilClass]
31
+ # @param commentperiod [RelatonNist::CommentPeriod, nil]
32
32
  #
33
33
  # @param date [Array<Hash>]
34
34
  # @option date [String] :type
@@ -84,7 +84,7 @@ module RelatonNist
84
84
  result = nistbib_search_filter(code, year, opts) || (return nil)
85
85
  ret = nistbib_results_filter(result, year, opts)
86
86
  if ret[:ret]
87
- Util.warn "(#{result.reference}) Found: `#{ret[:ret].docidentifier.first.id}`"
87
+ Util.info "Found: `#{ret[:ret].docidentifier.first.id}`", key: result.reference
88
88
  ret[:ret]
89
89
  else
90
90
  fetch_ref_err(result.reference, year, ret[:years])
@@ -173,14 +173,14 @@ module RelatonNist
173
173
  # @return [nil] nil
174
174
  #
175
175
  def fetch_ref_err(ref, year, missed_years)
176
- Util.warn "(#{ref}) No found."
176
+ Util.info "No found.", key: ref
177
177
  unless missed_years.empty?
178
- Util.warn "(There was no match for #{year}, though there " \
179
- "were matches found for `#{missed_years.join('`, `')}`.)"
178
+ Util.info "(There was no match for #{year}, though there " \
179
+ "were matches found for `#{missed_years.join('`, `')}`.)", key: ref
180
180
  end
181
181
  if /\d-\d/.match? ref
182
- Util.warn "The provided document part may not exist, " \
183
- "or the document may no longer be published in parts."
182
+ Util.info "The provided document part may not exist, " \
183
+ "or the document may no longer be published in parts.", key: ref
184
184
  end
185
185
  nil
186
186
  end
@@ -43,10 +43,10 @@ module RelatonNist
43
43
  RelatonNist::NistBibliographicItem.new(
44
44
  type: "standard", language: [@doc["language"]], script: ["Latn"], **args
45
45
  )
46
- rescue StandardError => e
47
- warn "Document: `#{@doc.at('doi').text}`"
48
- warn e.message
49
- warn e.backtrace[0..5].join("\n")
46
+ # rescue StandardError => e
47
+ # warn "Document: `#{pub_id}`"
48
+ # warn e.message
49
+ # warn e.backtrace[0..5].join("\n")
50
50
  end
51
51
 
52
52
  def args
@@ -73,12 +73,18 @@ module RelatonNist
73
73
  #
74
74
  def pub_id
75
75
  # anchor(doc).gsub(".", " ")
76
- doi.split("/")[1..].join("/").gsub(".", " ").sub(/^nist\sir/, "NIST IR")
76
+ if doi
77
+ doi.split("/")[1..].join("/").gsub(".", " ").sub(/^nist\sir/, "NIST IR")
78
+ else
79
+ @doc.at("publisher_item/item_number").text
80
+ end
77
81
  end
78
82
 
79
83
  def doi # rubocop:disable Metrics/CyclomaticComplexity,Metrics/MethodLength
80
- @doi ||= begin
81
- id = @doc.at("doi_data/doi").text
84
+ return @doi if defined? @doi
85
+
86
+ @doi = begin
87
+ id = @doc.at("doi_data/doi")&.text
82
88
  case id
83
89
  when "10.6028/NBS.CIRC.e2e" then "10.6028/NBS.CIRC.2e2"
84
90
  when "10.6028/NBS.CIRC.sup" then "10.6028/NBS.CIRC.24e7sup"
@@ -146,7 +152,7 @@ module RelatonNist
146
152
  # @return [Array<Hash>]
147
153
  def parse_contributor
148
154
  contribs = @doc.xpath("contributors/person_name").map do |p|
149
- person = RelatonBib::Person.new(name: fullname(p), affiliation: affiliation)
155
+ person = RelatonBib::Person.new(name: fullname(p), affiliation: affiliation, identifier: identifier(p))
150
156
  { entity: person, role: [{ type: p["contributor_role"] }] }
151
157
  end
152
158
  contribs + @doc.xpath("publisher").map do |p|
@@ -154,6 +160,12 @@ module RelatonNist
154
160
  end
155
161
  end
156
162
 
163
+ def identifier(person)
164
+ person.xpath("ORCID").map do |id|
165
+ RelatonBib::PersonIdentifier.new "orcid", id.text
166
+ end
167
+ end
168
+
157
169
  #
158
170
  # Create full name object from person name element.
159
171
  #
@@ -163,12 +175,11 @@ module RelatonNist
163
175
  #
164
176
  def fullname(person)
165
177
  fname, initials = forename_initial person
166
- surname = localized_string person.at("surname").text
167
- ident = person.xpath("ORCID").map do |id|
168
- RelatonBib::PersonIdentifier.new "orcid", id.text
169
- end
170
- RelatonBib::FullName.new(surname: surname, forename: fname,
171
- initials: initials, identifier: ident)
178
+ surname = localized_string person.at("surname")&.text
179
+ completename = localized_string person.text unless surname
180
+ RelatonBib::FullName.new(
181
+ surname: surname, forename: fname, initials: initials, completename: completename,
182
+ )
172
183
  end
173
184
 
174
185
  #
@@ -290,6 +301,7 @@ module RelatonNist
290
301
  # @return [RelatonBib::LocalizedString] localized string
291
302
  #
292
303
  def localized_string(content)
304
+ return unless content
293
305
  RelatonBib::LocalizedString.new content, @doc["language"], "Latn"
294
306
  end
295
307
  end
@@ -1,9 +1,6 @@
1
1
  module RelatonNist
2
2
  module Util
3
3
  extend RelatonBib::Util
4
-
5
- def self.logger
6
- RelatonNist.configuration.logger
7
- end
4
+ PROGNAME = "relaton-nist".freeze
8
5
  end
9
6
  end
@@ -1,3 +1,3 @@
1
1
  module RelatonNist
2
- VERSION = "1.17.0".freeze
2
+ VERSION = "1.19.0".freeze
3
3
  end
data/lib/relaton_nist.rb CHANGED
@@ -2,7 +2,6 @@ require "singleton"
2
2
  require "relaton/index"
3
3
  require "relaton_bib"
4
4
  require "relaton_nist/version"
5
- require "relaton_nist/config"
6
5
  require "relaton_nist/util"
7
6
  require "relaton_nist/nist_bibliography"
8
7
  require "relaton_nist/data_fetcher"
data/relaton_nist.gemspec CHANGED
@@ -23,7 +23,8 @@ Gem::Specification.new do |spec|
23
23
  spec.require_paths = ["lib"]
24
24
  spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
25
25
 
26
- spec.add_dependency "relaton-bib", "~> 1.17.0"
26
+ spec.add_dependency "base64"
27
+ spec.add_dependency "relaton-bib", "~> 1.19.0"
27
28
  spec.add_dependency "relaton-index", "~> 0.2.0"
28
29
  spec.add_dependency "rubyzip"
29
30
  end
metadata CHANGED
@@ -1,29 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-nist
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.17.0
4
+ version: 1.19.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-11-27 00:00:00.000000000 Z
11
+ date: 2024-07-03 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: base64
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: relaton-bib
15
29
  requirement: !ruby/object:Gem::Requirement
16
30
  requirements:
17
31
  - - "~>"
18
32
  - !ruby/object:Gem::Version
19
- version: 1.17.0
33
+ version: 1.19.0
20
34
  type: :runtime
21
35
  prerelease: false
22
36
  version_requirements: !ruby/object:Gem::Requirement
23
37
  requirements:
24
38
  - - "~>"
25
39
  - !ruby/object:Gem::Version
26
- version: 1.17.0
40
+ version: 1.19.0
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: relaton-index
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -78,7 +92,6 @@ files:
78
92
  - grammars/relaton-nist.rng
79
93
  - lib/relaton_nist.rb
80
94
  - lib/relaton_nist/comment_period.rb
81
- - lib/relaton_nist/config.rb
82
95
  - lib/relaton_nist/data_fetcher.rb
83
96
  - lib/relaton_nist/document_relation.rb
84
97
  - lib/relaton_nist/document_status.rb
@@ -115,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
115
128
  - !ruby/object:Gem::Version
116
129
  version: '0'
117
130
  requirements: []
118
- rubygems_version: 3.3.26
131
+ rubygems_version: 3.3.27
119
132
  signing_key:
120
133
  specification_version: 4
121
134
  summary: 'RelatonNist: retrive NIST standards.'
@@ -1,10 +0,0 @@
1
- module RelatonNist
2
- module Config
3
- include RelatonBib::Config
4
- end
5
- extend Config
6
-
7
- class Configuration < RelatonBib::Configuration
8
- PROGNAME = "relaton-nist".freeze
9
- end
10
- end