relaton-gb 1.7.2 → 1.8.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -38,6 +38,9 @@
38
38
  </define>
39
39
  <define name="BibDataExtensionType">
40
40
  <ref name="doctype"/>
41
+ <optional>
42
+ <ref name="horizontal"/>
43
+ </optional>
41
44
  <ref name="editorialgroup"/>
42
45
  <zeroOrMore>
43
46
  <ref name="ics"/>
@@ -76,19 +79,6 @@
76
79
  </choice>
77
80
  </element>
78
81
  </define>
79
- <define name="ul">
80
- <element name="ul">
81
- <attribute name="id">
82
- <data type="ID"/>
83
- </attribute>
84
- <oneOrMore>
85
- <ref name="ul_li"/>
86
- </oneOrMore>
87
- <zeroOrMore>
88
- <ref name="note"/>
89
- </zeroOrMore>
90
- </element>
91
- </define>
92
82
  <define name="sections">
93
83
  <element name="sections">
94
84
  <zeroOrMore>
@@ -137,22 +127,28 @@
137
127
  </choice>
138
128
  </attribute>
139
129
  </optional>
130
+ <optional>
131
+ <attribute name="type"/>
132
+ </optional>
140
133
  <optional>
141
134
  <ref name="section-title"/>
142
135
  </optional>
143
- <choice>
144
- <group>
145
- <oneOrMore>
146
- <ref name="BasicBlock"/>
147
- </oneOrMore>
148
- <zeroOrMore>
149
- <ref name="note"/>
150
- </zeroOrMore>
151
- </group>
136
+ <group>
137
+ <choice>
138
+ <group>
139
+ <oneOrMore>
140
+ <ref name="BasicBlock"/>
141
+ </oneOrMore>
142
+ <zeroOrMore>
143
+ <ref name="note"/>
144
+ </zeroOrMore>
145
+ </group>
146
+ <ref name="amend"/>
147
+ </choice>
152
148
  <oneOrMore>
153
149
  <ref name="clause-subsection"/>
154
150
  </oneOrMore>
155
- </choice>
151
+ </group>
156
152
  </define>
157
153
  <define name="term">
158
154
  <element name="term">
@@ -183,17 +179,6 @@
183
179
  </zeroOrMore>
184
180
  </element>
185
181
  </define>
186
- <define name="definition">
187
- <element name="definition">
188
- <oneOrMore>
189
- <choice>
190
- <ref name="paragraph"/>
191
- <ref name="figure"/>
192
- <ref name="formula"/>
193
- </choice>
194
- </oneOrMore>
195
- </element>
196
- </define>
197
182
  <define name="annex">
198
183
  <element name="annex">
199
184
  <optional>
@@ -271,6 +256,7 @@
271
256
  <value>guide</value>
272
257
  <value>amendment</value>
273
258
  <value>technical-corrigendum</value>
259
+ <value>directive</value>
274
260
  </choice>
275
261
  </define>
276
262
  <define name="structuredidentifier">
@@ -324,6 +310,11 @@
324
310
  <optional>
325
311
  <attribute name="script"/>
326
312
  </optional>
313
+ <optional>
314
+ <attribute name="inline-header">
315
+ <data type="boolean"/>
316
+ </attribute>
317
+ </optional>
327
318
  <optional>
328
319
  <attribute name="obligation">
329
320
  <choice>
@@ -332,6 +323,12 @@
332
323
  </choice>
333
324
  </attribute>
334
325
  </optional>
326
+ <optional>
327
+ <attribute name="number"/>
328
+ </optional>
329
+ <optional>
330
+ <attribute name="type"/>
331
+ </optional>
335
332
  <optional>
336
333
  <ref name="section-title"/>
337
334
  </optional>
@@ -349,54 +346,6 @@
349
346
  </oneOrMore>
350
347
  </choice>
351
348
  </define>
352
- <define name="table">
353
- <element name="table">
354
- <attribute name="id">
355
- <data type="ID"/>
356
- </attribute>
357
- <optional>
358
- <attribute name="width"/>
359
- </optional>
360
- <optional>
361
- <attribute name="unnumbered">
362
- <data type="boolean"/>
363
- </attribute>
364
- </optional>
365
- <optional>
366
- <attribute name="number"/>
367
- </optional>
368
- <optional>
369
- <attribute name="subsequence"/>
370
- </optional>
371
- <optional>
372
- <attribute name="alt"/>
373
- </optional>
374
- <optional>
375
- <attribute name="summary"/>
376
- </optional>
377
- <optional>
378
- <attribute name="uri">
379
- <data type="anyURI"/>
380
- </attribute>
381
- </optional>
382
- <optional>
383
- <ref name="tname"/>
384
- </optional>
385
- <optional>
386
- <ref name="thead"/>
387
- </optional>
388
- <ref name="tbody"/>
389
- <optional>
390
- <ref name="tfoot"/>
391
- </optional>
392
- <zeroOrMore>
393
- <ref name="table-note"/>
394
- </zeroOrMore>
395
- <optional>
396
- <ref name="dl"/>
397
- </optional>
398
- </element>
399
- </define>
400
349
  </include>
401
350
  <!-- end overrides -->
402
351
  <!--
@@ -416,6 +365,9 @@
416
365
  <zeroOrMore>
417
366
  <ref name="termdocsource"/>
418
367
  </zeroOrMore>
368
+ <optional>
369
+ <ref name="misccontainer"/>
370
+ </optional>
419
371
  <optional>
420
372
  <ref name="boilerplate"/>
421
373
  </optional>
@@ -427,6 +379,14 @@
427
379
  <ref name="annex"/>
428
380
  </zeroOrMore>
429
381
  <ref name="bibliography"/>
382
+ <zeroOrMore>
383
+ <ref name="indexsect"/>
384
+ </zeroOrMore>
385
+ </element>
386
+ </define>
387
+ <define name="horizontal">
388
+ <element name="horizontal">
389
+ <data type="boolean"/>
430
390
  </element>
431
391
  </define>
432
392
  <define name="documentnumber">
@@ -510,28 +470,6 @@
510
470
  <ref name="Clause-Section"/>
511
471
  </element>
512
472
  </define>
513
- <define name="ul_li">
514
- <element name="li">
515
- <optional>
516
- <attribute name="id">
517
- <data type="ID"/>
518
- </attribute>
519
- </optional>
520
- <optional>
521
- <attribute name="uncheckedcheckbox">
522
- <data type="boolean"/>
523
- </attribute>
524
- </optional>
525
- <optional>
526
- <attribute name="checkedcheckbox">
527
- <data type="boolean"/>
528
- </attribute>
529
- </optional>
530
- <oneOrMore>
531
- <ref name="BasicBlock"/>
532
- </oneOrMore>
533
- </element>
534
- </define>
535
473
  <define name="stagename">
536
474
  <element name="stagename">
537
475
  <text/>
data/grammars/reqt.rng CHANGED
@@ -30,15 +30,34 @@
30
30
  <data type="boolean"/>
31
31
  </attribute>
32
32
  </optional>
33
+ <optional>
34
+ <attribute name="number"/>
35
+ </optional>
33
36
  <optional>
34
37
  <attribute name="subsequence"/>
35
38
  </optional>
39
+ <optional>
40
+ <attribute name="keep-with-next">
41
+ <data type="boolean"/>
42
+ </attribute>
43
+ </optional>
44
+ <optional>
45
+ <attribute name="keep-lines-together">
46
+ <data type="boolean"/>
47
+ </attribute>
48
+ </optional>
36
49
  <attribute name="id">
37
50
  <data type="ID"/>
38
51
  </attribute>
39
52
  <optional>
40
53
  <attribute name="filename"/>
41
54
  </optional>
55
+ <optional>
56
+ <attribute name="model"/>
57
+ </optional>
58
+ <optional>
59
+ <attribute name="type"/>
60
+ </optional>
42
61
  <optional>
43
62
  <ref name="reqtitle"/>
44
63
  </optional>
@@ -48,9 +67,9 @@
48
67
  <optional>
49
68
  <ref name="subject"/>
50
69
  </optional>
51
- <optional>
70
+ <zeroOrMore>
52
71
  <ref name="reqinherit"/>
53
- </optional>
72
+ </zeroOrMore>
54
73
  <zeroOrMore>
55
74
  <ref name="classification"/>
56
75
  </zeroOrMore>
@@ -135,6 +154,16 @@
135
154
  <data type="boolean"/>
136
155
  </attribute>
137
156
  </optional>
157
+ <optional>
158
+ <attribute name="keep-with-next">
159
+ <data type="boolean"/>
160
+ </attribute>
161
+ </optional>
162
+ <optional>
163
+ <attribute name="keep-lines-together">
164
+ <data type="boolean"/>
165
+ </attribute>
166
+ </optional>
138
167
  <oneOrMore>
139
168
  <ref name="BasicBlock"/>
140
169
  </oneOrMore>
@@ -52,7 +52,20 @@ module RelatonGb
52
52
  # @option opts [String, Symbol] :lang language
53
53
  # @return [String] XML
54
54
  def to_xml(**opts)
55
- super(**opts) { |xml| render_gbxml(xml) }
55
+ super(**opts) do |b|
56
+ if opts[:bibdata] && has_ext_attrs?
57
+ b.ext do
58
+ b.doctype doctype if doctype
59
+ b.horizontal horizontal unless horizontal.nil?
60
+ # b.docsubtype docsubtype if docsubtype
61
+ committee&.to_xml b
62
+ ics.each { |i| i.to_xml b }
63
+ structuredidentifier&.to_xml b
64
+ b.stagename stagename if stagename
65
+ render_gbxml(b)
66
+ end
67
+ end
68
+ end
56
69
  end
57
70
 
58
71
  # @return [Hash]
@@ -106,5 +119,12 @@ module RelatonGb
106
119
 
107
120
  builder.plannumber gbplannumber if gbplannumber
108
121
  end
122
+
123
+ #
124
+ # @return [Boolean]
125
+ #
126
+ def has_ext_attrs?
127
+ super || committee || docsubtype
128
+ end
109
129
  end
110
130
  end
@@ -7,6 +7,11 @@ require "gb_agencies"
7
7
  module RelatonGb
8
8
  # Common scrapping methods.
9
9
  module Scrapper
10
+ STAGES = { "即将实施" => "published",
11
+ "现行" => "activated",
12
+ "废止" => "obsoleted",
13
+ "被代替" => "replaced" }.freeze
14
+
10
15
  @prefixes = nil
11
16
 
12
17
  # rubocop:disable Metrics/MethodLength
@@ -96,12 +101,8 @@ module RelatonGb
96
101
  # @param status [String, NilClass]
97
102
  # @return [RelatonBib::DocumentStatus]
98
103
  def get_status(doc, status = nil)
99
- stage = case status || doc.at("//td[contains(., '标准状态')]/span")&.text
100
- when "即将实施" then "published"
101
- when "现行" then "activated"
102
- when "废止" then "obsoleted"
103
- end
104
- RelatonBib::DocumentStatus.new stage: stage
104
+ status ||= doc.at("//td[contains(., '标准状态')]/span")&.text
105
+ RelatonBib::DocumentStatus.new stage: STAGES[status]
105
106
  end
106
107
 
107
108
  private
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RelatonGb
4
- VERSION = "1.7.2"
4
+ VERSION = "1.8.0"
5
5
  end
data/relaton_gb.gemspec CHANGED
@@ -37,5 +37,5 @@ Gem::Specification.new do |spec|
37
37
 
38
38
  spec.add_dependency "cnccs", "~> 0.1.1"
39
39
  spec.add_dependency "gb-agencies", "~> 0.0.1"
40
- spec.add_dependency "relaton-iso-bib", ">= 1.7.0"
40
+ spec.add_dependency "relaton-iso-bib", ">= 1.8.0"
41
41
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-gb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.2
4
+ version: 1.8.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: 2021-03-19 00:00:00.000000000 Z
11
+ date: 2021-05-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: equivalent-xml
@@ -156,14 +156,14 @@ dependencies:
156
156
  requirements:
157
157
  - - ">="
158
158
  - !ruby/object:Gem::Version
159
- version: 1.7.0
159
+ version: 1.8.0
160
160
  type: :runtime
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
164
  - - ">="
165
165
  - !ruby/object:Gem::Version
166
- version: 1.7.0
166
+ version: 1.8.0
167
167
  description: 'RelatonGb: retrieve Chinese GB Standards for bibliographic use using
168
168
  the BibliographicItem model.'
169
169
  email:
@@ -182,6 +182,7 @@ files:
182
182
  - README.adoc
183
183
  - Rakefile
184
184
  - bin/console
185
+ - bin/rspec
185
186
  - bin/setup
186
187
  - grammars/basicdoc.rng
187
188
  - grammars/biblio.rng
@@ -226,7 +227,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
226
227
  - !ruby/object:Gem::Version
227
228
  version: '0'
228
229
  requirements: []
229
- rubygems_version: 3.0.6
230
+ rubygems_version: 3.2.3
230
231
  signing_key:
231
232
  specification_version: 4
232
233
  summary: 'RelatonGb: retrieve Chinese GB Standards for bibliographic use using the