relaton-iso-bib 1.13.0 → 1.16.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,225 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
3
+ <include href="biblio-standoc.rng">
4
+ <define name="BibDataExtensionType">
5
+ <optional>
6
+ <attribute name="schema-version"/>
7
+ </optional>
8
+ <ref name="doctype"/>
9
+ <optional>
10
+ <ref name="docsubtype"/>
11
+ </optional>
12
+ <optional>
13
+ <ref name="horizontal"/>
14
+ </optional>
15
+ <ref name="editorialgroup"/>
16
+ <optional>
17
+ <ref name="approvalgroup"/>
18
+ </optional>
19
+ <zeroOrMore>
20
+ <ref name="ics"/>
21
+ </zeroOrMore>
22
+ <ref name="structuredidentifier"/>
23
+ <optional>
24
+ <ref name="stagename"/>
25
+ </optional>
26
+ <optional>
27
+ <ref name="updates_document_type"/>
28
+ </optional>
29
+ </define>
30
+ <define name="bdate">
31
+ <element name="date">
32
+ <attribute name="type">
33
+ <choice>
34
+ <ref name="BibliographicDateType"/>
35
+ <text/>
36
+ </choice>
37
+ </attribute>
38
+ <choice>
39
+ <group>
40
+ <element name="from">
41
+ <ref name="ISO8601Date"/>
42
+ </element>
43
+ <optional>
44
+ <element name="to">
45
+ <ref name="ISO8601Date"/>
46
+ </element>
47
+ </optional>
48
+ </group>
49
+ <element name="on">
50
+ <choice>
51
+ <ref name="ISO8601Date"/>
52
+ <value>--</value>
53
+ <value>–</value>
54
+ </choice>
55
+ </element>
56
+ </choice>
57
+ </element>
58
+ </define>
59
+ <define name="organization">
60
+ <element name="organization">
61
+ <oneOrMore>
62
+ <ref name="orgname"/>
63
+ </oneOrMore>
64
+ <optional>
65
+ <ref name="abbreviation"/>
66
+ </optional>
67
+ <optional>
68
+ <ref name="uri"/>
69
+ </optional>
70
+ <zeroOrMore>
71
+ <ref name="org-identifier"/>
72
+ </zeroOrMore>
73
+ <zeroOrMore>
74
+ <ref name="contact"/>
75
+ </zeroOrMore>
76
+ <optional>
77
+ <ref name="technical-committee"/>
78
+ </optional>
79
+ <optional>
80
+ <ref name="subcommittee"/>
81
+ </optional>
82
+ <optional>
83
+ <ref name="workgroup"/>
84
+ </optional>
85
+ <optional>
86
+ <ref name="secretariat"/>
87
+ </optional>
88
+ </element>
89
+ </define>
90
+ <define name="DocumentType">
91
+ <choice>
92
+ <value>international-standard</value>
93
+ <value>technical-specification</value>
94
+ <value>technical-report</value>
95
+ <value>publicly-available-specification</value>
96
+ <value>international-workshop-agreement</value>
97
+ <value>guide</value>
98
+ <value>amendment</value>
99
+ <value>technical-corrigendum</value>
100
+ <value>directive</value>
101
+ </choice>
102
+ </define>
103
+ <define name="DocumentSubtype">
104
+ <choice>
105
+ <value>specification</value>
106
+ <value>method-of-test</value>
107
+ <value>vocabulary</value>
108
+ <value>code-of-practice</value>
109
+ </choice>
110
+ </define>
111
+ <define name="structuredidentifier">
112
+ <element name="structuredidentifier">
113
+ <optional>
114
+ <attribute name="type"/>
115
+ </optional>
116
+ <group>
117
+ <ref name="documentnumber"/>
118
+ <optional>
119
+ <ref name="tc-documentnumber"/>
120
+ </optional>
121
+ </group>
122
+ </element>
123
+ </define>
124
+ <define name="editorialgroup">
125
+ <element name="editorialgroup">
126
+ <ref name="ISOProjectGroup"/>
127
+ </element>
128
+ </define>
129
+ </include>
130
+ <define name="updates_document_type">
131
+ <element name="updates-document-type">
132
+ <ref name="DocumentType"/>
133
+ </element>
134
+ </define>
135
+ <define name="ISOProjectGroup">
136
+ <zeroOrMore>
137
+ <ref name="agency"/>
138
+ </zeroOrMore>
139
+ <oneOrMore>
140
+ <ref name="technical-committee"/>
141
+ </oneOrMore>
142
+ <zeroOrMore>
143
+ <ref name="subcommittee"/>
144
+ </zeroOrMore>
145
+ <zeroOrMore>
146
+ <ref name="workgroup"/>
147
+ </zeroOrMore>
148
+ <optional>
149
+ <ref name="secretariat"/>
150
+ </optional>
151
+ </define>
152
+ <define name="approvalgroup">
153
+ <element name="approvalgroup">
154
+ <ref name="ISOProjectGroup"/>
155
+ </element>
156
+ </define>
157
+ <define name="agency">
158
+ <element name="agency">
159
+ <text/>
160
+ </element>
161
+ </define>
162
+ <define name="horizontal">
163
+ <element name="horizontal">
164
+ <data type="boolean"/>
165
+ </element>
166
+ </define>
167
+ <define name="documentnumber">
168
+ <element name="project-number">
169
+ <optional>
170
+ <attribute name="part">
171
+ <data type="int"/>
172
+ </attribute>
173
+ </optional>
174
+ <optional>
175
+ <attribute name="subpart">
176
+ <data type="int"/>
177
+ </attribute>
178
+ </optional>
179
+ <optional>
180
+ <attribute name="amendment">
181
+ <data type="int"/>
182
+ </attribute>
183
+ </optional>
184
+ <optional>
185
+ <attribute name="corrigendum">
186
+ <data type="int"/>
187
+ </attribute>
188
+ </optional>
189
+ <optional>
190
+ <attribute name="origyr">
191
+ <ref name="ISO8601Date"/>
192
+ </attribute>
193
+ </optional>
194
+ <text/>
195
+ </element>
196
+ </define>
197
+ <define name="tc-documentnumber">
198
+ <element name="tc-document-number">
199
+ <data type="int"/>
200
+ </element>
201
+ </define>
202
+ <define name="subcommittee">
203
+ <element name="subcommittee">
204
+ <ref name="IsoWorkgroup"/>
205
+ </element>
206
+ </define>
207
+ <define name="workgroup">
208
+ <element name="workgroup">
209
+ <ref name="IsoWorkgroup"/>
210
+ </element>
211
+ </define>
212
+ <define name="secretariat">
213
+ <element name="secretariat">
214
+ <text/>
215
+ </element>
216
+ </define>
217
+ <define name="stagename">
218
+ <element name="stagename">
219
+ <optional>
220
+ <attribute name="abbreviation"/>
221
+ </optional>
222
+ <text/>
223
+ </element>
224
+ </define>
225
+ </grammar>
@@ -17,22 +17,22 @@ module RelatonIsoBib
17
17
  # @return [String, NilClass]
18
18
  attr_reader :secretariat
19
19
 
20
- # @param technical_committee [Array<Hash, RelatonIsoBib::IsoSubgroup>]
20
+ # @param technical_committee [Array<Hash, RelatonBib::WorkGroup>]
21
21
  # @option technical_committee [String] :name
22
22
  # @option technical_committee [String] :type
23
23
  # @option technical_committee [Integer] :number
24
24
  #
25
- # @param subcommittee [Array<Hash, RelatonIsoBib::IsoSubgroup>]
25
+ # @param subcommittee [Array<Hash, RelatonBib::WorkGroup>]
26
26
  # @option subcommittee [String] :name
27
27
  # @option subcommittee [String] :type
28
28
  # @option subcommittee [Integer] :number
29
29
  #
30
- # @param workgroup [Array<Hash, RelatonIsoBib::IsoSubgroup>]
30
+ # @param workgroup [Array<Hash, RelatonBib::WorkGroup>]
31
31
  # @option workgroup [String] :name
32
32
  # @option workgroup [String] :type
33
33
  # @option workgroup [Integer] :number
34
34
  #
35
- # @param secretariat [String, NilClass]
35
+ # @param secretariat [String, nil]
36
36
  def initialize(technical_committee:, **args) # rubocop:disable Metrics/CyclomaticComplexity,Metrics/AbcSize
37
37
  @technical_committee = technical_committee.map do |tc|
38
38
  tc.is_a?(Hash) ? RelatonBib::WorkGroup.new(**tc) : tc
@@ -58,7 +58,7 @@ module RelatonIsoBib
58
58
 
59
59
  builder.editorialgroup do
60
60
  technical_committee.each do |tc|
61
- builder.send("technical-committee") { tc.to_xml builder }
61
+ builder.send(:"technical-committee") { tc.to_xml builder }
62
62
  end
63
63
  subcommittee.each do |sc|
64
64
  builder.subcommittee { sc.to_xml builder }
@@ -21,7 +21,7 @@ end
21
21
  module RelatonIsoBib
22
22
  # Bibliographic item.
23
23
  class IsoBibliographicItem < RelatonBib::BibliographicItem
24
- TYPES = %w[
24
+ DOCTYPES = %w[
25
25
  international-standard technical-specification technical-report
26
26
  publicly-available-specification international-workshop-agreement guide
27
27
  amendment technical-corrigendum directive
@@ -133,17 +133,16 @@ module RelatonIsoBib
133
133
  def initialize(**args)
134
134
  check_doctype args[:doctype]
135
135
 
136
+ args[:type] ||= "standard"
136
137
  arg_names = %i[
137
138
  id title docnumber language script docstatus date abstract contributor
138
139
  edition version relation biblionote series medium place copyright link
139
140
  fetched docid formattedref extent accesslocation classification validity
140
- editorialgroup doctype keyword
141
+ editorialgroup doctype keyword type
141
142
  ]
142
143
  super_args = args.select { |k| arg_names.include? k }
143
144
  super(**super_args)
144
145
 
145
- @type = args[:type] || "standard"
146
-
147
146
  if args[:editorialgroup]
148
147
  @editorialgroup = if args[:editorialgroup].is_a?(Hash)
149
148
  EditorialGroup.new(**args[:editorialgroup])
@@ -151,8 +150,8 @@ module RelatonIsoBib
151
150
  end
152
151
  end
153
152
 
154
- if args[:subdoctype] && !SUBDOCTYPES.include?(args[:subdoctype])
155
- warn "Invald subdoctype '#{args[:subdoctype]}'. Allowed values are: #{SUBDOCTYPES.join(', ')}"
153
+ if args[:subdoctype] && !self.class::SUBDOCTYPES.include?(args[:subdoctype])
154
+ warn "Invald subdoctype '#{args[:subdoctype]}'. Allowed values are: #{self.class::SUBDOCTYPES.join(', ')}"
156
155
  end
157
156
  @subdoctype = args[:subdoctype]
158
157
  @structuredidentifier = args[:structuredidentifier]
@@ -162,16 +161,31 @@ module RelatonIsoBib
162
161
  @id_attribute = true
163
162
  end
164
163
 
165
- # @param opts [Hash]
164
+ #
165
+ # Fetch the flavour schema version
166
+ #
167
+ # @return [String] flavour schema version
168
+ #
169
+ def ext_schema
170
+ @ext_schema ||= schema_versions["relaton-model-iso"]
171
+ end
172
+
173
+ #
174
+ # Render the document as an XML string.
175
+ #
176
+ # @param opts [Hash] options
166
177
  # @option opts [Nokogiri::XML::Builder] :builder XML builder
167
- # @option opts [Boolean] :bibdata
178
+ # @option opts [Boolean] :bibdata if true, bibdata element is created
179
+ # @option opts [Boolean] :embedded if true the document is embedded in another document
168
180
  # @option opts [String] :lang language
181
+ #
169
182
  # @return [String] XML
183
+ #
170
184
  def to_xml(**opts)
171
185
  super(**opts) do |b|
172
186
  if block_given? then yield b
173
187
  elsif opts[:bibdata] && has_ext_attrs?
174
- b.ext do
188
+ ext = b.ext do
175
189
  b.doctype doctype if doctype
176
190
  b.subdoctype subdoctype if subdoctype
177
191
  b.horizontal horizontal unless horizontal.nil?
@@ -180,6 +194,7 @@ module RelatonIsoBib
180
194
  structuredidentifier&.to_xml b
181
195
  b.stagename stagename if stagename
182
196
  end
197
+ ext["schema-version"] = ext_schema unless opts[:embedded]
183
198
  end
184
199
  end
185
200
  end
@@ -187,8 +202,14 @@ module RelatonIsoBib
187
202
  # rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
188
203
  # rubocop:enable Metrics/AbcSize, Metrics/MethodLength
189
204
 
190
- # @return [Hash]
191
- def to_hash
205
+ #
206
+ # Render the document as HASH
207
+ #
208
+ # @param embedded [Boolean] true if the bibitem is embedded in another bibitem
209
+ #
210
+ # @return [Hash] the document as HAS
211
+ #
212
+ def to_hash(embedded: false)
192
213
  hash = super
193
214
  hash["horizontal"] = horizontal unless horizontal.nil?
194
215
  hash["stagename"] = stagename if stagename
@@ -209,9 +230,9 @@ module RelatonIsoBib
209
230
  # @param doctype [String]
210
231
  # @raise ArgumentError
211
232
  def check_doctype(doctype)
212
- if doctype && !self.class::TYPES.include?(doctype)
233
+ if doctype && !self.class::DOCTYPES.include?(doctype)
213
234
  warn "[relaton-iso-bib] WARNING: invalid doctype: #{doctype}"
214
- warn "[relaton-iso-bib] Allowed doctypes are: #{self.class::TYPES.join(', ')}"
235
+ warn "[relaton-iso-bib] Allowed doctypes are: #{self.class::DOCTYPES.join(', ')}"
215
236
  end
216
237
  end
217
238
 
@@ -1,3 +1,3 @@
1
1
  module RelatonIsoBib
2
- VERSION = "1.13.0".freeze
2
+ VERSION = "1.16.0".freeze
3
3
  end
@@ -24,17 +24,8 @@ Gem::Specification.new do |spec|
24
24
  spec.bindir = "exe"
25
25
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
26
26
  spec.require_paths = ["lib"]
27
- spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
28
-
29
- # spec.add_development_dependency "debase"
30
- spec.add_development_dependency "equivalent-xml", "~> 0.6"
31
- spec.add_development_dependency "pry-byebug"
32
- spec.add_development_dependency "rake", "~> 13.0"
33
- spec.add_development_dependency "rspec", "~> 3.0"
34
- # spec.add_development_dependency "ruby-debug-ide"
35
- spec.add_development_dependency "ruby-jing"
36
- spec.add_development_dependency "simplecov"
27
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
37
28
 
38
29
  spec.add_dependency "isoics", "~> 0.1.6"
39
- spec.add_dependency "relaton-bib", "~> 1.13.0"
30
+ spec.add_dependency "relaton-bib", "~> 1.16.0"
40
31
  end
metadata CHANGED
@@ -1,99 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-iso-bib
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.13.0
4
+ version: 1.16.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: 2022-08-21 00:00:00.000000000 Z
11
+ date: 2023-09-03 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: equivalent-xml
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '0.6'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '0.6'
27
- - !ruby/object:Gem::Dependency
28
- name: pry-byebug
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: rake
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '13.0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '13.0'
55
- - !ruby/object:Gem::Dependency
56
- name: rspec
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '3.0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '3.0'
69
- - !ruby/object:Gem::Dependency
70
- name: ruby-jing
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
- - !ruby/object:Gem::Dependency
84
- name: simplecov
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: '0'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: '0'
97
13
  - !ruby/object:Gem::Dependency
98
14
  name: isoics
99
15
  requirement: !ruby/object:Gem::Requirement
@@ -114,14 +30,14 @@ dependencies:
114
30
  requirements:
115
31
  - - "~>"
116
32
  - !ruby/object:Gem::Version
117
- version: 1.13.0
33
+ version: 1.16.0
118
34
  type: :runtime
119
35
  prerelease: false
120
36
  version_requirements: !ruby/object:Gem::Requirement
121
37
  requirements:
122
38
  - - "~>"
123
39
  - !ruby/object:Gem::Version
124
- version: 1.13.0
40
+ version: 1.16.0
125
41
  description: 'RelatonIsoBib: Ruby ISOXMLDOC impementation.'
126
42
  email:
127
43
  - open.source@ribose.com
@@ -130,6 +46,7 @@ extensions: []
130
46
  extra_rdoc_files: []
131
47
  files:
132
48
  - ".github/workflows/rake.yml"
49
+ - ".github/workflows/release.yml"
133
50
  - ".gitignore"
134
51
  - ".rspec"
135
52
  - ".rubocop.yml"
@@ -141,10 +58,10 @@ files:
141
58
  - bin/rspec
142
59
  - bin/setup
143
60
  - grammars/basicdoc.rng
61
+ - grammars/biblio-standoc.rng
144
62
  - grammars/biblio.rng
145
- - grammars/isodoc.rng
146
- - grammars/isostandard.rng
147
- - grammars/reqt.rng
63
+ - grammars/relaton-iso-compile.rng
64
+ - grammars/relaton-iso.rng
148
65
  - lib/relaton_iso_bib.rb
149
66
  - lib/relaton_iso_bib/editorial_group.rb
150
67
  - lib/relaton_iso_bib/hash_converter.rb
@@ -167,14 +84,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
167
84
  requirements:
168
85
  - - ">="
169
86
  - !ruby/object:Gem::Version
170
- version: 2.5.0
87
+ version: 2.7.0
171
88
  required_rubygems_version: !ruby/object:Gem::Requirement
172
89
  requirements:
173
90
  - - ">="
174
91
  - !ruby/object:Gem::Version
175
92
  version: '0'
176
93
  requirements: []
177
- rubygems_version: 3.2.3
94
+ rubygems_version: 3.4.9
178
95
  signing_key:
179
96
  specification_version: 4
180
97
  summary: 'RelatonIsoBib: Ruby ISOXMLDOC impementation.'