relaton-iso-bib 1.7.0 → 1.9.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -38,6 +38,12 @@
38
38
  </define>
39
39
  <define name="BibDataExtensionType">
40
40
  <ref name="doctype"/>
41
+ <optional>
42
+ <ref name="docsubtype"/>
43
+ </optional>
44
+ <optional>
45
+ <ref name="horizontal"/>
46
+ </optional>
41
47
  <ref name="editorialgroup"/>
42
48
  <zeroOrMore>
43
49
  <ref name="ics"/>
@@ -76,19 +82,6 @@
76
82
  </choice>
77
83
  </element>
78
84
  </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
85
  <define name="sections">
93
86
  <element name="sections">
94
87
  <zeroOrMore>
@@ -108,7 +101,11 @@
108
101
  <ref name="definitions"/>
109
102
  </optional>
110
103
  <oneOrMore>
111
- <ref name="clause"/>
104
+ <choice>
105
+ <ref name="clause"/>
106
+ <ref name="term-clause"/>
107
+ <ref name="terms"/>
108
+ </choice>
112
109
  </oneOrMore>
113
110
  </element>
114
111
  </define>
@@ -137,18 +134,24 @@
137
134
  </choice>
138
135
  </attribute>
139
136
  </optional>
137
+ <optional>
138
+ <attribute name="type"/>
139
+ </optional>
140
140
  <optional>
141
141
  <ref name="section-title"/>
142
142
  </optional>
143
143
  <choice>
144
- <group>
145
- <oneOrMore>
146
- <ref name="BasicBlock"/>
147
- </oneOrMore>
148
- <zeroOrMore>
149
- <ref name="note"/>
150
- </zeroOrMore>
151
- </group>
144
+ <choice>
145
+ <group>
146
+ <oneOrMore>
147
+ <ref name="BasicBlock"/>
148
+ </oneOrMore>
149
+ <zeroOrMore>
150
+ <ref name="note"/>
151
+ </zeroOrMore>
152
+ </group>
153
+ <ref name="amend"/>
154
+ </choice>
152
155
  <oneOrMore>
153
156
  <ref name="clause-subsection"/>
154
157
  </oneOrMore>
@@ -183,17 +186,6 @@
183
186
  </zeroOrMore>
184
187
  </element>
185
188
  </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
189
  <define name="annex">
198
190
  <element name="annex">
199
191
  <optional>
@@ -271,6 +263,15 @@
271
263
  <value>guide</value>
272
264
  <value>amendment</value>
273
265
  <value>technical-corrigendum</value>
266
+ <value>directive</value>
267
+ </choice>
268
+ </define>
269
+ <define name="DocumentSubtype">
270
+ <choice>
271
+ <value>specification</value>
272
+ <value>method-of-test</value>
273
+ <value>vocabulary</value>
274
+ <value>code-of-practice</value>
274
275
  </choice>
275
276
  </define>
276
277
  <define name="structuredidentifier">
@@ -324,6 +325,11 @@
324
325
  <optional>
325
326
  <attribute name="script"/>
326
327
  </optional>
328
+ <optional>
329
+ <attribute name="inline-header">
330
+ <data type="boolean"/>
331
+ </attribute>
332
+ </optional>
327
333
  <optional>
328
334
  <attribute name="obligation">
329
335
  <choice>
@@ -332,6 +338,12 @@
332
338
  </choice>
333
339
  </attribute>
334
340
  </optional>
341
+ <optional>
342
+ <attribute name="number"/>
343
+ </optional>
344
+ <optional>
345
+ <attribute name="type"/>
346
+ </optional>
335
347
  <optional>
336
348
  <ref name="section-title"/>
337
349
  </optional>
@@ -349,54 +361,6 @@
349
361
  </oneOrMore>
350
362
  </choice>
351
363
  </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
364
  </include>
401
365
  <!-- end overrides -->
402
366
  <!--
@@ -416,6 +380,9 @@
416
380
  <zeroOrMore>
417
381
  <ref name="termdocsource"/>
418
382
  </zeroOrMore>
383
+ <optional>
384
+ <ref name="misccontainer"/>
385
+ </optional>
419
386
  <optional>
420
387
  <ref name="boilerplate"/>
421
388
  </optional>
@@ -427,6 +394,14 @@
427
394
  <ref name="annex"/>
428
395
  </zeroOrMore>
429
396
  <ref name="bibliography"/>
397
+ <zeroOrMore>
398
+ <ref name="indexsect"/>
399
+ </zeroOrMore>
400
+ </element>
401
+ </define>
402
+ <define name="horizontal">
403
+ <element name="horizontal">
404
+ <data type="boolean"/>
430
405
  </element>
431
406
  </define>
432
407
  <define name="documentnumber">
@@ -510,28 +485,6 @@
510
485
  <ref name="Clause-Section"/>
511
486
  </element>
512
487
  </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
488
  <define name="stagename">
536
489
  <element name="stagename">
537
490
  <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>
@@ -35,13 +35,13 @@ module RelatonIsoBib
35
35
  # @param secretariat [String, NilClass]
36
36
  def initialize(technical_committee:, **args) # rubocop:disable Metrics/CyclomaticComplexity,Metrics/AbcSize
37
37
  @technical_committee = technical_committee.map do |tc|
38
- tc.is_a?(Hash) ? IsoSubgroup.new(tc) : tc
38
+ tc.is_a?(Hash) ? RelatonBib::WorkGroup.new(**tc) : tc
39
39
  end
40
40
  @subcommittee = args.fetch(:subcommittee, []).map do |sc|
41
- sc.is_a?(Hash) ? IsoSubgroup.new(sc) : sc
41
+ sc.is_a?(Hash) ? RelatonBib::WorkGroup.new(**sc) : sc
42
42
  end
43
43
  @workgroup = args.fetch(:workgroup, []).map do |wg|
44
- wg.is_a?(Hash) ? IsoSubgroup.new(wg) : wg
44
+ wg.is_a?(Hash) ? RelatonBib::WorkGroup.new(**wg) : wg
45
45
  end
46
46
  @secretariat = args[:secretariat]
47
47
  end
@@ -86,7 +86,7 @@ module RelatonIsoBib
86
86
  # @param prefix [String]
87
87
  # @return [String]
88
88
  def to_asciibib(prefix = "") # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
89
- pref = prefix.empty? ? prefix : prefix + "."
89
+ pref = prefix.empty? ? prefix : "#{prefix}."
90
90
  pref += "editorialgroup"
91
91
  out = ""
92
92
  technical_committee.each do |tc|
@@ -105,48 +105,48 @@ module RelatonIsoBib
105
105
  end
106
106
 
107
107
  # ISO subgroup.
108
- class IsoSubgroup
109
- # @return [String, NilClass]
110
- attr_reader :type
111
-
112
- # @return [Integer, NilClass]
113
- attr_reader :number
114
-
115
- # @return [String]
116
- attr_reader :name
117
-
118
- # @param name [String]
119
- # @param type [String, NilClass]
120
- # @param number [Integer, NilClass]
121
- def initialize(name:, type: nil, number: nil)
122
- @name = name
123
- @type = type
124
- @number = number
125
- end
126
-
127
- # @param builder [Nokogiri::XML::Builder]
128
- def to_xml(builder)
129
- builder.parent[:number] = number if number
130
- builder.parent[:type] = type if type
131
- builder.text name
132
- end
133
-
134
- # @return [Hash]
135
- def to_hash
136
- hash = { "name" => name }
137
- hash["type"] = type if type
138
- hash["number"] = number if number
139
- hash
140
- end
141
-
142
- # @param prefix [String]
143
- # @param count [Integer] number of the elements
144
- def to_asciibib(prefix, count = 1)
145
- out = count > 1 ? "#{prefix}::\n" : ""
146
- out += "#{prefix}.type:: #{type}\n" if type
147
- out += "#{prefix}.number:: #{number}\n" if number
148
- out += "#{prefix}.name:: #{name}\n"
149
- out
150
- end
151
- end
108
+ # class IsoSubgroup
109
+ # # @return [String, NilClass]
110
+ # attr_reader :type
111
+
112
+ # # @return [Integer, NilClass]
113
+ # attr_reader :number
114
+
115
+ # # @return [String]
116
+ # attr_reader :name
117
+
118
+ # # @param name [String]
119
+ # # @param type [String, NilClass]
120
+ # # @param number [Integer, NilClass]
121
+ # def initialize(name:, type: nil, number: nil)
122
+ # @name = name
123
+ # @type = type
124
+ # @number = number
125
+ # end
126
+
127
+ # # @param builder [Nokogiri::XML::Builder]
128
+ # def to_xml(builder)
129
+ # builder.parent[:number] = number if number
130
+ # builder.parent[:type] = type if type
131
+ # builder.text name
132
+ # end
133
+
134
+ # # @return [Hash]
135
+ # def to_hash
136
+ # hash = { "name" => name }
137
+ # hash["type"] = type if type
138
+ # hash["number"] = number if number
139
+ # hash
140
+ # end
141
+
142
+ # # @param prefix [String]
143
+ # # @param count [Integer] number of the elements
144
+ # def to_asciibib(prefix, count = 1)
145
+ # out = count > 1 ? "#{prefix}::\n" : ""
146
+ # out += "#{prefix}.type:: #{type}\n" if type
147
+ # out += "#{prefix}.number:: #{number}\n" if number
148
+ # out += "#{prefix}.name:: #{name}\n"
149
+ # out
150
+ # end
151
+ # end
152
152
  end
@@ -9,7 +9,7 @@ module RelatonIsoBib
9
9
  # @param item [Hash]
10
10
  # @retirn [RelatonIsoBib::IsoBibliographicItem]
11
11
  def bib_item(item)
12
- IsoBibliographicItem.new(item)
12
+ IsoBibliographicItem.new(**item)
13
13
  end
14
14
 
15
15
  #
@@ -18,7 +18,7 @@ module RelatonIsoBib
18
18
  # @param title [Hash]
19
19
  # @return [RelatonBib::TypedTitleString]
20
20
  def typed_title_strig(title)
21
- RelatonBib::TypedTitleString.new title
21
+ RelatonBib::TypedTitleString.new(**title)
22
22
  end
23
23
 
24
24
  # @param ret [Hash]
@@ -45,9 +45,7 @@ module RelatonIsoBib
45
45
  def structuredidentifier_hash_to_bib(ret)
46
46
  return unless ret[:structuredidentifier]
47
47
 
48
- ret[:structuredidentifier] = RelatonIsoBib::StructuredIdentifier.new(
49
- ret[:structuredidentifier],
50
- )
48
+ ret[:structuredidentifier] = RelatonIsoBib::StructuredIdentifier.new(**ret[:structuredidentifier])
51
49
  end
52
50
  end
53
51
  end