metanorma-iec 1.2.0 → 1.2.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  module Metanorma
2
2
  module Iec
3
- VERSION = "1.2.0"
3
+ VERSION = "1.2.6"
4
4
  end
5
5
  end
6
6
 
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
29
29
 
30
30
  spec.add_dependency "ruby-jing"
31
31
  spec.add_dependency "isodoc", "~> 1.2.0"
32
- spec.add_dependency "metanorma-iso", "~> 1.5.0"
32
+ spec.add_dependency "metanorma-iso", "~> 1.5.10"
33
33
 
34
34
  spec.add_development_dependency "byebug"
35
35
  spec.add_development_dependency "sassc", "2.4.0"
@@ -89,7 +89,7 @@ RSpec.describe Asciidoctor::Iec do
89
89
  :library-ics: 1,2,3
90
90
  INPUT
91
91
  <?xml version="1.0" encoding="UTF-8"?>
92
- <iec-standard xmlns="https://www.metanorma.org/ns/iec">
92
+ <iec-standard xmlns="https://www.metanorma.org/ns/iec" type="semantic" version="#{Metanorma::Iec::VERSION}">
93
93
  <bibdata type="standard">
94
94
  <title language="en" format="text/plain" type="main">Introduction — Main Title — Title — Title Part</title>
95
95
  <title language="en" format="text/plain" type="title-intro">Introduction</title>
@@ -188,7 +188,7 @@ RSpec.describe Asciidoctor::Iec do
188
188
  :doctype: technical-specification
189
189
  INPUT
190
190
  <?xml version="1.0" encoding="UTF-8"?>
191
- <iec-standard xmlns="https://www.metanorma.org/ns/iec">
191
+ <iec-standard xmlns="https://www.metanorma.org/ns/iec" type="semantic" version="#{Metanorma::Iec::VERSION}">
192
192
  <bibdata type="standard">
193
193
  <docidentifier type="ISO">ISO/IEC/IETF/2CDTS 1000-1-1 ED 1</docidentifier>
194
194
  <docidentifier type="iso-tc">2000</docidentifier>
@@ -336,7 +336,7 @@ RSpec.describe Asciidoctor::Iec do
336
336
  :docnumber: 1000
337
337
  :docstage: 50
338
338
  INPUT
339
- <iec-standard xmlns="https://www.metanorma.org/ns/iec">
339
+ <iec-standard xmlns="https://www.metanorma.org/ns/iec" type="semantic" version="#{Metanorma::Iec::VERSION}">
340
340
  <bibdata type="standard">
341
341
  <docidentifier type="ISO">IEC/FDIS 1000 ED 1</docidentifier>
342
342
  <docnumber>1000</docnumber>
@@ -400,7 +400,7 @@ OUTPUT
400
400
  :docnumber: 1000
401
401
  :docstage: 60
402
402
  INPUT
403
- <iec-standard xmlns="https://www.metanorma.org/ns/iec">
403
+ <iec-standard xmlns="https://www.metanorma.org/ns/iec" type="semantic" version="#{Metanorma::Iec::VERSION}">
404
404
  <bibdata type="standard">
405
405
  <docidentifier type="ISO">IEC 1000 ED 1</docidentifier>
406
406
  <docnumber>1000</docnumber>
@@ -465,7 +465,7 @@ OUTPUT
465
465
  :docstage: 60
466
466
  :docsubstage: 00
467
467
  INPUT
468
- <iec-standard xmlns="https://www.metanorma.org/ns/iec">
468
+ <iec-standard xmlns="https://www.metanorma.org/ns/iec" type="semantic" version="#{Metanorma::Iec::VERSION}">
469
469
  <bibdata type="standard">
470
470
  <docidentifier type="ISO">IEC 1000 ED 1</docidentifier>
471
471
  <docnumber>1000</docnumber>
@@ -34,7 +34,19 @@ RSpec.describe Asciidoctor::Iec do
34
34
  <p id="_">For the purposes of this document,
35
35
  the following terms and definitions apply.</p>
36
36
  #{TERMS_BOILERPLATE}
37
- <term id="term-t90"><preferred><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>t</mi><mn>90</mn></msub></math></stem></preferred><admitted><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>t</mi><mn>91</mn></msub></math></stem></admitted>
37
+ <term id="term-t90"><preferred><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mrow>
38
+ <mi>t</mi>
39
+ </mrow>
40
+ <mrow>
41
+ <mn>90</mn>
42
+ </mrow>
43
+ </msub></math></stem></preferred><admitted><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mrow>
44
+ <mi>t</mi>
45
+ </mrow>
46
+ <mrow>
47
+ <mn>91</mn>
48
+ </mrow>
49
+ </msub></math></stem></admitted>
38
50
  <definition><p id="_">Time</p></definition></term>
39
51
  </terms>
40
52
  </sections>
@@ -70,8 +82,20 @@ RSpec.describe Asciidoctor::Iec do
70
82
  <p id="_">For the purposes of this document,
71
83
  the following terms and definitions apply.</p>
72
84
  #{TERMS_BOILERPLATE}
73
- <term id="term-t90"><preferred><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>t</mi><mn>90</mn></msub></math></stem></preferred><definition><formula id="_">
74
- <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>t</mi><mi>A</mi></msub></math></stem>
85
+ <term id="term-t90"><preferred><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mrow>
86
+ <mi>t</mi>
87
+ </mrow>
88
+ <mrow>
89
+ <mn>90</mn>
90
+ </mrow>
91
+ </msub></math></stem></preferred><definition><formula id="_">
92
+ <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mrow>
93
+ <mi>t</mi>
94
+ </mrow>
95
+ <mrow>
96
+ <mi>A</mi>
97
+ </mrow>
98
+ </msub></math></stem>
75
99
  </formula><p id="_">This paragraph is extraneous</p></definition>
76
100
  </term>
77
101
  </terms>
@@ -257,9 +281,9 @@ RSpec.describe Asciidoctor::Iec do
257
281
  <sections><table id="_">
258
282
  <tbody>
259
283
  <tr>
260
- <td align="left">a</td>
261
- <td align="left">b</td>
262
- <td align="left">c</td>
284
+ <td valign="top" align="left">a</td>
285
+ <td valign="top" align="left">b</td>
286
+ <td valign="top" align="left">c</td>
263
287
  </tr>
264
288
  </tbody>
265
289
  <dl id="_">
@@ -18,7 +18,7 @@ RSpec.describe Asciidoctor::Iec do
18
18
  * [[[A,B]]], _TITLE_
19
19
  INPUT
20
20
  <?xml version='1.0' encoding='UTF-8'?>
21
- <iec-standard xmlns='https://www.metanorma.org/ns/iec'>
21
+ <iec-standard xmlns='https://www.metanorma.org/ns/iec' type="semantic" version="#{Metanorma::Iec::VERSION}">
22
22
  <bibdata type='standard'>
23
23
  <docidentifier type='ISO'>IEC 60050 ED 1</docidentifier>
24
24
  <docnumber>60050</docnumber>
@@ -96,7 +96,7 @@ RSpec.describe Asciidoctor::Iec do
96
96
  === General
97
97
  ==== Term 1
98
98
  INPUT
99
- <iec-standard xmlns='https://www.metanorma.org/ns/iec'>
99
+ <iec-standard xmlns='https://www.metanorma.org/ns/iec' type="semantic" version="#{Metanorma::Iec::VERSION}">
100
100
  <bibdata type='standard'>
101
101
  <docidentifier type='ISO'>IEC 60050 ED 1</docidentifier>
102
102
  <docnumber>60050</docnumber>
@@ -174,7 +174,7 @@ OUTPUT
174
174
  Text
175
175
  INPUT
176
176
  <?xml version='1.0' encoding='UTF-8'?>
177
- <iec-standard xmlns='https://www.metanorma.org/ns/iec'>
177
+ <iec-standard xmlns='https://www.metanorma.org/ns/iec' type="semantic" version="#{Metanorma::Iec::VERSION}">
178
178
  <bibdata type='standard'>
179
179
  <docidentifier type='ISO'>IEC 60050 ED 1</docidentifier>
180
180
  <docnumber>60050</docnumber>
@@ -28,7 +28,13 @@ RSpec.describe Asciidoctor::Iec do
28
28
  ‘single quote’
29
29
  super<sup>script</sup>
30
30
  sub<sub>script</sub>
31
- <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>a</mi><mn>90</mn></msub></math></stem>
31
+ <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mrow>
32
+ <mi>a</mi>
33
+ </mrow>
34
+ <mrow>
35
+ <mn>90</mn>
36
+ </mrow>
37
+ </msub></math></stem>
32
38
  <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub> <mrow> <mrow> <mi mathvariant="bold-italic">F</mi> </mrow> </mrow> <mrow> <mrow> <mi mathvariant="bold-italic">Α</mi> </mrow> </mrow> </msub> </math></stem>
33
39
  <admitted>alt</admitted>
34
40
  <deprecates>deprecated</deprecates>
@@ -2,10 +2,30 @@ require "spec_helper"
2
2
  require "fileutils"
3
3
 
4
4
  RSpec.describe Asciidoctor::Iec do
5
+ context "when xref_error.adoc compilation" do
6
+ around do |example|
7
+ FileUtils.rm_f "spec/assets/xref_error.err"
8
+ example.run
9
+ Dir["spec/assets/xref_error*"].each do |file|
10
+ next if file.match?(/adoc$/)
11
+
12
+ FileUtils.rm_f(file)
13
+ end
14
+ end
15
+
16
+ it "generates error file" do
17
+ expect do
18
+ Metanorma::Compile
19
+ .new
20
+ .compile("spec/assets/xref_error.adoc", type: "iec")
21
+ end.to(change { File.exist?("spec/assets/xref_error.err") }
22
+ .from(false).to(true))
23
+ end
24
+ end
5
25
 
6
26
  it "Warns of illegal doctype" do
7
27
  FileUtils.rm_f "test.err"
8
- Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)
28
+ Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)
9
29
  = Document title
10
30
  Author
11
31
  :docfile: test.adoc
@@ -0,0 +1,7 @@
1
+ = X
2
+ A
3
+
4
+ == Clause
5
+
6
+ <<a,b>>
7
+
@@ -177,7 +177,7 @@ RSpec.describe IsoDoc::Iec do
177
177
  </sections>
178
178
  </iso-standard>
179
179
  INPUT
180
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
180
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
181
181
  <preface>
182
182
  <foreword>
183
183
  <p>
@@ -73,11 +73,15 @@ RSpec.describe IsoDoc do
73
73
  INPUT
74
74
 
75
75
  presxml = <<~OUTPUT
76
- <iso-standard xmlns="http://riboseinc.com/isoxml">
76
+ <iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
77
77
  <bibdata>
78
78
  <docnumber>1</docnumber>
79
79
  <language>en</language>
80
80
  </bibdata>
81
+ <local_bibdata>
82
+ <docnumber>1</docnumber>
83
+ <language>en</language>
84
+ </local_bibdata>
81
85
  <preface>
82
86
  <foreword obligation="informative">
83
87
  <title>Foreword</title>
@@ -289,10 +293,13 @@ RSpec.describe IsoDoc do
289
293
  </bibliography>
290
294
  </iso-standard>
291
295
  INPUT
292
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
296
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
293
297
  <bibdata>
294
298
  <language>tlh</language>
295
299
  </bibdata>
300
+ <local_bibdata>
301
+ <language>tlh</language>
302
+ </local_bibdata>
296
303
  <preface>
297
304
  <foreword obligation='informative'>
298
305
  <title>Foreword</title>
@@ -498,10 +505,13 @@ RSpec.describe IsoDoc do
498
505
  INPUT
499
506
 
500
507
  presxml = <<~OUTPUT
501
- <iso-standard xmlns="http://riboseinc.com/isoxml">
508
+ <iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
502
509
  <bibdata>
503
510
  <language>fr</language>
504
511
  </bibdata>
512
+ <local_bibdata>
513
+ <language>fr</language>
514
+ </local_bibdata>
505
515
  <preface>
506
516
  <foreword obligation="informative">
507
517
  <title>Foreword</title>
@@ -22,11 +22,15 @@ RSpec.describe IsoDoc do
22
22
  INPUT
23
23
 
24
24
  presxml = <<~OUTPUT
25
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
25
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
26
26
  <bibdata>
27
27
  <docidentifier type='iso'>IEC/PWI 60050-871 ED 2</docidentifier>
28
28
  <docnumber>60050</docnumber>
29
29
  </bibdata>
30
+ <local_bibdata>
31
+ <docidentifier type='iso'>IEC/PWI 60050-871 ED 2</docidentifier>
32
+ <docnumber>60050</docnumber>
33
+ </local_bibdata>
30
34
  <preface>
31
35
  <foreword obligation='informative'>
32
36
  <title>Foreword</title>
@@ -142,7 +146,7 @@ OUTPUT
142
146
  </iec-standard>
143
147
  INPUT
144
148
  presxml = <<~OUTPUT
145
- <iec-standard xmlns='https://www.metanorma.org/ns/iec'>
149
+ <iec-standard xmlns='https://www.metanorma.org/ns/iec' type="presentation">
146
150
  <bibdata type='standard'>
147
151
  <docidentifier type='iso'>IEC 60050 ED 1</docidentifier>
148
152
  <docnumber>60050</docnumber>
@@ -187,6 +191,50 @@ OUTPUT
187
191
  </structuredidentifier>
188
192
  </ext>
189
193
  </bibdata>
194
+ <local_bibdata type='standard'>
195
+ <docidentifier type='iso'>IEC 60050 ED 1</docidentifier>
196
+ <docnumber>60050</docnumber>
197
+ <contributor>
198
+ <role type='author'/>
199
+ <organization>
200
+ <name>International Electrotechnical Commission</name>
201
+ <abbreviation>IEC</abbreviation>
202
+ </organization>
203
+ </contributor>
204
+ <contributor>
205
+ <role type='publisher'/>
206
+ <organization>
207
+ <name>International Electrotechnical Commission</name>
208
+ <abbreviation>IEC</abbreviation>
209
+ </organization>
210
+ </contributor>
211
+ <language>en</language>
212
+ <script>Latn</script>
213
+ <status>
214
+ <stage>60</stage>
215
+ <substage>60</substage>
216
+ </status>
217
+ <copyright>
218
+ <from>2020</from>
219
+ <owner>
220
+ <organization>
221
+ <name>International Electrotechnical Commission</name>
222
+ <abbreviation>IEC</abbreviation>
223
+ </organization>
224
+ </owner>
225
+ </copyright>
226
+ <ext>
227
+ <doctype>article</doctype>
228
+ <editorialgroup>
229
+ <technical-committee/>
230
+ <subcommittee/>
231
+ <workgroup/>
232
+ </editorialgroup>
233
+ <structuredidentifier>
234
+ <project-number>IEC 60050</project-number>
235
+ </structuredidentifier>
236
+ </ext>
237
+ </local_bibdata>
190
238
  <sections> </sections>
191
239
  <bibliography>
192
240
  <references obligation='informative' normative='true' id="X">
@@ -222,10 +270,6 @@ OUTPUT
222
270
  <div>
223
271
  <h1>1&#160; Normative References</h1>
224
272
  <p id='_'>There are no normative references in this document.</p>
225
- <p id='A' class='NormRef'>
226
- B,
227
- <i>TITLE</i>
228
- </p>
229
273
  </div>
230
274
  </div>
231
275
  </body>
@@ -294,11 +338,15 @@ OUTPUT
294
338
  INPUT
295
339
 
296
340
  presxml = <<~INPUT
297
- <iso-standard xmlns="http://riboseinc.com/isoxml">
341
+ <iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
298
342
  <bibdata type='standard'>
299
343
  <docidentifier type='ISO'>IEC 60050-192 ED 1</docidentifier>
300
344
  <docnumber>60050</docnumber>
301
345
  </bibdata>
346
+ <local_bibdata type='standard'>
347
+ <docidentifier type='ISO'>IEC 60050-192 ED 1</docidentifier>
348
+ <docnumber>60050</docnumber>
349
+ </local_bibdata>
302
350
  <sections>
303
351
  <clause id="_terms_and_definitions" obligation="normative"><title depth="1">1<tab/>Terms and definitions</title>
304
352
  <terms id="_general" obligation="normative"><title>192-01 General</title>
@@ -477,11 +525,15 @@ end
477
525
  </iso-standard>
478
526
  INPUT
479
527
  presxml = <<~OUTPUT
480
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
528
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
481
529
  <bibdata type='standard'>
482
530
  <docidentifier type='ISO'>IEC 60050-192 ED 1</docidentifier>
483
531
  <docnumber>60050</docnumber>
484
532
  </bibdata>
533
+ <local_bibdata type='standard'>
534
+ <docidentifier type='ISO'>IEC 60050-192 ED 1</docidentifier>
535
+ <docnumber>60050</docnumber>
536
+ </local_bibdata>
485
537
  <sections>
486
538
  <clause id='_terms_and_definitions' obligation='normative'>
487
539
  <title depth='1'>1<tab/>Terms and definitions</title>
@@ -185,7 +185,7 @@ expect(xmlpp(IsoDoc::Iec::PresentationXMLConvert.new({}).convert("test", <<~"INP
185
185
  </iso-standard>
186
186
  INPUT
187
187
  <?xml version='1.0'?>
188
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
188
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
189
189
  <preface>
190
190
  <foreword>
191
191
  <p>
@@ -7,7 +7,7 @@ RSpec.describe IsoDoc::Iec::Metadata do
7
7
  arr = c.convert_init(<<~"INPUT", "test", false)
8
8
  <iec-standard xmlns="http://riboseinc.com/isoxml">
9
9
  INPUT
10
- expect(Hash[c.info(Nokogiri::XML(<<~"INPUT"), nil).sort].to_s.gsub(/, :/, ",\n:")).to be_equivalent_to <<~"OUTPUT"
10
+ expect(metadata(c.info(Nokogiri::XML(<<~"INPUT"), nil)).to_s.gsub(/, :/, ",\n:")).to be_equivalent_to <<~"OUTPUT"
11
11
  <iso-standard xmlns="http://riboseinc.com/isoxml">
12
12
  <bibdata type="standard">
13
13
  <title type="title-intro" language="en" format="text/plain">Cereals and pulses</title>
@@ -76,12 +76,8 @@ INPUT
76
76
  {:accesseddate=>"2012",
77
77
  :activateddate=>"2013",
78
78
  :agency=>"ISO",
79
- :authors=>[],
80
- :authors_affiliations=>{},
81
79
  :createddate=>"2010&ndash;2011",
82
80
  :docnumber=>"ISO/PreCD3 17301-1",
83
- :docnumber_lang=>nil,
84
- :docnumber_reference=>nil,
85
81
  :docnumeric=>"1730",
86
82
  :docsubtitle=>"C&#xe9;r&#xe9;ales et l&#xe9;gumineuses&nbsp;&mdash; Sp&#xe9;cification et m&#xe9;thodes d&#x27;essai&nbsp;&mdash; Partie&nbsp;1: Riz",
87
83
  :docsubtitleintro=>"C&#xe9;r&#xe9;ales et l&#xe9;gumineuses",
@@ -99,11 +95,7 @@ INPUT
99
95
  :draftinfo=>" (draft 0.4, 2016-05-01)",
100
96
  :edition=>"2",
101
97
  :editorialgroup=>["TC 34", "SC 4", "WG 3"],
102
- :ics=>nil,
103
- :keywords=>[],
104
98
  :obsoleteddate=>"2014",
105
- :obsoletes=>nil,
106
- :obsoletes_part=>nil,
107
99
  :publisheddate=>"2011",
108
100
  :publisher=>"International Organization for Standardization",
109
101
  :revdate=>"2016-05-01",
@@ -126,7 +118,7 @@ OUTPUT
126
118
  arr = c.convert_init(<<~"INPUT", "test", false)
127
119
  <iso-standard xmlns="http://riboseinc.com/isoxml">
128
120
  INPUT
129
- expect(Hash[c.info(Nokogiri::XML(<<~"INPUT"), nil).sort].to_s.gsub(/, :/, ",\n:")).to be_equivalent_to <<~"OUTPUT"
121
+ expect(metadata(c.info(Nokogiri::XML(<<~"INPUT"), nil)).to_s.gsub(/, :/, ",\n:")).to be_equivalent_to <<~"OUTPUT"
130
122
  <iso-standard xmlns="http://riboseinc.com/isoxml">
131
123
  <bibdata type="standard">
132
124
  <title>
@@ -197,12 +189,7 @@ OUTPUT
197
189
  </iso-standard>
198
190
  INPUT
199
191
  {:agency=>"ISO/IEC",
200
- :authors=>[],
201
- :authors_affiliations=>{},
202
192
  :docnumber=>"ISO/IEC/CD 17301-1-3",
203
- :docnumber_lang=>nil,
204
- :docnumber_reference=>nil,
205
- :docnumeric=>nil,
206
193
  :docsubtitle=>"C&#xe9;r&#xe9;ales et l&#xe9;gumineuses&nbsp;&mdash; Sp&#xe9;cification et m&#xe9;thodes d&#x27;essai&nbsp;&mdash; Partie&nbsp;1&ndash;3: Riz",
207
194
  :docsubtitleintro=>"C&#xe9;r&#xe9;ales et l&#xe9;gumineuses",
208
195
  :docsubtitlemain=>"Sp&#xe9;cification et m&#xe9;thodes d&#x27;essai",
@@ -215,17 +202,11 @@ INPUT
215
202
  :doctitlepartlabel=>"Part&nbsp;1&ndash;3",
216
203
  :doctype=>"Technical Report",
217
204
  :docyear=>"2016",
218
- :draft=>nil,
219
- :draftinfo=>"",
220
- :edition=>nil,
221
205
  :editorialgroup=>["ABC 34", "DEF 4", "GHI 3"],
222
206
  :ics=>"1.2.3, 1.2.3",
223
- :keywords=>[],
224
207
  :obsoletes=>"IEC 8121",
225
208
  :obsoletes_part=>"3.1",
226
209
  :publisher=>"International Organization for Standardization and International Electrotechnical Commission",
227
- :revdate=>nil,
228
- :revdate_monthyear=>nil,
229
210
  :sc=>"DEF 4",
230
211
  :secretariat=>"XXXX",
231
212
  :stage=>"50",