metanorma-iec 1.4.2 → 1.4.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,14 +2,12 @@ require "spec_helper"
2
2
  require "fileutils"
3
3
 
4
4
  RSpec.describe Asciidoctor::Iec do
5
- before(:all) do
6
- @boilerplate = boilerplate(Nokogiri::XML(BLANK_HDR + "</iec-standard>"))
7
- end
8
-
9
-
5
+ before(:all) do
6
+ @boilerplate = boilerplate(Nokogiri::XML("#{BLANK_HDR}</iec-standard>"))
7
+ end
10
8
 
11
9
  it "generates reference boilerplate for IEV" do
12
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
10
+ input = <<~INPUT
13
11
  = Document title
14
12
  Author
15
13
  :docfile: test.adoc
@@ -23,74 +21,77 @@ end
23
21
 
24
22
  * [[[A,B]]], _TITLE_
25
23
  INPUT
26
- <?xml version='1.0' encoding='UTF-8'?>
27
- <iec-standard xmlns='https://www.metanorma.org/ns/iec' type="semantic" version="#{Metanorma::Iec::VERSION}">
28
- <bibdata type='standard'>
29
- <docidentifier type='ISO'>IEC 60050 ED 1</docidentifier>
30
- <docnumber>60050</docnumber>
31
- <contributor>
32
- <role type='author'/>
33
- <organization>
34
- <name>International Electrotechnical Commission</name>
35
- <abbreviation>IEC</abbreviation>
36
- </organization>
37
- </contributor>
38
- <contributor>
39
- <role type='publisher'/>
40
- <organization>
41
- <name>International Electrotechnical Commission</name>
42
- <abbreviation>IEC</abbreviation>
43
- </organization>
44
- </contributor>
45
- <language>en</language>
46
- <script>Latn</script>
47
- <status>
48
- <stage abbreviation="PPUB">60</stage>
49
- <substage abbreviation="PPUB">60</substage>
50
- </status>
51
- <copyright>
52
- <from>#{Time.now.year}</from>
53
- <owner>
54
- <organization>
55
- <name>International Electrotechnical Commission</name>
56
- <abbreviation>IEC</abbreviation>
57
- </organization>
58
- </owner>
59
- </copyright>
60
- <ext>
61
- <doctype>article</doctype>
62
- <horizontal>false</horizontal>
63
- <editorialgroup>
64
- <technical-committee/>
65
- <subcommittee/>
66
- <workgroup/>
67
- </editorialgroup>
68
- <structuredidentifier>
69
- <project-number>IEC 60050</project-number>
70
- </structuredidentifier>
71
- <stagename>International standard</stagename>
72
- </ext>
73
- </bibdata>
74
- #{@boilerplate}
75
- <sections> </sections>
76
- <bibliography>
77
- <references id='_' obligation='informative' normative="true">
78
- <title>Normative references</title>
79
- <p id='_'>There are no normative references in this document.</p>
80
- <bibitem id='A'>
81
- <formattedref format='application/x-isodoc+xml'>
82
- <em>TITLE</em>
83
- </formattedref>
84
- <docidentifier>B</docidentifier>
85
- </bibitem>
86
- </references>
87
- </bibliography>
88
- </iec-standard>
24
+ output = <<~OUTPUT
25
+ <?xml version='1.0' encoding='UTF-8'?>
26
+ <iec-standard xmlns='https://www.metanorma.org/ns/iec' type="semantic" version="#{Metanorma::Iec::VERSION}">
27
+ <bibdata type='standard'>
28
+ <docidentifier type='ISO'>IEC 60050 ED 1</docidentifier>
29
+ <docnumber>60050</docnumber>
30
+ <contributor>
31
+ <role type='author'/>
32
+ <organization>
33
+ <name>International Electrotechnical Commission</name>
34
+ <abbreviation>IEC</abbreviation>
35
+ </organization>
36
+ </contributor>
37
+ <contributor>
38
+ <role type='publisher'/>
39
+ <organization>
40
+ <name>International Electrotechnical Commission</name>
41
+ <abbreviation>IEC</abbreviation>
42
+ </organization>
43
+ </contributor>
44
+ <language>en</language>
45
+ <script>Latn</script>
46
+ <status>
47
+ <stage abbreviation="PPUB">60</stage>
48
+ <substage abbreviation="PPUB">60</substage>
49
+ </status>
50
+ <copyright>
51
+ <from>#{Time.now.year}</from>
52
+ <owner>
53
+ <organization>
54
+ <name>International Electrotechnical Commission</name>
55
+ <abbreviation>IEC</abbreviation>
56
+ </organization>
57
+ </owner>
58
+ </copyright>
59
+ <ext>
60
+ <doctype>article</doctype>
61
+ <subdoctype>vocabulary</subdoctype>
62
+ <editorialgroup>
63
+ <technical-committee/>
64
+ <subcommittee/>
65
+ <workgroup/>
66
+ </editorialgroup>
67
+ <structuredidentifier>
68
+ <project-number>IEC 60050</project-number>
69
+ </structuredidentifier>
70
+ <stagename>International standard</stagename>
71
+ </ext>
72
+ </bibdata>
73
+ #{@boilerplate}
74
+ <sections> </sections>
75
+ <bibliography>
76
+ <references id='_' obligation='informative' normative="true">
77
+ <title>Normative references</title>
78
+ <p id='_'>There are no normative references in this document.</p>
79
+ <bibitem id='A'>
80
+ <formattedref format='application/x-isodoc+xml'>
81
+ <em>TITLE</em>
82
+ </formattedref>
83
+ <docidentifier>B</docidentifier>
84
+ </bibitem>
85
+ </references>
86
+ </bibliography>
87
+ </iec-standard>
89
88
  OUTPUT
89
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
90
+ .to be_equivalent_to xmlpp(output)
90
91
  end
91
92
 
92
- it "generates terms boilerplate for IEV" do
93
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
93
+ it "generates terms boilerplate for IEV" do
94
+ input = <<~INPUT
94
95
  = Document title
95
96
  Author
96
97
  :docfile: test.adoc
@@ -102,73 +103,74 @@ end
102
103
  == Terms and definitions
103
104
  === General
104
105
  ==== Term 1
105
- INPUT
106
- <iec-standard xmlns='https://www.metanorma.org/ns/iec' type="semantic" version="#{Metanorma::Iec::VERSION}">
107
- <bibdata type='standard'>
108
- <docidentifier type='ISO'>IEC 60050 ED 1</docidentifier>
109
- <docnumber>60050</docnumber>
110
- <contributor>
111
- <role type='author'/>
112
- <organization>
113
- <name>International Electrotechnical Commission</name>
114
- <abbreviation>IEC</abbreviation>
115
- </organization>
116
- </contributor>
117
- <contributor>
118
- <role type='publisher'/>
119
- <organization>
120
- <name>International Electrotechnical Commission</name>
121
- <abbreviation>IEC</abbreviation>
122
- </organization>
123
- </contributor>
124
- <language>en</language>
125
- <script>Latn</script>
126
- <status>
127
- <stage abbreviation="PPUB">60</stage>
128
- <substage abbreviation="PPUB">60</substage>
129
- </status>
130
- <copyright>
131
- <from>#{Time.now.year}</from>
132
- <owner>
133
- <organization>
134
- <name>International Electrotechnical Commission</name>
135
- <abbreviation>IEC</abbreviation>
136
- </organization>
137
- </owner>
138
- </copyright>
139
- <ext>
140
- <doctype>article</doctype>
141
- <horizontal>false</horizontal>
142
- <editorialgroup>
143
- <technical-committee/>
144
- <subcommittee/>
145
- <workgroup/>
146
- </editorialgroup>
147
- <structuredidentifier>
148
- <project-number>IEC 60050</project-number>
149
- </structuredidentifier>
150
- <stagename>International standard</stagename>
151
- </ext>
152
- </bibdata>
153
- #{@boilerplate}
154
- <sections>
155
- <clause id='_' obligation='normative'>
156
- <title>Terms and definitions</title>
157
- <terms id='_' obligation='normative'>
158
- <title>General</title>
159
- <term id='term-term-1'>
160
- <preferred><expression><name>Term 1</name></expression></preferred>
161
- </term>
162
- </terms>
163
- </clause>
164
- </sections>
165
- </iec-standard>
106
+ INPUT
107
+ output = <<~OUTPUT
108
+ <iec-standard xmlns='https://www.metanorma.org/ns/iec' type="semantic" version="#{Metanorma::Iec::VERSION}">
109
+ <bibdata type='standard'>
110
+ <docidentifier type='ISO'>IEC 60050 ED 1</docidentifier>
111
+ <docnumber>60050</docnumber>
112
+ <contributor>
113
+ <role type='author'/>
114
+ <organization>
115
+ <name>International Electrotechnical Commission</name>
116
+ <abbreviation>IEC</abbreviation>
117
+ </organization>
118
+ </contributor>
119
+ <contributor>
120
+ <role type='publisher'/>
121
+ <organization>
122
+ <name>International Electrotechnical Commission</name>
123
+ <abbreviation>IEC</abbreviation>
124
+ </organization>
125
+ </contributor>
126
+ <language>en</language>
127
+ <script>Latn</script>
128
+ <status>
129
+ <stage abbreviation="PPUB">60</stage>
130
+ <substage abbreviation="PPUB">60</substage>
131
+ </status>
132
+ <copyright>
133
+ <from>#{Time.now.year}</from>
134
+ <owner>
135
+ <organization>
136
+ <name>International Electrotechnical Commission</name>
137
+ <abbreviation>IEC</abbreviation>
138
+ </organization>
139
+ </owner>
140
+ </copyright>
141
+ <ext>
142
+ <doctype>article</doctype>
143
+ <subdoctype>vocabulary</subdoctype>
144
+ <editorialgroup>
145
+ <technical-committee/>
146
+ <subcommittee/>
147
+ <workgroup/>
148
+ </editorialgroup>
149
+ <structuredidentifier>
150
+ <project-number>IEC 60050</project-number>
151
+ </structuredidentifier>
152
+ <stagename>International standard</stagename>
153
+ </ext>
154
+ </bibdata>
155
+ #{@boilerplate}
156
+ <sections>
157
+ <clause id='_' obligation='normative'>
158
+ <title>Terms and definitions</title>
159
+ <terms id='_' obligation='normative'>
160
+ <title>General</title>
161
+ <term id='term-term-1'>
162
+ <preferred><expression><name>Term 1</name></expression></preferred>
163
+ </term>
164
+ </terms>
165
+ </clause>
166
+ </sections>
167
+ </iec-standard>
166
168
 
167
- OUTPUT
169
+ OUTPUT
168
170
  end
169
171
 
170
- it "uses IEV introduction title" do
171
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
172
+ it "uses IEV introduction title" do
173
+ input = <<~INPUT
172
174
  = Document title
173
175
  Author
174
176
  :docfile: test.adoc
@@ -181,63 +183,66 @@ OUTPUT
181
183
 
182
184
  Text
183
185
  INPUT
184
- <?xml version='1.0' encoding='UTF-8'?>
185
- <iec-standard xmlns='https://www.metanorma.org/ns/iec' type="semantic" version="#{Metanorma::Iec::VERSION}">
186
- <bibdata type='standard'>
187
- <docidentifier type='ISO'>IEC 60050 ED 1</docidentifier>
188
- <docnumber>60050</docnumber>
189
- <contributor>
190
- <role type='author'/>
191
- <organization>
192
- <name>International Electrotechnical Commission</name>
193
- <abbreviation>IEC</abbreviation>
194
- </organization>
195
- </contributor>
196
- <contributor>
197
- <role type='publisher'/>
198
- <organization>
199
- <name>International Electrotechnical Commission</name>
200
- <abbreviation>IEC</abbreviation>
201
- </organization>
202
- </contributor>
203
- <language>en</language>
204
- <script>Latn</script>
205
- <status>
206
- <stage abbreviation='PPUB'>60</stage>
207
- <substage abbreviation='PPUB'>60</substage>
208
- </status>
209
- <copyright>
210
- <from>#{Time.now.year}</from>
211
- <owner>
186
+ output = <<~OUTPUT
187
+ <?xml version='1.0' encoding='UTF-8'?>
188
+ <iec-standard xmlns='https://www.metanorma.org/ns/iec' type="semantic" version="#{Metanorma::Iec::VERSION}">
189
+ <bibdata type='standard'>
190
+ <docidentifier type='ISO'>IEC 60050 ED 1</docidentifier>
191
+ <docnumber>60050</docnumber>
192
+ <contributor>
193
+ <role type='author'/>
212
194
  <organization>
213
195
  <name>International Electrotechnical Commission</name>
214
196
  <abbreviation>IEC</abbreviation>
215
197
  </organization>
216
- </owner>
217
- </copyright>
218
- <ext>
219
- <doctype>article</doctype>
220
- <horizontal>false</horizontal>
221
- <editorialgroup>
222
- <technical-committee/>
223
- <subcommittee/>
224
- <workgroup/>
225
- </editorialgroup>
226
- <structuredidentifier>
227
- <project-number>IEC 60050</project-number>
228
- </structuredidentifier>
229
- <stagename>International standard</stagename>
230
- </ext>
231
- </bibdata>
232
- #{@boilerplate}
233
- <preface>
234
- <introduction id='_' obligation='informative'>
235
- <title>INTRODUCTION&lt;br/&gt;Principles and rules followed</title>
236
- <p id='_'>Text</p>
237
- </introduction>
238
- </preface>
239
- <sections> </sections>
240
- </iec-standard>
241
- OUTPUT
242
- end
198
+ </contributor>
199
+ <contributor>
200
+ <role type='publisher'/>
201
+ <organization>
202
+ <name>International Electrotechnical Commission</name>
203
+ <abbreviation>IEC</abbreviation>
204
+ </organization>
205
+ </contributor>
206
+ <language>en</language>
207
+ <script>Latn</script>
208
+ <status>
209
+ <stage abbreviation='PPUB'>60</stage>
210
+ <substage abbreviation='PPUB'>60</substage>
211
+ </status>
212
+ <copyright>
213
+ <from>#{Time.now.year}</from>
214
+ <owner>
215
+ <organization>
216
+ <name>International Electrotechnical Commission</name>
217
+ <abbreviation>IEC</abbreviation>
218
+ </organization>
219
+ </owner>
220
+ </copyright>
221
+ <ext>
222
+ <doctype>article</doctype>
223
+ <subdoctype>vocabulary</subdoctype>
224
+ <editorialgroup>
225
+ <technical-committee/>
226
+ <subcommittee/>
227
+ <workgroup/>
228
+ </editorialgroup>
229
+ <structuredidentifier>
230
+ <project-number>IEC 60050</project-number>
231
+ </structuredidentifier>
232
+ <stagename>International standard</stagename>
233
+ </ext>
234
+ </bibdata>
235
+ #{@boilerplate}
236
+ <preface>
237
+ <introduction id='_' obligation='informative'>
238
+ <title>INTRODUCTION<br/>Principles and rules followed</title>
239
+ <p id='_'>Text</p>
240
+ </introduction>
241
+ </preface>
242
+ <sections> </sections>
243
+ </iec-standard>
244
+ OUTPUT
245
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
246
+ .to be_equivalent_to xmlpp(output)
247
+ end
243
248
  end