pubid-iso 0.7.1 → 0.7.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/lib/pubid/iso/identifier/base.rb +14 -5
- data/lib/pubid/iso/identifier/data.rb +17 -0
- data/lib/pubid/iso/parser.rb +2 -1
- data/lib/pubid/iso/renderer/data.rb +11 -0
- data/lib/pubid/iso/renderer/dir.rb +5 -1
- data/lib/pubid/iso/renderer/supplement.rb +5 -1
- data/lib/pubid/iso/transformer.rb +5 -0
- data/lib/pubid/iso/version.rb +1 -1
- data/lib/pubid/iso.rb +3 -1
- metadata +6 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5c7548bf553930fd483cab3fd09c4a23279ef230108587725c5cecb456e36885
|
|
4
|
+
data.tar.gz: eb037635c55d8f10068fb4a31ed4254e796c2c158a3b2553a643ee0e1794e8a0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 830082c58902dfd2763afdf5d8809665f7eae31a8802b8bf290daa9cd6341a553782ed388415c3c6986b731abeb35371ceb4bbf362cd2e42aaacaa2c691f4593
|
|
7
|
+
data.tar.gz: 70c49c310c2ba7bba7a28027a7c96689d2129f7c0b1193390e81373dc901309248a21055e0ca0fd62290f1f2f919d4749c0c0142195ec46e9b77f1208e70ae92
|
|
@@ -12,9 +12,10 @@ module Pubid::Iso
|
|
|
12
12
|
:tctype, :sctype, :wgtype, :tcnumber, :scnumber, :wgnumber,
|
|
13
13
|
:dirtype,
|
|
14
14
|
:base,
|
|
15
|
-
# :typed_stage,
|
|
16
15
|
:supplements,
|
|
17
|
-
:addendum
|
|
16
|
+
:addendum,
|
|
17
|
+
:jtc_dir,
|
|
18
|
+
:month
|
|
18
19
|
|
|
19
20
|
# Creates new identifier from options provided, includes options from
|
|
20
21
|
# Pubid::Core::Identifier#initialize
|
|
@@ -32,6 +33,7 @@ module Pubid::Iso
|
|
|
32
33
|
# @param dirtype [String] Directives document type, eg. "JTC"
|
|
33
34
|
# @param base [Identifier, Hash] base document for supplement's identifier
|
|
34
35
|
# @param type [nil, :tr, :ts, :amd, :cor, :guide, :dir, :tc, Type] document's type, eg. :tr, :ts, :amd, :cor, Type.new(:tr)
|
|
36
|
+
# @param jtc_dir [String] String to indicate "JTC 1 Directives" identifier
|
|
35
37
|
# @raise [Errors::SupplementWithoutYearOrStageError] when trying to apply
|
|
36
38
|
# supplement to the document without edition year or stage
|
|
37
39
|
# @raise [Errors::IsStageIterationError] when trying to apply iteration
|
|
@@ -47,7 +49,7 @@ module Pubid::Iso
|
|
|
47
49
|
scnumber: nil, wgnumber:nil,
|
|
48
50
|
dir: nil, dirtype: nil, year: nil, amendments: nil,
|
|
49
51
|
corrigendums: nil, type: nil, base: nil, supplements: nil,
|
|
50
|
-
part: nil, addendum: nil, edition: nil, **opts)
|
|
52
|
+
part: nil, addendum: nil, edition: nil, jtc_dir: nil, month: nil, **opts)
|
|
51
53
|
super(**opts.merge(number: number, publisher: publisher, year: year,
|
|
52
54
|
amendments: amendments, corrigendums: corrigendums))
|
|
53
55
|
|
|
@@ -75,7 +77,9 @@ module Pubid::Iso
|
|
|
75
77
|
@joint_document = joint_document
|
|
76
78
|
end
|
|
77
79
|
end
|
|
78
|
-
|
|
80
|
+
if tctype
|
|
81
|
+
@tctype = tctype.is_a?(Array) ? tctype.map(&:to_s) : tctype.to_s
|
|
82
|
+
end
|
|
79
83
|
@sctype = sctype.to_s if sctype
|
|
80
84
|
@wgtype = wgtype.to_s if wgtype
|
|
81
85
|
@tcnumber = tcnumber.to_s if tcnumber
|
|
@@ -83,6 +87,9 @@ module Pubid::Iso
|
|
|
83
87
|
@wgnumber = wgnumber.to_s if wgnumber
|
|
84
88
|
@dir = dir.to_s if dir
|
|
85
89
|
@dirtype = dirtype.to_s if dirtype
|
|
90
|
+
if jtc_dir
|
|
91
|
+
@jtc_dir = jtc_dir
|
|
92
|
+
end
|
|
86
93
|
if base
|
|
87
94
|
if base.is_a?(Hash)
|
|
88
95
|
@base = Identifier.create(**base)
|
|
@@ -90,9 +97,10 @@ module Pubid::Iso
|
|
|
90
97
|
@base = base
|
|
91
98
|
end
|
|
92
99
|
end
|
|
93
|
-
@part = part if part
|
|
100
|
+
@part = part.to_s if part
|
|
94
101
|
@addendum = addendum if addendum
|
|
95
102
|
@edition = edition
|
|
103
|
+
@month = month
|
|
96
104
|
end
|
|
97
105
|
|
|
98
106
|
class << self
|
|
@@ -109,6 +117,7 @@ module Pubid::Iso
|
|
|
109
117
|
def transform_supplements(supplements_params, base_params)
|
|
110
118
|
supplements = supplements_params.map do |supplement|
|
|
111
119
|
Identifier.create(number: supplement[:number], year: supplement[:year],
|
|
120
|
+
month: supplement[:month],
|
|
112
121
|
stage: supplement[:typed_stage], edition: supplement[:edition],
|
|
113
122
|
iteration: supplement[:iteration], type: (supplement[:type] || !supplement[:typed_stage] && :sup),
|
|
114
123
|
publisher: supplement[:publisher], base: Identifier.create(**base_params))
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
require_relative "../renderer/data"
|
|
2
|
+
|
|
3
|
+
module Pubid::Iso
|
|
4
|
+
module Identifier
|
|
5
|
+
class Data < Base
|
|
6
|
+
def_delegators 'Pubid::Iso::Identifier::Data', :type
|
|
7
|
+
|
|
8
|
+
def self.type
|
|
9
|
+
{ key: :data, title: "Data", short: "DATA" }
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def self.get_renderer_class
|
|
13
|
+
Renderer::Data
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
data/lib/pubid/iso/parser.rb
CHANGED
|
@@ -169,9 +169,10 @@ module Pubid::Iso
|
|
|
169
169
|
((str("DIR") | str("Directives Part") | str("Directives, Part") | str("Directives,")).as(:type) >> space).maybe >>
|
|
170
170
|
(str("JTC").as(:dirtype) >> space).maybe >>
|
|
171
171
|
(digits.as(:number) >> (str(":") >> year).maybe).maybe >>
|
|
172
|
+
(space >> str("DIR").as(:jtc_dir) >> (str(":") >> year).maybe).maybe >>
|
|
172
173
|
(str(" -- Consolidated").maybe >> (str("").as(:mark) >> space? >>
|
|
173
174
|
(organization.as(:publisher) >> space?).maybe >>
|
|
174
|
-
array_to_str(DIR_SUPPLEMENTS) >> (str(":") >> year).maybe >>
|
|
175
|
+
array_to_str(DIR_SUPPLEMENTS) >> (str(":") >> (year >> (dash >> month_digits.as(:month)).maybe)).maybe >>
|
|
175
176
|
dir_supplement_edition.maybe).repeat(1).as(:supplements)).maybe >>
|
|
176
177
|
# parse identifiers with publisher at the end, e.g. "ISO/IEC DIR 2 ISO"
|
|
177
178
|
(space >> organization.as(:publisher) >> (str(":") >> year).maybe).as(:edition).maybe
|
|
@@ -4,7 +4,11 @@ module Pubid::Iso::Renderer
|
|
|
4
4
|
class Dir < Base
|
|
5
5
|
|
|
6
6
|
def render_identifier(params, opts)
|
|
7
|
-
|
|
7
|
+
if params.key?(:jtc_dir)
|
|
8
|
+
res = ("%{publisher}%{dirtype}%{number} DIR%{year}%{edition}" % params)
|
|
9
|
+
else
|
|
10
|
+
res = ("%{publisher} DIR%{dirtype}%{number}%{year}%{edition}" % params)
|
|
11
|
+
end
|
|
8
12
|
|
|
9
13
|
if params.key?(:joint_document)
|
|
10
14
|
joint_params = prerender_params(params[:joint_document].to_h(deep: false), {})
|
|
@@ -32,7 +32,7 @@ module Pubid::Iso::Renderer
|
|
|
32
32
|
|
|
33
33
|
if self.class == Supplement
|
|
34
34
|
if opts[:base_type] == :dir
|
|
35
|
-
"%{stage}%{publisher} SUP%{number}%{part}%{iteration}%{year}%{edition}" % params
|
|
35
|
+
"%{stage}%{publisher} SUP%{number}%{part}%{iteration}%{year}%{month}%{edition}" % params
|
|
36
36
|
else
|
|
37
37
|
# type_prefix = "/#{type_prefix}" unless type_prefix.empty?
|
|
38
38
|
"/%{stage}#{type_prefix}%{number}%{part}%{iteration}%{year}%{edition}" % params
|
|
@@ -60,5 +60,9 @@ module Pubid::Iso::Renderer
|
|
|
60
60
|
def render_edition(edition, opts, _params)
|
|
61
61
|
" Edition #{edition}" if opts[:with_edition]
|
|
62
62
|
end
|
|
63
|
+
|
|
64
|
+
def render_month(month, _opts, _params)
|
|
65
|
+
"-#{month}"
|
|
66
|
+
end
|
|
63
67
|
end
|
|
64
68
|
end
|
|
@@ -114,6 +114,11 @@ module Pubid::Iso
|
|
|
114
114
|
context.select { |k, v| k != :dir_joint_document }
|
|
115
115
|
end
|
|
116
116
|
|
|
117
|
+
rule(jtc_dir: simple(:jtc_dir)) do |context|
|
|
118
|
+
context[:type] = "DIR"
|
|
119
|
+
context
|
|
120
|
+
end
|
|
121
|
+
|
|
117
122
|
def self.convert_stage(code)
|
|
118
123
|
russian_code = Pubid::Iso::Renderer::Base::TRANSLATION[:russian][:stage].key(code.to_s)
|
|
119
124
|
return { stage: russian_code } if russian_code
|
data/lib/pubid/iso/version.rb
CHANGED
data/lib/pubid/iso.rb
CHANGED
|
@@ -30,6 +30,7 @@ require_relative "iso/identifier/technology_trends_assessments"
|
|
|
30
30
|
require_relative "iso/identifier/international_workshop_agreement"
|
|
31
31
|
require_relative "iso/identifier/extract"
|
|
32
32
|
require_relative "iso/identifier/addendum"
|
|
33
|
+
require_relative "iso/identifier/data"
|
|
33
34
|
|
|
34
35
|
config = Pubid::Core::Configuration.new
|
|
35
36
|
config.stages = YAML.load_file(File.join(File.dirname(__FILE__), "../../stages.yaml"))
|
|
@@ -50,7 +51,8 @@ config.types = [Pubid::Iso::Identifier::InternationalStandard,
|
|
|
50
51
|
Pubid::Iso::Identifier::TechnologyTrendsAssessments,
|
|
51
52
|
Pubid::Iso::Identifier::Guide,
|
|
52
53
|
Pubid::Iso::Identifier::Extract,
|
|
53
|
-
Pubid::Iso::Identifier::Addendum
|
|
54
|
+
Pubid::Iso::Identifier::Addendum,
|
|
55
|
+
Pubid::Iso::Identifier::Data]
|
|
54
56
|
config.type_names = { tr: {
|
|
55
57
|
long: "Technical Report",
|
|
56
58
|
short: "TR",
|
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.7.
|
|
4
|
+
version: 0.7.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: 2024-01-
|
|
11
|
+
date: 2024-01-20 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:
|
|
61
|
+
version: 1.12.3
|
|
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:
|
|
68
|
+
version: 1.12.3
|
|
69
69
|
description: Library to generate, parse and manipulate ISO PubID.
|
|
70
70
|
email:
|
|
71
71
|
- open.source@ribose.com
|
|
@@ -85,6 +85,7 @@ files:
|
|
|
85
85
|
- lib/pubid/iso/identifier/amendment.rb
|
|
86
86
|
- lib/pubid/iso/identifier/base.rb
|
|
87
87
|
- lib/pubid/iso/identifier/corrigendum.rb
|
|
88
|
+
- lib/pubid/iso/identifier/data.rb
|
|
88
89
|
- lib/pubid/iso/identifier/directives.rb
|
|
89
90
|
- lib/pubid/iso/identifier/extract.rb
|
|
90
91
|
- lib/pubid/iso/identifier/guide.rb
|
|
@@ -103,6 +104,7 @@ files:
|
|
|
103
104
|
- lib/pubid/iso/renderer/amendment.rb
|
|
104
105
|
- lib/pubid/iso/renderer/base.rb
|
|
105
106
|
- lib/pubid/iso/renderer/corrigendum.rb
|
|
107
|
+
- lib/pubid/iso/renderer/data.rb
|
|
106
108
|
- lib/pubid/iso/renderer/dir.rb
|
|
107
109
|
- lib/pubid/iso/renderer/extract.rb
|
|
108
110
|
- lib/pubid/iso/renderer/guide.rb
|