metanorma-iso 1.7.1 → 1.8.1
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 +11 -41
- data/.gitignore +2 -0
- data/.rubocop.yml +6 -2
- data/lib/asciidoctor/iso/base.rb +18 -16
- data/lib/asciidoctor/iso/biblio.rng +4 -6
- data/lib/asciidoctor/iso/cleanup.rb +28 -24
- data/lib/asciidoctor/iso/front.rb +26 -16
- data/lib/asciidoctor/iso/front_id.rb +30 -25
- data/lib/asciidoctor/iso/isodoc.rng +172 -3
- data/lib/asciidoctor/iso/isostandard-amd.rng +3 -0
- data/lib/asciidoctor/iso/isostandard.rng +17 -97
- data/lib/asciidoctor/iso/validate.rb +22 -109
- data/lib/asciidoctor/iso/validate_image.rb +97 -0
- data/lib/asciidoctor/iso/validate_requirements.rb +26 -20
- data/lib/asciidoctor/iso/validate_section.rb +39 -20
- data/lib/asciidoctor/iso/validate_style.rb +36 -24
- data/lib/asciidoctor/iso/validate_title.rb +23 -17
- data/lib/isodoc/iso/base_convert.rb +19 -2
- data/lib/isodoc/iso/html/style-human.css +7 -0
- data/lib/isodoc/iso/html/style-iso.css +7 -0
- data/lib/isodoc/iso/html_convert.rb +0 -1
- data/lib/isodoc/iso/i18n-en.yaml +4 -0
- data/lib/isodoc/iso/i18n-fr.yaml +4 -0
- data/lib/isodoc/iso/i18n-zh-Hans.yaml +4 -0
- data/lib/isodoc/iso/index.rb +140 -0
- data/lib/isodoc/iso/iso.amendment.xsl +1092 -208
- data/lib/isodoc/iso/iso.international-standard.xsl +1092 -208
- data/lib/isodoc/iso/presentation_xml_convert.rb +45 -37
- data/lib/isodoc/iso/word_convert.rb +0 -1
- data/lib/isodoc/iso/xref.rb +15 -7
- data/lib/metanorma/iso/processor.rb +1 -0
- data/lib/metanorma/iso/version.rb +1 -1
- data/metanorma-iso.gemspec +8 -8
- data/spec/asciidoctor/amd_spec.rb +696 -0
- data/spec/asciidoctor/base_spec.rb +733 -0
- data/spec/asciidoctor/blocks_spec.rb +527 -0
- data/spec/asciidoctor/cleanup_spec.rb +1134 -0
- data/spec/asciidoctor/inline_spec.rb +195 -0
- data/spec/asciidoctor/lists_spec.rb +197 -0
- data/spec/asciidoctor/refs_spec.rb +375 -0
- data/spec/asciidoctor/section_spec.rb +393 -0
- data/spec/asciidoctor/table_spec.rb +329 -0
- data/spec/asciidoctor/validate_spec.rb +1627 -0
- data/spec/isodoc/amd_spec.rb +967 -946
- data/spec/isodoc/blocks_spec.rb +530 -507
- data/spec/isodoc/i18n_spec.rb +953 -911
- data/spec/isodoc/inline_spec.rb +355 -293
- data/spec/isodoc/iso_spec.rb +338 -314
- data/spec/isodoc/metadata_spec.rb +392 -382
- data/spec/isodoc/postproc_spec.rb +836 -657
- data/spec/isodoc/ref_spec.rb +374 -331
- data/spec/isodoc/section_spec.rb +821 -519
- data/spec/isodoc/table_spec.rb +472 -411
- data/spec/isodoc/terms_spec.rb +209 -185
- data/spec/isodoc/xref_spec.rb +1370 -1236
- data/spec/metanorma/processor_spec.rb +28 -26
- data/spec/spec_helper.rb +178 -193
- metadata +65 -66
- data/.rubocop.ribose.yml +0 -66
- data/lib/isodoc/iso/html/scripts.html +0 -178
- data/spec/asciidoctor-iso/amd_spec.rb +0 -694
- data/spec/asciidoctor-iso/base_spec.rb +0 -713
- data/spec/asciidoctor-iso/blocks_spec.rb +0 -482
- data/spec/asciidoctor-iso/cleanup_spec.rb +0 -1025
- data/spec/asciidoctor-iso/inline_spec.rb +0 -170
- data/spec/asciidoctor-iso/lists_spec.rb +0 -190
- data/spec/asciidoctor-iso/refs_spec.rb +0 -317
- data/spec/asciidoctor-iso/section_spec.rb +0 -362
- data/spec/asciidoctor-iso/table_spec.rb +0 -313
- data/spec/asciidoctor-iso/validate_spec.rb +0 -1621
- data/spec/assets/xref_error.adoc +0 -7
@@ -0,0 +1,733 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
RSpec.describe Asciidoctor::ISO do
|
4
|
+
it "has a version number" do
|
5
|
+
expect(Metanorma::ISO::VERSION).not_to be nil
|
6
|
+
end
|
7
|
+
|
8
|
+
it "processes a blank document" do
|
9
|
+
expect(xmlpp(Asciidoctor.convert(<<~"INPUT", *OPTIONS))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
10
|
+
#{ASCIIDOC_BLANK_HDR}
|
11
|
+
INPUT
|
12
|
+
#{BLANK_HDR}
|
13
|
+
<sections/>
|
14
|
+
</iso-standard>
|
15
|
+
OUTPUT
|
16
|
+
end
|
17
|
+
|
18
|
+
it "converts a blank document" do
|
19
|
+
expect(xmlpp(Asciidoctor.convert(<<~"INPUT", *OPTIONS))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
20
|
+
= Document title
|
21
|
+
Author
|
22
|
+
:docfile: test.adoc
|
23
|
+
:novalid:
|
24
|
+
:no-isobib:
|
25
|
+
INPUT
|
26
|
+
#{BLANK_HDR}
|
27
|
+
<sections/>
|
28
|
+
</iso-standard>
|
29
|
+
OUTPUT
|
30
|
+
expect(File.exist?("test_alt.html")).to be true
|
31
|
+
expect(File.exist?("test.html")).to be true
|
32
|
+
expect(File.exist?("test.doc")).to be true
|
33
|
+
expect(File.exist?("test.pdf")).to be true
|
34
|
+
expect(File.exist?("htmlstyle.css")).to be false
|
35
|
+
end
|
36
|
+
|
37
|
+
it "converts a blank document in French" do
|
38
|
+
expect(xmlpp(Asciidoctor.convert(<<~"INPUT", *OPTIONS))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
39
|
+
= Document title
|
40
|
+
Author
|
41
|
+
:docfile: test.adoc
|
42
|
+
:novalid:
|
43
|
+
:no-isobib:
|
44
|
+
:no-pdf:
|
45
|
+
:language: fr
|
46
|
+
INPUT
|
47
|
+
#{BLANK_HDR_FR}
|
48
|
+
<sections/>
|
49
|
+
</iso-standard>
|
50
|
+
OUTPUT
|
51
|
+
end
|
52
|
+
|
53
|
+
it "processes default metadata" do
|
54
|
+
output = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
|
55
|
+
= Document title
|
56
|
+
Author
|
57
|
+
:docfile: test.adoc
|
58
|
+
:nodoc:
|
59
|
+
:novalid:
|
60
|
+
:no-isobib:
|
61
|
+
:docnumber: 1000
|
62
|
+
:partnumber: 1
|
63
|
+
:edition: 2
|
64
|
+
:revdate: 2000-01-01
|
65
|
+
:draft: 0.3.4
|
66
|
+
:technical-committee: TC
|
67
|
+
:technical-committee-number: 1
|
68
|
+
:technical-committee-type: A
|
69
|
+
:subcommittee: SC
|
70
|
+
:subcommittee-number: 2
|
71
|
+
:subcommittee-type: B
|
72
|
+
:workgroup: WG
|
73
|
+
:workgroup-number: 3
|
74
|
+
:workgroup-type: C
|
75
|
+
:technical-committee_2: TC1
|
76
|
+
:technical-committee-number_2: 11
|
77
|
+
:technical-committee-type_2: A1
|
78
|
+
:subcommittee_2: SC1
|
79
|
+
:subcommittee-number_2: 21
|
80
|
+
:subcommittee-type_2: B1
|
81
|
+
:workgroup_2: WG1
|
82
|
+
:workgroup-number_2: 31
|
83
|
+
:workgroup-type_2: C1
|
84
|
+
:secretariat: SECRETARIAT
|
85
|
+
:docstage: 20
|
86
|
+
:docsubstage: 20
|
87
|
+
:iteration: 3
|
88
|
+
:language: en
|
89
|
+
:title-intro-en: Introduction
|
90
|
+
:title-main-en: Main Title -- Title
|
91
|
+
:title-part-en: Title Part
|
92
|
+
:title-intro-fr: Introduction Française
|
93
|
+
:title-main-fr: Titre Principal
|
94
|
+
:title-part-fr: Part du Titre
|
95
|
+
:library-ics: 1,2,3
|
96
|
+
:copyright-year: 2000
|
97
|
+
:horizontal: true
|
98
|
+
INPUT
|
99
|
+
expect(xmlpp(output.sub(%r{<boilerplate>.*</boilerplate>}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
100
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
101
|
+
<iso-standard type="semantic" version="#{Metanorma::ISO::VERSION}" xmlns="https://www.metanorma.org/ns/iso">
|
102
|
+
<bibdata type="standard">
|
103
|
+
<title format="text/plain" language="en" type="main">Introduction — Main Title — Title — Title Part</title>
|
104
|
+
<title format="text/plain" language="en" type="title-intro">Introduction</title>
|
105
|
+
<title format="text/plain" language="en" type="title-main">Main Title — Title</title>
|
106
|
+
<title format="text/plain" language="en" type="title-part">Title Part</title>
|
107
|
+
<title format="text/plain" language="fr" type="main">Introduction Française — Titre Principal — Part du Titre</title>
|
108
|
+
<title format="text/plain" language="fr" type="title-intro">Introduction Française</title>
|
109
|
+
<title format="text/plain" language="fr" type="title-main">Titre Principal</title>
|
110
|
+
<title format="text/plain" language="fr" type="title-part">Part du Titre</title>
|
111
|
+
<docidentifier type="ISO">ISO/PreWD3 1000-1</docidentifier>
|
112
|
+
<docidentifier type="iso-with-lang">ISO/PreWD3 1000-1(E)</docidentifier>
|
113
|
+
<docidentifier type="iso-reference">ISO/PreWD3 1000-1:2000(E)</docidentifier>
|
114
|
+
<docnumber>1000</docnumber>
|
115
|
+
<contributor>
|
116
|
+
<role type="author"/>
|
117
|
+
<organization>
|
118
|
+
<name>International Organization for Standardization</name>
|
119
|
+
<abbreviation>ISO</abbreviation>
|
120
|
+
</organization>
|
121
|
+
</contributor>
|
122
|
+
<contributor>
|
123
|
+
<role type="publisher"/>
|
124
|
+
<organization>
|
125
|
+
<name>International Organization for Standardization</name>
|
126
|
+
<abbreviation>ISO</abbreviation>
|
127
|
+
</organization>
|
128
|
+
</contributor>
|
129
|
+
<edition>2</edition>
|
130
|
+
<version>
|
131
|
+
<revision-date>2000-01-01</revision-date>
|
132
|
+
<draft>0.3.4</draft>
|
133
|
+
</version>
|
134
|
+
<language>en</language>
|
135
|
+
<script>Latn</script>
|
136
|
+
<status>
|
137
|
+
<stage abbreviation="WD">20</stage>
|
138
|
+
<substage>20</substage>
|
139
|
+
<iteration>3</iteration>
|
140
|
+
</status>
|
141
|
+
<copyright>
|
142
|
+
<from>2000</from>
|
143
|
+
<owner>
|
144
|
+
<organization>
|
145
|
+
<name>International Organization for Standardization</name>
|
146
|
+
<abbreviation>ISO</abbreviation>
|
147
|
+
</organization>
|
148
|
+
</owner>
|
149
|
+
</copyright>
|
150
|
+
<ext>
|
151
|
+
<doctype>article</doctype>
|
152
|
+
<horizontal>true</horizontal>
|
153
|
+
<editorialgroup>
|
154
|
+
<technical-committee number="1" type="A">TC</technical-committee>
|
155
|
+
<technical-committee number="11" type="A1">TC1</technical-committee>
|
156
|
+
<subcommittee number="2" type="B">SC</subcommittee>
|
157
|
+
<subcommittee number="21" type="B1">SC1</subcommittee>
|
158
|
+
<workgroup number="3" type="C">WG</workgroup>
|
159
|
+
<workgroup number="31" type="C1">WG1</workgroup>
|
160
|
+
<secretariat>SECRETARIAT</secretariat>
|
161
|
+
</editorialgroup>
|
162
|
+
<ics>
|
163
|
+
<code>1</code>
|
164
|
+
</ics>
|
165
|
+
<ics>
|
166
|
+
<code>2</code>
|
167
|
+
</ics>
|
168
|
+
<ics>
|
169
|
+
<code>3</code>
|
170
|
+
</ics>
|
171
|
+
<structuredidentifier>
|
172
|
+
<project-number part="1">ISO 1000</project-number>
|
173
|
+
</structuredidentifier>
|
174
|
+
<stagename>Third working draft</stagename>
|
175
|
+
</ext>
|
176
|
+
</bibdata>
|
177
|
+
<sections/>
|
178
|
+
</iso-standard>
|
179
|
+
OUTPUT
|
180
|
+
end
|
181
|
+
|
182
|
+
it "processes complex metadata" do
|
183
|
+
output = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
|
184
|
+
= Document title
|
185
|
+
Author
|
186
|
+
:docfile: test.adoc
|
187
|
+
:nodoc:
|
188
|
+
:novalid:
|
189
|
+
:no-isobib:
|
190
|
+
:docnumber: 1000
|
191
|
+
:partnumber: 1-1
|
192
|
+
:tc-docnumber: 2000, 2003
|
193
|
+
:language: el
|
194
|
+
:script: Grek
|
195
|
+
:publisher: IEC;IETF;ISO
|
196
|
+
:copyright-holder: ISO;IETF
|
197
|
+
:copyright-year: 2001
|
198
|
+
:doctype: technical-report
|
199
|
+
:pub-address: 1 Infinity Loop + \
|
200
|
+
California
|
201
|
+
:pub-phone: 3333333
|
202
|
+
:pub-fax: 4444444
|
203
|
+
:pub-email: x@example.com
|
204
|
+
:pub-uri: http://www.example.com
|
205
|
+
INPUT
|
206
|
+
expect(xmlpp(output.sub(%r{<boilerplate>.*</boilerplate>}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
207
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
208
|
+
<iso-standard type="semantic" version="#{Metanorma::ISO::VERSION}" xmlns="https://www.metanorma.org/ns/iso">
|
209
|
+
<bibdata type="standard">
|
210
|
+
<docidentifier type="ISO">ISO/IEC/IETF/TR 1000-1-1:2001</docidentifier>
|
211
|
+
<docidentifier type="iso-with-lang">ISO/IEC/IETF/TR 1000-1-1:2001(X)</docidentifier>
|
212
|
+
<docidentifier type="iso-reference">ISO/IEC/IETF/TR 1000-1-1:2001(X)</docidentifier>
|
213
|
+
<docidentifier type="iso-tc">2000</docidentifier>
|
214
|
+
<docidentifier type="iso-tc">2003</docidentifier>
|
215
|
+
<docnumber>1000</docnumber>
|
216
|
+
<contributor>
|
217
|
+
<role type="author"/>
|
218
|
+
<organization>
|
219
|
+
<name>International Electrotechnical Commission</name>
|
220
|
+
<abbreviation>IEC</abbreviation>
|
221
|
+
</organization>
|
222
|
+
</contributor>
|
223
|
+
<contributor>
|
224
|
+
<role type="author"/>
|
225
|
+
<organization>
|
226
|
+
<name>IETF</name>
|
227
|
+
</organization>
|
228
|
+
</contributor>
|
229
|
+
<contributor>
|
230
|
+
<role type="author"/>
|
231
|
+
<organization>
|
232
|
+
<name>International Organization for Standardization</name>
|
233
|
+
<abbreviation>ISO</abbreviation>
|
234
|
+
</organization>
|
235
|
+
</contributor>
|
236
|
+
<contributor>
|
237
|
+
<role type="publisher"/>
|
238
|
+
<organization>
|
239
|
+
<name>International Electrotechnical Commission</name>
|
240
|
+
<abbreviation>IEC</abbreviation>
|
241
|
+
<address>
|
242
|
+
<formattedAddress>1 Infinity Loop + California</formattedAddress>
|
243
|
+
</address>
|
244
|
+
<phone>3333333</phone>
|
245
|
+
<phone type='fax'>4444444</phone>
|
246
|
+
<email>x@example.com</email>
|
247
|
+
<uri>http://www.example.com</uri>
|
248
|
+
</organization>
|
249
|
+
</contributor>
|
250
|
+
<contributor>
|
251
|
+
<role type="publisher"/>
|
252
|
+
<organization>
|
253
|
+
<name>IETF</name>
|
254
|
+
<address>
|
255
|
+
<formattedAddress>1 Infinity Loop + California</formattedAddress>
|
256
|
+
</address>
|
257
|
+
<phone>3333333</phone>
|
258
|
+
<phone type='fax'>4444444</phone>
|
259
|
+
<email>x@example.com</email>
|
260
|
+
<uri>http://www.example.com</uri>
|
261
|
+
</organization>
|
262
|
+
</contributor>
|
263
|
+
<contributor>
|
264
|
+
<role type="publisher"/>
|
265
|
+
<organization>
|
266
|
+
<name>International Organization for Standardization</name>
|
267
|
+
<abbreviation>ISO</abbreviation>
|
268
|
+
<address>
|
269
|
+
<formattedAddress>1 Infinity Loop + California</formattedAddress>
|
270
|
+
</address>
|
271
|
+
<phone>3333333</phone>
|
272
|
+
<phone type='fax'>4444444</phone>
|
273
|
+
<email>x@example.com</email>
|
274
|
+
<uri>http://www.example.com</uri>
|
275
|
+
</organization>
|
276
|
+
</contributor>
|
277
|
+
<language>el</language>
|
278
|
+
<script>Grek</script>
|
279
|
+
<status>
|
280
|
+
<stage abbreviation="IS">60</stage>
|
281
|
+
<substage>60</substage>
|
282
|
+
</status>
|
283
|
+
<copyright>
|
284
|
+
<from>2001</from>
|
285
|
+
<owner>
|
286
|
+
<organization>
|
287
|
+
<name>International Organization for Standardization</name>
|
288
|
+
<abbreviation>ISO</abbreviation>
|
289
|
+
<address>
|
290
|
+
<formattedAddress>1 Infinity Loop + California</formattedAddress>
|
291
|
+
</address>
|
292
|
+
<phone>3333333</phone>
|
293
|
+
<phone type='fax'>4444444</phone>
|
294
|
+
<email>x@example.com</email>
|
295
|
+
<uri>http://www.example.com</uri>
|
296
|
+
|
297
|
+
</organization>
|
298
|
+
</owner>
|
299
|
+
</copyright>
|
300
|
+
<copyright>
|
301
|
+
<from>2001</from>
|
302
|
+
<owner>
|
303
|
+
<organization>
|
304
|
+
<name>IETF</name>
|
305
|
+
<address>
|
306
|
+
<formattedAddress>1 Infinity Loop + California</formattedAddress>
|
307
|
+
</address>
|
308
|
+
<phone>3333333</phone>
|
309
|
+
<phone type='fax'>4444444</phone>
|
310
|
+
<email>x@example.com</email>
|
311
|
+
<uri>http://www.example.com</uri>
|
312
|
+
</organization>
|
313
|
+
</owner>
|
314
|
+
</copyright>
|
315
|
+
<ext>
|
316
|
+
<doctype>technical-report</doctype>
|
317
|
+
<editorialgroup>
|
318
|
+
<technical-committee/>
|
319
|
+
<subcommittee/>
|
320
|
+
<workgroup/>
|
321
|
+
</editorialgroup>
|
322
|
+
<structuredidentifier>
|
323
|
+
<project-number part="1" subpart="1">ISO/IEC/IETF 1000</project-number>
|
324
|
+
</structuredidentifier>
|
325
|
+
<stagename>International standard</stagename>
|
326
|
+
</ext>
|
327
|
+
</bibdata>
|
328
|
+
<sections/>
|
329
|
+
</iso-standard>
|
330
|
+
OUTPUT
|
331
|
+
end
|
332
|
+
|
333
|
+
it "processes subdivisions" do
|
334
|
+
output = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
|
335
|
+
= Document title
|
336
|
+
Author
|
337
|
+
:docfile: test.adoc
|
338
|
+
:nodoc:
|
339
|
+
:novalid:
|
340
|
+
:revdate: 2000-01
|
341
|
+
:published-date: 1000-01
|
342
|
+
:docnumber: 1000
|
343
|
+
:partnumber: 1-1
|
344
|
+
:tc-docnumber: 2000
|
345
|
+
:language: el
|
346
|
+
:script: Grek
|
347
|
+
:subdivision: Subdivision
|
348
|
+
:subdivision-abbr: SD
|
349
|
+
:doctype: This is a DocType
|
350
|
+
:pub-address: 1 Infinity Loop + \\
|
351
|
+
California
|
352
|
+
:pub-phone: 3333333
|
353
|
+
:pub-fax: 4444444
|
354
|
+
:pub-email: x@example.com
|
355
|
+
:pub-uri: http://www.example.com
|
356
|
+
INPUT
|
357
|
+
expect(xmlpp(strip_guid(output.sub(%r{<boilerplate>.*</boilerplate>}m, ""))))
|
358
|
+
.to be_equivalent_to xmlpp(<<~"OUTPUT")
|
359
|
+
<iso-standard xmlns="https://www.metanorma.org/ns/iso" type="semantic" version="#{Metanorma::ISO::VERSION}">
|
360
|
+
<bibdata type='standard'>
|
361
|
+
<docidentifier type='ISO'>SD 1000-1-1</docidentifier>
|
362
|
+
<docidentifier type='iso-with-lang'>SD 1000-1-1(X)</docidentifier>
|
363
|
+
<docidentifier type='iso-reference'>SD 1000-1-1(X)</docidentifier>
|
364
|
+
<docidentifier type='iso-tc'>2000</docidentifier>
|
365
|
+
<docnumber>1000</docnumber>
|
366
|
+
<date type='published'>
|
367
|
+
<on>1000-01</on>
|
368
|
+
</date>
|
369
|
+
<contributor>
|
370
|
+
<role type='author'/>
|
371
|
+
<organization>
|
372
|
+
<name>International Organization for Standardization</name>
|
373
|
+
<subdivision>Subdivision</subdivision>
|
374
|
+
<abbreviation>SD</abbreviation>
|
375
|
+
</organization>
|
376
|
+
</contributor>
|
377
|
+
<contributor>
|
378
|
+
<role type='publisher'/>
|
379
|
+
<organization>
|
380
|
+
<name>International Organization for Standardization</name>
|
381
|
+
<subdivision>Subdivision</subdivision>
|
382
|
+
<abbreviation>SD</abbreviation>
|
383
|
+
<address>
|
384
|
+
<formattedAddress>1 Infinity Loop <br/>California</formattedAddress>
|
385
|
+
</address>
|
386
|
+
<phone>3333333</phone>
|
387
|
+
<phone type='fax'>4444444</phone>
|
388
|
+
<email>x@example.com</email>
|
389
|
+
<uri>http://www.example.com</uri>
|
390
|
+
</organization>
|
391
|
+
</contributor>
|
392
|
+
<version>
|
393
|
+
<revision-date>2000-01</revision-date>
|
394
|
+
</version>
|
395
|
+
<language>el</language>
|
396
|
+
<script>Grek</script>
|
397
|
+
<status>
|
398
|
+
<stage abbreviation='IS'>60</stage>
|
399
|
+
<substage>60</substage>
|
400
|
+
</status>
|
401
|
+
<copyright>
|
402
|
+
<from>#{Time.now.year}</from>
|
403
|
+
<owner>
|
404
|
+
<organization>
|
405
|
+
<name>International Organization for Standardization</name>
|
406
|
+
<subdivision>Subdivision</subdivision>
|
407
|
+
<abbreviation>SD</abbreviation>
|
408
|
+
<address>
|
409
|
+
<formattedAddress>1 Infinity Loop
|
410
|
+
<br/>
|
411
|
+
California</formattedAddress>
|
412
|
+
</address>
|
413
|
+
<phone>3333333</phone>
|
414
|
+
<phone type="fax">4444444</phone>
|
415
|
+
<email>x@example.com</email>
|
416
|
+
<uri>http://www.example.com</uri>
|
417
|
+
</organization>
|
418
|
+
</owner>
|
419
|
+
</copyright>
|
420
|
+
<ext>
|
421
|
+
<doctype>this-is-a-doctype</doctype>
|
422
|
+
<editorialgroup>
|
423
|
+
<technical-committee/>
|
424
|
+
<subcommittee/>
|
425
|
+
<workgroup/>
|
426
|
+
</editorialgroup>
|
427
|
+
<structuredidentifier>
|
428
|
+
<project-number part="1" subpart="1">SD 1000</project-number>
|
429
|
+
</structuredidentifier>
|
430
|
+
<stagename>International standard</stagename>
|
431
|
+
</ext>
|
432
|
+
</bibdata>
|
433
|
+
<sections> </sections>
|
434
|
+
</iso-standard>
|
435
|
+
OUTPUT
|
436
|
+
end
|
437
|
+
|
438
|
+
it "defaults substage, defines iteration on stage 50" do
|
439
|
+
output = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
|
440
|
+
= Document title
|
441
|
+
Author
|
442
|
+
:docfile: test.adoc
|
443
|
+
:nodoc:
|
444
|
+
:novalid:
|
445
|
+
:no-isobib:
|
446
|
+
:docnumber: 1000
|
447
|
+
:docstage: 50
|
448
|
+
:language: fr
|
449
|
+
:doctype: international-standard
|
450
|
+
:iteration: 2
|
451
|
+
INPUT
|
452
|
+
expect(xmlpp(output.sub(%r{<boilerplate>.*</boilerplate>}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
453
|
+
<iso-standard type="semantic" version="#{Metanorma::ISO::VERSION}" xmlns="https://www.metanorma.org/ns/iso">
|
454
|
+
<bibdata type="standard">
|
455
|
+
<docidentifier type='ISO'>ISO/FDIS 1000.2</docidentifier>
|
456
|
+
<docidentifier type='iso-with-lang'>ISO/FDIS 1000.2(F)</docidentifier>
|
457
|
+
<docidentifier type='iso-reference'>ISO/FDIS 1000.2(F)</docidentifier>
|
458
|
+
<docnumber>1000</docnumber>
|
459
|
+
<contributor>
|
460
|
+
<role type="author"/>
|
461
|
+
<organization>
|
462
|
+
<name>International Organization for Standardization</name>
|
463
|
+
<abbreviation>ISO</abbreviation>
|
464
|
+
</organization>
|
465
|
+
</contributor>
|
466
|
+
<contributor>
|
467
|
+
<role type="publisher"/>
|
468
|
+
<organization>
|
469
|
+
<name>International Organization for Standardization</name>
|
470
|
+
<abbreviation>ISO</abbreviation>
|
471
|
+
</organization>
|
472
|
+
</contributor>
|
473
|
+
<language>fr</language>
|
474
|
+
<script>Latn</script>
|
475
|
+
<status>
|
476
|
+
<stage abbreviation="FDIS">50</stage>
|
477
|
+
<substage>00</substage>
|
478
|
+
<iteration>2</iteration>
|
479
|
+
</status>
|
480
|
+
<copyright>
|
481
|
+
<from>#{Date.today.year}</from>
|
482
|
+
<owner>
|
483
|
+
<organization>
|
484
|
+
<name>International Organization for Standardization</name>
|
485
|
+
<abbreviation>ISO</abbreviation>
|
486
|
+
</organization>
|
487
|
+
</owner>
|
488
|
+
</copyright>
|
489
|
+
<ext>
|
490
|
+
<doctype>international-standard</doctype>
|
491
|
+
<editorialgroup>
|
492
|
+
<technical-committee/>
|
493
|
+
<subcommittee/>
|
494
|
+
<workgroup/>
|
495
|
+
</editorialgroup>
|
496
|
+
<structuredidentifier>
|
497
|
+
<project-number>ISO 1000</project-number>
|
498
|
+
</structuredidentifier>
|
499
|
+
<stagename>Final draft</stagename>
|
500
|
+
</ext>
|
501
|
+
</bibdata>
|
502
|
+
<sections/>
|
503
|
+
</iso-standard>
|
504
|
+
OUTPUT
|
505
|
+
end
|
506
|
+
|
507
|
+
it "defaults substage for stage 60" do
|
508
|
+
output = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
|
509
|
+
= Document title
|
510
|
+
Author
|
511
|
+
:docfile: test.adoc
|
512
|
+
:nodoc:
|
513
|
+
:novalid:
|
514
|
+
:no-isobib:
|
515
|
+
:docnumber: 1000
|
516
|
+
:docstage: 60
|
517
|
+
INPUT
|
518
|
+
|
519
|
+
expect(xmlpp(output.sub(%r{<boilerplate>.*</boilerplate>}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
520
|
+
<iso-standard xmlns="https://www.metanorma.org/ns/iso" type="semantic" version="#{Metanorma::ISO::VERSION}">
|
521
|
+
<bibdata type="standard">
|
522
|
+
<docidentifier type="ISO">ISO 1000</docidentifier>
|
523
|
+
<docidentifier type='iso-with-lang'>ISO 1000(E)</docidentifier>
|
524
|
+
<docidentifier type='iso-reference'>ISO 1000(E)</docidentifier>
|
525
|
+
<docnumber>1000</docnumber>
|
526
|
+
<contributor>
|
527
|
+
<role type="author"/>
|
528
|
+
<organization>
|
529
|
+
<name>International Organization for Standardization</name>
|
530
|
+
<abbreviation>ISO</abbreviation>
|
531
|
+
</organization>
|
532
|
+
</contributor>
|
533
|
+
<contributor>
|
534
|
+
<role type="publisher"/>
|
535
|
+
<organization>
|
536
|
+
<name>International Organization for Standardization</name>
|
537
|
+
<abbreviation>ISO</abbreviation>
|
538
|
+
</organization>
|
539
|
+
</contributor>
|
540
|
+
|
541
|
+
<language>en</language>
|
542
|
+
<script>Latn</script>
|
543
|
+
<status>
|
544
|
+
<stage abbreviation="IS">60</stage>
|
545
|
+
<substage>60</substage>
|
546
|
+
</status>
|
547
|
+
<copyright>
|
548
|
+
<from>#{Date.today.year}</from>
|
549
|
+
<owner>
|
550
|
+
<organization>
|
551
|
+
<name>International Organization for Standardization</name>
|
552
|
+
<abbreviation>ISO</abbreviation>
|
553
|
+
</organization>
|
554
|
+
</owner>
|
555
|
+
</copyright>
|
556
|
+
<ext>
|
557
|
+
<doctype>article</doctype>
|
558
|
+
<editorialgroup>
|
559
|
+
<technical-committee/>
|
560
|
+
<subcommittee/>
|
561
|
+
<workgroup/>
|
562
|
+
</editorialgroup>
|
563
|
+
<structuredidentifier>
|
564
|
+
<project-number>ISO 1000</project-number>
|
565
|
+
</structuredidentifier>
|
566
|
+
<stagename>International standard</stagename>
|
567
|
+
</ext>
|
568
|
+
</bibdata>
|
569
|
+
<sections/>
|
570
|
+
</iso-standard>
|
571
|
+
OUTPUT
|
572
|
+
end
|
573
|
+
|
574
|
+
it "populates metadata for PRF" do
|
575
|
+
output = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
|
576
|
+
= Document title
|
577
|
+
Author
|
578
|
+
:docfile: test.adoc
|
579
|
+
:nodoc:
|
580
|
+
:novalid:
|
581
|
+
:no-isobib:
|
582
|
+
:docnumber: 1000
|
583
|
+
:docstage: 60
|
584
|
+
:docsubstage: 00
|
585
|
+
INPUT
|
586
|
+
expect(xmlpp(output.sub(%r{<boilerplate>.*</boilerplate>}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
587
|
+
<iso-standard xmlns="https://www.metanorma.org/ns/iso" type="semantic" version="#{Metanorma::ISO::VERSION}">
|
588
|
+
<bibdata type="standard">
|
589
|
+
<docidentifier type="ISO">ISO 1000</docidentifier>
|
590
|
+
<docidentifier type='iso-with-lang'>ISO 1000(E)</docidentifier>
|
591
|
+
<docidentifier type='iso-reference'>ISO 1000(E)</docidentifier>
|
592
|
+
<docnumber>1000</docnumber>
|
593
|
+
<contributor>
|
594
|
+
<role type="author"/>
|
595
|
+
<organization>
|
596
|
+
<name>International Organization for Standardization</name>
|
597
|
+
<abbreviation>ISO</abbreviation>
|
598
|
+
</organization>
|
599
|
+
</contributor>
|
600
|
+
<contributor>
|
601
|
+
<role type="publisher"/>
|
602
|
+
<organization>
|
603
|
+
<name>International Organization for Standardization</name>
|
604
|
+
<abbreviation>ISO</abbreviation>
|
605
|
+
</organization>
|
606
|
+
</contributor>
|
607
|
+
|
608
|
+
<language>en</language>
|
609
|
+
<script>Latn</script>
|
610
|
+
<status>
|
611
|
+
<stage abbreviation="PRF">60</stage>
|
612
|
+
<substage>00</substage>
|
613
|
+
</status>
|
614
|
+
<copyright>
|
615
|
+
<from>#{Date.today.year}</from>
|
616
|
+
<owner>
|
617
|
+
<organization>
|
618
|
+
<name>International Organization for Standardization</name>
|
619
|
+
<abbreviation>ISO</abbreviation>
|
620
|
+
</organization>
|
621
|
+
</owner>
|
622
|
+
</copyright>
|
623
|
+
<ext>
|
624
|
+
<doctype>article</doctype>
|
625
|
+
<editorialgroup>
|
626
|
+
<technical-committee/>
|
627
|
+
<subcommittee/>
|
628
|
+
<workgroup/>
|
629
|
+
</editorialgroup>
|
630
|
+
<structuredidentifier>
|
631
|
+
<project-number>ISO 1000</project-number>
|
632
|
+
</structuredidentifier>
|
633
|
+
<stagename>Proof</stagename>
|
634
|
+
</ext>
|
635
|
+
</bibdata>
|
636
|
+
<sections/>
|
637
|
+
</iso-standard>
|
638
|
+
OUTPUT
|
639
|
+
end
|
640
|
+
|
641
|
+
it "reads scripts into blank HTML document" do
|
642
|
+
Asciidoctor.convert(<<~"INPUT", *OPTIONS)
|
643
|
+
= Document title
|
644
|
+
Author
|
645
|
+
:docfile: test.adoc
|
646
|
+
:novalid:
|
647
|
+
:no-isobib:
|
648
|
+
:no-pdf:
|
649
|
+
INPUT
|
650
|
+
html = File.read("test.html", encoding: "utf-8")
|
651
|
+
expect(html).to match(%r{<script>})
|
652
|
+
end
|
653
|
+
|
654
|
+
it "uses default fonts" do
|
655
|
+
Asciidoctor.convert(<<~"INPUT", *OPTIONS)
|
656
|
+
= Document title
|
657
|
+
Author
|
658
|
+
:docfile: test.adoc
|
659
|
+
:novalid:
|
660
|
+
:no-isobib:
|
661
|
+
:no-pdf:
|
662
|
+
INPUT
|
663
|
+
html = File.read("test.html", encoding: "utf-8")
|
664
|
+
expect(html).to match(%r[\bpre[^{]+\{[^{]+font-family: "Courier New", monospace;]m)
|
665
|
+
expect(html).to match(%r[blockquote[^{]+\{[^{]+font-family: "Cambria", serif;]m)
|
666
|
+
expect(html).to match(%r[\.h2Annex[^{]+\{[^{]+font-family: "Cambria", serif;]m)
|
667
|
+
end
|
668
|
+
|
669
|
+
it "uses default fonts for alt doc" do
|
670
|
+
Asciidoctor.convert(<<~"INPUT", *OPTIONS)
|
671
|
+
= Document title
|
672
|
+
Author
|
673
|
+
:docfile: test.adoc
|
674
|
+
:novalid:
|
675
|
+
:no-isobib:
|
676
|
+
:no-pdf:
|
677
|
+
INPUT
|
678
|
+
html = File.read("test_alt.html", encoding: "utf-8")
|
679
|
+
expect(html).to match(%r[\bpre[^{]+\{[^{]+font-family: "Space Mono", monospace;]m)
|
680
|
+
expect(html).to match(%r[blockquote[^{]+\{[^{]+font-family: "Lato", sans-serif;]m)
|
681
|
+
expect(html).to match(%r[\.h2Annex[^{]+\{[^{]+font-family: "Lato", sans-serif;]m)
|
682
|
+
end
|
683
|
+
|
684
|
+
it "uses Chinese fonts" do
|
685
|
+
Asciidoctor.convert(<<~"INPUT", *OPTIONS)
|
686
|
+
= Document title
|
687
|
+
Author
|
688
|
+
:docfile: test.adoc
|
689
|
+
:novalid:
|
690
|
+
:no-isobib:
|
691
|
+
:script: Hans
|
692
|
+
:no-pdf:
|
693
|
+
INPUT
|
694
|
+
html = File.read("test.html", encoding: "utf-8")
|
695
|
+
expect(html).to match(%r[\bpre[^{]+\{[^{]+font-family: "Courier New", monospace;]m)
|
696
|
+
expect(html).to match(%r[blockquote[^{]+\{[^{]+font-family: "Source Han Sans", serif;]m)
|
697
|
+
expect(html).to match(%r[\.h2Annex[^{]+\{[^{]+font-family: "Source Han Sans", sans-serif;]m)
|
698
|
+
end
|
699
|
+
|
700
|
+
it "uses specified fonts" do
|
701
|
+
Asciidoctor.convert(<<~"INPUT", *OPTIONS)
|
702
|
+
= Document title
|
703
|
+
Author
|
704
|
+
:docfile: test.adoc
|
705
|
+
:novalid:
|
706
|
+
:no-isobib:
|
707
|
+
:script: Hans
|
708
|
+
:body-font: Zapf Chancery
|
709
|
+
:header-font: Comic Sans
|
710
|
+
:monospace-font: Andale Mono
|
711
|
+
:no-pdf:
|
712
|
+
INPUT
|
713
|
+
html = File.read("test.html", encoding: "utf-8")
|
714
|
+
expect(html).to match(%r[\bpre[^{]+\{[^{]+font-family: Andale Mono;]m)
|
715
|
+
expect(html).to match(%r[blockquote[^{]+\{[^{]+font-family: Zapf Chancery;]m)
|
716
|
+
expect(html).to match(%r[\.h2Annex[^{]+\{[^{]+font-family: Comic Sans;]m)
|
717
|
+
end
|
718
|
+
|
719
|
+
it "strips MS-specific CSS" do
|
720
|
+
Asciidoctor.convert(<<~"INPUT", *OPTIONS)
|
721
|
+
= Document title
|
722
|
+
Author
|
723
|
+
:docfile: test.adoc
|
724
|
+
:novalid:
|
725
|
+
:no-isobib:
|
726
|
+
:no-pdf:
|
727
|
+
INPUT
|
728
|
+
word = File.read("test.doc", encoding: "utf-8")
|
729
|
+
html = File.read("test.html", encoding: "utf-8")
|
730
|
+
expect(word).to match(%r[mso-style-name: "Intro Title";]m)
|
731
|
+
expect(html).not_to match(%r[mso-style-name: "Intro Title";]m)
|
732
|
+
end
|
733
|
+
end
|