pubid-iec 0.2.4 → 0.2.5
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1873b70daa92fcd0ca9a5a4db60a23bf2e7ec228f2036f1a81a06a589f3e5c67
|
4
|
+
data.tar.gz: b01fc14aeed19ecae83b61a7ad57c9899c584ca88a4d5144dc4db0a39a6abbc8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a84aede1cc1d76a1fe2e59d7d944e05e9ea087d3687616b9331be21625b103fb1be16645fcada73869b197b2e8b27b5ddd843546fbc819508a9e08185881625b
|
7
|
+
data.tar.gz: 9c397e13902622f6bcbd4b18984c74d814f10005269e32938838580ec1774ed8088ce9b54622d25c497091789702d46c614634dc09662c3a85e77083806a5576
|
@@ -83,6 +83,16 @@ module Pubid::Iec
|
|
83
83
|
def transform(params)
|
84
84
|
identifier_params = transform_hash(params)
|
85
85
|
|
86
|
+
if identifier_params[:interpretation_sheet]
|
87
|
+
return Identifier.create(
|
88
|
+
type: :ish,
|
89
|
+
base: Identifier.create(
|
90
|
+
**identifier_params.dup.tap { |h| h.delete(:interpretation_sheet) }),
|
91
|
+
number: identifier_params[:interpretation_sheet][:number],
|
92
|
+
year: identifier_params[:interpretation_sheet][:year]
|
93
|
+
)
|
94
|
+
end
|
95
|
+
|
86
96
|
Identifier.create(**identifier_params)
|
87
97
|
end
|
88
98
|
|
@@ -31,12 +31,17 @@ module Pubid::Iec
|
|
31
31
|
},
|
32
32
|
}.freeze
|
33
33
|
|
34
|
+
def initialize(base: nil, **opts)
|
35
|
+
super(**opts)
|
36
|
+
@base = base
|
37
|
+
end
|
38
|
+
|
34
39
|
def self.type
|
35
40
|
{ key: :ish, title: "InterpretationSheet", short: "ISH" }
|
36
41
|
end
|
37
42
|
|
38
|
-
def
|
39
|
-
|
43
|
+
def self.get_renderer_class
|
44
|
+
Renderer::InterpretationSheet
|
40
45
|
end
|
41
46
|
end
|
42
47
|
end
|
data/lib/pubid/iec/parser.rb
CHANGED
@@ -35,6 +35,12 @@ module Pubid::Iec
|
|
35
35
|
(str(":") >> digits.as(:year)).maybe).as(:amendments)
|
36
36
|
end
|
37
37
|
|
38
|
+
rule(:interpretation_sheet) do
|
39
|
+
(str("/") >> str("ISH") >>
|
40
|
+
digits.as(:number) >>
|
41
|
+
(str(":") >> digits.as(:year)).maybe).as(:interpretation_sheet)
|
42
|
+
end
|
43
|
+
|
38
44
|
rule(:fragment) do
|
39
45
|
(str("/") >> str("FRAG") >> match('[\dA-Z]').repeat(1).as(:fragment)).maybe
|
40
46
|
end
|
@@ -57,15 +63,15 @@ module Pubid::Iec
|
|
57
63
|
end
|
58
64
|
|
59
65
|
rule(:std_document_body) do
|
60
|
-
(
|
61
|
-
number.as(:number) >>
|
66
|
+
((str("/") | space) >> type).maybe >>
|
67
|
+
space >> number.as(:number) >>
|
62
68
|
edition.maybe >>
|
63
69
|
part.maybe >>
|
64
70
|
conjuction_part.maybe >>
|
65
71
|
(space? >> str(":") >> year >> (str("-") >> month_digits.as(:month) >>
|
66
72
|
(str("-") >> day_digits.as(:day)).maybe).maybe).maybe >>
|
67
73
|
((amendment >> corrigendum.maybe) | corrigendum).repeat >>
|
68
|
-
fragment.maybe
|
74
|
+
interpretation_sheet.maybe >> fragment.maybe
|
69
75
|
end
|
70
76
|
|
71
77
|
rule(:vap) do
|
@@ -84,7 +90,7 @@ module Pubid::Iec
|
|
84
90
|
end
|
85
91
|
|
86
92
|
rule(:identifier) do
|
87
|
-
(originator.maybe >> (space.maybe >> stage.as(:stage)).maybe >>
|
93
|
+
(originator.maybe >> (space.maybe >> stage.as(:stage)).maybe >>
|
88
94
|
std_document_body >>
|
89
95
|
vap.maybe >> database.maybe >>
|
90
96
|
edition.maybe >>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Pubid::Iec::Renderer
|
2
|
+
class InterpretationSheet < Pubid
|
3
|
+
def render_identifier(params)
|
4
|
+
type_prefix = params[:typed_stage].nil? || params[:typed_stage].empty? ? "ISH" : ""
|
5
|
+
|
6
|
+
"%{base}/%{typed_stage}#{type_prefix}%{number}%{year}" % params
|
7
|
+
end
|
8
|
+
|
9
|
+
def render_typed_stage(typed_stage, _opts, _params)
|
10
|
+
typed_stage
|
11
|
+
end
|
12
|
+
|
13
|
+
def render_year(year, _opts, _params)
|
14
|
+
":#{year}"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/lib/pubid/iec/version.rb
CHANGED
data/lib/pubid/iec.rb
CHANGED
@@ -18,6 +18,7 @@ require_relative "iec/renderer/urn"
|
|
18
18
|
require_relative "iec/renderer/trf_urn"
|
19
19
|
require_relative "iec/renderer/working_document"
|
20
20
|
require_relative "iec/renderer/working_document_urn"
|
21
|
+
require_relative "iec/renderer/interpretation_sheet"
|
21
22
|
require_relative "iec/transformer"
|
22
23
|
require_relative "iec/identifier/base"
|
23
24
|
require_relative "iec/identifier/international_standard"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pubid-iec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
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-08-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -103,6 +103,7 @@ files:
|
|
103
103
|
- lib/pubid/iec/parser.rb
|
104
104
|
- lib/pubid/iec/renderer/amendment.rb
|
105
105
|
- lib/pubid/iec/renderer/corrigendum.rb
|
106
|
+
- lib/pubid/iec/renderer/interpretation_sheet.rb
|
106
107
|
- lib/pubid/iec/renderer/pubid.rb
|
107
108
|
- lib/pubid/iec/renderer/trf_pubid.rb
|
108
109
|
- lib/pubid/iec/renderer/trf_urn.rb
|