relaton-iec 1.7.8 → 1.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.adoc +12 -0
- data/grammars/basicdoc.rng +165 -20
- data/grammars/biblio.rng +4 -6
- data/grammars/iec.rng +92 -1
- data/grammars/isodoc.rng +460 -6
- data/grammars/isostandard.rng +42 -104
- data/grammars/reqt.rng +31 -2
- data/lib/relaton_iec/basic_block/alignment.rb +30 -0
- data/lib/relaton_iec/basic_block/basic_block.rb +15 -0
- data/lib/relaton_iec/basic_block/citation_type.rb +32 -0
- data/lib/relaton_iec/basic_block/dl.rb +60 -0
- data/lib/relaton_iec/basic_block/eref.rb +10 -0
- data/lib/relaton_iec/basic_block/eref_type.rb +39 -0
- data/lib/relaton_iec/basic_block/formula.rb +34 -0
- data/lib/relaton_iec/basic_block/image.rb +41 -0
- data/lib/relaton_iec/basic_block/index.rb +27 -0
- data/lib/relaton_iec/basic_block/index_xref.rb +31 -0
- data/lib/relaton_iec/basic_block/note.rb +21 -0
- data/lib/relaton_iec/basic_block/paragraph.rb +27 -0
- data/lib/relaton_iec/basic_block/paragraph_with_footnote.rb +29 -0
- data/lib/relaton_iec/basic_block/reference_format.rb +38 -0
- data/lib/relaton_iec/basic_block/stem.rb +30 -0
- data/lib/relaton_iec/basic_block/table.rb +115 -0
- data/lib/relaton_iec/basic_block/text_element.rb +27 -0
- data/lib/relaton_iec/hit_collection.rb +1 -1
- data/lib/relaton_iec/iec_bibliographic_item.rb +85 -0
- data/lib/relaton_iec/tc_sc_officers_note.rb +24 -0
- data/lib/relaton_iec/version.rb +1 -1
- data/lib/relaton_iec/xml_parser.rb +20 -0
- data/relaton_iec.gemspec +1 -1
- metadata +22 -4
data/grammars/isostandard.rng
CHANGED
@@ -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
|
-
<
|
144
|
-
<
|
145
|
-
<
|
146
|
-
<
|
147
|
-
|
148
|
-
|
149
|
-
<
|
150
|
-
|
151
|
-
|
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
|
-
</
|
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
|
-
<
|
70
|
+
<zeroOrMore>
|
52
71
|
<ref name="reqinherit"/>
|
53
|
-
</
|
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>
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module BasicBlock
|
2
|
+
class Alignment
|
3
|
+
ALIGNS = %w[left right center justified].freeze
|
4
|
+
|
5
|
+
#
|
6
|
+
# @param [String] content
|
7
|
+
#
|
8
|
+
def initialize(content)
|
9
|
+
unless ALIGNS.include?(content)
|
10
|
+
warn "[basic-block] WARNING: invalid alignment \"#{content}\""
|
11
|
+
warn "[basic-block] alloved aligments are: #{ALIGNS.join ', '}"
|
12
|
+
end
|
13
|
+
@content = content
|
14
|
+
end
|
15
|
+
|
16
|
+
#
|
17
|
+
# @return [String]
|
18
|
+
#
|
19
|
+
def to_s
|
20
|
+
@content
|
21
|
+
end
|
22
|
+
|
23
|
+
#
|
24
|
+
# @return [String]
|
25
|
+
#
|
26
|
+
def inspect
|
27
|
+
to_s
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require_relative "alignment"
|
2
|
+
require_relative "citation_type"
|
3
|
+
require_relative "dl"
|
4
|
+
require_relative "eref_type"
|
5
|
+
require_relative "eref"
|
6
|
+
require_relative "formula"
|
7
|
+
require_relative "image"
|
8
|
+
require_relative "index_xref"
|
9
|
+
require_relative "index"
|
10
|
+
require_relative "note"
|
11
|
+
require_relative "paragraph_with_footnote"
|
12
|
+
require_relative "paragraph"
|
13
|
+
require_relative "reference_format"
|
14
|
+
require_relative "stem"
|
15
|
+
require_relative "text_element"
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module RelatonIec
|
2
|
+
class CitationType
|
3
|
+
# @return [String]
|
4
|
+
attr_reader :bibitemid
|
5
|
+
|
6
|
+
# @return [Array<elatonBib::Locality, RelatonBib::LocalityStack>]
|
7
|
+
attr_reader :locality
|
8
|
+
|
9
|
+
# @return [String, nil]
|
10
|
+
attr_reader :date
|
11
|
+
|
12
|
+
#
|
13
|
+
# @param [String] bibitemid
|
14
|
+
# @param [Array<RelatonBib::Locality, RelatonBib::LocalityStack>] locality
|
15
|
+
# @param [String, nil] date
|
16
|
+
#
|
17
|
+
def initialize(bibitemid:, locality:, date: nil)
|
18
|
+
@bibitemid = bibitemid
|
19
|
+
@locality = locality
|
20
|
+
@date = date
|
21
|
+
end
|
22
|
+
|
23
|
+
#
|
24
|
+
# @param [Nokogiri::XML::Builder] builder
|
25
|
+
#
|
26
|
+
def to_xml(builder)
|
27
|
+
builder.parent[:bibitemid] = bibitemid
|
28
|
+
locality.each { |l| l.to_xml builder }
|
29
|
+
builder.date date if date
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
module BasicBlock
|
2
|
+
class Dl
|
3
|
+
#
|
4
|
+
# @param [String] id
|
5
|
+
# @param [Array<BasicBlock::Dl::Dt, BasicBlock::Dl::Dd>] content
|
6
|
+
# @param [Array<BasicBlock::Note>] note
|
7
|
+
#
|
8
|
+
def initialize(id:, content:, note:)
|
9
|
+
@id = id
|
10
|
+
@content = content
|
11
|
+
@note = note
|
12
|
+
end
|
13
|
+
|
14
|
+
#
|
15
|
+
# @param [Nokogiri::XML::Builder] builder
|
16
|
+
#
|
17
|
+
def to_xml(builder)
|
18
|
+
builder.dl id: @id do |b|
|
19
|
+
@content.each { |c| c.to_xml b }
|
20
|
+
@note.each { |n| n.to_xml b }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
class Dt
|
25
|
+
#
|
26
|
+
# @param [Array<BasicBlock::TextElement>] content
|
27
|
+
#
|
28
|
+
def initialize(content)
|
29
|
+
@content = content
|
30
|
+
end
|
31
|
+
|
32
|
+
#
|
33
|
+
# @param [Nokogiri::XML::Builder] builder
|
34
|
+
#
|
35
|
+
def to_xml(builder)
|
36
|
+
builder.dt do |b|
|
37
|
+
@content.each { |c| c.to_xml b }
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
class Dd
|
43
|
+
#
|
44
|
+
# @param [Array<BasicBlock::ParagraphWithFootnote>] content
|
45
|
+
#
|
46
|
+
def initialize(content)
|
47
|
+
@content = content
|
48
|
+
end
|
49
|
+
|
50
|
+
#
|
51
|
+
# @param [Nokogiri::XML::Builder] builder
|
52
|
+
#
|
53
|
+
def to_xml(builder)
|
54
|
+
builder.dd do |b|
|
55
|
+
@content.each { |c| c.to_xml b }
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module RelatonIec
|
2
|
+
class ErefType < RelatonIec::CitationType
|
3
|
+
# @return [String]
|
4
|
+
attr_reader :citeas
|
5
|
+
|
6
|
+
# @return [RelatonIec::ReferenceFormat]
|
7
|
+
attr_reader :type
|
8
|
+
|
9
|
+
# @return [Boolean, nil]
|
10
|
+
attr_reader :normative
|
11
|
+
|
12
|
+
# @return [String, nil]
|
13
|
+
attr_reader :alt
|
14
|
+
|
15
|
+
# @param [String] citeas
|
16
|
+
# @param [RelatonIec::ReferenceFormat] type
|
17
|
+
# @param [Hash] args
|
18
|
+
# @option args [Boolean, nil] :normative
|
19
|
+
# @option args [String, nil] :alt
|
20
|
+
def initialize(citeas:, type:, bibitemid:, locality:, **args)
|
21
|
+
super bibitemid, locality, args[:date]
|
22
|
+
@citeas = citeas
|
23
|
+
@type = type
|
24
|
+
@normative = args[:normative]
|
25
|
+
@alt = args[:alt]
|
26
|
+
end
|
27
|
+
|
28
|
+
#
|
29
|
+
# @param [Nokogiri::XML::Builder] builder <description>
|
30
|
+
#
|
31
|
+
def to_xml(builder) # rubocop:disable Metrics/AbcSize
|
32
|
+
builder.parent[:normative] = normative unless normative.nil?
|
33
|
+
builder.parent[:citeas] = citeas
|
34
|
+
builder.parent[:type] = type
|
35
|
+
builder.parent[:alt] = alt if alt
|
36
|
+
super
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|