metanorma-iec 1.4.1 → 1.4.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -0
- data/Rakefile +1 -1
- data/lib/asciidoctor/iec/converter.rb +43 -26
- data/lib/asciidoctor/iec/front.rb +2 -3
- data/lib/asciidoctor/iec/iec.rng +48 -0
- data/lib/asciidoctor/iec/isodoc.rng +61 -18
- data/lib/asciidoctor/iec/isostandard.rng +14 -0
- data/lib/isodoc/iec/base_convert.rb +23 -58
- data/lib/isodoc/iec/html/htmlstyle.css +37 -5
- data/lib/isodoc/iec/html/htmlstyle.scss +34 -5
- data/lib/isodoc/iec/html/isodoc.css +1 -2
- data/lib/isodoc/iec/html/isodoc.scss +1 -2
- data/lib/isodoc/iec/html/scripts.html +0 -1
- data/lib/isodoc/iec/html/wordstyle.css +13 -11
- data/lib/isodoc/iec/html/wordstyle.scss +13 -11
- data/lib/isodoc/iec/iec.international-standard.xsl +428 -111
- data/lib/isodoc/iec/presentation_xml_convert.rb +193 -5
- data/lib/metanorma/iec/processor.rb +15 -8
- data/lib/metanorma/iec/version.rb +1 -1
- data/metanorma-iec.gemspec +2 -2
- data/spec/asciidoctor/base_spec.rb +0 -4
- data/spec/asciidoctor/cleanup_spec.rb +231 -202
- data/spec/asciidoctor/iev_spec.rb +195 -190
- data/spec/isodoc/iev_spec.rb +459 -118
- data/spec/isodoc/postproc_spec.rb +2 -5
- data/spec/isodoc/terms_spec.rb +183 -181
- data/spec/metanorma/processor_spec.rb +139 -44
- data/spec/spec_helper.rb +10 -12
- metadata +6 -6
@@ -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
|
-
|
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
|
-
|
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
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
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
|
-
|
93
|
-
|
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
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
</
|
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
|
-
|
171
|
-
|
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
|
-
|
185
|
-
|
186
|
-
|
187
|
-
<
|
188
|
-
|
189
|
-
|
190
|
-
<
|
191
|
-
|
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
|
-
</
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
</
|
226
|
-
<
|
227
|
-
<
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
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
|