pubid-iso 0.6.1 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pubid/iso/identifier/amendment.rb +1 -1
- data/lib/pubid/iso/identifier/base.rb +4 -4
- data/lib/pubid/iso/identifier/corrigendum.rb +1 -1
- data/lib/pubid/iso/identifier/directives.rb +1 -1
- data/lib/pubid/iso/identifier/international_standard.rb +1 -1
- data/lib/pubid/iso/identifier/international_standardized_profile.rb +2 -2
- data/lib/pubid/iso/identifier/international_workshop_agreement.rb +1 -1
- data/lib/pubid/iso/identifier/supplement.rb +1 -1
- data/lib/pubid/iso/renderer/base.rb +10 -6
- data/lib/pubid/iso/renderer/dir.rb +1 -1
- data/lib/pubid/iso/renderer/guide.rb +2 -2
- data/lib/pubid/iso/renderer/international_workshop_agreement.rb +2 -1
- data/lib/pubid/iso/renderer/supplement.rb +6 -5
- data/lib/pubid/iso/renderer/urn-dir.rb +2 -2
- data/lib/pubid/iso/renderer/urn-supplement.rb +1 -1
- data/lib/pubid/iso/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e4fd0f754d87e7496c307221422d69bb36c6d4b497843eafa27a547d68bcd4e6
|
4
|
+
data.tar.gz: c1d58a83fb0d672111b9fe6d0dc28df87c0070e483c3c19d487e7c2618c99293
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aff91d1b6b5bc709bb4929b2901ac7ee53e35a2e67e403f4c3eec4123b8ab29a4d42604ae06ff0777be19b29d598139b224bfd7f34fe206595f3946147fb440b
|
7
|
+
data.tar.gz: ec6219d66f0b62c97bb20c09adcb3c53f3d63f7fb245228e3463fe47b33d37087574f6a327461f839b0eef1f713c8ce33dd1408619194814fda9ccc8938fdab1
|
@@ -12,7 +12,7 @@ module Pubid::Iso
|
|
12
12
|
:tctype, :sctype, :wgtype, :tcnumber, :scnumber, :wgnumber,
|
13
13
|
:dirtype,
|
14
14
|
:base,
|
15
|
-
:typed_stage,
|
15
|
+
# :typed_stage,
|
16
16
|
:supplements,
|
17
17
|
:addendum
|
18
18
|
|
@@ -62,7 +62,7 @@ module Pubid::Iso
|
|
62
62
|
end
|
63
63
|
|
64
64
|
if stage
|
65
|
-
@
|
65
|
+
@stage = resolve_stage(stage)
|
66
66
|
elsif iteration && !is_a?(Supplement)
|
67
67
|
raise Errors::IterationWithoutStageError, "Document without stage cannot have iteration"
|
68
68
|
end
|
@@ -178,7 +178,7 @@ module Pubid::Iso
|
|
178
178
|
# @return [String] URN identifier
|
179
179
|
def urn
|
180
180
|
((@tctype && Renderer::UrnTc) || Pubid::Iso::Renderer::Urn).new(
|
181
|
-
|
181
|
+
to_h(deep: false).merge({ type: type[:key] }),
|
182
182
|
).render + (language ? ":#{language}" : "")
|
183
183
|
end
|
184
184
|
|
@@ -243,7 +243,7 @@ module Pubid::Iso
|
|
243
243
|
options[:with_prf] = with_prf
|
244
244
|
options[:language] = lang
|
245
245
|
|
246
|
-
self.class.get_renderer_class.new(
|
246
|
+
self.class.get_renderer_class.new(to_h(deep: false)).render(**options) +
|
247
247
|
if @joint_document
|
248
248
|
render_joint_document(@joint_document)
|
249
249
|
end.to_s
|
@@ -6,12 +6,12 @@ module Pubid::Iso
|
|
6
6
|
def_delegators 'Pubid::Iso::Identifier::InternationalStandardizedProfile', :type
|
7
7
|
|
8
8
|
TYPED_STAGES = {
|
9
|
-
|
9
|
+
disp: {
|
10
10
|
abbr: "DISP",
|
11
11
|
name: "Draft International Standardized Profile",
|
12
12
|
harmonized_stages: %w[40.00 40.20 40.60 40.92 40.93 40.98 40.99],
|
13
13
|
},
|
14
|
-
|
14
|
+
fdisp: {
|
15
15
|
abbr: "FDISP",
|
16
16
|
name: "Final Draft International Standardized Profile",
|
17
17
|
harmonized_stages: %w[50.00 50.20 50.60 50.92],
|
@@ -6,7 +6,7 @@ module Pubid::Iso
|
|
6
6
|
def_delegators 'Pubid::Iso::Identifier::InternationalWorkshopAgreement', :type
|
7
7
|
|
8
8
|
TYPED_STAGES = {
|
9
|
-
|
9
|
+
diwa: {
|
10
10
|
abbr: "DIWA",
|
11
11
|
name: "Draft International Workshop Agreement",
|
12
12
|
harmonized_stages: %w[40.00 40.20 40.60 40.92 40.93 40.98 40.99],
|
@@ -42,10 +42,10 @@ module Pubid::Iso::Renderer
|
|
42
42
|
def render_base(_base, _opts, _params)
|
43
43
|
end
|
44
44
|
|
45
|
-
def render_type_prefix(params)
|
46
|
-
result = params[:
|
45
|
+
def render_type_prefix(params, opts)
|
46
|
+
result = params[:stage].nil? || !params[:stage].is_a?(Pubid::Core::TypedStage) ? self.class::TYPE : ""
|
47
47
|
|
48
|
-
if params[:stage] && !params[:stage].empty? && !result.empty?
|
48
|
+
if params[:stage] != "" && !params[:stage].to_s(with_prf: opts[:with_prf]).empty? && !result.empty?
|
49
49
|
" #{result}"
|
50
50
|
else
|
51
51
|
result
|
@@ -53,7 +53,8 @@ module Pubid::Iso::Renderer
|
|
53
53
|
end
|
54
54
|
|
55
55
|
def render_identifier(params, opts)
|
56
|
-
|
56
|
+
stage = params.key?(:stage) ? postrender_stage(params[:stage], opts, params) : ""
|
57
|
+
"%{publisher}#{stage}#{render_type_prefix(params, opts)} %{number}%{part}%{iteration}%{year}%{amendments}%{corrigendums}%{addendum}%{edition}" % params
|
57
58
|
end
|
58
59
|
|
59
60
|
def render_copublisher_string(publisher, copublishers, opts)
|
@@ -125,8 +126,11 @@ module Pubid::Iso::Renderer
|
|
125
126
|
typed_stage.to_s
|
126
127
|
end
|
127
128
|
|
128
|
-
def render_stage(stage,
|
129
|
-
|
129
|
+
def render_stage(stage, _opts, _params)
|
130
|
+
stage
|
131
|
+
end
|
132
|
+
|
133
|
+
def postrender_stage(stage, opts, params)
|
130
134
|
return if stage.empty_abbr?(with_prf: opts[:with_prf])
|
131
135
|
|
132
136
|
if opts[:language]
|
@@ -7,7 +7,7 @@ module Pubid::Iso::Renderer
|
|
7
7
|
res = ("%{publisher} DIR%{dirtype}%{number}%{year}%{edition}" % params)
|
8
8
|
|
9
9
|
if params.key?(:joint_document)
|
10
|
-
joint_params = prerender_params(params[:joint_document].
|
10
|
+
joint_params = prerender_params(params[:joint_document].to_h(deep: false), {})
|
11
11
|
joint_params.default = ""
|
12
12
|
res += (" + %{publisher}%{dirtype}%{number}%{year}" % joint_params)
|
13
13
|
end
|
@@ -8,8 +8,8 @@ module Pubid::Iso::Renderer
|
|
8
8
|
elsif opts[:language] == :russian
|
9
9
|
"Руководство %{publisher}%{stage} %{number}%{part}%{iteration}%{year}%{amendments}%{corrigendums}%{edition}" % params
|
10
10
|
else
|
11
|
-
if params[:
|
12
|
-
"%{publisher}%{
|
11
|
+
if params[:stage] && params[:stage].is_a?(Pubid::Core::TypedStage)
|
12
|
+
"%{publisher}%{stage} %{number}%{part}%{iteration}%{year}%{amendments}%{corrigendums}%{edition}" % params
|
13
13
|
else
|
14
14
|
"%{publisher}%{stage} Guide %{number}%{part}%{iteration}%{year}%{amendments}%{corrigendums}%{edition}" % params
|
15
15
|
end
|
@@ -11,7 +11,8 @@ module Pubid::Iso::Renderer
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def render_identifier(params, opts)
|
14
|
-
|
14
|
+
stage = params.key?(:stage) ? postrender_stage(params[:stage], opts, params) : ""
|
15
|
+
"#{stage}#{render_type_prefix(params, opts)} %{number}%{part}%{iteration}%{year}%{amendments}%{corrigendums}%{addendum}%{edition}" % params
|
15
16
|
end
|
16
17
|
end
|
17
18
|
end
|
@@ -23,21 +23,22 @@ module Pubid::Iso::Renderer
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def render_identifier(params, opts)
|
26
|
-
type_prefix = params[:
|
26
|
+
type_prefix = params[:stage].nil? || !params[:stage].is_a?(Pubid::Core::TypedStage) ? self.class::TYPE : ""
|
27
|
+
# type_prefix = params[:typed_stage].nil? || params[:typed_stage].empty? ? self.class::TYPE : ""
|
27
28
|
|
28
|
-
if params[:stage].
|
29
|
+
if params[:stage].instance_of?(Pubid::Core::Stage) && !params[:stage].empty_abbr?
|
29
30
|
type_prefix = " #{type_prefix}"
|
30
31
|
end
|
31
32
|
|
32
33
|
if self.class == Supplement
|
33
34
|
if opts[:base_type] == :dir
|
34
|
-
"%{
|
35
|
+
"%{stage}%{publisher} SUP%{number}%{part}%{iteration}%{year}%{edition}" % params
|
35
36
|
else
|
36
37
|
# type_prefix = "/#{type_prefix}" unless type_prefix.empty?
|
37
|
-
"/%{
|
38
|
+
"/%{stage}#{type_prefix}%{number}%{part}%{iteration}%{year}%{edition}" % params
|
38
39
|
end
|
39
40
|
else
|
40
|
-
"/%{
|
41
|
+
"/%{stage}#{type_prefix}%{number}%{part}%{iteration}%{year}%{edition}" % params
|
41
42
|
end
|
42
43
|
end
|
43
44
|
|
@@ -8,10 +8,10 @@ module Pubid::Iso::Renderer
|
|
8
8
|
|
9
9
|
if params.key?(:joint_document)
|
10
10
|
if params[:joint_document].is_a?(Pubid::Iso::Identifier::Supplement)
|
11
|
-
joint_params = params[:joint_document].
|
11
|
+
joint_params = params[:joint_document].to_h(deep: false)
|
12
12
|
res += ":#{joint_params[:base].publisher.downcase}:sup:%{year}" % joint_params
|
13
13
|
else
|
14
|
-
joint_params = prerender_params(params[:joint_document].
|
14
|
+
joint_params = prerender_params(params[:joint_document].to_h(deep: false), {})
|
15
15
|
joint_params.default = ""
|
16
16
|
res += (":%{publisher}%{copublisher}%{dirtype}%{number}%{supplement}" % joint_params)
|
17
17
|
end
|
@@ -13,7 +13,7 @@ module Pubid::Iso::Renderer
|
|
13
13
|
return base.urn if base.base || base.is_a?(Pubid::Iso::Identifier::Directives)
|
14
14
|
|
15
15
|
# to avoid rendering language as part of base
|
16
|
-
Urn.new(base.
|
16
|
+
Urn.new(base.to_h(deep: false)).render
|
17
17
|
end
|
18
18
|
|
19
19
|
def render_number(number, _opts, params)
|
data/lib/pubid/iso/version.rb
CHANGED
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.
|
4
|
+
version: 0.7.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
|
+
date: 2023-12-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 1.
|
61
|
+
version: '1.12'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 1.
|
68
|
+
version: '1.12'
|
69
69
|
description: Library to generate, parse and manipulate ISO PubID.
|
70
70
|
email:
|
71
71
|
- open.source@ribose.com
|