pubid-iso 0.5.2 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.adoc +14 -5
- data/lib/pubid/iso/identifier/addendum.rb +24 -0
- data/lib/pubid/iso/identifier/base.rb +7 -0
- data/lib/pubid/iso/identifier/extract.rb +19 -0
- data/lib/pubid/iso/identifier/international_standard.rb +5 -0
- data/lib/pubid/iso/parser.rb +30 -10
- data/lib/pubid/iso/renderer/addendum.rb +7 -0
- data/lib/pubid/iso/renderer/extract.rb +9 -0
- data/lib/pubid/iso/transformer.rb +6 -1
- data/lib/pubid/iso/version.rb +1 -1
- data/lib/pubid/iso.rb +5 -1
- data/stages.yaml +2 -0
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc8335f48f32190dc97e33a697eb6c4e4c167dde7439ed9ea7c86f993b63851e
|
4
|
+
data.tar.gz: 761131f2e57b70c3c7cc1544cd916c262f4fc747910e36f015280d17367e14d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb15a0823609ccf7b45858407d2bf9ebb3bf64eb47cbac1d0c3295b7bd6db5d702ba46ece8908aa4ed326eb219f0d3d35dc4eb33158e5fc48a68a35e7689e53e
|
7
|
+
data.tar.gz: cf0520e2b7ce394218c1a3cfd898d7b562eec3c55f4ddbf0ccdfa3ff933aa32ce53c69b6835e9254e59a9966c988b933bddc047a27a52de8863556f362bfb5c2
|
data/README.adoc
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
= ISO publication identifiers ("ISO PubID")
|
2
2
|
|
3
|
+
image:https://badge.fury.io/rb/pubid-iso.svg["Gem Version", link="https://badge.fury.io/rb/pubid-iso"]
|
4
|
+
|
3
5
|
== Purpose
|
4
6
|
|
5
7
|
This gem implements a mechanism to parse and utilize ISO publication
|
@@ -349,12 +351,19 @@ final draft International Standards (FDIS) and International Standards`",
|
|
349
351
|
distinguished by a numerical suffix (.2, .3, etc.).
|
350
352
|
____
|
351
353
|
|
352
|
-
|
353
|
-
|
354
|
+
[example]
|
355
|
+
====
|
356
|
+
ISO/CD TR 10064-2.2
|
357
|
+
ISO/IEC CD 23264-2.4
|
358
|
+
ISO/DIS 80369-3.2
|
359
|
+
====
|
360
|
+
|
361
|
+
In an ISO PubID, the stage iteration number is applied to the standard
|
362
|
+
number, patterned as:
|
354
363
|
|
355
|
-
* `{document stage}` (
|
356
|
-
* `{document stage}.{iteration number}`
|
357
|
-
(
|
364
|
+
* `{document stage} {document number}` (if iteration is 1); or
|
365
|
+
* `{document stage} {document number}.{iteration number}`
|
366
|
+
(if iteration is larger than 1).
|
358
367
|
|
359
368
|
Once the document is published (stage 60 substage 60), no status abbreviation is
|
360
369
|
given.
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require_relative "../renderer/addendum"
|
2
|
+
|
3
|
+
module Pubid::Iso
|
4
|
+
module Identifier
|
5
|
+
class Addendum < Supplement
|
6
|
+
def_delegators 'Pubid::Iso::Identifier::Addendum', :type
|
7
|
+
|
8
|
+
TYPED_STAGES = {
|
9
|
+
dad: {
|
10
|
+
abbr: "DAD",
|
11
|
+
name: "Draft Addendum",
|
12
|
+
harmonized_stages: %w[],
|
13
|
+
},
|
14
|
+
}.freeze
|
15
|
+
def self.type
|
16
|
+
{ key: :add, title: "Addendum" }
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.get_renderer_class
|
20
|
+
Renderer::Addendum
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -186,6 +186,13 @@ module Pubid::Iso
|
|
186
186
|
)
|
187
187
|
end
|
188
188
|
|
189
|
+
if identifier_params[:extract]
|
190
|
+
base_parameters = params.reject { |k, _| k == :extract }
|
191
|
+
|
192
|
+
return Identifier.create(base: Identifier.create(**base_parameters),
|
193
|
+
type: :ext, **identifier_params[:extract])
|
194
|
+
end
|
195
|
+
|
189
196
|
Identifier.create(**identifier_params)
|
190
197
|
end
|
191
198
|
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require_relative "../renderer/extract"
|
2
|
+
|
3
|
+
module Pubid::Iso
|
4
|
+
module Identifier
|
5
|
+
class Extract < Base
|
6
|
+
def_delegators 'Pubid::Iso::Identifier::Extract', :type
|
7
|
+
|
8
|
+
TYPED_STAGES = {}.freeze
|
9
|
+
|
10
|
+
def self.type
|
11
|
+
{ key: :ext, title: "Extract" }
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.get_renderer_class
|
15
|
+
Renderer::Extract
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/pubid/iso/parser.rb
CHANGED
@@ -3,7 +3,7 @@ require_relative "renderer/base"
|
|
3
3
|
|
4
4
|
module Pubid::Iso
|
5
5
|
class Parser < Pubid::Core::Parser
|
6
|
-
STAGES = %w[NP NWIP WD CD PRF AWI PWI FPD].freeze
|
6
|
+
STAGES = %w[NP NWIP WD CD FCD PRF AWI PWI FPD].freeze
|
7
7
|
TYPES = %w[DATA ISP IWA R TTA TS TR IS PAS Guide GUIDE DIR].freeze
|
8
8
|
# TYPED_STAGES = %w[DIS FDIS DPAS FDTR FDTS DTS DTR PDTR PDTS].freeze
|
9
9
|
SUPPLEMENTS = %w[Amd Cor AMD COR Suppl].freeze
|
@@ -18,13 +18,17 @@ module Pubid::Iso
|
|
18
18
|
end.flatten +
|
19
19
|
%w[pDCOR PDAM]
|
20
20
|
|
21
|
+
STAGED_ADDENDA = Pubid::Iso::Identifier::Addendum::TYPED_STAGES.map do |_, v|
|
22
|
+
v[:abbr]
|
23
|
+
end
|
24
|
+
|
21
25
|
DIR_SUPPLEMENTS = %w[Supplement SUP].freeze
|
22
26
|
|
23
|
-
TYPED_STAGES = Identifier.config.types.map do |type|
|
27
|
+
TYPED_STAGES = (Identifier.config.types.map do |type|
|
24
28
|
type::TYPED_STAGES.map do |_, v|
|
25
29
|
v.key?(:legacy_abbr) ? (v[:legacy_abbr] + [v[:abbr]]) : v[:abbr]
|
26
30
|
end
|
27
|
-
end.flatten - STAGED_SUPPLEMENTS + %w[PDTR PDTS]
|
31
|
+
end.flatten - STAGED_SUPPLEMENTS + %w[PDTR PDTS]).sort_by(&:length).reverse
|
28
32
|
|
29
33
|
TCTYPES = ["TC", "JTC", "PC", "IT", "CAB", "CASCO", "COPOLCO",
|
30
34
|
"COUNCIL", "CPSG", "CS", "DEVCO", "GA", "GAAB", "INFCO",
|
@@ -40,6 +44,10 @@ module Pubid::Iso
|
|
40
44
|
"CSC/SP", "CSC/FIN", "JAG"].freeze
|
41
45
|
|
42
46
|
ORGANIZATIONS = %w[IEC IEEE CIW SAE CIE ASME ASTM OECD ISO HL7 CEI].freeze
|
47
|
+
rule(:dash) do
|
48
|
+
str("-") | str("‑") | str("‐")
|
49
|
+
end
|
50
|
+
|
43
51
|
rule(:stage) do
|
44
52
|
array_to_str(Pubid::Iso::Renderer::Base::TRANSLATION[:russian][:stage].values) | array_to_str(STAGES)
|
45
53
|
end
|
@@ -60,6 +68,10 @@ module Pubid::Iso
|
|
60
68
|
(array_to_str(Pubid::Iso::Renderer::Base::TRANSLATION[:russian][:type].values) | array_to_str(TYPES)).as(:type)
|
61
69
|
end
|
62
70
|
|
71
|
+
rule(:staged_addenda) do
|
72
|
+
array_to_str(STAGED_ADDENDA)
|
73
|
+
end
|
74
|
+
|
63
75
|
rule(:tctype) do
|
64
76
|
# tc-types
|
65
77
|
array_to_str(TCTYPES)
|
@@ -82,11 +94,12 @@ module Pubid::Iso
|
|
82
94
|
|
83
95
|
rule(:part_matcher) do
|
84
96
|
year_digits.absent? >>
|
85
|
-
|
97
|
+
supplements.absent? >>
|
98
|
+
staged_addenda.absent? >> ((roman_numerals >> digits.absent?) | match['[\dA-Z]'].repeat(1)).as(:part)
|
86
99
|
end
|
87
100
|
|
88
101
|
rule(:part) do
|
89
|
-
(str("/") |
|
102
|
+
(str("/") | dash) >> space? >> part_matcher >> (dash >> part_matcher).repeat
|
90
103
|
end
|
91
104
|
|
92
105
|
rule(:organization) do
|
@@ -109,13 +122,19 @@ module Pubid::Iso
|
|
109
122
|
(space | str(".")).repeat(1).maybe >>
|
110
123
|
digits.as(:number).maybe >>
|
111
124
|
(str(".") >> digits.as(:iteration)).maybe >>
|
112
|
-
((str(":") |
|
125
|
+
((str(":") | dash) >> digits.as(:year)).maybe).repeat(1).as(:supplements)
|
113
126
|
end
|
114
127
|
|
115
128
|
rule(:addendum) do
|
116
129
|
(
|
117
|
-
((str("/") >> (str("Add") | str("ADD"))) | (str(" —
|
118
|
-
|
130
|
+
(((str("/") >> (str("Add") | str("ADD")).as(:type)) | (str(" — ") >> str("Addendum").as(:type))) |
|
131
|
+
(str("/") >> staged_addenda.as(:typed_stage))) >>
|
132
|
+
space >> digits.as(:number) >> ((str(":")) >> digits.as(:year)).maybe
|
133
|
+
).repeat(1).as(:supplements)
|
134
|
+
end
|
135
|
+
|
136
|
+
rule(:extract) do
|
137
|
+
str("/") >> str("Ext") >> space >> (digits.as(:number) >> str(":") >> digits.as(:year)).as(:extract)
|
119
138
|
end
|
120
139
|
|
121
140
|
rule(:language) do
|
@@ -157,15 +176,16 @@ module Pubid::Iso
|
|
157
176
|
end
|
158
177
|
|
159
178
|
rule(:std_document_body) do
|
160
|
-
(type | stage.as(:stage)).maybe >>
|
179
|
+
(type | (stage.as(:stage) >> digits.as(:iteration).maybe)).maybe >>
|
161
180
|
# for ISO/IEC WD TS 25025
|
162
181
|
space? >> ((stage.as(:stage) | typed_stage.as(:stage) | type) >> space).maybe >>
|
163
182
|
digits.as(:number) >>
|
164
183
|
# for identifiers like ISO 5537/IDF 26
|
165
184
|
(str("|") >> (str("IDF").as(:publisher) >> space >> digits.as(:number)).as(:joint_document)).maybe >>
|
166
185
|
part.maybe >> iteration.maybe >>
|
167
|
-
(space? >> (str(":") |
|
186
|
+
(space? >> (str(":") | dash) >> year).maybe >>
|
168
187
|
supplement.maybe >>
|
188
|
+
extract.maybe >>
|
169
189
|
addendum.maybe >>
|
170
190
|
edition.maybe >>
|
171
191
|
language.maybe
|
data/lib/pubid/iso/version.rb
CHANGED
data/lib/pubid/iso.rb
CHANGED
@@ -28,6 +28,8 @@ require_relative "iso/identifier/guide"
|
|
28
28
|
require_relative "iso/identifier/recommendation"
|
29
29
|
require_relative "iso/identifier/technology_trends_assessments"
|
30
30
|
require_relative "iso/identifier/international_workshop_agreement"
|
31
|
+
require_relative "iso/identifier/extract"
|
32
|
+
require_relative "iso/identifier/addendum"
|
31
33
|
|
32
34
|
config = Pubid::Core::Configuration.new
|
33
35
|
config.stages = YAML.load_file(File.join(File.dirname(__FILE__), "../../stages.yaml"))
|
@@ -46,7 +48,9 @@ config.types = [Pubid::Iso::Identifier::InternationalStandard,
|
|
46
48
|
Pubid::Iso::Identifier::TechnicalReport,
|
47
49
|
Pubid::Iso::Identifier::TechnicalSpecification,
|
48
50
|
Pubid::Iso::Identifier::TechnologyTrendsAssessments,
|
49
|
-
Pubid::Iso::Identifier::Guide
|
51
|
+
Pubid::Iso::Identifier::Guide,
|
52
|
+
Pubid::Iso::Identifier::Extract,
|
53
|
+
Pubid::Iso::Identifier::Addendum]
|
50
54
|
config.type_names = { tr: {
|
51
55
|
long: "Technical Report",
|
52
56
|
short: "TR",
|
data/stages.yaml
CHANGED
@@ -4,6 +4,7 @@ abbreviations:
|
|
4
4
|
AWI: ["20.00", "10.99"]
|
5
5
|
WD: ["20.20", "20.60", "20.98", "20.99"]
|
6
6
|
CD: ["30.00", "30.20", "30.60", "30.92", "30.98", "30.99"]
|
7
|
+
FCD: ["40.00", "40.20", "40.60", "40.92", "40.98", "40.99"]
|
7
8
|
PRF: ["50.00", "50.20", "50.60", "50.92", "50.98", "50.99"]
|
8
9
|
|
9
10
|
names:
|
@@ -11,6 +12,7 @@ names:
|
|
11
12
|
PWI: Preliminary Work Item
|
12
13
|
NP: New Proposal
|
13
14
|
CD: Committee Draft
|
15
|
+
FCD: Final Committee Draft
|
14
16
|
PRF: Proof of a new
|
15
17
|
|
16
18
|
codes_description:
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pubid-iso
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.3
|
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-05-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -123,10 +123,12 @@ files:
|
|
123
123
|
- lib/pubid/iso.rb
|
124
124
|
- lib/pubid/iso/errors.rb
|
125
125
|
- lib/pubid/iso/identifier.rb
|
126
|
+
- lib/pubid/iso/identifier/addendum.rb
|
126
127
|
- lib/pubid/iso/identifier/amendment.rb
|
127
128
|
- lib/pubid/iso/identifier/base.rb
|
128
129
|
- lib/pubid/iso/identifier/corrigendum.rb
|
129
130
|
- lib/pubid/iso/identifier/directives.rb
|
131
|
+
- lib/pubid/iso/identifier/extract.rb
|
130
132
|
- lib/pubid/iso/identifier/guide.rb
|
131
133
|
- lib/pubid/iso/identifier/international_standard.rb
|
132
134
|
- lib/pubid/iso/identifier/international_standardized_profile.rb
|
@@ -139,10 +141,12 @@ files:
|
|
139
141
|
- lib/pubid/iso/identifier/technical_specification.rb
|
140
142
|
- lib/pubid/iso/identifier/technology_trends_assessments.rb
|
141
143
|
- lib/pubid/iso/parser.rb
|
144
|
+
- lib/pubid/iso/renderer/addendum.rb
|
142
145
|
- lib/pubid/iso/renderer/amendment.rb
|
143
146
|
- lib/pubid/iso/renderer/base.rb
|
144
147
|
- lib/pubid/iso/renderer/corrigendum.rb
|
145
148
|
- lib/pubid/iso/renderer/dir.rb
|
149
|
+
- lib/pubid/iso/renderer/extract.rb
|
146
150
|
- lib/pubid/iso/renderer/guide.rb
|
147
151
|
- lib/pubid/iso/renderer/international_standard.rb
|
148
152
|
- lib/pubid/iso/renderer/international_standardized_profile.rb
|