pubid-nist 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pubid/nist/identifier.rb +1 -1
- data/lib/pubid/nist/parsers/default.rb +14 -6
- data/lib/pubid/nist/parsers/nist_hb.rb +1 -0
- data/lib/pubid/nist/renderer.rb +11 -4
- data/lib/pubid/nist/stage.rb +7 -7
- data/lib/pubid/nist/transformer.rb +13 -0
- data/lib/pubid/nist/version.rb +1 -1
- data/stages.yaml +16 -5
- data/update_codes.yaml +36 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae5b75b8cb77b433b69d107ca44d6f828602da328419436c24c25968412d1719
|
4
|
+
data.tar.gz: 1377f4285c99bd9f1582f5ca1daff8ed79cf90543405bf43d4a8a9659d2ae21b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f0252ea5cf1e0f418d15b29a051dbaa203ff0765dcf1d45124b3fb123a5d0baaaa6aac5e2cca8de138e0fbf21f20d4b7aba0ecaf79de7fbc79164a119763d971
|
7
|
+
data.tar.gz: a8e8a4c490568753bd6233432825c7cf717dbd379c1eb56155082bdbe9ce74040365e9579f802c241ca6c98631da38ca7caa6ac6ff2687e6ada9003cc21e28de
|
@@ -93,7 +93,7 @@ module Pubid::Nist
|
|
93
93
|
@publisher = publisher.is_a?(Publisher) ? publisher : Publisher.new(publisher: publisher)
|
94
94
|
@serie = serie.is_a?(Serie) ? serie : Serie.new(serie: serie)
|
95
95
|
@code = number
|
96
|
-
@stage = Stage.new(stage
|
96
|
+
@stage = Stage.new(**stage) if stage
|
97
97
|
@supplement = (supplement.is_a?(Array) && "") || supplement
|
98
98
|
@edition = parse_edition(edition_month, edition_year, edition_day) if edition_month || edition_year
|
99
99
|
@update = update
|
@@ -2,14 +2,15 @@ module Pubid::Nist
|
|
2
2
|
module Parsers
|
3
3
|
class Default < Pubid::Core::Parser
|
4
4
|
rule(:identifier) do
|
5
|
-
|
5
|
+
old_stage.maybe >> (str(" ") | str(".")) >> report_number >>
|
6
|
+
parts.repeat >> draft.maybe >> stage.maybe >> translation.maybe
|
6
7
|
end
|
7
8
|
|
8
9
|
rule(:month_letters) { match('[A-Za-z]').repeat(3, 3) }
|
9
10
|
rule(:number_suffix) { match("[aA-Z]") }
|
10
11
|
|
11
12
|
rule(:parts) do
|
12
|
-
(edition | revision | version | volume | part | update | addendum |
|
13
|
+
(edition | revision | version | volume | part | update | addendum |
|
13
14
|
supplement | errata | index | insert | section | appendix)
|
14
15
|
end
|
15
16
|
|
@@ -33,10 +34,17 @@ module Pubid::Nist
|
|
33
34
|
(str("insert") | str("ins")).as(:insert)
|
34
35
|
end
|
35
36
|
|
37
|
+
rule(:old_stage) do
|
38
|
+
(str("(") >> (array_to_str(STAGES["id"].keys.map(&:upcase)).as(:id) >>
|
39
|
+
array_to_str(STAGES["type"].keys.map(&:upcase)).as(:type)).as(:stage) >> str(")"))
|
40
|
+
end
|
41
|
+
|
36
42
|
rule(:stage) do
|
37
|
-
(
|
38
|
-
|
39
|
-
|
43
|
+
(space >> (array_to_str(STAGES["id"].keys).as(:id) >> array_to_str(STAGES["type"].keys).as(:type)).as(:stage))
|
44
|
+
end
|
45
|
+
|
46
|
+
rule(:draft) do
|
47
|
+
space >> str("(Draft)").as(:draft)
|
40
48
|
end
|
41
49
|
|
42
50
|
rule(:digits_with_suffix) do
|
@@ -80,7 +88,7 @@ module Pubid::Nist
|
|
80
88
|
|
81
89
|
rule(:translation) do
|
82
90
|
(str("(") >> match('\w').repeat(3, 3).as(:translation) >> str(")")) |
|
83
|
-
(str(".") >> match('\w').repeat(3, 3).as(:translation))
|
91
|
+
((str(".") | space) >> match('\w').repeat(3, 3).as(:translation))
|
84
92
|
end
|
85
93
|
|
86
94
|
rule(:edition_prefixes) { str("e") }
|
data/lib/pubid/nist/renderer.rb
CHANGED
@@ -7,9 +7,16 @@ module Pubid::Nist
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def render_identifier(params, opts)
|
10
|
-
result =
|
11
|
-
|
12
|
-
|
10
|
+
result = case opts[:format]
|
11
|
+
when :short, :mr
|
12
|
+
"%{serie}%{code}%{volume}%{part}%{edition}%{revision}%{version}"\
|
13
|
+
"%{supplement}%{section}%{appendix}%{errata}%{index}%{insert}%{update}"\
|
14
|
+
"%{stage}%{translation}" % params
|
15
|
+
else
|
16
|
+
"%{serie}%{stage}%{code}%{volume}%{part}%{edition}%{revision}%{version}"\
|
17
|
+
"%{supplement}%{section}%{appendix}%{errata}%{index}%{insert}%{update}"\
|
18
|
+
"%{translation}" % params
|
19
|
+
end
|
13
20
|
|
14
21
|
if params[:addendum] && !params[:addendum].empty?
|
15
22
|
case opts[:format]
|
@@ -109,7 +116,7 @@ module Pubid::Nist
|
|
109
116
|
when :mr
|
110
117
|
".#{translation}"
|
111
118
|
when :short
|
112
|
-
"
|
119
|
+
" #{translation}"
|
113
120
|
end
|
114
121
|
end
|
115
122
|
|
data/lib/pubid/nist/stage.rb
CHANGED
@@ -2,10 +2,10 @@ STAGES = YAML.load_file(File.join(File.dirname(__FILE__), "../../../stages.yaml"
|
|
2
2
|
|
3
3
|
module Pubid::Nist
|
4
4
|
class Stage
|
5
|
-
attr_accessor :
|
5
|
+
attr_accessor :id, :type
|
6
6
|
|
7
|
-
def initialize(
|
8
|
-
@
|
7
|
+
def initialize(id:, type:)
|
8
|
+
@id, @type = id.to_s.downcase, type.to_s.downcase
|
9
9
|
end
|
10
10
|
|
11
11
|
def to_s(format = :short)
|
@@ -13,16 +13,16 @@ module Pubid::Nist
|
|
13
13
|
|
14
14
|
case format
|
15
15
|
when :short
|
16
|
-
"
|
16
|
+
" #{@id}#{@type}"
|
17
17
|
when :mr
|
18
|
-
@
|
18
|
+
"#{@id}#{@type}"
|
19
19
|
else
|
20
|
-
STAGES[@
|
20
|
+
"#{STAGES['id'][@id]} #{STAGES['type'][@type]}"
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
24
|
def nil?
|
25
|
-
@
|
25
|
+
@id.nil? && @type.nil?
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
@@ -26,5 +26,18 @@ module Pubid::Nist
|
|
26
26
|
rule(update: subtree(:update)) do |context|
|
27
27
|
{ update: Update.new(**context[:update]) }
|
28
28
|
end
|
29
|
+
|
30
|
+
rule(stage: subtree(:stage)) do |context|
|
31
|
+
case context[:stage][:id]
|
32
|
+
when "1"
|
33
|
+
{ stage: { id: "i", type: context[:stage][:type] } }
|
34
|
+
else
|
35
|
+
{ stage: context[:stage] }
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
rule(draft: subtree(:draft)) do |context|
|
40
|
+
{ stage: { id: "i", type: "prd"} }
|
41
|
+
end
|
29
42
|
end
|
30
43
|
end
|
data/lib/pubid/nist/version.rb
CHANGED
data/stages.yaml
CHANGED
@@ -1,5 +1,16 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
id:
|
2
|
+
i: Initial
|
3
|
+
F: Final
|
4
|
+
"1": Initial
|
5
|
+
"2": Second
|
6
|
+
"3": Third
|
7
|
+
"4": Fourth
|
8
|
+
"5": Fifth
|
9
|
+
"6": Sixth
|
10
|
+
"7": Seventh
|
11
|
+
"8": Eight
|
12
|
+
"9": Ninth
|
13
|
+
type:
|
14
|
+
pd: Public Draft
|
15
|
+
wd: Work-in-Progress Draft
|
16
|
+
prd: Preliminary Draft
|
data/update_codes.yaml
CHANGED
@@ -13,15 +13,19 @@ NIST CSWP: CSRC White Paper
|
|
13
13
|
NIST SP 800-56ar: NIST SP 800-56Ar1
|
14
14
|
NIST.LCIRC: NIST.LC
|
15
15
|
NBS.LCIRC: NBS.LC
|
16
|
+
NIST LCIRC: NIST LC
|
17
|
+
NBS LCIRC: NBS LC
|
16
18
|
NIST SP 800-57Pt3r1: NIST SP 800-57pt3r1
|
17
19
|
NISTIR: NIST IR
|
18
20
|
NIST FIPS: FIPS PUB
|
19
21
|
NIST.CSWP.01162020pt: NIST.CSWP.01162020(por)
|
20
|
-
NBS FIPS 11-1-Sep30
|
21
|
-
FIPS
|
22
|
-
FIPS PUB 54-1-
|
22
|
+
/^NBS FIPS 11-1-Sep30$/: NBS FIPS 11-1-Sep30/1977
|
23
|
+
/^NBS FIPS 89-Sep1$/: NBS FIPS 89-Sep1981
|
24
|
+
/^FIPS PUB 54-1-Jan15$/: FIPS PUB 54-1
|
25
|
+
/^FIPS PUB 54-1-Jan17$/: FIPS PUB 54-1-Jan17/1991
|
23
26
|
NBS CRPL c4-4: NBS CRPL 4-4
|
24
|
-
NIST AMS 300-8r1 (February 2021 update): NIST AMS 300-8r1/Upd1-
|
27
|
+
NIST AMS 300-8r1 (February 2021 update): NIST AMS 300-8r1/Upd1-202102
|
28
|
+
NIST AMS 300-8r1/upd: NIST AMS 300-8r1/Upd1-202102
|
25
29
|
NIST IR 8115r1-upd: NIST IR 8115r1/Upd1-202103
|
26
30
|
NIST SP 500-300-upd: NIST SP 500-300/Upd1-202105
|
27
31
|
NIST TN 2150-upd: NIST TN 2150/Upd1-202102
|
@@ -32,6 +36,7 @@ NBS.HB.28p11969: NBS.HB.28-1969pt1
|
|
32
36
|
NIST HB 105-1-1990: NIST HB 105-1r1990
|
33
37
|
NBS.FIPS.100-1-1991: NIST.FIPS.100-1-1991
|
34
38
|
NBS.LC.1088sp: NBS.LC.1088.spa
|
39
|
+
NBS LC 1088sp: NBS LC 1088 spa
|
35
40
|
#NBS.LC.145r11/1925: NBS.LC.145/Upd1-192511
|
36
41
|
#NBS.LC.118sup12/1926: NBS.LC.118sup/Upd1-192612
|
37
42
|
NIST SP 955 Suppl.: NIST SP 955sup
|
@@ -41,7 +46,9 @@ NIST FIPS 54-Jan15: NIST FIPS 54
|
|
41
46
|
NBS report ;: NBS RPT
|
42
47
|
NBS TN 467p1adde1: NBS TN 467pt1-add
|
43
48
|
NIST SP 1011-II-1.0: NIST SP 1011v2ver1.0
|
49
|
+
NIST SP 1011-II-1 0: NIST SP 1011v2ver1.0
|
44
50
|
NIST SP 1011-I-2.0: NIST SP 1011v1ver2.0
|
51
|
+
NIST SP 1011-I-2 0: NIST SP 1011v1ver2.0
|
45
52
|
NIST SP 500-281-v1.0: NIST SP 500-281v1.0
|
46
53
|
NIST IR 8259Aes: NIST IR 8259A(spa)
|
47
54
|
NIST IR 8259Apt: NIST IR 8259A(por)
|
@@ -50,8 +57,33 @@ NIST IR 8115r1/upd: NIST IR 8115r1/Upd1-2021
|
|
50
57
|
NBS CS v: NBS CSM v
|
51
58
|
NIST SP 800-57p1r2006: NIST SP 800-57pt1r1
|
52
59
|
NIST SP 800-57p1r2007: NIST SP 800-57pt1r2
|
60
|
+
NIST SP 500-268v1 1: NIST SP 500-268v1.1
|
61
|
+
NIST SP 500-270v1 1: NIST SP 500-270v1.1
|
62
|
+
NIST SP 500-280v2 1: NIST SP 500-280v2.1
|
63
|
+
NIST SP 500-281-v1 0: NIST SP 500-281v1.0
|
64
|
+
NIST SP 800-63v1 0 1: NIST SP 800-63v1.0.1
|
65
|
+
NIST SP 800-63v1 0 2: NIST SP 800-63v1.0.2
|
66
|
+
NIST SP 955 Suppl: NIST SP 955sup
|
67
|
+
NIST SP 984 4: NIST SP 984-4
|
68
|
+
NISTPUB 0413171251: NIST TN 1648-2009
|
69
|
+
NIST IR 8286C-draft: NIST IR 8286C (Draft)
|
70
|
+
NIST SP 800-140Cr1-draft2: NIST SP 800-140Cr1 2pd
|
71
|
+
NIST SP 800-140Dr1-draft2: NIST SP 800-140Dr1 2pd
|
72
|
+
NIST SP 800-219-draft: NIST SP 800-219 (Draft)
|
73
|
+
NIST IR 8270-draft2: NIST IR 8270 2pd
|
74
|
+
NIST HB 135e2022-upd1: NIST HB 135e2022/Upd1-202205
|
75
|
+
NIST SP 1900-206-upd1: NIST SP 1900-206/Upd1-202202
|
76
|
+
NIST TN 2207-upd1: NIST TN 2207/Upd1-202205
|
77
|
+
NIST IR 8290-upd1: NIST IR 8290/Upd1-202205
|
78
|
+
NIST IR 8413-upd1: NIST IR 8413/Upd1-202207
|
79
|
+
NIST IR 85-3273-37-upd1: NIST IR 85-3273-37/Upd1-202205
|
80
|
+
NIST IR 8352-draft: NIST IR 8352 (Draft)
|
81
|
+
NIST SP 1273-draft: NIST SP 1273 (Draft)
|
82
|
+
NIST IR 8323-draft: NIST IR 8323 (Draft)
|
53
83
|
/NBS CRPL-F-B(?=\d+)/: "NBS CRPL-F-B "
|
54
84
|
/NBS[.\s]CS[.\s]e/: "NBS CS-E "
|
85
|
+
NBS NSRDS: NSRDS-NBS
|
86
|
+
nist ir: NIST IR
|
55
87
|
/(?<=\d)es/: (spa)
|
56
88
|
/(?<=\d)chi/: (zho)
|
57
89
|
/(?<=\d)viet/: (vie)
|
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.
|
4
|
+
version: 0.2.2
|
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
|
+
date: 2023-09-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|