pubid-nist 0.2.6 → 0.3.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: effbdd3a2d023969c91461079bcb6b2ac8fc24d1260a7655cdacaf50858a6084
4
- data.tar.gz: '07885e3191c545d7f5796c5ad431094af88a4334fa12b3f97357c8dbebc71d6f'
3
+ metadata.gz: 6d4329248de2fde990db7f396796b104fc7152a4d3cf19c9b1fba9817bd9bc59
4
+ data.tar.gz: 1f1368050820296d410019b9bb66d980de01d166ba62ec9572b9f048c1fde931
5
5
  SHA512:
6
- metadata.gz: f5612165d60141ecccaf5c757f5cf30a8eb7d9dd4c62855d44d4a67489b7ff32216fdc81baa5f8d17fd8b5a58bfe38602421083a0ac23e36f2cc7bda62bb5206
7
- data.tar.gz: d5b169cb694230dbb1d9667a6c38d7b7b0a900dac783412364026ea3d58a330d6045440a26770f01a63d3afb805f2d86907bdf42171e57b5e0258363a89bf226
6
+ metadata.gz: 0d711d29e07f10c5f69307dcfb0267a4a480c12a715d75901d083362fb123ff5a7074d45d9d37f83cea5efc12ae8a5aa6e2c8d47f529c2b78858dba4e3e7fb23
7
+ data.tar.gz: 50b16da1bb63033efe8c09d37f2f9687e79d2efc73a0b7b66a61637e1fad7d414a71b6a182b4710556ab9f332b6e9670d1af10d82940a170f30e12b1fc8f04d2
@@ -1,26 +1,38 @@
1
1
  module Pubid::Nist
2
2
  class Edition < Pubid::Core::Entity
3
- attr_accessor :year, :month, :day, :parsed, :sequence
3
+ attr_accessor :year, :month, :day, :parsed, :number
4
4
 
5
- def initialize(parsed: nil, year: nil, month: nil, day: nil, sequence: nil)
5
+ def initialize(parsed: nil, year: nil, month: nil, day: nil, number: nil)
6
6
  @parsed = parsed
7
7
  @year = year
8
8
  @month = month
9
9
  @day = day
10
- @sequence = sequence
10
+ @number = number
11
11
  end
12
12
 
13
- def to_s
14
- result = (@sequence && [@sequence]) || []
15
- if @day
16
- result << Date.new(@year, @month, @day).strftime("%Y%m%d")
17
- elsif @month
18
- result << Date.new(@year, @month).strftime("%Y%m")
19
- elsif @year
20
- result << Date.new(@year).strftime("%Y")
21
- end
13
+ def to_s(format: :short)
22
14
 
23
- result.join("-")
15
+ if format == :long
16
+ result = (@number && ["Edition #{@number}"]) || []
17
+ if @day
18
+ result << Date.new(@year, @month, @day).strftime("(%B %d, %Y)")
19
+ elsif @month
20
+ result << Date.new(@year, @month).strftime("(%B %Y)")
21
+ elsif @year
22
+ result << Date.new(@year).strftime("(%Y)")
23
+ end
24
+ result.join(" ")
25
+ else
26
+ result = (@number && [@number]) || []
27
+ if @day
28
+ result << Date.new(@year, @month, @day).strftime("%Y%m%d")
29
+ elsif @month
30
+ result << Date.new(@year, @month).strftime("%Y%m")
31
+ elsif @year
32
+ result << Date.new(@year).strftime("%Y")
33
+ end
34
+ result.join("-")
35
+ end
24
36
  end
25
37
  end
26
38
  end
@@ -8,19 +8,24 @@ UPDATE_CODES = YAML.load_file(File.join(File.dirname(__FILE__), "../../../update
8
8
  module Pubid::Nist
9
9
  class Identifier < Pubid::Core::Identifier::Base
10
10
  extend Forwardable
11
- attr_accessor :serie, :code, :revision, :publisher, :version, :volume,
11
+ attr_accessor :series, :code, :revision, :publisher, :version, :volume,
12
12
  :part, :addendum, :stage, :translation,
13
13
  :edition, :supplement, :update,
14
14
  :section, :appendix, :errata, :index, :insert
15
15
 
16
- def initialize(publisher: "NIST", serie:, number: nil, stage: nil, supplement: nil,
17
- edition_month: nil, edition_year: nil, edition_day: nil, update: nil, **opts)
18
- @publisher = publisher.is_a?(Publisher) ? publisher : Publisher.new(publisher: publisher)
19
- @serie = serie.is_a?(Serie) ? serie : Serie.new(serie: serie)
16
+ def initialize(publisher: "NIST", series:, number: nil, stage: nil, supplement: nil,
17
+ edition_month: nil, edition_year: nil, edition_day: nil, update: nil,
18
+ edition: nil, **opts)
19
+ @publisher = publisher.is_a?(Publisher) ? publisher : Publisher.new(publisher: publisher.to_s)
20
+ @series = series.is_a?(Series) ? series : Series.new(series: series)
20
21
  @code = number
21
22
  @stage = Stage.new(**stage) if stage
22
23
  @supplement = (supplement.is_a?(Array) && "") || supplement
23
- @edition = parse_edition(edition_month, edition_year, edition_day) if edition_month || edition_year
24
+ if edition_month || edition_year
25
+ @edition = parse_edition(edition_month, edition_year, edition_day)
26
+ elsif edition
27
+ @edition = Edition.new(number: edition)
28
+ end
24
29
  @update = update
25
30
  opts.each { |key, value| send("#{key}=", value.to_s) }
26
31
  end
@@ -56,7 +61,7 @@ module Pubid::Nist
56
61
  document.instance_variables.each do |var|
57
62
  val = document.instance_variable_get(var)
58
63
  current_val = instance_variable_get(var)
59
- if [:@serie, :@publisher].include?(var) ||
64
+ if [:@series, :@publisher].include?(var) ||
60
65
  (val && current_val.nil?) ||
61
66
  (val && current_val.to_s.length < val.to_s.length)
62
67
  instance_variable_set(var, val)
@@ -5,7 +5,7 @@ module Pubid::Nist
5
5
  rule(:series) do
6
6
  (array_to_str(SERIES["long"].keys.sort_by(&:length).reverse.flatten).as(:series) |
7
7
  array_to_str(SERIES["mr"].values).as(:series_mr) |
8
- (str("NIST ") >> array_to_str(SERIES["long"].keys.sort_by(&:length).reverse.flatten).as(:series))) >>
8
+ ((str("NBS") | str("NIST")).as(:publisher) >> (space | dot) >> array_to_str(SERIES["long"].keys.sort_by(&:length).reverse.flatten).as(:series))) >>
9
9
  any.repeat.as(:remaining)
10
10
  end
11
11
 
@@ -18,7 +18,8 @@ module Pubid::Nist
18
18
  else
19
19
  SERIES["mr"].key(parsed[:series_mr].to_s)
20
20
  end
21
- parser = find_parser(series)
21
+ publisher = parsed[:publisher]
22
+ parser = find_parser(publisher, series)
22
23
  begin
23
24
  parsed = parser.new.parse(parsed[:remaining].to_s)
24
25
  rescue Parslet::ParseFailed
@@ -26,11 +27,15 @@ module Pubid::Nist
26
27
  # so parse using Default parser which is comply with PubID 1.0
27
28
  parsed = Parsers::Default.new.parse(parsed[:remaining].to_s)
28
29
  end
29
- parsed.is_a?(Array) ? parsed << { series: series } : parsed.merge({ series: series })
30
+ if publisher
31
+ parsed.is_a?(Array) ? parsed << { series: series, publisher: publisher } : parsed.merge({ series: series, publisher: publisher })
32
+ else
33
+ parsed.is_a?(Array) ? parsed << { series: series } : parsed.merge({ series: series })
34
+ end
30
35
  end
31
36
 
32
- def find_parser(series)
33
- PARSERS_CLASSES[series] || Pubid::Nist::Parsers::Default
37
+ def find_parser(publisher, series)
38
+ PARSERS_CLASSES[series] || PARSERS_CLASSES["#{publisher} #{series}"] || Pubid::Nist::Parsers::Default
34
39
  end
35
40
  end
36
41
  end
@@ -1,6 +1,6 @@
1
1
  module Pubid::Nist
2
2
  module Parsers
3
- class NbsCirc < Default
3
+ class Circ < Default
4
4
  rule(:revision) do
5
5
  ((str("rev") >> (words >> year_digits).as(:revision)) |
6
6
  (str("r") >> (digits | (words >> year_digits)).as(:revision))
@@ -1,6 +1,6 @@
1
1
  module Pubid::Nist
2
2
  module Parsers
3
- class NbsCrpl < Default
3
+ class Crpl < Default
4
4
  rule(:first_report_number) do
5
5
  (digits >> (str("-m") | str("-M")).maybe).as(:first_report_number)
6
6
  end
@@ -1,6 +1,6 @@
1
1
  module Pubid::Nist
2
2
  module Parsers
3
- class NbsCsm < Default
3
+ class Csm < Default
4
4
  rule(:identifier) do
5
5
  (str(" ") | str(".")) >> report_number.maybe >> parts.repeat.as(:parts)
6
6
  end
@@ -1,8 +1,15 @@
1
- require_relative "nbs_fips"
2
-
3
1
  module Pubid::Nist
4
2
  module Parsers
5
- class Fips < NbsFips
3
+ class Fips < Default
4
+ rule(:edition) do
5
+ str("-") >> (
6
+ (month_letters.as(:edition_month) >> year_digits.as(:edition_year)) |
7
+ year_digits.as(:edition_year) |
8
+ (month_letters.as(:edition_month) >> match('\d').repeat(2, 2).as(:edition_day) >>
9
+ str("/") >> year_digits.as(:edition_year))
10
+ ) |
11
+ (str("e") >> year_digits.as(:edition_year) >> month_digits.as(:edition_month).maybe)
12
+ end
6
13
  end
7
14
  end
8
15
  end
@@ -1,6 +1,6 @@
1
1
  module Pubid::Nist
2
2
  module Parsers
3
- class NistGcr < Default
3
+ class Gcr < Default
4
4
  rule(:report_number) do
5
5
  (digits >>
6
6
  str("-") >> digits >> (str("-") >> digits).maybe).as(:report_number)
@@ -1,15 +1,7 @@
1
1
  module Pubid::Nist
2
2
  module Parsers
3
- class NbsHb < Default
4
- # found patterns:
5
- # 44e2-1955 -> 44e2
6
- # 146v1-1991
7
- # 105-1-1990 -> 105-1e1990
8
- # 111r1977 / 146v1
9
- # 130-1979 -> 130e1979
10
- # 105-8 -> 105-8
11
- # 28supp1957pt1
12
- # 67suppFeb1965
3
+ class Hb < Default
4
+ rule(:number_suffix) { match("[a-zA-Z]") }
13
5
 
14
6
  rule(:edition) do
15
7
  (str("supp") >> str("").as(:supplement) >>
@@ -1,6 +1,6 @@
1
1
  module Pubid::Nist
2
2
  module Parsers
3
- class NbsMp < Default
3
+ class Mp < Default
4
4
  rule(:edition) do
5
5
  (str("e") >> digits.as(:edition)) | (str("(") >> digits.as(:edition) >> str(")"))
6
6
  end
@@ -1,6 +1,6 @@
1
1
  module Pubid::Nist
2
2
  module Parsers
3
- class NistNcstar < Default
3
+ class Ncstar < Default
4
4
  rule(:number_suffix) { match("[abcdefghijA-Z]") }
5
5
  end
6
6
  end
@@ -1,6 +1,6 @@
1
1
  module Pubid::Nist
2
2
  module Parsers
3
- class NistOwmwp < Default
3
+ class Owmwp < Default
4
4
  rule(:report_number) do
5
5
  digits_with_suffix.as(:first_report_number) >>
6
6
  (str("-") >> (digits_with_suffix >> (str("-") >> digits_with_suffix).maybe)
@@ -1,6 +1,6 @@
1
1
  module Pubid::Nist
2
2
  module Parsers
3
- class NbsRpt < Default
3
+ class Rpt < Default
4
4
  rule(:report_number) do
5
5
  (month_letters >>
6
6
  str("-") >> (month_letters >> year_digits)).as(:report_number) |
@@ -1,6 +1,6 @@
1
1
  module Pubid::Nist
2
2
  module Parsers
3
- class NistSp < Default
3
+ class Sp < Default
4
4
  rule(:version) do
5
5
  (((str("ver") | str(" Ver. ") | str(" Version ")) >> (digits >> (str(".") >> digits).repeat).as(:version)) |
6
6
  (str("v") >>
@@ -50,10 +50,12 @@ module Pubid::Nist
50
50
  end
51
51
 
52
52
  rule(:volume) do
53
- (str("v") | str(" Vol. ")) >> digits.as(:volume)
53
+ # hack for NBS SP 535v2a-l vs NBS SP 535v2m-z
54
+ # https://github.com/metanorma/pubid-nist/issues/98
55
+ (str("v") | str(" Vol. ")) >> (digits >> (str("a-l") | str("m-z")).maybe >> match("[A-Z]").repeat).as(:volume)
54
56
  end
55
57
 
56
- rule(:part_prefixes) { str("pt") | str("p") | str(" Part ") }
58
+ rule(:part_prefixes) { str("pt") | str("p") | str("P") | str(" Part ") }
57
59
  end
58
60
  end
59
61
  end
@@ -0,0 +1,17 @@
1
+ module Pubid::Nist
2
+ module Parsers
3
+ class Tn < Default
4
+ # rule(:report_number) do
5
+ # first_report_number
6
+ # end
7
+
8
+ rule(:edition_prefixes) do
9
+ str("-") | str("e")
10
+ end
11
+
12
+ rule(:second_report_number) do
13
+ year_digits.absent? >> (digits_with_suffix | str("A")).as(:second_report_number)
14
+ end
15
+ end
16
+ end
17
+ end
@@ -10,22 +10,24 @@ module Pubid::Nist
10
10
  def render_identifier(params, opts)
11
11
  case opts[:format]
12
12
  when :short, :mr
13
- "%{serie}%{code}%{volume}%{part}%{edition}%{revision}%{version}"\
13
+ "%{series}%{code}%{volume}%{part}%{edition}%{revision}%{version}"\
14
14
  "%{supplement}%{section}%{appendix}%{errata}%{index}%{insert}%{update}"\
15
15
  "%{stage}%{translation}" % params
16
16
  else
17
- "%{serie}%{stage}%{code}%{volume}%{part}%{edition}%{revision}%{version}"\
17
+ "%{series}%{code}%{stage}%{volume}%{part}%{edition}%{revision}%{version}"\
18
18
  "%{supplement}%{section}%{appendix}%{errata}%{index}%{insert}%{update}"\
19
19
  "%{translation}" % params
20
20
  end
21
21
  end
22
22
 
23
- def render_serie(serie, opts, params)
24
- if serie.to_s(opts[:format]).include?(params[:publisher].to_s(opts[:format]))
25
- return serie.to_s(opts[:format])
23
+ def render_series(series, opts, params)
24
+ if series.to_s(opts[:format]).include?(params[:publisher].to_s(opts[:format]))
25
+ return series.to_s(opts[:format])
26
26
  end
27
27
 
28
- "#{params[:publisher].to_s(opts[:format])} #{serie.to_s(opts[:format])}"
28
+ "#{params[:publisher].to_s(opts[:format])}" +
29
+ (opts[:format] == :mr ? "." : " ") +
30
+ "#{series.to_s(opts[:format])}"
29
31
  end
30
32
 
31
33
  def render_code(code, opts, _params)
@@ -37,12 +39,12 @@ module Pubid::Nist
37
39
 
38
40
  case opts[:format]
39
41
  when :long
40
- " Edition "
42
+ " #{edition.to_s(format: :long)}"
41
43
  when :abbrev
42
- " Ed. "
44
+ " Ed. " + edition.to_s
43
45
  when :short, :mr
44
- "e"
45
- end + edition.to_s
46
+ "e" + edition.to_s
47
+ end
46
48
  end
47
49
 
48
50
  def render_revision(revision, opts, _params)
@@ -0,0 +1,30 @@
1
+ SERIES = YAML.load_file(File.join(File.dirname(__FILE__), "../../../series.yaml"))
2
+
3
+ module Pubid::Nist
4
+ class Series
5
+ attr_accessor :series, :parsed
6
+
7
+ def initialize(series:, parsed: nil)
8
+ raise Errors::SerieInvalidError, "#{series} is not valid series" unless SERIES["long"].key?(series)
9
+
10
+ @series = series
11
+ @parsed = parsed
12
+ end
13
+
14
+ def to_s(format = :short)
15
+ # return SERIES["abbrev"][@serie] ||
16
+ return @series if format == :short
17
+
18
+ result = SERIES[format.to_s][@series]
19
+ return @series if result.nil? && format == :mr
20
+
21
+ return SERIES["long"][@series] if result.nil?
22
+
23
+ result
24
+ end
25
+
26
+ def ==(other)
27
+ other.series == @series
28
+ end
29
+ end
30
+ end
@@ -6,6 +6,9 @@ module Pubid::Nist
6
6
 
7
7
  def initialize(id:, type:)
8
8
  @id, @type = id.to_s.downcase, type.to_s.downcase
9
+
10
+ raise ArgumentError, "id cannot be #{id.inspect}" unless STAGES['id'].key?(@id)
11
+ raise ArgumentError, "type cannot be #{type.inspect}" unless STAGES['type'].key?(@type)
9
12
  end
10
13
 
11
14
  def to_s(format = :short)
@@ -17,12 +20,8 @@ module Pubid::Nist
17
20
  when :mr
18
21
  "#{@id}#{@type}"
19
22
  else
20
- "#{STAGES['id'][@id]} #{STAGES['type'][@type]}"
23
+ "(#{STAGES['id'][@id]} #{STAGES['type'][@type]})"
21
24
  end
22
25
  end
23
-
24
- def nil?
25
- @id.nil? && @type.nil?
26
- end
27
26
  end
28
27
  end
@@ -10,8 +10,16 @@ module Pubid::Nist
10
10
  end
11
11
 
12
12
  rule(series: subtree(:series)) do |context|
13
- { serie: Serie.new(serie: context[:series].to_s.gsub(".", " ")),
14
- publisher: Publisher.parse(context[:series]) }
13
+ if context[:publisher]
14
+ if context[:series]
15
+ { series: Series.new(series: context[:series].to_s.gsub(".", " ")) }
16
+ else
17
+ {}
18
+ end
19
+ else
20
+ { series: Series.new(series: context[:series].to_s.gsub(".", " ")),
21
+ publisher: Publisher.parse(context[:series]) }
22
+ end
15
23
  end
16
24
 
17
25
  # remove :second_report_number from output
@@ -1,5 +1,5 @@
1
1
  module Pubid
2
2
  module Nist
3
- VERSION = "0.2.6".freeze
3
+ VERSION = "0.3.1".freeze
4
4
  end
5
5
  end
data/lib/pubid/nist.rb CHANGED
@@ -10,7 +10,7 @@ module Pubid
10
10
  end
11
11
  end
12
12
 
13
- require_relative "nist/serie"
13
+ require_relative "nist/series"
14
14
  require_relative "nist/parsers/default"
15
15
  require_relative "nist/update"
16
16
  require_relative "nist/transformer"
data/series.yaml CHANGED
@@ -1,137 +1,115 @@
1
1
  long:
2
- NIST AMS: Advanced Manufacturing Standard
3
- NIST BSS: Building Science Series
4
- NBS BSS: Building Science Series
5
- NBS BMS: Building Material Structures Report
2
+ AMS: Advanced Manufacturing Series
3
+ BSS: Building Science Series
4
+ BMS: Building Material Structures Report
6
5
  NBS BRPD-CRPL-D: Basic Radio Propagation Predictions Series
7
- NBS BH: Building and Housing Reports
8
- NBS CRPL: Central Radio Propagation Laboratory Reports
6
+ BH: Building and Housing
7
+ CRPL: Central Radio Propagation Laboratory Reports
9
8
  NBS CRPL-F-A: CRPL Ionospheric Data
10
9
  NBS CRPL-F-B: CRPL Solar-Geophysical Data
11
10
  NBS IP: CRPL Ionospheric Predictions
12
- NBS CIRC: Circulars
11
+ CIRC: Circulars
13
12
  NBS CIS: Consumer Information Series
14
- NBS CS: Commercial Standards
13
+ CS: Commercial Standards
15
14
  NBS CS-E: Commercial Standards (emergency)
16
- NBS CSM: Commercial Standards Monthly
17
- NBS FIPS: Federal Information Processing Standards Publication
15
+ CSM: Commercial Standards Monthly
18
16
  FIPS: Federal Information Processing Standards Publication
19
- NIST GCR: Grant/Contract Reports
20
- NBS GCR: Grant/Contract Reports
21
- NIST HB: Handbook
22
- NBS HB: Handbook
17
+ GCR: Grant/Contract Reports
18
+ HB: Handbooks
23
19
  NBS HR: Hydraulic Research in the United States
24
20
  NBS IRPL: Interservice Radio Propagation Laboratory
25
21
  ITL Bulletin: ITL Bulletin
26
22
  NIST LC: Letter Circular
27
23
  NBS LC: Letter Circular
28
- NIST MN: Monograph
29
- NBS MN: Monograph
30
- NBS MP: Miscellaneous Publications
31
- NIST NCSTAR: National Construction Safety Team Report
32
- NIST NSRDS: National Standard Reference Data Series
24
+ MONO: Monograph
25
+ MP: Miscellaneous Publications
26
+ NCSTAR: National Construction Safety Team Act Reports
27
+ NSRDS: National Standard Reference Data Series
33
28
  NSRDS-NBS: National Standard Reference Data Series
34
- NIST IR: Interagency or Internal Report
35
- NBS IR: Interagency or Internal Report
36
- NIST OWMWP: Office of Weights and Measures White Papers
37
- NBS PC: Photographic Circulars
38
- NBS RPT: Reports
29
+ IR: IR
30
+ OWMWP: Office of Weights and Measures White Papers
31
+ PC: Photographic Laboratory Circulars
32
+ RPT: Reports
39
33
  NIST PS: Voluntary Product Standards
40
- NBS SIBS: Special Interior Ballistics Studies
34
+ SIBS: Special Interior Ballistics Studies
41
35
  NBS PS: Voluntary Product Standards
42
- NIST SP: Special Publication
43
- NBS SP: Special Publication
44
- NIST TN: Technical Note
45
- NBS TN: Technical Note
46
- NBS TIBM: Technical Information on Building Materials
47
- NIST TTB: Technology Transfer Brief
36
+ SP: Special Publication
37
+ TN: Technical Notes
38
+ TIBM: Technical Information on Building Materials for Use in the Design of Low Cost Housing
39
+ TTB: Technology Transfer Briefs
48
40
  NIST DCI: Data Collection Instruments
49
- NIST EAB: Economic Analysis Brief
41
+ EAB: Economic Analysis Brief
50
42
  NIST Other: Other
51
- CSRC White Paper: Cybersecurity Resource Center White Paper
43
+ CSWP: Cybersecurity White Papers
52
44
  CSRC Book: Cybersecurity Resource Center Book
53
45
  CSRC Use Case: Cybersecurity Resource Center Use Case
54
46
  CSRC Building Block: Cybersecurity Resource Center Building Block
55
47
  JPCRD: Journal of Physical and Chemical Reference Data
56
48
  JRES: Journal of Research of NIST
57
49
  abbrev:
58
- NIST AMS: Adv. Man. Ser
59
- NIST BSS: Bldg. Sci. Ser.
60
- NBS BSS: Bldg. Sci. Ser.
61
- NBS FIPS: Federal Inf. Process. Stds.
50
+ AMS: Adv. Man. Ser
51
+ BSS: Bldg. Sci. Ser.
62
52
  FIPS: Federal Inf. Process. Stds.
63
- NIST HB: Handb.
64
- NBS HB: Handb.
65
- NIST MN: Monogr.
66
- NBS MN: Monogr.
67
- NIST NCSTAR: Natl. Constr. Tm. Act Rpt.
68
- NIST NSRDS: Natl. Stand. Ret. Data Ser.
53
+ HB: Handb.
54
+ MONO: Monogr.
55
+ NCSTAR: Natl. Constr. Tm. Act Rpt.
56
+ NSRDS: Natl. Stand. Ret. Data Ser.
69
57
  NSRDS-NBS: Natl. Stand. Ret. Data Ser.
70
58
  NIST PS: Prod. Stand.
71
59
  NBS PS: Prod. Stand.
72
- NIST SP: Spec. Publ.
73
- NBS SP: Spec. Publ.
74
- NIST TN: Tech. Note
75
- NBS TN: Tech. Note
60
+ SP: Spec. Publ.
61
+ TN: Tech. Note
76
62
  NIST DCI: Data Collect. Instr.
77
63
  NIST Other: Other
78
- CSRC White Paper: CSWP
64
+ CSWP: CSWP
79
65
  CSRC Book: CSRC Book
80
66
  CSRC Use Case: CSRC Use Case
81
67
  CSRC Building Block: CSRC Building Block
82
68
  JPCRD: J. Phys. & Chem. Ref. Data
83
69
  JRES: J. Res. Natl. Inst. Stan.
84
70
  mr:
85
- NIST AMS: NIST.AMS
86
- NIST BSS: NIST.BSS
87
- NBS BSS: NBS.BSS
88
- NBS BMS: NBS.BMS
71
+ AMS: AMS
72
+ BSS: BSS
73
+ BMS: BMS
89
74
  NBS BRPD-CRPL-D: NBS.BRPD-CRPL-D
90
- NBS BH: NBS.BH
91
- NBS CRPL: NBS.CRPL
75
+ BH: BH
76
+ CRPL: CRPL
92
77
  NBS CRPL-F-A: NBS.CRPL-F-A
93
78
  NBS CRPL-F-B: NBS.CRPL-F-B
94
79
  NBS IP: NBS.IP
95
- NBS CIRC: NBS.CIRC
80
+ CIRC: CIRC
96
81
  NBS CIS: NBS.CIS
97
- NBS CS: NBS.CS
82
+ CS: CS
98
83
  NBS CS-E: NBS.CS-E
99
- NBS CSM: NBS.CSM
100
- NBS FIPS: NBS.FIPS
101
- FIPS: NIST.FIPS
102
- NIST GCR: NIST.GCR
103
- NBS GCR: NBS.GCR
104
- NIST HB: NIST.HB
105
- NBS HB: NBS.HB
84
+ CSM: CSM
85
+ FIPS: FIPS
86
+ GCR: GCR
87
+ HB: HB
106
88
  NBS HR: NBS.HR
107
89
  NBS IRPL: NBS.IRPL
108
90
  ITL Bulletin: NIST.ITLB
109
91
  NIST LC: NIST.LC
110
92
  NBS LC: NBS.LC
111
- NIST MN: NIST.MN
112
- NBS MN: NBS.MN
113
- NBS MP: NBS.MP
114
- NIST NCSTAR: NIST.NCSTAR
115
- NIST NSRDS: NIST.NSRDS
93
+ MONO: MN
94
+ MP: MP
95
+ NCSTAR: NCSTAR
96
+ NSRDS: NSRDS
116
97
  NSRDS-NBS: NBS.NSRDS
117
- NIST IR: NIST.IR
118
- NBS IR: NBS.IR
119
- NIST OWMWP: NIST.OWMWP
120
- NBS PC: NBS.PC
121
- NBS RPT: NBS.RPT
98
+ IR: IR
99
+ OWMWP: OWMWP
100
+ PC: PC
101
+ RPT: RPT
122
102
  NIST PS: NIST.PS
123
- NBS SIBS: NBS.SIBS
103
+ SIBS: SIBS
124
104
  NBS PS: NBS.PS
125
- NIST SP: NIST.SP
126
- NBS SP: NBS.SP
127
- NIST TN: NIST.TN
128
- NBS TN: NBS.TN
129
- NBS TIBM: NBS.TIBM
130
- NIST TTB: NIST.TTB
105
+ SP: SP
106
+ TN: TN
107
+ TIBM: TIBM
108
+ TTB: TTB
131
109
  NIST DCI: NIST.DCI
132
- NIST EAB: NIST.EAB
110
+ EAB: EAB
133
111
  NIST Other: NIST.O
134
- CSRC White Paper: NIST.CSWP
112
+ CSWP: CSWP
135
113
  CSRC Book: NIST.CSB
136
114
  CSRC Use Case: NIST.CSUC
137
115
  CSRC Building Block: NIST.CSBB
data/update_codes.yaml CHANGED
@@ -1,5 +1,5 @@
1
- NBS MONO: NBS MN
2
- NIST MONO: NIST MN
1
+ NBS MN: NBS MONO
2
+ NIST MN: NIST MONO
3
3
  NIST MP: NBS MP
4
4
  NIST SP 260-162 2006ed.: NIST SP 260-162e2006
5
5
  NBS CIRC 154suprev: NBS CIRC 154r1sup
@@ -9,7 +9,7 @@ NBS CIRC supJun1925-Jun1927: NBS CIRC 24e7sup3
9
9
  NBS CIRC e2: NBS CIRC 2e2
10
10
  NBS CIRC 25sup-1924: NBS CIRC 25sup
11
11
  NIST SP 260-126 rev 2013: NIST SP 260-126r2013
12
- NIST CSWP: CSRC White Paper
12
+ NIST CSRC White Paper: NIST CSWP
13
13
  NIST SP 800-56ar: NIST SP 800-56Ar1
14
14
  NIST.LCIRC: NIST.LC
15
15
  NBS.LCIRC: NBS.LC
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pubid-nist
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.3.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: 2024-01-17 00:00:00.000000000 Z
11
+ date: 2024-03-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -171,32 +171,26 @@ files:
171
171
  - lib/pubid/nist/identifier.rb
172
172
  - lib/pubid/nist/nist_tech_pubs.rb
173
173
  - lib/pubid/nist/parser.rb
174
+ - lib/pubid/nist/parsers/circ.rb
175
+ - lib/pubid/nist/parsers/crpl.rb
176
+ - lib/pubid/nist/parsers/csm.rb
174
177
  - lib/pubid/nist/parsers/default.rb
175
178
  - lib/pubid/nist/parsers/fips.rb
176
- - lib/pubid/nist/parsers/nbs_bh.rb
177
- - lib/pubid/nist/parsers/nbs_circ.rb
178
- - lib/pubid/nist/parsers/nbs_crpl.rb
179
- - lib/pubid/nist/parsers/nbs_csm.rb
180
- - lib/pubid/nist/parsers/nbs_fips.rb
181
- - lib/pubid/nist/parsers/nbs_hb.rb
179
+ - lib/pubid/nist/parsers/gcr.rb
180
+ - lib/pubid/nist/parsers/hb.rb
181
+ - lib/pubid/nist/parsers/mp.rb
182
182
  - lib/pubid/nist/parsers/nbs_ir.rb
183
183
  - lib/pubid/nist/parsers/nbs_lc.rb
184
- - lib/pubid/nist/parsers/nbs_mn.rb
185
- - lib/pubid/nist/parsers/nbs_mp.rb
186
- - lib/pubid/nist/parsers/nbs_rpt.rb
187
- - lib/pubid/nist/parsers/nbs_sp.rb
188
- - lib/pubid/nist/parsers/nbs_tn.rb
189
- - lib/pubid/nist/parsers/nist_gcr.rb
190
- - lib/pubid/nist/parsers/nist_hb.rb
184
+ - lib/pubid/nist/parsers/ncstar.rb
191
185
  - lib/pubid/nist/parsers/nist_ir.rb
192
- - lib/pubid/nist/parsers/nist_ncstar.rb
193
- - lib/pubid/nist/parsers/nist_owmwp.rb
194
- - lib/pubid/nist/parsers/nist_sp.rb
195
- - lib/pubid/nist/parsers/nist_tn.rb
186
+ - lib/pubid/nist/parsers/owmwp.rb
187
+ - lib/pubid/nist/parsers/rpt.rb
188
+ - lib/pubid/nist/parsers/sp.rb
189
+ - lib/pubid/nist/parsers/tn.rb
196
190
  - lib/pubid/nist/publisher.rb
197
191
  - lib/pubid/nist/renderer/addendum.rb
198
192
  - lib/pubid/nist/renderer/base.rb
199
- - lib/pubid/nist/serie.rb
193
+ - lib/pubid/nist/series.rb
200
194
  - lib/pubid/nist/stage.rb
201
195
  - lib/pubid/nist/transformer.rb
202
196
  - lib/pubid/nist/update.rb
@@ -1,6 +0,0 @@
1
- module Pubid::Nist
2
- module Parsers
3
- class NbsBh < Default
4
- end
5
- end
6
- end
@@ -1,15 +0,0 @@
1
- module Pubid::Nist
2
- module Parsers
3
- class NbsFips < Default
4
- rule(:edition) do
5
- str("-") >> (
6
- (month_letters.as(:edition_month) >> year_digits.as(:edition_year)) |
7
- year_digits.as(:edition_year) |
8
- (month_letters.as(:edition_month) >> match('\d').repeat(2, 2).as(:edition_day) >>
9
- str("/") >> year_digits.as(:edition_year))
10
- ) |
11
- (str("e") >> year_digits.as(:edition_year) >> month_digits.as(:edition_month).maybe)
12
- end
13
- end
14
- end
15
- end
@@ -1,6 +0,0 @@
1
- module Pubid::Nist
2
- module Parsers
3
- class NbsMn < Default
4
- end
5
- end
6
- end
@@ -1,13 +0,0 @@
1
- module Pubid::Nist
2
- module Parsers
3
- class NbsSp < Default
4
- rule(:part_prefixes) do
5
- str("pt") | str("p") | str("P")
6
- end
7
-
8
- rule(:volume) do
9
- str("v") >> (match('[\da-z-]').repeat(1) >> match("[A-Z]").repeat).as(:volume)
10
- end
11
- end
12
- end
13
- end
@@ -1,9 +0,0 @@
1
- module Pubid::Nist
2
- module Parsers
3
- class NbsTn < Default
4
- rule(:second_report_number) do
5
- (digits_with_suffix | str("A")).as(:second_report_number)
6
- end
7
- end
8
- end
9
- end
@@ -1,9 +0,0 @@
1
- require_relative "nbs_hb"
2
-
3
- module Pubid::Nist
4
- module Parsers
5
- class NistHb < NbsHb
6
- rule(:number_suffix) { match("[a-zA-Z]") }
7
- end
8
- end
9
- end
@@ -1,13 +0,0 @@
1
- module Pubid::Nist
2
- module Parsers
3
- class NistTn < Default
4
- rule(:report_number) do
5
- first_report_number
6
- end
7
-
8
- rule(:edition_prefixes) do
9
- str("-") | str("e")
10
- end
11
- end
12
- end
13
- end
@@ -1,29 +0,0 @@
1
- SERIES = YAML.load_file(File.join(File.dirname(__FILE__), "../../../series.yaml"))
2
-
3
- module Pubid::Nist
4
- class Serie
5
- attr_accessor :serie, :parsed
6
-
7
- def initialize(serie:, parsed: nil)
8
- raise Errors::SerieInvalidError, "#{serie} is not valid serie" unless SERIES["long"].key?(serie)
9
-
10
- @serie = serie
11
- @parsed = parsed
12
- end
13
-
14
- def to_s(format = :short)
15
- return @serie if format == :short
16
-
17
- result = SERIES[format.to_s][@serie]
18
- return @serie if result.nil? && format == :mr
19
-
20
- return SERIES["long"][@serie] if result.nil?
21
-
22
- result
23
- end
24
-
25
- def ==(other)
26
- other.serie == @serie
27
- end
28
- end
29
- end