pubid-iso 0.7.1 → 0.7.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 554740ba301fe225d6b7a58931013bb6d33d2c9ffa41de45c2b72b53b16340e7
4
- data.tar.gz: ad603b65a477dbf70222252e0b286226d9dc576ff24fc794e9873fdea4a0a45e
3
+ metadata.gz: 1be767645c955bb6ca456984b088d443786947ced66241b01f0ece4e772e37cc
4
+ data.tar.gz: ed2de74d63898105105b3edba5afa50c4e0133619c17be50c42c0e2a2c58dc32
5
5
  SHA512:
6
- metadata.gz: 731c5b93d0c2a443a6d1af5c965d6eb4984279bb062d1bd3136436cf65044186332661cbc6ae51a0500131b1cc13204991c4ed8e211fe28937298db806c65817
7
- data.tar.gz: 441fbee4c9481f6c60f7f25a7ea6256550dab0241c0fb1a048e3272eaab4b87ac1089c08d2f7a33dbd74d418151793193ee7e0d36143b8c46ac79594134b3fcf
6
+ metadata.gz: b9faf9bc67c1995284a1e68cef72f4b52324875c16371f0c0ab37db06a565a2673134931808426edddfaad775db7cc10c586bb3b66f835f56a8a90a8775afb68
7
+ data.tar.gz: c97332b884ecfa4f4a363c0a0825d028ca1899405f1d1d133cbd5538baf6683716fb5c5e530ffa4a186b53da6521c6d678308f370755a89e4be40163d90da76a
@@ -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
 
@@ -83,6 +85,9 @@ module Pubid::Iso
83
85
  @wgnumber = wgnumber.to_s if wgnumber
84
86
  @dir = dir.to_s if dir
85
87
  @dirtype = dirtype.to_s if dirtype
88
+ if jtc_dir
89
+ @jtc_dir = jtc_dir
90
+ end
86
91
  if base
87
92
  if base.is_a?(Hash)
88
93
  @base = Identifier.create(**base)
@@ -93,6 +98,7 @@ module Pubid::Iso
93
98
  @part = part if part
94
99
  @addendum = addendum if addendum
95
100
  @edition = edition
101
+ @month = month
96
102
  end
97
103
 
98
104
  class << self
@@ -109,6 +115,7 @@ module Pubid::Iso
109
115
  def transform_supplements(supplements_params, base_params)
110
116
  supplements = supplements_params.map do |supplement|
111
117
  Identifier.create(number: supplement[:number], year: supplement[:year],
118
+ month: supplement[:month],
112
119
  stage: supplement[:typed_stage], edition: supplement[:edition],
113
120
  iteration: supplement[:iteration], type: (supplement[:type] || !supplement[:typed_stage] && :sup),
114
121
  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
@@ -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
@@ -0,0 +1,11 @@
1
+ require_relative "base"
2
+
3
+ module Pubid::Iso::Renderer
4
+ class Data < Base
5
+ TYPE = "DATA".freeze
6
+
7
+ def omit_post_publisher_symbol?(_typed_stage, _stage, _opts)
8
+ false
9
+ end
10
+ end
11
+ end
@@ -4,7 +4,11 @@ module Pubid::Iso::Renderer
4
4
  class Dir < Base
5
5
 
6
6
  def render_identifier(params, opts)
7
- res = ("%{publisher} DIR%{dirtype}%{number}%{year}%{edition}" % params)
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
@@ -1,5 +1,5 @@
1
1
  module Pubid
2
2
  module Iso
3
- VERSION = "0.7.1".freeze
3
+ VERSION = "0.7.2".freeze
4
4
  end
5
5
  end
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.1
4
+ version: 0.7.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: 2024-01-14 00:00:00.000000000 Z
11
+ date: 2024-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -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