relaton-iso-bib 1.7.1 → 1.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +1 -11
- data/.rubocop.yml +3 -1
- data/bin/rspec +29 -0
- data/grammars/basicdoc.rng +191 -27
- data/grammars/biblio.rng +7 -8
- data/grammars/isodoc.rng +1156 -112
- data/grammars/isostandard.rng +69 -115
- data/grammars/reqt.rng +65 -7
- data/lib/relaton_iso_bib/editorial_group.rb +48 -48
- data/lib/relaton_iso_bib/hash_converter.rb +1 -1
- data/lib/relaton_iso_bib/ics.rb +1 -0
- data/lib/relaton_iso_bib/iso_bibliographic_item.rb +40 -23
- data/lib/relaton_iso_bib/structured_identifier.rb +2 -2
- data/lib/relaton_iso_bib/version.rb +1 -1
- data/lib/relaton_iso_bib/xml_parser.rb +5 -6
- data/relaton_iso_bib.gemspec +3 -3
- metadata +8 -7
data/grammars/isostandard.rng
CHANGED
@@ -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
|
-
<
|
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,19 @@
|
|
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
|
-
<
|
144
|
+
<choice>
|
145
145
|
<oneOrMore>
|
146
146
|
<ref name="BasicBlock"/>
|
147
147
|
</oneOrMore>
|
148
|
-
<
|
149
|
-
|
150
|
-
</zeroOrMore>
|
151
|
-
</group>
|
148
|
+
<ref name="amend"/>
|
149
|
+
</choice>
|
152
150
|
<oneOrMore>
|
153
151
|
<ref name="clause-subsection"/>
|
154
152
|
</oneOrMore>
|
@@ -161,6 +159,20 @@
|
|
161
159
|
<data type="ID"/>
|
162
160
|
</attribute>
|
163
161
|
</optional>
|
162
|
+
<optional>
|
163
|
+
<attribute name="language"/>
|
164
|
+
</optional>
|
165
|
+
<optional>
|
166
|
+
<attribute name="script"/>
|
167
|
+
</optional>
|
168
|
+
<optional>
|
169
|
+
<attribute name="tag"/>
|
170
|
+
</optional>
|
171
|
+
<optional>
|
172
|
+
<attribute name="multilingual-rendering">
|
173
|
+
<ref name="MultilingualRenderingType"/>
|
174
|
+
</attribute>
|
175
|
+
</optional>
|
164
176
|
<ref name="preferred"/>
|
165
177
|
<zeroOrMore>
|
166
178
|
<ref name="admitted"/>
|
@@ -171,7 +183,7 @@
|
|
171
183
|
<optional>
|
172
184
|
<ref name="termdomain"/>
|
173
185
|
</optional>
|
174
|
-
<ref name="
|
186
|
+
<ref name="termdefinition"/>
|
175
187
|
<zeroOrMore>
|
176
188
|
<ref name="termnote"/>
|
177
189
|
</zeroOrMore>
|
@@ -181,17 +193,9 @@
|
|
181
193
|
<zeroOrMore>
|
182
194
|
<ref name="termsource"/>
|
183
195
|
</zeroOrMore>
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
<element name="definition">
|
188
|
-
<oneOrMore>
|
189
|
-
<choice>
|
190
|
-
<ref name="paragraph"/>
|
191
|
-
<ref name="figure"/>
|
192
|
-
<ref name="formula"/>
|
193
|
-
</choice>
|
194
|
-
</oneOrMore>
|
196
|
+
<zeroOrMore>
|
197
|
+
<ref name="term"/>
|
198
|
+
</zeroOrMore>
|
195
199
|
</element>
|
196
200
|
</define>
|
197
201
|
<define name="annex">
|
@@ -230,9 +234,6 @@
|
|
230
234
|
-->
|
231
235
|
<ref name="BasicBlock"/>
|
232
236
|
</zeroOrMore>
|
233
|
-
<zeroOrMore>
|
234
|
-
<ref name="note"/>
|
235
|
-
</zeroOrMore>
|
236
237
|
<zeroOrMore>
|
237
238
|
<ref name="clause-hanging-paragraph-with-footnote"/>
|
238
239
|
</zeroOrMore>
|
@@ -271,6 +272,15 @@
|
|
271
272
|
<value>guide</value>
|
272
273
|
<value>amendment</value>
|
273
274
|
<value>technical-corrigendum</value>
|
275
|
+
<value>directive</value>
|
276
|
+
</choice>
|
277
|
+
</define>
|
278
|
+
<define name="DocumentSubtype">
|
279
|
+
<choice>
|
280
|
+
<value>specification</value>
|
281
|
+
<value>method-of-test</value>
|
282
|
+
<value>vocabulary</value>
|
283
|
+
<value>code-of-practice</value>
|
274
284
|
</choice>
|
275
285
|
</define>
|
276
286
|
<define name="structuredidentifier">
|
@@ -324,6 +334,11 @@
|
|
324
334
|
<optional>
|
325
335
|
<attribute name="script"/>
|
326
336
|
</optional>
|
337
|
+
<optional>
|
338
|
+
<attribute name="inline-header">
|
339
|
+
<data type="boolean"/>
|
340
|
+
</attribute>
|
341
|
+
</optional>
|
327
342
|
<optional>
|
328
343
|
<attribute name="obligation">
|
329
344
|
<choice>
|
@@ -332,71 +347,24 @@
|
|
332
347
|
</choice>
|
333
348
|
</attribute>
|
334
349
|
</optional>
|
350
|
+
<optional>
|
351
|
+
<attribute name="number"/>
|
352
|
+
</optional>
|
353
|
+
<optional>
|
354
|
+
<attribute name="type"/>
|
355
|
+
</optional>
|
335
356
|
<optional>
|
336
357
|
<ref name="section-title"/>
|
337
358
|
</optional>
|
338
359
|
<choice>
|
339
|
-
<
|
340
|
-
<
|
341
|
-
|
342
|
-
</zeroOrMore>
|
343
|
-
<zeroOrMore>
|
344
|
-
<ref name="note"/>
|
345
|
-
</zeroOrMore>
|
346
|
-
</group>
|
360
|
+
<zeroOrMore>
|
361
|
+
<ref name="BasicBlock"/>
|
362
|
+
</zeroOrMore>
|
347
363
|
<oneOrMore>
|
348
364
|
<ref name="content-subsection"/>
|
349
365
|
</oneOrMore>
|
350
366
|
</choice>
|
351
367
|
</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
368
|
</include>
|
401
369
|
<!-- end overrides -->
|
402
370
|
<!--
|
@@ -416,6 +384,9 @@
|
|
416
384
|
<zeroOrMore>
|
417
385
|
<ref name="termdocsource"/>
|
418
386
|
</zeroOrMore>
|
387
|
+
<optional>
|
388
|
+
<ref name="misccontainer"/>
|
389
|
+
</optional>
|
419
390
|
<optional>
|
420
391
|
<ref name="boilerplate"/>
|
421
392
|
</optional>
|
@@ -427,6 +398,14 @@
|
|
427
398
|
<ref name="annex"/>
|
428
399
|
</zeroOrMore>
|
429
400
|
<ref name="bibliography"/>
|
401
|
+
<zeroOrMore>
|
402
|
+
<ref name="indexsect"/>
|
403
|
+
</zeroOrMore>
|
404
|
+
</element>
|
405
|
+
</define>
|
406
|
+
<define name="horizontal">
|
407
|
+
<element name="horizontal">
|
408
|
+
<data type="boolean"/>
|
430
409
|
</element>
|
431
410
|
</define>
|
432
411
|
<define name="documentnumber">
|
@@ -497,9 +476,6 @@
|
|
497
476
|
<!-- allow hanging paragraphs in annexes: they introduce lists -->
|
498
477
|
<ref name="BasicBlock"/>
|
499
478
|
</zeroOrMore>
|
500
|
-
<zeroOrMore>
|
501
|
-
<ref name="note"/>
|
502
|
-
</zeroOrMore>
|
503
479
|
<zeroOrMore>
|
504
480
|
<ref name="clause-hanging-paragraph-with-footnote"/>
|
505
481
|
</zeroOrMore>
|
@@ -510,28 +486,6 @@
|
|
510
486
|
<ref name="Clause-Section"/>
|
511
487
|
</element>
|
512
488
|
</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
489
|
<define name="stagename">
|
536
490
|
<element name="stagename">
|
537
491
|
<text/>
|
data/grammars/reqt.rng
CHANGED
@@ -30,9 +30,22 @@
|
|
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>
|
@@ -40,17 +53,31 @@
|
|
40
53
|
<attribute name="filename"/>
|
41
54
|
</optional>
|
42
55
|
<optional>
|
43
|
-
<
|
56
|
+
<attribute name="model"/>
|
44
57
|
</optional>
|
45
58
|
<optional>
|
46
|
-
<
|
59
|
+
<attribute name="type"/>
|
47
60
|
</optional>
|
48
61
|
<optional>
|
49
|
-
<
|
62
|
+
<attribute name="tag"/>
|
50
63
|
</optional>
|
51
64
|
<optional>
|
52
|
-
<
|
65
|
+
<attribute name="multilingual-rendering">
|
66
|
+
<ref name="MultilingualRenderingType"/>
|
67
|
+
</attribute>
|
53
68
|
</optional>
|
69
|
+
<optional>
|
70
|
+
<ref name="reqtitle"/>
|
71
|
+
</optional>
|
72
|
+
<optional>
|
73
|
+
<ref name="label"/>
|
74
|
+
</optional>
|
75
|
+
<zeroOrMore>
|
76
|
+
<ref name="subject"/>
|
77
|
+
</zeroOrMore>
|
78
|
+
<zeroOrMore>
|
79
|
+
<ref name="reqinherit"/>
|
80
|
+
</zeroOrMore>
|
54
81
|
<zeroOrMore>
|
55
82
|
<ref name="classification"/>
|
56
83
|
</zeroOrMore>
|
@@ -61,6 +88,7 @@
|
|
61
88
|
<ref name="verification"/>
|
62
89
|
<ref name="import"/>
|
63
90
|
<ref name="description"/>
|
91
|
+
<ref name="component"/>
|
64
92
|
</choice>
|
65
93
|
</zeroOrMore>
|
66
94
|
<optional>
|
@@ -81,17 +109,23 @@
|
|
81
109
|
</define>
|
82
110
|
<define name="label">
|
83
111
|
<element name="label">
|
84
|
-
<
|
112
|
+
<oneOrMore>
|
113
|
+
<ref name="TextElement"/>
|
114
|
+
</oneOrMore>
|
85
115
|
</element>
|
86
116
|
</define>
|
87
117
|
<define name="subject">
|
88
118
|
<element name="subject">
|
89
|
-
<
|
119
|
+
<oneOrMore>
|
120
|
+
<ref name="TextElement"/>
|
121
|
+
</oneOrMore>
|
90
122
|
</element>
|
91
123
|
</define>
|
92
124
|
<define name="reqinherit">
|
93
125
|
<element name="inherit">
|
94
|
-
<
|
126
|
+
<oneOrMore>
|
127
|
+
<ref name="TextElement"/>
|
128
|
+
</oneOrMore>
|
95
129
|
</element>
|
96
130
|
</define>
|
97
131
|
<define name="measurementtarget">
|
@@ -119,6 +153,12 @@
|
|
119
153
|
<ref name="RequirementSubpart"/>
|
120
154
|
</element>
|
121
155
|
</define>
|
156
|
+
<define name="component">
|
157
|
+
<element name="component">
|
158
|
+
<attribute name="class"/>
|
159
|
+
<ref name="RequirementSubpart"/>
|
160
|
+
</element>
|
161
|
+
</define>
|
122
162
|
<define name="reqt_references">
|
123
163
|
<element name="references">
|
124
164
|
<oneOrMore>
|
@@ -135,6 +175,24 @@
|
|
135
175
|
<data type="boolean"/>
|
136
176
|
</attribute>
|
137
177
|
</optional>
|
178
|
+
<optional>
|
179
|
+
<attribute name="keep-with-next">
|
180
|
+
<data type="boolean"/>
|
181
|
+
</attribute>
|
182
|
+
</optional>
|
183
|
+
<optional>
|
184
|
+
<attribute name="keep-lines-together">
|
185
|
+
<data type="boolean"/>
|
186
|
+
</attribute>
|
187
|
+
</optional>
|
188
|
+
<optional>
|
189
|
+
<attribute name="tag"/>
|
190
|
+
</optional>
|
191
|
+
<optional>
|
192
|
+
<attribute name="multilingual-rendering">
|
193
|
+
<ref name="MultilingualRenderingType"/>
|
194
|
+
</attribute>
|
195
|
+
</optional>
|
138
196
|
<oneOrMore>
|
139
197
|
<ref name="BasicBlock"/>
|
140
198
|
</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) ?
|
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) ?
|
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) ?
|
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
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
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
|