relaton-iec 1.7.6 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +36 -0
- data/.rubocop.yml +1 -1
- data/README.adoc +25 -0
- data/grammars/basicdoc.rng +165 -20
- data/grammars/biblio.rng +5 -6
- data/grammars/iec.rng +96 -1
- data/grammars/isodoc.rng +532 -16
- data/grammars/isostandard.rng +56 -103
- 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/hash_converter.rb +1 -1
- data/lib/relaton_iec/hit_collection.rb +1 -1
- data/lib/relaton_iec/iec_bibliographic_item.rb +93 -1
- data/lib/relaton_iec/iec_bibliography.rb +6 -5
- data/lib/relaton_iec/processor.rb +1 -2
- data/lib/relaton_iec/scrapper.rb +10 -13
- 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 +21 -1
- data/relaton_iec.gemspec +2 -4
- metadata +25 -37
- data/.github/workflows/macos.yml +0 -34
- data/.github/workflows/ubuntu.yml +0 -33
- data/.github/workflows/windows.yml +0 -35
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,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
|
-
<
|
145
|
-
<
|
146
|
-
<
|
147
|
-
|
148
|
-
|
149
|
-
<
|
150
|
-
|
151
|
-
|
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
|
-
<
|
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
|