metanorma-iso 1.6.0 → 1.7.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +16 -29
  3. data/.rubocop.yml +0 -4
  4. data/lib/asciidoctor/iso/base.rb +13 -13
  5. data/lib/asciidoctor/iso/basicdoc.rng +5 -3
  6. data/lib/asciidoctor/iso/cleanup.rb +1 -1
  7. data/lib/asciidoctor/iso/front.rb +5 -5
  8. data/lib/asciidoctor/iso/isodoc.rng +134 -5
  9. data/lib/asciidoctor/iso/isostandard-amd.rng +11 -4
  10. data/lib/asciidoctor/iso/isostandard.rng +33 -107
  11. data/lib/asciidoctor/iso/validate.rb +79 -0
  12. data/lib/asciidoctor/iso/validate_section.rb +12 -9
  13. data/lib/isodoc/iso/base_convert.rb +11 -0
  14. data/lib/isodoc/iso/html/header.html +12 -12
  15. data/lib/isodoc/iso/html/html_iso_intro.html +1 -1
  16. data/lib/isodoc/iso/html/html_iso_titlepage.html +1 -1
  17. data/lib/isodoc/iso/html/word_iso_intro.html +1 -1
  18. data/lib/isodoc/iso/html/word_iso_titlepage.html +1 -1
  19. data/lib/isodoc/iso/html_convert.rb +2 -2
  20. data/lib/isodoc/iso/i18n-en.yaml +6 -0
  21. data/lib/isodoc/iso/i18n-fr.yaml +4 -0
  22. data/lib/isodoc/iso/i18n-zh-Hans.yaml +4 -0
  23. data/lib/isodoc/iso/index.rb +139 -0
  24. data/lib/isodoc/iso/iso.amendment.xsl +1006 -317
  25. data/lib/isodoc/iso/iso.international-standard.xsl +1006 -317
  26. data/lib/isodoc/iso/presentation_xml_convert.rb +1 -4
  27. data/lib/isodoc/iso/sections.rb +1 -1
  28. data/lib/isodoc/iso/word_convert.rb +2 -2
  29. data/lib/isodoc/iso/xref.rb +33 -12
  30. data/lib/metanorma/iso/version.rb +1 -1
  31. data/metanorma-iso.gemspec +3 -3
  32. data/spec/asciidoctor/amd_spec.rb +696 -0
  33. data/spec/asciidoctor/base_spec.rb +704 -0
  34. data/spec/asciidoctor/blocks_spec.rb +527 -0
  35. data/spec/asciidoctor/cleanup_spec.rb +1134 -0
  36. data/spec/asciidoctor/inline_spec.rb +195 -0
  37. data/spec/asciidoctor/lists_spec.rb +197 -0
  38. data/spec/asciidoctor/refs_spec.rb +375 -0
  39. data/spec/asciidoctor/section_spec.rb +393 -0
  40. data/spec/asciidoctor/table_spec.rb +329 -0
  41. data/spec/asciidoctor/validate_spec.rb +1555 -0
  42. data/spec/isodoc/amd_spec.rb +967 -946
  43. data/spec/isodoc/blocks_spec.rb +530 -507
  44. data/spec/isodoc/i18n_spec.rb +953 -911
  45. data/spec/isodoc/inline_spec.rb +355 -293
  46. data/spec/isodoc/iso_spec.rb +340 -316
  47. data/spec/isodoc/metadata_spec.rb +392 -382
  48. data/spec/isodoc/postproc_spec.rb +834 -656
  49. data/spec/isodoc/ref_spec.rb +374 -331
  50. data/spec/isodoc/section_spec.rb +821 -519
  51. data/spec/isodoc/table_spec.rb +472 -411
  52. data/spec/isodoc/terms_spec.rb +209 -185
  53. data/spec/isodoc/xref_spec.rb +1370 -1236
  54. data/spec/metanorma/processor_spec.rb +28 -26
  55. data/spec/spec_helper.rb +184 -189
  56. metadata +22 -23
  57. data/.rubocop.ribose.yml +0 -66
  58. data/spec/asciidoctor-iso/amd_spec.rb +0 -694
  59. data/spec/asciidoctor-iso/base_spec.rb +0 -713
  60. data/spec/asciidoctor-iso/blocks_spec.rb +0 -482
  61. data/spec/asciidoctor-iso/cleanup_spec.rb +0 -1025
  62. data/spec/asciidoctor-iso/inline_spec.rb +0 -170
  63. data/spec/asciidoctor-iso/lists_spec.rb +0 -190
  64. data/spec/asciidoctor-iso/refs_spec.rb +0 -317
  65. data/spec/asciidoctor-iso/section_spec.rb +0 -362
  66. data/spec/asciidoctor-iso/table_spec.rb +0 -313
  67. data/spec/asciidoctor-iso/validate_spec.rb +0 -1251
  68. data/spec/assets/xref_error.adoc +0 -7
@@ -0,0 +1,704 @@
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
+ </organization>
242
+ </contributor>
243
+ <contributor>
244
+ <role type="publisher"/>
245
+ <organization>
246
+ <name>IETF</name>
247
+ </organization>
248
+ </contributor>
249
+ <contributor>
250
+ <role type="publisher"/>
251
+ <organization>
252
+ <name>International Organization for Standardization</name>
253
+ <abbreviation>ISO</abbreviation>
254
+ </organization>
255
+ </contributor>
256
+ <language>el</language>
257
+ <script>Grek</script>
258
+ <status>
259
+ <stage abbreviation="IS">60</stage>
260
+ <substage>60</substage>
261
+ </status>
262
+ <copyright>
263
+ <from>2001</from>
264
+ <owner>
265
+ <organization>
266
+ <name>International Organization for Standardization</name>
267
+ <abbreviation>ISO</abbreviation>
268
+ </organization>
269
+ </owner>
270
+ </copyright>
271
+ <copyright>
272
+ <from>2001</from>
273
+ <owner>
274
+ <organization>
275
+ <name>IETF</name>
276
+ </organization>
277
+ </owner>
278
+ </copyright>
279
+ <ext>
280
+ <doctype>technical-report</doctype>
281
+ <editorialgroup>
282
+ <technical-committee/>
283
+ <subcommittee/>
284
+ <workgroup/>
285
+ </editorialgroup>
286
+ <structuredidentifier>
287
+ <project-number part="1" subpart="1">ISO/IEC/IETF 1000</project-number>
288
+ </structuredidentifier>
289
+ <stagename>International standard</stagename>
290
+ </ext>
291
+ </bibdata>
292
+ <sections/>
293
+ </iso-standard>
294
+ OUTPUT
295
+ end
296
+
297
+ it "processes subdivisions" do
298
+ output = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
299
+ = Document title
300
+ Author
301
+ :docfile: test.adoc
302
+ :nodoc:
303
+ :novalid:
304
+ :revdate: 2000-01
305
+ :published-date: 1000-01
306
+ :docnumber: 1000
307
+ :partnumber: 1-1
308
+ :tc-docnumber: 2000
309
+ :language: el
310
+ :script: Grek
311
+ :subdivision: Subdivision
312
+ :subdivision-abbr: SD
313
+ :doctype: This is a DocType
314
+ :pub-address: 1 Infinity Loop + \\
315
+ California
316
+ :pub-phone: 3333333
317
+ :pub-fax: 4444444
318
+ :pub-email: x@example.com
319
+ :pub-uri: http://www.example.com
320
+ INPUT
321
+ expect(xmlpp(strip_guid(output.sub(%r{<boilerplate>.*</boilerplate>}m, ""))))
322
+ .to be_equivalent_to xmlpp(<<~"OUTPUT")
323
+ <iso-standard xmlns="https://www.metanorma.org/ns/iso" type="semantic" version="#{Metanorma::ISO::VERSION}">
324
+ <bibdata type='standard'>
325
+ <docidentifier type='ISO'>SD 1000-1-1</docidentifier>
326
+ <docidentifier type='iso-with-lang'>SD 1000-1-1(X)</docidentifier>
327
+ <docidentifier type='iso-reference'>SD 1000-1-1(X)</docidentifier>
328
+ <docidentifier type='iso-tc'>2000</docidentifier>
329
+ <docnumber>1000</docnumber>
330
+ <date type='published'>
331
+ <on>1000-01</on>
332
+ </date>
333
+ <contributor>
334
+ <role type='author'/>
335
+ <organization>
336
+ <name>International Organization for Standardization</name>
337
+ <subdivision>Subdivision</subdivision>
338
+ <abbreviation>SD</abbreviation>
339
+ <address>
340
+ <formattedAddress>1 Infinity Loop <br/>California</formattedAddress>
341
+ </address>
342
+ <phone>3333333</phone>
343
+ <phone type='fax'>4444444</phone>
344
+ <email>x@example.com</email>
345
+ <uri>http://www.example.com</uri>
346
+ </organization>
347
+ </contributor>
348
+ <contributor>
349
+ <role type='publisher'/>
350
+ <organization>
351
+ <name>International Organization for Standardization</name>
352
+ <subdivision>Subdivision</subdivision>
353
+ <abbreviation>SD</abbreviation>
354
+ <address>
355
+ <formattedAddress>1 Infinity Loop <br/>California</formattedAddress>
356
+ </address>
357
+ <phone>3333333</phone>
358
+ <phone type='fax'>4444444</phone>
359
+ <email>x@example.com</email>
360
+ <uri>http://www.example.com</uri>
361
+ </organization>
362
+ </contributor>
363
+ <version>
364
+ <revision-date>2000-01</revision-date>
365
+ </version>
366
+ <language>el</language>
367
+ <script>Grek</script>
368
+ <status>
369
+ <stage abbreviation='IS'>60</stage>
370
+ <substage>60</substage>
371
+ </status>
372
+ <copyright>
373
+ <from>#{Time.now.year}</from>
374
+ <owner>
375
+ <organization>
376
+ <name>International Organization for Standardization</name>
377
+ <subdivision>Subdivision</subdivision>
378
+ <abbreviation>SD</abbreviation>
379
+ <address>
380
+ <formattedAddress>1 Infinity Loop
381
+ <br/>
382
+ California</formattedAddress>
383
+ </address>
384
+ <phone>3333333</phone>
385
+ <phone type="fax">4444444</phone>
386
+ <email>x@example.com</email>
387
+ <uri>http://www.example.com</uri>
388
+ </organization>
389
+ </owner>
390
+ </copyright>
391
+ <ext>
392
+ <doctype>this-is-a-doctype</doctype>
393
+ <editorialgroup>
394
+ <technical-committee/>
395
+ <subcommittee/>
396
+ <workgroup/>
397
+ </editorialgroup>
398
+ <structuredidentifier>
399
+ <project-number part="1" subpart="1">SD 1000</project-number>
400
+ </structuredidentifier>
401
+ <stagename>International standard</stagename>
402
+ </ext>
403
+ </bibdata>
404
+ <sections> </sections>
405
+ </iso-standard>
406
+ OUTPUT
407
+ end
408
+
409
+ it "defaults substage, defines iteration on stage 50, gives stage 50 on technical specification" do
410
+ output = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
411
+ = Document title
412
+ Author
413
+ :docfile: test.adoc
414
+ :nodoc:
415
+ :novalid:
416
+ :no-isobib:
417
+ :docnumber: 1000
418
+ :docstage: 50
419
+ :language: fr
420
+ :doctype: technical-specification
421
+ :iteration: 2
422
+ INPUT
423
+ expect(xmlpp(output.sub(%r{<boilerplate>.*</boilerplate>}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
424
+ <iso-standard type="semantic" version="#{Metanorma::ISO::VERSION}" xmlns="https://www.metanorma.org/ns/iso">
425
+ <bibdata type="standard">
426
+ <docidentifier type="ISO">ISO/DTS 1000.2</docidentifier>
427
+ <docidentifier type="iso-with-lang">ISO/DTS 1000.2(F)</docidentifier>
428
+ <docidentifier type="iso-reference">ISO/DTS 1000.2(F)</docidentifier>
429
+ <docnumber>1000</docnumber>
430
+ <contributor>
431
+ <role type="author"/>
432
+ <organization>
433
+ <name>International Organization for Standardization</name>
434
+ <abbreviation>ISO</abbreviation>
435
+ </organization>
436
+ </contributor>
437
+ <contributor>
438
+ <role type="publisher"/>
439
+ <organization>
440
+ <name>International Organization for Standardization</name>
441
+ <abbreviation>ISO</abbreviation>
442
+ </organization>
443
+ </contributor>
444
+ <language>fr</language>
445
+ <script>Latn</script>
446
+ <status>
447
+ <stage abbreviation="D">50</stage>
448
+ <substage>00</substage>
449
+ <iteration>2</iteration>
450
+ </status>
451
+ <copyright>
452
+ <from>#{Date.today.year}</from>
453
+ <owner>
454
+ <organization>
455
+ <name>International Organization for Standardization</name>
456
+ <abbreviation>ISO</abbreviation>
457
+ </organization>
458
+ </owner>
459
+ </copyright>
460
+ <ext>
461
+ <doctype>technical-specification</doctype>
462
+ <editorialgroup>
463
+ <technical-committee/>
464
+ <subcommittee/>
465
+ <workgroup/>
466
+ </editorialgroup>
467
+ <structuredidentifier>
468
+ <project-number>ISO 1000</project-number>
469
+ </structuredidentifier>
470
+ <stagename>Final draft</stagename>
471
+ </ext>
472
+ </bibdata>
473
+ <sections/>
474
+ </iso-standard>
475
+ OUTPUT
476
+ end
477
+
478
+ it "defaults substage for stage 60" do
479
+ output = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
480
+ = Document title
481
+ Author
482
+ :docfile: test.adoc
483
+ :nodoc:
484
+ :novalid:
485
+ :no-isobib:
486
+ :docnumber: 1000
487
+ :docstage: 60
488
+ INPUT
489
+
490
+ expect(xmlpp(output.sub(%r{<boilerplate>.*</boilerplate>}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
491
+ <iso-standard xmlns="https://www.metanorma.org/ns/iso" type="semantic" version="#{Metanorma::ISO::VERSION}">
492
+ <bibdata type="standard">
493
+ <docidentifier type="ISO">ISO 1000</docidentifier>
494
+ <docidentifier type='iso-with-lang'>ISO 1000(E)</docidentifier>
495
+ <docidentifier type='iso-reference'>ISO 1000(E)</docidentifier>
496
+ <docnumber>1000</docnumber>
497
+ <contributor>
498
+ <role type="author"/>
499
+ <organization>
500
+ <name>International Organization for Standardization</name>
501
+ <abbreviation>ISO</abbreviation>
502
+ </organization>
503
+ </contributor>
504
+ <contributor>
505
+ <role type="publisher"/>
506
+ <organization>
507
+ <name>International Organization for Standardization</name>
508
+ <abbreviation>ISO</abbreviation>
509
+ </organization>
510
+ </contributor>
511
+
512
+ <language>en</language>
513
+ <script>Latn</script>
514
+ <status>
515
+ <stage abbreviation="IS">60</stage>
516
+ <substage>60</substage>
517
+ </status>
518
+ <copyright>
519
+ <from>#{Date.today.year}</from>
520
+ <owner>
521
+ <organization>
522
+ <name>International Organization for Standardization</name>
523
+ <abbreviation>ISO</abbreviation>
524
+ </organization>
525
+ </owner>
526
+ </copyright>
527
+ <ext>
528
+ <doctype>article</doctype>
529
+ <editorialgroup>
530
+ <technical-committee/>
531
+ <subcommittee/>
532
+ <workgroup/>
533
+ </editorialgroup>
534
+ <structuredidentifier>
535
+ <project-number>ISO 1000</project-number>
536
+ </structuredidentifier>
537
+ <stagename>International standard</stagename>
538
+ </ext>
539
+ </bibdata>
540
+ <sections/>
541
+ </iso-standard>
542
+ OUTPUT
543
+ end
544
+
545
+ it "populates metadata for PRF" do
546
+ output = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
547
+ = Document title
548
+ Author
549
+ :docfile: test.adoc
550
+ :nodoc:
551
+ :novalid:
552
+ :no-isobib:
553
+ :docnumber: 1000
554
+ :docstage: 60
555
+ :docsubstage: 00
556
+ INPUT
557
+ expect(xmlpp(output.sub(%r{<boilerplate>.*</boilerplate>}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
558
+ <iso-standard xmlns="https://www.metanorma.org/ns/iso" type="semantic" version="#{Metanorma::ISO::VERSION}">
559
+ <bibdata type="standard">
560
+ <docidentifier type="ISO">ISO 1000</docidentifier>
561
+ <docidentifier type='iso-with-lang'>ISO 1000(E)</docidentifier>
562
+ <docidentifier type='iso-reference'>ISO 1000(E)</docidentifier>
563
+ <docnumber>1000</docnumber>
564
+ <contributor>
565
+ <role type="author"/>
566
+ <organization>
567
+ <name>International Organization for Standardization</name>
568
+ <abbreviation>ISO</abbreviation>
569
+ </organization>
570
+ </contributor>
571
+ <contributor>
572
+ <role type="publisher"/>
573
+ <organization>
574
+ <name>International Organization for Standardization</name>
575
+ <abbreviation>ISO</abbreviation>
576
+ </organization>
577
+ </contributor>
578
+
579
+ <language>en</language>
580
+ <script>Latn</script>
581
+ <status>
582
+ <stage abbreviation="PRF">60</stage>
583
+ <substage>00</substage>
584
+ </status>
585
+ <copyright>
586
+ <from>#{Date.today.year}</from>
587
+ <owner>
588
+ <organization>
589
+ <name>International Organization for Standardization</name>
590
+ <abbreviation>ISO</abbreviation>
591
+ </organization>
592
+ </owner>
593
+ </copyright>
594
+ <ext>
595
+ <doctype>article</doctype>
596
+ <editorialgroup>
597
+ <technical-committee/>
598
+ <subcommittee/>
599
+ <workgroup/>
600
+ </editorialgroup>
601
+ <structuredidentifier>
602
+ <project-number>ISO 1000</project-number>
603
+ </structuredidentifier>
604
+ <stagename>Proof</stagename>
605
+ </ext>
606
+ </bibdata>
607
+ <sections/>
608
+ </iso-standard>
609
+ OUTPUT
610
+ end
611
+
612
+ it "reads scripts into blank HTML document" do
613
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
614
+ = Document title
615
+ Author
616
+ :docfile: test.adoc
617
+ :novalid:
618
+ :no-isobib:
619
+ :no-pdf:
620
+ INPUT
621
+ html = File.read("test.html", encoding: "utf-8")
622
+ expect(html).to match(%r{<script>})
623
+ end
624
+
625
+ it "uses default fonts" do
626
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
627
+ = Document title
628
+ Author
629
+ :docfile: test.adoc
630
+ :novalid:
631
+ :no-isobib:
632
+ :no-pdf:
633
+ INPUT
634
+ html = File.read("test.html", encoding: "utf-8")
635
+ expect(html).to match(%r[\bpre[^{]+\{[^{]+font-family: "Courier New", monospace;]m)
636
+ expect(html).to match(%r[blockquote[^{]+\{[^{]+font-family: "Cambria", serif;]m)
637
+ expect(html).to match(%r[\.h2Annex[^{]+\{[^{]+font-family: "Cambria", serif;]m)
638
+ end
639
+
640
+ it "uses default fonts for alt doc" do
641
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
642
+ = Document title
643
+ Author
644
+ :docfile: test.adoc
645
+ :novalid:
646
+ :no-isobib:
647
+ :no-pdf:
648
+ INPUT
649
+ html = File.read("test_alt.html", encoding: "utf-8")
650
+ expect(html).to match(%r[\bpre[^{]+\{[^{]+font-family: "Space Mono", monospace;]m)
651
+ expect(html).to match(%r[blockquote[^{]+\{[^{]+font-family: "Lato", sans-serif;]m)
652
+ expect(html).to match(%r[\.h2Annex[^{]+\{[^{]+font-family: "Lato", sans-serif;]m)
653
+ end
654
+
655
+ it "uses Chinese fonts" do
656
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
657
+ = Document title
658
+ Author
659
+ :docfile: test.adoc
660
+ :novalid:
661
+ :no-isobib:
662
+ :script: Hans
663
+ :no-pdf:
664
+ INPUT
665
+ html = File.read("test.html", encoding: "utf-8")
666
+ expect(html).to match(%r[\bpre[^{]+\{[^{]+font-family: "Courier New", monospace;]m)
667
+ expect(html).to match(%r[blockquote[^{]+\{[^{]+font-family: "Source Han Sans", serif;]m)
668
+ expect(html).to match(%r[\.h2Annex[^{]+\{[^{]+font-family: "Source Han Sans", sans-serif;]m)
669
+ end
670
+
671
+ it "uses specified fonts" do
672
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
673
+ = Document title
674
+ Author
675
+ :docfile: test.adoc
676
+ :novalid:
677
+ :no-isobib:
678
+ :script: Hans
679
+ :body-font: Zapf Chancery
680
+ :header-font: Comic Sans
681
+ :monospace-font: Andale Mono
682
+ :no-pdf:
683
+ INPUT
684
+ html = File.read("test.html", encoding: "utf-8")
685
+ expect(html).to match(%r[\bpre[^{]+\{[^{]+font-family: Andale Mono;]m)
686
+ expect(html).to match(%r[blockquote[^{]+\{[^{]+font-family: Zapf Chancery;]m)
687
+ expect(html).to match(%r[\.h2Annex[^{]+\{[^{]+font-family: Comic Sans;]m)
688
+ end
689
+
690
+ it "strips MS-specific CSS" do
691
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
692
+ = Document title
693
+ Author
694
+ :docfile: test.adoc
695
+ :novalid:
696
+ :no-isobib:
697
+ :no-pdf:
698
+ INPUT
699
+ word = File.read("test.doc", encoding: "utf-8")
700
+ html = File.read("test.html", encoding: "utf-8")
701
+ expect(word).to match(%r[mso-style-name: "Intro Title";]m)
702
+ expect(html).not_to match(%r[mso-style-name: "Intro Title";]m)
703
+ end
704
+ end