relaton-iec 1.7.7 → 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/README.adoc +36 -0
- data/grammars/basicdoc.rng +191 -27
- data/grammars/biblio.rng +7 -8
- data/grammars/iec.rng +144 -1
- data/grammars/isodoc.rng +1156 -112
- data/grammars/isostandard.rng +69 -115
- data/grammars/reqt.rng +65 -7
- 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 +93 -1
- data/lib/relaton_iec/processor.rb +1 -2
- 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 +2 -4
- metadata +23 -5
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>
|
@@ -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
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module BasicBlock
|
2
|
+
class Formula
|
3
|
+
#
|
4
|
+
# @param [String] id
|
5
|
+
# @param [BasicBlock::Stem] content
|
6
|
+
# @param [Array<BasicBlock::Note>] note
|
7
|
+
# @param [Hash] args
|
8
|
+
# @option args [Boolean, nil] :unnumbered
|
9
|
+
# @option args [String, nil] :subsequence
|
10
|
+
# @option args [Boolean, nil] :inequality
|
11
|
+
# @option args [BasicBlock::Dl, nil] :dl
|
12
|
+
#
|
13
|
+
def initialize(id:, content:, note:, **args)
|
14
|
+
@id = id
|
15
|
+
@content = content
|
16
|
+
@note = note
|
17
|
+
@unnumbered = args[:unnumbered]
|
18
|
+
end
|
19
|
+
|
20
|
+
#
|
21
|
+
# @param [Builder] builder
|
22
|
+
#
|
23
|
+
def to_xml(builder) # rubocop:disable Metrics/CyclomaticComplexity
|
24
|
+
f = builder.formula id: @id do |b|
|
25
|
+
@content.to_xml b
|
26
|
+
@dl&.each { |d| d.to_xml b }
|
27
|
+
@note.each { |n| n.to_xml b }
|
28
|
+
end
|
29
|
+
f[:unnumbered] = @unnumbered if @unnumbered
|
30
|
+
f[:subsequence] = @subsequence if @subsequence
|
31
|
+
f[:inequality] = @inequality if @ineainequality
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module BasicBlock
|
2
|
+
class Image
|
3
|
+
#
|
4
|
+
# @param [String] id
|
5
|
+
# @param [String] src
|
6
|
+
# @param [String] mimetype
|
7
|
+
# @param [Hash] args
|
8
|
+
# @option args [String] :filename
|
9
|
+
#
|
10
|
+
def initialize(id:, src:, mimetype:, **args) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength
|
11
|
+
@id = id
|
12
|
+
@src = src
|
13
|
+
@mimetype = mimetype
|
14
|
+
@filename = args[:filename]
|
15
|
+
if args[:width] && !args[:width].is_a?(Integer) && args[:width] != "auto"
|
16
|
+
warn "[basic-block] WARNING: invalid image width attribute \"#{args[:width]}"
|
17
|
+
warn "[basic-block] image width should be integer or \"auto\""
|
18
|
+
end
|
19
|
+
if args[:height] && !args[:height].is_a?(Integer) && args[:height] != "auto"
|
20
|
+
warn "[basic-block] WARNING: invalid image height attribute \"#{args[:height]}"
|
21
|
+
warn "[basic-block] image height should be integer or \"auto\""
|
22
|
+
end
|
23
|
+
@width = args[:width]
|
24
|
+
@height = args[:height]
|
25
|
+
@alt = args[:alt]
|
26
|
+
@title = args[:title]
|
27
|
+
@longdesc = args[:longdesc]
|
28
|
+
end
|
29
|
+
|
30
|
+
# @param [Nokogiri::XML::Builder]
|
31
|
+
def to_xml(builder) # rubocop:disable Metrics/CyclomaticComplexity
|
32
|
+
img = builder.image id: @id, src: @src, mimetype: @mimetype
|
33
|
+
img[:filename] = @filename if @filename
|
34
|
+
img[:width] = @width if @width
|
35
|
+
img[:height] = @height if @height
|
36
|
+
img[:alt] = @alt if @alt
|
37
|
+
img[:title] = @title if @title
|
38
|
+
img[:longdesc] = @longdesc if @longdesc
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|