relaton-gb 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,297 @@
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
+ <optional>
9
+ <ref name="doctype"/>
10
+ </optional>
11
+ <optional>
12
+ <ref name="docsubtype"/>
13
+ </optional>
14
+ <zeroOrMore>
15
+ <ref name="gbcommittee"/>
16
+ </zeroOrMore>
17
+ <zeroOrMore>
18
+ <ref name="ics"/>
19
+ </zeroOrMore>
20
+ <ref name="structuredidentifier"/>
21
+ <optional>
22
+ <ref name="stagename"/>
23
+ </optional>
24
+ <ref name="gbtype"/>
25
+ <oneOrMore>
26
+ <ref name="gbccs"/>
27
+ </oneOrMore>
28
+ <optional>
29
+ <ref name="gbplannumber"/>
30
+ </optional>
31
+ </define>
32
+ <define name="bdate">
33
+ <element name="date">
34
+ <attribute name="type">
35
+ <choice>
36
+ <ref name="BibliographicDateType"/>
37
+ <text/>
38
+ </choice>
39
+ </attribute>
40
+ <choice>
41
+ <group>
42
+ <element name="from">
43
+ <ref name="ISO8601Date"/>
44
+ </element>
45
+ <optional>
46
+ <element name="to">
47
+ <ref name="ISO8601Date"/>
48
+ </element>
49
+ </optional>
50
+ </group>
51
+ <element name="on">
52
+ <choice>
53
+ <ref name="ISO8601Date"/>
54
+ <value>--</value>
55
+ <value>–</value>
56
+ </choice>
57
+ </element>
58
+ </choice>
59
+ </element>
60
+ </define>
61
+ <define name="organization">
62
+ <element name="organization">
63
+ <oneOrMore>
64
+ <ref name="orgname"/>
65
+ </oneOrMore>
66
+ <optional>
67
+ <ref name="abbreviation"/>
68
+ </optional>
69
+ <optional>
70
+ <ref name="uri"/>
71
+ </optional>
72
+ <zeroOrMore>
73
+ <ref name="org-identifier"/>
74
+ </zeroOrMore>
75
+ <zeroOrMore>
76
+ <ref name="contact"/>
77
+ </zeroOrMore>
78
+ <optional>
79
+ <ref name="technical-committee"/>
80
+ </optional>
81
+ <optional>
82
+ <ref name="subcommittee"/>
83
+ </optional>
84
+ <optional>
85
+ <ref name="workgroup"/>
86
+ </optional>
87
+ <optional>
88
+ <ref name="secretariat"/>
89
+ </optional>
90
+ </element>
91
+ </define>
92
+ <define name="DocumentType">
93
+ <choice>
94
+ <value>standard</value>
95
+ <value>recommendation</value>
96
+ </choice>
97
+ </define>
98
+ <define name="DocumentSubtype">
99
+ <choice>
100
+ <value>specification</value>
101
+ <value>method-of-test</value>
102
+ <value>vocabulary</value>
103
+ <value>code-of-practice</value>
104
+ </choice>
105
+ </define>
106
+ <define name="structuredidentifier">
107
+ <element name="structuredidentifier">
108
+ <optional>
109
+ <attribute name="type"/>
110
+ </optional>
111
+ <group>
112
+ <ref name="documentnumber"/>
113
+ <optional>
114
+ <ref name="tc-documentnumber"/>
115
+ </optional>
116
+ </group>
117
+ </element>
118
+ </define>
119
+ <define name="editorialgroup">
120
+ <element name="editorialgroup">
121
+ <ref name="ISOProjectGroup"/>
122
+ </element>
123
+ </define>
124
+ </include>
125
+ <define name="updates_document_type">
126
+ <element name="updates-document-type">
127
+ <ref name="DocumentType"/>
128
+ </element>
129
+ </define>
130
+ <define name="ISOProjectGroup">
131
+ <zeroOrMore>
132
+ <ref name="agency"/>
133
+ </zeroOrMore>
134
+ <oneOrMore>
135
+ <ref name="technical-committee"/>
136
+ </oneOrMore>
137
+ <zeroOrMore>
138
+ <ref name="subcommittee"/>
139
+ </zeroOrMore>
140
+ <zeroOrMore>
141
+ <ref name="workgroup"/>
142
+ </zeroOrMore>
143
+ <optional>
144
+ <ref name="secretariat"/>
145
+ </optional>
146
+ </define>
147
+ <define name="approvalgroup">
148
+ <element name="approvalgroup">
149
+ <ref name="ISOProjectGroup"/>
150
+ </element>
151
+ </define>
152
+ <define name="agency">
153
+ <element name="agency">
154
+ <text/>
155
+ </element>
156
+ </define>
157
+ <define name="horizontal">
158
+ <element name="horizontal">
159
+ <data type="boolean"/>
160
+ </element>
161
+ </define>
162
+ <define name="documentnumber">
163
+ <element name="project-number">
164
+ <optional>
165
+ <attribute name="part">
166
+ <data type="int"/>
167
+ </attribute>
168
+ </optional>
169
+ <optional>
170
+ <attribute name="subpart">
171
+ <data type="int"/>
172
+ </attribute>
173
+ </optional>
174
+ <optional>
175
+ <attribute name="amendment">
176
+ <data type="int"/>
177
+ </attribute>
178
+ </optional>
179
+ <optional>
180
+ <attribute name="corrigendum">
181
+ <data type="int"/>
182
+ </attribute>
183
+ </optional>
184
+ <optional>
185
+ <attribute name="origyr">
186
+ <ref name="ISO8601Date"/>
187
+ </attribute>
188
+ </optional>
189
+ <text/>
190
+ </element>
191
+ </define>
192
+ <define name="tc-documentnumber">
193
+ <element name="tc-document-number">
194
+ <data type="int"/>
195
+ </element>
196
+ </define>
197
+ <define name="subcommittee">
198
+ <element name="subcommittee">
199
+ <ref name="IsoWorkgroup"/>
200
+ </element>
201
+ </define>
202
+ <define name="workgroup">
203
+ <element name="workgroup">
204
+ <ref name="IsoWorkgroup"/>
205
+ </element>
206
+ </define>
207
+ <define name="secretariat">
208
+ <element name="secretariat">
209
+ <text/>
210
+ </element>
211
+ </define>
212
+ <define name="stagename">
213
+ <element name="stagename">
214
+ <optional>
215
+ <attribute name="abbreviation"/>
216
+ </optional>
217
+ <text/>
218
+ </element>
219
+ </define>
220
+ <define name="gbccs">
221
+ <element name="ccs">
222
+ <element name="code">
223
+ <text/>
224
+ </element>
225
+ <optional>
226
+ <element name="text">
227
+ <text/>
228
+ </element>
229
+ </optional>
230
+ </element>
231
+ </define>
232
+ <define name="gbplannumber">
233
+ <element name="plannumber">
234
+ <text/>
235
+ </element>
236
+ </define>
237
+ <define name="gbcommittee">
238
+ <element name="gbcommittee">
239
+ <attribute name="type">
240
+ <choice>
241
+ <value>technical</value>
242
+ <value>provisional</value>
243
+ <value>drafting</value>
244
+ </choice>
245
+ </attribute>
246
+ <text/>
247
+ </element>
248
+ </define>
249
+ <define name="gbtype">
250
+ <element name="gbtype">
251
+ <ref name="gbscope"/>
252
+ <ref name="gbprefix"/>
253
+ <ref name="gbmandate"/>
254
+ <ref name="gbtopic"/>
255
+ </element>
256
+ </define>
257
+ <define name="gbscope">
258
+ <element name="gbscope">
259
+ <choice>
260
+ <value>national</value>
261
+ <value>sector</value>
262
+ <value>professional</value>
263
+ <value>local</value>
264
+ <value>enterprise</value>
265
+ <value>social-group</value>
266
+ </choice>
267
+ </element>
268
+ </define>
269
+ <define name="gbmandate">
270
+ <element name="gbmandate">
271
+ <choice>
272
+ <value>mandatory</value>
273
+ <value>recommended</value>
274
+ <value>guidelines</value>
275
+ </choice>
276
+ </element>
277
+ </define>
278
+ <define name="gbprefix">
279
+ <element name="gbprefix">
280
+ <text/>
281
+ </element>
282
+ </define>
283
+ <define name="gbtopic">
284
+ <element name="gbtopic">
285
+ <choice>
286
+ <value>basic</value>
287
+ <value>health-and-safety</value>
288
+ <value>environment-protection</value>
289
+ <value>engineering-and-construction</value>
290
+ <value>product</value>
291
+ <value>method</value>
292
+ <value>management-techniques</value>
293
+ <value>other</value>
294
+ </choice>
295
+ </element>
296
+ </define>
297
+ </grammar>
@@ -31,18 +31,22 @@ module RelatonGb
31
31
 
32
32
  def initialize(**args)
33
33
  super
34
- @committee = GbTechnicalCommittee.new **args[:committee] if args[:committee]
34
+ @committee = GbTechnicalCommittee.new(**args[:committee]) if args[:committee]
35
35
  @ccs = args[:ccs].map { |c| c.is_a?(Cnccs::Ccs) ? c : Cnccs.fetch(c) }
36
- @gbtype = GbStandardType.new **args[:gbtype]
36
+ @gbtype = GbStandardType.new(**args[:gbtype])
37
37
  @gbplannumber = args[:gbplannumber] ||
38
38
  structuredidentifier&.project_number
39
39
  end
40
40
 
41
+ def ext_schema
42
+ @ext_schema ||= schema_versions["relaton-model-gb"]
43
+ end
44
+
41
45
  # @param hash [Hash]
42
46
  # @return [RelatonGb::GbBibliographicItem]
43
47
  def self.from_hash(hash)
44
48
  item_hash = ::RelatonGb::HashConverter.hash_to_bib(hash)
45
- new **item_hash
49
+ new(**item_hash)
46
50
  end
47
51
 
48
52
  # @param opts [Hash]
@@ -51,10 +55,10 @@ module RelatonGb
51
55
  # @option opts [Symbol, NilClass] :date_format (:short), :full
52
56
  # @option opts [String, Symbol] :lang language
53
57
  # @return [String] XML
54
- def to_xml(**opts)
58
+ def to_xml(**opts) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
55
59
  super(**opts) do |b|
56
60
  if opts[:bibdata] && has_ext_attrs?
57
- b.ext do
61
+ ext = b.ext do
58
62
  b.doctype doctype if doctype
59
63
  b.horizontal horizontal unless horizontal.nil?
60
64
  # b.docsubtype docsubtype if docsubtype
@@ -64,6 +68,7 @@ module RelatonGb
64
68
  b.stagename stagename if stagename
65
69
  render_gbxml(b)
66
70
  end
71
+ ext["schema-version"] = ext_schema unless opts[:embedded]
67
72
  end
68
73
  end
69
74
  end
@@ -15,24 +15,25 @@ module RelatonGb
15
15
  # @return [RelatonGb::HitCollection]
16
16
  def search(text)
17
17
  case text
18
- when /^(GB|GJ|GS)/
18
+ # when /^(GB|GJ|GS)/
19
19
  # Scrape national standards.
20
- require "relaton_gb/gb_scrapper"
21
- GbScrapper.scrape_page text
22
- when /^ZB/
20
+ # require "relaton_gb/gb_scrapper"
21
+ # GbScrapper.scrape_page text
22
+ # when /^ZB/
23
23
  # Scrape proffesional.
24
- when /^DB/
24
+ # when /^DB/
25
25
  # Scrape local standard.
26
- when %r{^Q/}
26
+ # when %r{^Q/}
27
27
  # Enterprise standard
28
- when %r{^T/[^\s]{3,6}\s}
28
+ when %r{^T/[^\s]{2,6}\s}
29
29
  # Scrape social standard.
30
30
  require "relaton_gb/t_scrapper"
31
31
  TScrapper.scrape_page text
32
32
  else
33
33
  # Scrape sector standard.
34
- require "relaton_gb/sec_scrapper"
35
- SecScrapper.scrape_page text
34
+ # require "relaton_gb/sec_scrapper"
35
+ # SecScrapper.scrape_page text
36
+ []
36
37
  end
37
38
  end
38
39
  # rubocop:enable Metrics/MethodLength
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RelatonGb
4
- VERSION = "1.13.0"
4
+ VERSION = "1.16.0"
5
5
  end
data/relaton_gb.gemspec CHANGED
@@ -22,18 +22,9 @@ Gem::Specification.new do |spec|
22
22
  spec.bindir = "exe"
23
23
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
24
  spec.require_paths = ["lib"]
25
- spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
26
-
27
- spec.add_development_dependency "equivalent-xml", "~> 0.6"
28
- spec.add_development_dependency "pry-byebug"
29
- spec.add_development_dependency "rake", "~> 13.0"
30
- spec.add_development_dependency "rspec", "~> 3.0"
31
- spec.add_development_dependency "ruby-jing"
32
- spec.add_development_dependency "simplecov"
33
- spec.add_development_dependency "vcr"
34
- spec.add_development_dependency "webmock"
25
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
35
26
 
36
27
  spec.add_dependency "cnccs", "~> 0.1.1"
37
28
  spec.add_dependency "gb-agencies", "~> 0.0.1"
38
- spec.add_dependency "relaton-iso-bib", "~> 1.13.0"
29
+ spec.add_dependency "relaton-iso-bib", "~> 1.16.0"
39
30
  end
metadata CHANGED
@@ -1,127 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-gb
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
- autorequire:
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
- - !ruby/object:Gem::Dependency
98
- name: vcr
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - ">="
102
- - !ruby/object:Gem::Version
103
- version: '0'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - ">="
109
- - !ruby/object:Gem::Version
110
- version: '0'
111
- - !ruby/object:Gem::Dependency
112
- name: webmock
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - ">="
116
- - !ruby/object:Gem::Version
117
- version: '0'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - ">="
123
- - !ruby/object:Gem::Version
124
- version: '0'
125
13
  - !ruby/object:Gem::Dependency
126
14
  name: cnccs
127
15
  requirement: !ruby/object:Gem::Requirement
@@ -156,14 +44,14 @@ dependencies:
156
44
  requirements:
157
45
  - - "~>"
158
46
  - !ruby/object:Gem::Version
159
- version: 1.13.0
47
+ version: 1.16.0
160
48
  type: :runtime
161
49
  prerelease: false
162
50
  version_requirements: !ruby/object:Gem::Requirement
163
51
  requirements:
164
52
  - - "~>"
165
53
  - !ruby/object:Gem::Version
166
- version: 1.13.0
54
+ version: 1.16.0
167
55
  description: 'RelatonGb: retrieve Chinese GB Standards for bibliographic use using
168
56
  the BibliographicItem model.'
169
57
  email:
@@ -173,6 +61,7 @@ extensions: []
173
61
  extra_rdoc_files: []
174
62
  files:
175
63
  - ".github/workflows/rake.yml"
64
+ - ".github/workflows/release.yml"
176
65
  - ".gitignore"
177
66
  - ".hound.yml"
178
67
  - ".rspec"
@@ -185,11 +74,10 @@ files:
185
74
  - bin/rspec
186
75
  - bin/setup
187
76
  - grammars/basicdoc.rng
77
+ - grammars/biblio-standoc.rng
188
78
  - grammars/biblio.rng
189
- - grammars/gbstandard.rng
190
- - grammars/isodoc.rng
191
- - grammars/isostandard.rng
192
- - grammars/reqt.rng
79
+ - grammars/relaton-gb-compile.rng
80
+ - grammars/relaton-gb.rng
193
81
  - lib/relaton_gb.rb
194
82
  - lib/relaton_gb/ccs.rb
195
83
  - lib/relaton_gb/gb_bibliographic_item.rb
@@ -212,7 +100,7 @@ homepage: https://github.com/metanorma/relaton_gb
212
100
  licenses:
213
101
  - BSD-2-Clause
214
102
  metadata: {}
215
- post_install_message:
103
+ post_install_message:
216
104
  rdoc_options: []
217
105
  require_paths:
218
106
  - lib
@@ -220,15 +108,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
220
108
  requirements:
221
109
  - - ">="
222
110
  - !ruby/object:Gem::Version
223
- version: 2.5.0
111
+ version: 2.7.0
224
112
  required_rubygems_version: !ruby/object:Gem::Requirement
225
113
  requirements:
226
114
  - - ">="
227
115
  - !ruby/object:Gem::Version
228
116
  version: '0'
229
117
  requirements: []
230
- rubygems_version: 3.2.3
231
- signing_key:
118
+ rubygems_version: 3.3.26
119
+ signing_key:
232
120
  specification_version: 4
233
121
  summary: 'RelatonGb: retrieve Chinese GB Standards for bibliographic use using the
234
122
  BibliographicItem model.'