metanorma-iso 1.10.4 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +3 -33
  3. data/.github/workflows/ubuntu.yml +1 -1
  4. data/.gitignore +26 -0
  5. data/Makefile +1 -1
  6. data/lib/asciidoctor/iso/base.rb +2 -69
  7. data/lib/asciidoctor/iso/cleanup.rb +2 -175
  8. data/lib/asciidoctor/iso/converter.rb +2 -17
  9. data/lib/asciidoctor/iso/deprecated.rb +5 -0
  10. data/lib/asciidoctor/iso/front.rb +2 -156
  11. data/lib/asciidoctor/iso/front_id.rb +2 -221
  12. data/lib/asciidoctor/iso/section.rb +2 -48
  13. data/lib/asciidoctor/iso/validate.rb +2 -171
  14. data/lib/asciidoctor/iso/validate_image.rb +2 -96
  15. data/lib/asciidoctor/iso/validate_requirements.rb +2 -110
  16. data/lib/asciidoctor/iso/validate_section.rb +2 -246
  17. data/lib/asciidoctor/iso/validate_style.rb +2 -169
  18. data/lib/asciidoctor/iso/validate_title.rb +2 -104
  19. data/lib/isodoc/iso/base_convert.rb +14 -31
  20. data/lib/isodoc/iso/html/style-human.css +37 -22
  21. data/lib/isodoc/iso/html/style-human.scss +17 -10
  22. data/lib/isodoc/iso/html/style-iso.css +34 -20
  23. data/lib/isodoc/iso/html/style-iso.scss +13 -7
  24. data/lib/isodoc/iso/html/wordstyle.css +10 -8
  25. data/lib/isodoc/iso/html/wordstyle.scss +10 -8
  26. data/lib/isodoc/iso/html_convert.rb +6 -4
  27. data/lib/isodoc/iso/index.rb +53 -45
  28. data/lib/isodoc/iso/iso.amendment.xsl +1328 -1225
  29. data/lib/isodoc/iso/iso.international-standard.xsl +1328 -1225
  30. data/lib/isodoc/iso/metadata.rb +27 -22
  31. data/lib/isodoc/iso/presentation_xml_convert.rb +41 -16
  32. data/lib/isodoc/iso/sts_convert.rb +2 -4
  33. data/lib/isodoc/iso/word_convert.rb +2 -0
  34. data/lib/metanorma/iso/base.rb +70 -0
  35. data/lib/{asciidoctor → metanorma}/iso/basicdoc.rng +0 -0
  36. data/lib/{asciidoctor → metanorma}/iso/biblio.rng +0 -0
  37. data/lib/{asciidoctor → metanorma}/iso/boilerplate-fr.xml +0 -0
  38. data/lib/{asciidoctor → metanorma}/iso/boilerplate.xml +0 -0
  39. data/lib/metanorma/iso/cleanup.rb +176 -0
  40. data/lib/metanorma/iso/converter.rb +18 -0
  41. data/lib/metanorma/iso/front.rb +170 -0
  42. data/lib/metanorma/iso/front_id.rb +225 -0
  43. data/lib/{asciidoctor → metanorma}/iso/isodoc.rng +35 -2
  44. data/lib/{asciidoctor → metanorma}/iso/isostandard-amd.rng +0 -0
  45. data/lib/{asciidoctor → metanorma}/iso/isostandard.rnc +0 -0
  46. data/lib/{asciidoctor → metanorma}/iso/isostandard.rng +0 -0
  47. data/lib/{asciidoctor → metanorma}/iso/reqt.rng +0 -0
  48. data/lib/metanorma/iso/section.rb +49 -0
  49. data/lib/metanorma/iso/validate.rb +172 -0
  50. data/lib/metanorma/iso/validate_image.rb +97 -0
  51. data/lib/metanorma/iso/validate_requirements.rb +111 -0
  52. data/lib/metanorma/iso/validate_section.rb +247 -0
  53. data/lib/metanorma/iso/validate_style.rb +170 -0
  54. data/lib/metanorma/iso/validate_title.rb +105 -0
  55. data/lib/metanorma/iso/version.rb +1 -1
  56. data/lib/metanorma-iso.rb +1 -1
  57. data/metanorma-iso.gemspec +2 -2
  58. data/spec/isodoc/amd_spec.rb +261 -250
  59. data/spec/isodoc/inline_spec.rb +238 -212
  60. data/spec/isodoc/iso_spec.rb +3 -1
  61. data/spec/isodoc/ref_spec.rb +4 -2
  62. data/spec/isodoc/section_spec.rb +1 -1
  63. data/spec/isodoc/terms_spec.rb +4 -4
  64. data/spec/{asciidoctor → metanorma}/amd_spec.rb +1 -1
  65. data/spec/metanorma/base_spec.rb +1185 -0
  66. data/spec/{asciidoctor → metanorma}/blank_spec.rb +1 -1
  67. data/spec/{asciidoctor → metanorma}/blocks_spec.rb +1 -1
  68. data/spec/{asciidoctor → metanorma}/cleanup_spec.rb +1 -1
  69. data/spec/{asciidoctor → metanorma}/inline_spec.rb +1 -1
  70. data/spec/{asciidoctor → metanorma}/lists_spec.rb +1 -1
  71. data/spec/metanorma/processor_spec.rb +1 -1
  72. data/spec/{asciidoctor → metanorma}/refs_spec.rb +1 -1
  73. data/spec/{asciidoctor → metanorma}/section_spec.rb +1 -1
  74. data/spec/{asciidoctor → metanorma}/table_spec.rb +1 -1
  75. data/spec/{asciidoctor → metanorma}/validate_spec.rb +1 -1
  76. data/spec/spec_helper.rb +1 -1
  77. data/spec/vcr_cassettes/docrels.yml +34 -424
  78. metadata +39 -26
  79. data/spec/asciidoctor/base_spec.rb +0 -1333
@@ -0,0 +1,1185 @@
1
+ require "spec_helper"
2
+
3
+ RSpec.describe Metanorma::ISO do
4
+ it "has a version number" do
5
+ expect(Metanorma::ISO::VERSION).not_to be nil
6
+ end
7
+
8
+ it "processes default metadata" do
9
+ output = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
10
+ = Document title
11
+ Author
12
+ :docfile: test.adoc
13
+ :nodoc:
14
+ :novalid:
15
+ :no-isobib:
16
+ :docnumber: 1000
17
+ :partnumber: 1
18
+ :edition: 2
19
+ :revdate: 2000-01-01
20
+ :draft: 0.3.4
21
+ :technical-committee: TC
22
+ :technical-committee-number: 1
23
+ :technical-committee-type: A
24
+ :subcommittee: SC
25
+ :subcommittee-number: 2
26
+ :subcommittee-type: B
27
+ :workgroup: WG
28
+ :workgroup-number: 3
29
+ :workgroup-type: C
30
+ :technical-committee_2: TC1
31
+ :technical-committee-number_2: 11
32
+ :technical-committee-type_2: A1
33
+ :subcommittee_2: SC1
34
+ :subcommittee-number_2: 21
35
+ :subcommittee-type_2: B1
36
+ :workgroup_2: WG1
37
+ :workgroup-number_2: 31
38
+ :workgroup-type_2: C1
39
+ :secretariat: SECRETARIAT
40
+ :docstage: 20
41
+ :docsubstage: 20
42
+ :iteration: 3
43
+ :language: en
44
+ :title-intro-en: Introduction
45
+ :title-main-en: Main Title -- Title
46
+ :title-part-en: Title Part
47
+ :title-intro-fr: Introduction Française
48
+ :title-main-fr: Titre Principal
49
+ :title-part-fr: Part du Titre
50
+ :library-ics: 1,2,3
51
+ :copyright-year: 2000
52
+ :horizontal: true
53
+ INPUT
54
+ expect(xmlpp(output.sub(%r{<boilerplate>.*</boilerplate>}m, "")))
55
+ .to be_equivalent_to xmlpp(<<~"OUTPUT")
56
+ <?xml version="1.0" encoding="UTF-8"?>
57
+ <iso-standard type="semantic" version="#{Metanorma::ISO::VERSION}" xmlns="https://www.metanorma.org/ns/iso">
58
+ <bibdata type="standard">
59
+ <title format="text/plain" language="en" type="main">Introduction — Main Title — Title — Title Part</title>
60
+ <title format="text/plain" language="en" type="title-intro">Introduction</title>
61
+ <title format="text/plain" language="en" type="title-main">Main Title — Title</title>
62
+ <title format="text/plain" language="en" type="title-part">Title Part</title>
63
+ <title format="text/plain" language="fr" type="main">Introduction Française — Titre Principal — Part du Titre</title>
64
+ <title format="text/plain" language="fr" type="title-intro">Introduction Française</title>
65
+ <title format="text/plain" language="fr" type="title-main">Titre Principal</title>
66
+ <title format="text/plain" language="fr" type="title-part">Part du Titre</title>
67
+ <docidentifier type="ISO">ISO/PreWD3 1000-1</docidentifier>
68
+ <docidentifier type="iso-with-lang">ISO/PreWD3 1000-1(E)</docidentifier>
69
+ <docidentifier type="iso-reference">ISO/PreWD3 1000-1:2000(E)</docidentifier>
70
+ <docnumber>1000</docnumber>
71
+ <contributor>
72
+ <role type="author"/>
73
+ <organization>
74
+ <name>International Organization for Standardization</name>
75
+ <abbreviation>ISO</abbreviation>
76
+ </organization>
77
+ </contributor>
78
+ <contributor>
79
+ <role type="publisher"/>
80
+ <organization>
81
+ <name>International Organization for Standardization</name>
82
+ <abbreviation>ISO</abbreviation>
83
+ </organization>
84
+ </contributor>
85
+ <edition>2</edition>
86
+ <version>
87
+ <revision-date>2000-01-01</revision-date>
88
+ <draft>0.3.4</draft>
89
+ </version>
90
+ <language>en</language>
91
+ <script>Latn</script>
92
+ <status>
93
+ <stage abbreviation="WD">20</stage>
94
+ <substage>20</substage>
95
+ <iteration>3</iteration>
96
+ </status>
97
+ <copyright>
98
+ <from>2000</from>
99
+ <owner>
100
+ <organization>
101
+ <name>International Organization for Standardization</name>
102
+ <abbreviation>ISO</abbreviation>
103
+ </organization>
104
+ </owner>
105
+ </copyright>
106
+ <ext>
107
+ <doctype>article</doctype>
108
+ <horizontal>true</horizontal>
109
+ <editorialgroup>
110
+ <technical-committee number="1" type="A">TC</technical-committee>
111
+ <technical-committee number="11" type="A1">TC1</technical-committee>
112
+ <subcommittee number="2" type="B">SC</subcommittee>
113
+ <subcommittee number="21" type="B1">SC1</subcommittee>
114
+ <workgroup number="3" type="C">WG</workgroup>
115
+ <workgroup number="31" type="C1">WG1</workgroup>
116
+ <secretariat>SECRETARIAT</secretariat>
117
+ </editorialgroup>
118
+ <ics>
119
+ <code>1</code>
120
+ </ics>
121
+ <ics>
122
+ <code>2</code>
123
+ </ics>
124
+ <ics>
125
+ <code>3</code>
126
+ </ics>
127
+ <structuredidentifier>
128
+ <project-number part="1">ISO 1000</project-number>
129
+ </structuredidentifier>
130
+ <stagename>Third working draft</stagename>
131
+ </ext>
132
+ </bibdata>
133
+ <sections/>
134
+ </iso-standard>
135
+ OUTPUT
136
+ end
137
+
138
+ it "processes complex metadata" do
139
+ output = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
140
+ = Document title
141
+ Author
142
+ :docfile: test.adoc
143
+ :nodoc:
144
+ :novalid:
145
+ :no-isobib:
146
+ :docnumber: 1000
147
+ :partnumber: 1-1
148
+ :tc-docnumber: 2000, 2003
149
+ :language: el
150
+ :script: Grek
151
+ :publisher: IEC;IETF;ISO
152
+ :copyright-holder: ISO;IETF
153
+ :copyright-year: 2001
154
+ :doctype: technical-report
155
+ :pub-address: 1 Infinity Loop + \
156
+ California
157
+ :pub-phone: 3333333
158
+ :pub-fax: 4444444
159
+ :pub-email: x@example.com
160
+ :pub-uri: http://www.example.com
161
+ :docstage:
162
+ :docsubstage:
163
+ INPUT
164
+ expect(xmlpp(output.sub(%r{<boilerplate>.*</boilerplate>}m, "")))
165
+ .to be_equivalent_to xmlpp(<<~"OUTPUT")
166
+ <?xml version="1.0" encoding="UTF-8"?>
167
+ <iso-standard type="semantic" version="#{Metanorma::ISO::VERSION}" xmlns="https://www.metanorma.org/ns/iso">
168
+ <bibdata type="standard">
169
+ <docidentifier type="ISO">ISO/IEC/IETF/TR 1000-1-1:2001</docidentifier>
170
+ <docidentifier type="iso-with-lang">ISO/IEC/IETF/TR 1000-1-1:2001(X)</docidentifier>
171
+ <docidentifier type="iso-reference">ISO/IEC/IETF/TR 1000-1-1:2001(X)</docidentifier>
172
+ <docidentifier type="iso-tc">2000</docidentifier>
173
+ <docidentifier type="iso-tc">2003</docidentifier>
174
+ <docnumber>1000</docnumber>
175
+ <contributor>
176
+ <role type="author"/>
177
+ <organization>
178
+ <name>International Electrotechnical Commission</name>
179
+ <abbreviation>IEC</abbreviation>
180
+ </organization>
181
+ </contributor>
182
+ <contributor>
183
+ <role type="author"/>
184
+ <organization>
185
+ <name>IETF</name>
186
+ </organization>
187
+ </contributor>
188
+ <contributor>
189
+ <role type="author"/>
190
+ <organization>
191
+ <name>International Organization for Standardization</name>
192
+ <abbreviation>ISO</abbreviation>
193
+ </organization>
194
+ </contributor>
195
+ <contributor>
196
+ <role type="publisher"/>
197
+ <organization>
198
+ <name>International Electrotechnical Commission</name>
199
+ <abbreviation>IEC</abbreviation>
200
+ <address>
201
+ <formattedAddress>1 Infinity Loop + California</formattedAddress>
202
+ </address>
203
+ <phone>3333333</phone>
204
+ <phone type='fax'>4444444</phone>
205
+ <email>x@example.com</email>
206
+ <uri>http://www.example.com</uri>
207
+ </organization>
208
+ </contributor>
209
+ <contributor>
210
+ <role type="publisher"/>
211
+ <organization>
212
+ <name>IETF</name>
213
+ <address>
214
+ <formattedAddress>1 Infinity Loop + California</formattedAddress>
215
+ </address>
216
+ <phone>3333333</phone>
217
+ <phone type='fax'>4444444</phone>
218
+ <email>x@example.com</email>
219
+ <uri>http://www.example.com</uri>
220
+ </organization>
221
+ </contributor>
222
+ <contributor>
223
+ <role type="publisher"/>
224
+ <organization>
225
+ <name>International Organization for Standardization</name>
226
+ <abbreviation>ISO</abbreviation>
227
+ <address>
228
+ <formattedAddress>1 Infinity Loop + California</formattedAddress>
229
+ </address>
230
+ <phone>3333333</phone>
231
+ <phone type='fax'>4444444</phone>
232
+ <email>x@example.com</email>
233
+ <uri>http://www.example.com</uri>
234
+ </organization>
235
+ </contributor>
236
+ <language>el</language>
237
+ <script>Grek</script>
238
+ <status>
239
+ <stage abbreviation="IS">60</stage>
240
+ <substage>60</substage>
241
+ </status>
242
+ <copyright>
243
+ <from>2001</from>
244
+ <owner>
245
+ <organization>
246
+ <name>International Organization for Standardization</name>
247
+ <abbreviation>ISO</abbreviation>
248
+ <address>
249
+ <formattedAddress>1 Infinity Loop + California</formattedAddress>
250
+ </address>
251
+ <phone>3333333</phone>
252
+ <phone type='fax'>4444444</phone>
253
+ <email>x@example.com</email>
254
+ <uri>http://www.example.com</uri>
255
+ </organization>
256
+ </owner>
257
+ </copyright>
258
+ <copyright>
259
+ <from>2001</from>
260
+ <owner>
261
+ <organization>
262
+ <name>IETF</name>
263
+ <address>
264
+ <formattedAddress>1 Infinity Loop + California</formattedAddress>
265
+ </address>
266
+ <phone>3333333</phone>
267
+ <phone type='fax'>4444444</phone>
268
+ <email>x@example.com</email>
269
+ <uri>http://www.example.com</uri>
270
+ </organization>
271
+ </owner>
272
+ </copyright>
273
+ <ext>
274
+ <doctype>technical-report</doctype>
275
+ <editorialgroup>
276
+ <technical-committee/>
277
+ <subcommittee/>
278
+ <workgroup/>
279
+ </editorialgroup>
280
+ <structuredidentifier>
281
+ <project-number part="1" subpart="1">ISO/IEC/IETF 1000</project-number>
282
+ </structuredidentifier>
283
+ <stagename>International standard</stagename>
284
+ </ext>
285
+ </bibdata>
286
+ <sections/>
287
+ </iso-standard>
288
+ OUTPUT
289
+ end
290
+
291
+ it "processes subdivisions" do
292
+ output = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
293
+ = Document title
294
+ Author
295
+ :docfile: test.adoc
296
+ :nodoc:
297
+ :novalid:
298
+ :revdate: 2000-01
299
+ :published-date: 1000-01
300
+ :docnumber: 1000
301
+ :partnumber: 1-1
302
+ :tc-docnumber: 2000
303
+ :language: el
304
+ :script: Grek
305
+ :subdivision: Subdivision
306
+ :subdivision-abbr: SD
307
+ :doctype: This is a DocType
308
+ :pub-address: 1 Infinity Loop + \\
309
+ California
310
+ :pub-phone: 3333333
311
+ :pub-fax: 4444444
312
+ :pub-email: x@example.com
313
+ :pub-uri: http://www.example.com
314
+ INPUT
315
+ expect(xmlpp(strip_guid(output
316
+ .sub(%r{<boilerplate>.*</boilerplate>}m, ""))))
317
+ .to be_equivalent_to xmlpp(<<~"OUTPUT")
318
+ <iso-standard xmlns="https://www.metanorma.org/ns/iso" type="semantic" version="#{Metanorma::ISO::VERSION}">
319
+ <bibdata type='standard'>
320
+ <docidentifier type='ISO'>SD 1000-1-1</docidentifier>
321
+ <docidentifier type='iso-with-lang'>SD 1000-1-1(X)</docidentifier>
322
+ <docidentifier type='iso-reference'>SD 1000-1-1(X)</docidentifier>
323
+ <docidentifier type='iso-tc'>2000</docidentifier>
324
+ <docnumber>1000</docnumber>
325
+ <date type='published'>
326
+ <on>1000-01</on>
327
+ </date>
328
+ <contributor>
329
+ <role type='author'/>
330
+ <organization>
331
+ <name>International Organization for Standardization</name>
332
+ <subdivision>Subdivision</subdivision>
333
+ <abbreviation>SD</abbreviation>
334
+ </organization>
335
+ </contributor>
336
+ <contributor>
337
+ <role type='publisher'/>
338
+ <organization>
339
+ <name>International Organization for Standardization</name>
340
+ <subdivision>Subdivision</subdivision>
341
+ <abbreviation>SD</abbreviation>
342
+ <address>
343
+ <formattedAddress>1 Infinity Loop <br/>California</formattedAddress>
344
+ </address>
345
+ <phone>3333333</phone>
346
+ <phone type='fax'>4444444</phone>
347
+ <email>x@example.com</email>
348
+ <uri>http://www.example.com</uri>
349
+ </organization>
350
+ </contributor>
351
+ <version>
352
+ <revision-date>2000-01</revision-date>
353
+ </version>
354
+ <language>el</language>
355
+ <script>Grek</script>
356
+ <status>
357
+ <stage abbreviation='IS'>60</stage>
358
+ <substage>60</substage>
359
+ </status>
360
+ <copyright>
361
+ <from>#{Time.now.year}</from>
362
+ <owner>
363
+ <organization>
364
+ <name>International Organization for Standardization</name>
365
+ <subdivision>Subdivision</subdivision>
366
+ <abbreviation>SD</abbreviation>
367
+ <address>
368
+ <formattedAddress>1 Infinity Loop
369
+ <br/>
370
+ California</formattedAddress>
371
+ </address>
372
+ <phone>3333333</phone>
373
+ <phone type="fax">4444444</phone>
374
+ <email>x@example.com</email>
375
+ <uri>http://www.example.com</uri>
376
+ </organization>
377
+ </owner>
378
+ </copyright>
379
+ <ext>
380
+ <doctype>this-is-a-doctype</doctype>
381
+ <editorialgroup>
382
+ <technical-committee/>
383
+ <subcommittee/>
384
+ <workgroup/>
385
+ </editorialgroup>
386
+ <structuredidentifier>
387
+ <project-number part="1" subpart="1">SD 1000</project-number>
388
+ </structuredidentifier>
389
+ <stagename>International standard</stagename>
390
+ </ext>
391
+ </bibdata>
392
+ <sections> </sections>
393
+ </iso-standard>
394
+ OUTPUT
395
+ end
396
+
397
+ it "defaults substage, defines iteration on stage 50" do
398
+ output = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
399
+ = Document title
400
+ Author
401
+ :docfile: test.adoc
402
+ :nodoc:
403
+ :novalid:
404
+ :no-isobib:
405
+ :docnumber: 1000
406
+ :docstage: 50
407
+ :language: fr
408
+ :doctype: international-standard
409
+ :iteration: 2
410
+ INPUT
411
+ expect(xmlpp(output.sub(%r{<boilerplate>.*</boilerplate>}m, "")))
412
+ .to be_equivalent_to xmlpp(<<~"OUTPUT")
413
+ <iso-standard type="semantic" version="#{Metanorma::ISO::VERSION}" xmlns="https://www.metanorma.org/ns/iso">
414
+ <bibdata type="standard">
415
+ <docidentifier type='ISO'>ISO/FDIS 1000.2</docidentifier>
416
+ <docidentifier type='iso-with-lang'>ISO/FDIS 1000.2(F)</docidentifier>
417
+ <docidentifier type='iso-reference'>ISO/FDIS 1000.2(F)</docidentifier>
418
+ <docnumber>1000</docnumber>
419
+ <contributor>
420
+ <role type="author"/>
421
+ <organization>
422
+ <name>International Organization for Standardization</name>
423
+ <abbreviation>ISO</abbreviation>
424
+ </organization>
425
+ </contributor>
426
+ <contributor>
427
+ <role type="publisher"/>
428
+ <organization>
429
+ <name>International Organization for Standardization</name>
430
+ <abbreviation>ISO</abbreviation>
431
+ </organization>
432
+ </contributor>
433
+ <language>fr</language>
434
+ <script>Latn</script>
435
+ <status>
436
+ <stage abbreviation="FDIS">50</stage>
437
+ <substage>00</substage>
438
+ <iteration>2</iteration>
439
+ </status>
440
+ <copyright>
441
+ <from>#{Date.today.year}</from>
442
+ <owner>
443
+ <organization>
444
+ <name>International Organization for Standardization</name>
445
+ <abbreviation>ISO</abbreviation>
446
+ </organization>
447
+ </owner>
448
+ </copyright>
449
+ <ext>
450
+ <doctype>international-standard</doctype>
451
+ <editorialgroup>
452
+ <technical-committee/>
453
+ <subcommittee/>
454
+ <workgroup/>
455
+ </editorialgroup>
456
+ <structuredidentifier>
457
+ <project-number>ISO 1000</project-number>
458
+ </structuredidentifier>
459
+ <stagename>Final draft</stagename>
460
+ </ext>
461
+ </bibdata>
462
+ <sections/>
463
+ </iso-standard>
464
+ OUTPUT
465
+ end
466
+
467
+ it "defaults substage for stage 60" do
468
+ output = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
469
+ = Document title
470
+ Author
471
+ :docfile: test.adoc
472
+ :nodoc:
473
+ :novalid:
474
+ :no-isobib:
475
+ :docnumber: 1000
476
+ :docstage: 60
477
+ INPUT
478
+
479
+ expect(xmlpp(output.sub(%r{<boilerplate>.*</boilerplate>}m, "")))
480
+ .to be_equivalent_to xmlpp(<<~"OUTPUT")
481
+ <iso-standard xmlns="https://www.metanorma.org/ns/iso" type="semantic" version="#{Metanorma::ISO::VERSION}">
482
+ <bibdata type="standard">
483
+ <docidentifier type="ISO">ISO 1000</docidentifier>
484
+ <docidentifier type='iso-with-lang'>ISO 1000(E)</docidentifier>
485
+ <docidentifier type='iso-reference'>ISO 1000(E)</docidentifier>
486
+ <docnumber>1000</docnumber>
487
+ <contributor>
488
+ <role type="author"/>
489
+ <organization>
490
+ <name>International Organization for Standardization</name>
491
+ <abbreviation>ISO</abbreviation>
492
+ </organization>
493
+ </contributor>
494
+ <contributor>
495
+ <role type="publisher"/>
496
+ <organization>
497
+ <name>International Organization for Standardization</name>
498
+ <abbreviation>ISO</abbreviation>
499
+ </organization>
500
+ </contributor>
501
+
502
+ <language>en</language>
503
+ <script>Latn</script>
504
+ <status>
505
+ <stage abbreviation="IS">60</stage>
506
+ <substage>60</substage>
507
+ </status>
508
+ <copyright>
509
+ <from>#{Date.today.year}</from>
510
+ <owner>
511
+ <organization>
512
+ <name>International Organization for Standardization</name>
513
+ <abbreviation>ISO</abbreviation>
514
+ </organization>
515
+ </owner>
516
+ </copyright>
517
+ <ext>
518
+ <doctype>article</doctype>
519
+ <editorialgroup>
520
+ <technical-committee/>
521
+ <subcommittee/>
522
+ <workgroup/>
523
+ </editorialgroup>
524
+ <structuredidentifier>
525
+ <project-number>ISO 1000</project-number>
526
+ </structuredidentifier>
527
+ <stagename>International standard</stagename>
528
+ </ext>
529
+ </bibdata>
530
+ <sections/>
531
+ </iso-standard>
532
+ OUTPUT
533
+ end
534
+
535
+ it "populates metadata for PRF" do
536
+ output = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
537
+ = Document title
538
+ Author
539
+ :docfile: test.adoc
540
+ :nodoc:
541
+ :novalid:
542
+ :no-isobib:
543
+ :docnumber: 1000
544
+ :docstage: 60
545
+ :docsubstage: 00
546
+ INPUT
547
+ expect(xmlpp(output.sub(%r{<boilerplate>.*</boilerplate>}m, "")))
548
+ .to be_equivalent_to xmlpp(<<~"OUTPUT")
549
+ <iso-standard xmlns="https://www.metanorma.org/ns/iso" type="semantic" version="#{Metanorma::ISO::VERSION}">
550
+ <bibdata type="standard">
551
+ <docidentifier type="ISO">ISO 1000</docidentifier>
552
+ <docidentifier type='iso-with-lang'>ISO 1000(E)</docidentifier>
553
+ <docidentifier type='iso-reference'>ISO 1000(E)</docidentifier>
554
+ <docnumber>1000</docnumber>
555
+ <contributor>
556
+ <role type="author"/>
557
+ <organization>
558
+ <name>International Organization for Standardization</name>
559
+ <abbreviation>ISO</abbreviation>
560
+ </organization>
561
+ </contributor>
562
+ <contributor>
563
+ <role type="publisher"/>
564
+ <organization>
565
+ <name>International Organization for Standardization</name>
566
+ <abbreviation>ISO</abbreviation>
567
+ </organization>
568
+ </contributor>
569
+
570
+ <language>en</language>
571
+ <script>Latn</script>
572
+ <status>
573
+ <stage abbreviation="PRF">60</stage>
574
+ <substage>00</substage>
575
+ </status>
576
+ <copyright>
577
+ <from>#{Date.today.year}</from>
578
+ <owner>
579
+ <organization>
580
+ <name>International Organization for Standardization</name>
581
+ <abbreviation>ISO</abbreviation>
582
+ </organization>
583
+ </owner>
584
+ </copyright>
585
+ <ext>
586
+ <doctype>article</doctype>
587
+ <editorialgroup>
588
+ <technical-committee/>
589
+ <subcommittee/>
590
+ <workgroup/>
591
+ </editorialgroup>
592
+ <structuredidentifier>
593
+ <project-number>ISO 1000</project-number>
594
+ </structuredidentifier>
595
+ <stagename>Proof</stagename>
596
+ </ext>
597
+ </bibdata>
598
+ <sections/>
599
+ </iso-standard>
600
+ OUTPUT
601
+ end
602
+
603
+ it "defaults metadata for DIR" do
604
+ output = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
605
+ = Document title
606
+ Author
607
+ :docfile: test.adoc
608
+ :nodoc:
609
+ :novalid:
610
+ :no-isobib:
611
+ :docnumber: 1000
612
+ :doctype: directive
613
+ INPUT
614
+
615
+ expect(xmlpp(output.sub(%r{<boilerplate>.*</boilerplate>}m, "")))
616
+ .to be_equivalent_to xmlpp(<<~"OUTPUT")
617
+ <iso-standard xmlns="https://www.metanorma.org/ns/iso" type="semantic" version="#{Metanorma::ISO::VERSION}">
618
+ <bibdata type='standard'>
619
+ <docidentifier type='ISO'>ISO DIR 1000</docidentifier>
620
+ <docidentifier type='iso-with-lang'>ISO DIR 1000(E)</docidentifier>
621
+ <docidentifier type='iso-reference'>ISO DIR 1000(E)</docidentifier>
622
+ <docnumber>1000</docnumber>
623
+ <contributor>
624
+ <role type='author'/>
625
+ <organization>
626
+ <name>International Organization for Standardization</name>
627
+ <abbreviation>ISO</abbreviation>
628
+ </organization>
629
+ </contributor>
630
+ <contributor>
631
+ <role type='publisher'/>
632
+ <organization>
633
+ <name>International Organization for Standardization</name>
634
+ <abbreviation>ISO</abbreviation>
635
+ </organization>
636
+ </contributor>
637
+ <language>en</language>
638
+ <script>Latn</script>
639
+ <status>
640
+ <stage abbreviation='IS'>60</stage>
641
+ <substage>60</substage>
642
+ </status>
643
+ <copyright>
644
+ <from>#{Time.new.year}</from>
645
+ <owner>
646
+ <organization>
647
+ <name>International Organization for Standardization</name>
648
+ <abbreviation>ISO</abbreviation>
649
+ </organization>
650
+ </owner>
651
+ </copyright>
652
+ <ext>
653
+ <doctype>directive</doctype>
654
+ <editorialgroup>
655
+ <technical-committee/>
656
+ <subcommittee/>
657
+ <workgroup/>
658
+ </editorialgroup>
659
+ <structuredidentifier>
660
+ <project-number>ISO 1000</project-number>
661
+ </structuredidentifier>
662
+ <stagename>International standard</stagename>
663
+ </ext>
664
+ </bibdata>
665
+ <sections> </sections>
666
+ </iso-standard>
667
+ OUTPUT
668
+ end
669
+
670
+ it "processes document relations" do
671
+ VCR.use_cassette "docrels" do
672
+ output = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
673
+ = Document title
674
+ Author
675
+ :docfile: test.adoc
676
+ :nodoc:
677
+ :novalid:
678
+ :amends: ISO 123;ISO 124
679
+ :obsoletes: ABC 1
680
+ :successor-of: ABC 2
681
+ :manifestation-of: ABC 3
682
+ :annotation-of: ABC 3a
683
+ :related: ABC 4
684
+ :replaces: ABC 5
685
+ :supersedes: ABC 6
686
+ :corrects: ABC 7
687
+ :informatively-cited-in: ABC 8
688
+ :informatively-cites: ABC 9
689
+ :normatively-cited-in: ABC 10
690
+ :normatively-cites: ABC 11
691
+ :identical-adopted-from: ABC 12
692
+ :modified-adopted-from: ABC 13
693
+ :related-directive: ABC 14
694
+ :related-mandate: ABC 15
695
+ INPUT
696
+ expect(xmlpp(output.sub(%r{<boilerplate>.*</boilerplate>}m, "")))
697
+ .to be_equivalent_to xmlpp(<<~"OUTPUT")
698
+ <iso-standard xmlns="https://www.metanorma.org/ns/iso" type="semantic" version="#{Metanorma::ISO::VERSION}">
699
+ <bibdata type='standard'>
700
+ <contributor>
701
+ <role type='author'/>
702
+ <organization>
703
+ <name>International Organization for Standardization</name>
704
+ <abbreviation>ISO</abbreviation>
705
+ </organization>
706
+ </contributor>
707
+ <contributor>
708
+ <role type='publisher'/>
709
+ <organization>
710
+ <name>International Organization for Standardization</name>
711
+ <abbreviation>ISO</abbreviation>
712
+ </organization>
713
+ </contributor>
714
+ <language>en</language>
715
+ <script>Latn</script>
716
+ <status>
717
+ <stage abbreviation='IS'>60</stage>
718
+ <substage>60</substage>
719
+ </status>
720
+ <copyright>
721
+ <from>#{Time.new.year}</from>
722
+ <owner>
723
+ <organization>
724
+ <name>International Organization for Standardization</name>
725
+ <abbreviation>ISO</abbreviation>
726
+ </organization>
727
+ </owner>
728
+ </copyright>
729
+ <relation type='obsoletes'>
730
+ <bibitem>
731
+ <title>--</title>
732
+ <docidentifier>ABC 1</docidentifier>
733
+ </bibitem>
734
+ </relation>
735
+ <relation type='successorOf'>
736
+ <bibitem>
737
+ <title>--</title>
738
+ <docidentifier>ABC 2</docidentifier>
739
+ </bibitem>
740
+ </relation>
741
+ <relation type='manifestationOf'>
742
+ <bibitem>
743
+ <title>--</title>
744
+ <docidentifier>ABC 3</docidentifier>
745
+ </bibitem>
746
+ </relation>
747
+ <relation type='annotationOf'>
748
+ <bibitem>
749
+ <title>--</title>
750
+ <docidentifier>ABC 3a</docidentifier>
751
+ </bibitem>
752
+ </relation>
753
+ <relation type='related'>
754
+ <bibitem>
755
+ <title>--</title>
756
+ <docidentifier>ABC 4</docidentifier>
757
+ </bibitem>
758
+ </relation>
759
+ <relation type='updates'>
760
+ <description>amends</description>
761
+ <bibitem type='standard'>
762
+ <fetched/>
763
+ <title type='title-intro' format='text/plain' language='en' script='Latn'>Rubber latex</title>
764
+ <title type='title-main' format='text/plain' language='en' script='Latn'>Sampling</title>
765
+ <title type='main' format='text/plain' language='en' script='Latn'>Rubber latex&#8201;&#8212;&#8201;Sampling</title>
766
+ <title type='title-intro' format='text/plain' language='fr' script='Latn'>Latex de caoutchouc</title>
767
+ <title type='title-main' format='text/plain' language='fr' script='Latn'>&#201;chantillonnage</title>
768
+ <title type='main' format='text/plain' language='fr' script='Latn'>Latex de caoutchouc&#8201;&#8212;&#8201;&#201;chantillonnage</title>
769
+ <uri type='src'>https://www.iso.org/standard/23281.html</uri>
770
+ <uri type='obp'>https://www.iso.org/obp/ui/#!iso:std:23281:en</uri>
771
+ <uri type='rss'>https://www.iso.org/contents/data/standard/02/32/23281.detail.rss</uri>
772
+ <docidentifier type='ISO'>ISO 123</docidentifier>
773
+ <docidentifier type='URN'>urn:iso:std:iso:123:stage-90.93:ed-3:en,fr</docidentifier>
774
+ <docnumber>123</docnumber>
775
+ <contributor>
776
+ <role type='publisher'/>
777
+ <organization>
778
+ <name>International Organization for Standardization</name>
779
+ <abbreviation>ISO</abbreviation>
780
+ <uri>www.iso.org</uri>
781
+ </organization>
782
+ </contributor>
783
+ <edition>3</edition>
784
+ <language>en</language>
785
+ <language>fr</language>
786
+ <script>Latn</script>
787
+ <status>
788
+ <stage>90</stage>
789
+ <substage>93</substage>
790
+ </status>
791
+ <copyright>
792
+ <from>2001</from>
793
+ <owner>
794
+ <organization>
795
+ <name>ISO</name>
796
+ </organization>
797
+ </owner>
798
+ </copyright>
799
+ <relation type='obsoletes'>
800
+ <bibitem type='standard'>
801
+ <formattedref format='text/plain'>ISO 123:1985</formattedref>
802
+ </bibitem>
803
+ </relation>
804
+ <relation type='instance'>
805
+ <bibitem type='standard'>
806
+ <fetched/>
807
+ <title type='title-intro' format='text/plain' language='en' script='Latn'>Rubber latex</title>
808
+ <title type='title-main' format='text/plain' language='en' script='Latn'>Sampling</title>
809
+ <title type='main' format='text/plain' language='en' script='Latn'>Rubber latex&#8201;&#8212;&#8201;Sampling</title>
810
+ <title type='title-intro' format='text/plain' language='fr' script='Latn'>Latex de caoutchouc</title>
811
+ <title type='title-main' format='text/plain' language='fr' script='Latn'>&#201;chantillonnage</title>
812
+ <title type='main' format='text/plain' language='fr' script='Latn'>Latex de caoutchouc&#8201;&#8212;&#8201;&#201;chantillonnage</title>
813
+ <uri type='src'>https://www.iso.org/standard/23281.html</uri>
814
+ <uri type='obp'>https://www.iso.org/obp/ui/#!iso:std:23281:en</uri>
815
+ <uri type='rss'>https://www.iso.org/contents/data/standard/02/32/23281.detail.rss</uri>
816
+ <docidentifier type='ISO'>ISO 123:2001</docidentifier>
817
+ <docidentifier type='URN'>urn:iso:std:iso:123:stage-90.93:ed-3:en,fr</docidentifier>
818
+ <docnumber>123</docnumber>
819
+ <date type='published'>
820
+ <on>2001-05</on>
821
+ </date>
822
+ <contributor>
823
+ <role type='publisher'/>
824
+ <organization>
825
+ <name>International Organization for Standardization</name>
826
+ <abbreviation>ISO</abbreviation>
827
+ <uri>www.iso.org</uri>
828
+ </organization>
829
+ </contributor>
830
+ <edition>3</edition>
831
+ <language>en</language>
832
+ <language>fr</language>
833
+ <script>Latn</script>
834
+ <abstract format='text/plain' language='en' script='Latn'>
835
+ This International Standard specifies procedures for sampling
836
+ natural rubber latex concentrate and for sampling synthetic rubber
837
+ latices and artificial latices. It is also suitable for sampling
838
+ rubber latex contained in drums, tank cars or tanks. The
839
+ procedures may also be used for sampling plastics dispersions.
840
+ </abstract>
841
+ <abstract format='text/plain' language='fr' script='Latn'>
842
+ La pr&#233;sente Norme internationale sp&#233;cifie des
843
+ m&#233;thodes d&#8217;&#233;chantillonnage pour des
844
+ concentr&#233;s de latex de caoutchouc naturel et pour
845
+ &#233;chantillonner des latex de caoutchouc synth&#233;tique et
846
+ des latex artificiels. Elle s&#8217;applique &#233;galement &#224;
847
+ l&#8217;&#233;chantillonnage de latex de caoutchouc contenus dans
848
+ des f&#251;ts, citernes routi&#232;res ou de stockage. Le mode
849
+ op&#233;ratoire peut aussi &#234;tre utilis&#233; pour
850
+ l&#8217;&#233;chantillonnage de dispersions de plastiques.
851
+ </abstract>
852
+ <status>
853
+ <stage>90</stage>
854
+ <substage>93</substage>
855
+ </status>
856
+ <copyright>
857
+ <from>2001</from>
858
+ <owner>
859
+ <organization>
860
+ <name>ISO</name>
861
+ </organization>
862
+ </owner>
863
+ </copyright>
864
+ <relation type='obsoletes'>
865
+ <bibitem type='standard'>
866
+ <formattedref format='text/plain'>ISO 123:1985</formattedref>
867
+ </bibitem>
868
+ </relation>
869
+ <place>Geneva</place>
870
+ </bibitem>
871
+ </relation>
872
+ <place>Geneva</place>
873
+ </bibitem>
874
+ </relation>
875
+ <relation type='updates'>
876
+ <description>amends</description>
877
+ <bibitem type='standard'>
878
+ <fetched/>
879
+ <title type='title-intro' format='text/plain' language='en' script='Latn'>Latex, rubber</title>
880
+ <title type='title-main' format='text/plain' language='en' script='Latn'>Determination of total solids content</title>
881
+ <title type='main' format='text/plain' language='en' script='Latn'>Latex, rubber&#8201;&#8212;&#8201;Determination of total solids content</title>
882
+ <title type='title-intro' format='text/plain' language='fr' script='Latn'>Latex de caoutchouc</title>
883
+ <title type='title-main' format='text/plain' language='fr' script='Latn'>D&#233;termination des mati&#232;res solides totales</title>
884
+ <title type='main' format='text/plain' language='fr' script='Latn'>
885
+ Latex de caoutchouc&#8201;&#8212;&#8201;D&#233;termination des
886
+ mati&#232;res solides totales
887
+ </title>
888
+ <uri type='src'>https://www.iso.org/standard/61884.html</uri>
889
+ <uri type='obp'>https://www.iso.org/obp/ui/#!iso:std:61884:en</uri>
890
+ <uri type='rss'>https://www.iso.org/contents/data/standard/06/18/61884.detail.rss</uri>
891
+ <docidentifier type='ISO'>ISO 124</docidentifier>
892
+ <docidentifier type='URN'>urn:iso:std:iso:124:stage-90.93:ed-7:en,fr</docidentifier>
893
+ <docnumber>124</docnumber>
894
+ <contributor>
895
+ <role type='publisher'/>
896
+ <organization>
897
+ <name>International Organization for Standardization</name>
898
+ <abbreviation>ISO</abbreviation>
899
+ <uri>www.iso.org</uri>
900
+ </organization>
901
+ </contributor>
902
+ <edition>7</edition>
903
+ <language>en</language>
904
+ <language>fr</language>
905
+ <script>Latn</script>
906
+ <status>
907
+ <stage>90</stage>
908
+ <substage>93</substage>
909
+ </status>
910
+ <copyright>
911
+ <from>2014</from>
912
+ <owner>
913
+ <organization>
914
+ <name>ISO</name>
915
+ </organization>
916
+ </owner>
917
+ </copyright>
918
+ <relation type='obsoletes'>
919
+ <bibitem type='standard'>
920
+ <formattedref format='text/plain'>ISO 124:2011</formattedref>
921
+ </bibitem>
922
+ </relation>
923
+ <relation type='instance'>
924
+ <bibitem type='standard'>
925
+ <fetched/>
926
+ <title type='title-intro' format='text/plain' language='en' script='Latn'>Latex, rubber</title>
927
+ <title type='title-main' format='text/plain' language='en' script='Latn'>Determination of total solids content</title>
928
+ <title type='main' format='text/plain' language='en' script='Latn'>Latex, rubber&#8201;&#8212;&#8201;Determination of total solids content</title>
929
+ <title type='title-intro' format='text/plain' language='fr' script='Latn'>Latex de caoutchouc</title>
930
+ <title type='title-main' format='text/plain' language='fr' script='Latn'>D&#233;termination des mati&#232;res solides totales</title>
931
+ <title type='main' format='text/plain' language='fr' script='Latn'>
932
+ Latex de caoutchouc&#8201;&#8212;&#8201;D&#233;termination des
933
+ mati&#232;res solides totales
934
+ </title>
935
+ <uri type='src'>https://www.iso.org/standard/61884.html</uri>
936
+ <uri type='obp'>https://www.iso.org/obp/ui/#!iso:std:61884:en</uri>
937
+ <uri type='rss'>https://www.iso.org/contents/data/standard/06/18/61884.detail.rss</uri>
938
+ <docidentifier type='ISO'>ISO 124:2014</docidentifier>
939
+ <docidentifier type='URN'>urn:iso:std:iso:124:stage-90.93:ed-7:en,fr</docidentifier>
940
+ <docnumber>124</docnumber>
941
+ <date type='published'>
942
+ <on>2014-03</on>
943
+ </date>
944
+ <contributor>
945
+ <role type='publisher'/>
946
+ <organization>
947
+ <name>International Organization for Standardization</name>
948
+ <abbreviation>ISO</abbreviation>
949
+ <uri>www.iso.org</uri>
950
+ </organization>
951
+ </contributor>
952
+ <edition>7</edition>
953
+ <language>en</language>
954
+ <language>fr</language>
955
+ <script>Latn</script>
956
+ <abstract format='text/plain' language='en' script='Latn'>
957
+ ISO 124:2014 specifies methods for the determination of the total
958
+ solids content of natural rubber field and concentrated latices
959
+ and synthetic rubber latex. These methods are not necessarily
960
+ suitable for latex from natural sources other than the Hevea
961
+ brasiliensis, for vulcanized latex, for compounded latex, or for
962
+ artificial dispersions of rubber.
963
+ </abstract>
964
+ <abstract format='text/plain' language='fr' script='Latn'>
965
+ L&#8217;ISO 124:2014 sp&#233;cifie des m&#233;thodes pour la
966
+ d&#233;termination des mati&#232;res solides totales dans le latex
967
+ de plantation, le latex de concentr&#233; de caoutchouc naturel et
968
+ le latex de caoutchouc synth&#233;tique. Ces m&#233;thodes ne
969
+ conviennent pas n&#233;cessairement au latex d&#8217;origine
970
+ naturelle autre que celui de l&#8217;Hevea brasiliensis, au latex
971
+ vulcanis&#233;, aux m&#233;langes de latex, ou aux dispersions
972
+ artificielles de caoutchouc.
973
+ </abstract>
974
+ <status>
975
+ <stage>90</stage>
976
+ <substage>93</substage>
977
+ </status>
978
+ <copyright>
979
+ <from>2014</from>
980
+ <owner>
981
+ <organization>
982
+ <name>ISO</name>
983
+ </organization>
984
+ </owner>
985
+ </copyright>
986
+ <relation type='obsoletes'>
987
+ <bibitem type='standard'>
988
+ <formattedref format='text/plain'>ISO 124:2011</formattedref>
989
+ </bibitem>
990
+ </relation>
991
+ <place>Geneva</place>
992
+ </bibitem>
993
+ </relation>
994
+ <place>Geneva</place>
995
+ </bibitem>
996
+ </relation>
997
+ <relation type='obsoletes'>
998
+ <description>replaces</description>
999
+ <bibitem>
1000
+ <title>--</title>
1001
+ <docidentifier>ABC 5</docidentifier>
1002
+ </bibitem>
1003
+ </relation>
1004
+ <relation type='obsoletes'>
1005
+ <description>supersedes</description>
1006
+ <bibitem>
1007
+ <title>--</title>
1008
+ <docidentifier>ABC 6</docidentifier>
1009
+ </bibitem>
1010
+ </relation>
1011
+ <relation type='updates'>
1012
+ <description>corrects</description>
1013
+ <bibitem>
1014
+ <title>--</title>
1015
+ <docidentifier>ABC 7</docidentifier>
1016
+ </bibitem>
1017
+ </relation>
1018
+ <relation type='isCitedIn'>
1019
+ <description>informatively cited in</description>
1020
+ <bibitem>
1021
+ <title>--</title>
1022
+ <docidentifier>ABC 8</docidentifier>
1023
+ </bibitem>
1024
+ </relation>
1025
+ <relation type='cites'>
1026
+ <description>informatively cites</description>
1027
+ <bibitem>
1028
+ <title>--</title>
1029
+ <docidentifier>ABC 9</docidentifier>
1030
+ </bibitem>
1031
+ </relation>
1032
+ <relation type='cites'>
1033
+ <description>normatively cites</description>
1034
+ <bibitem>
1035
+ <title>--</title>
1036
+ <docidentifier>ABC 11</docidentifier>
1037
+ </bibitem>
1038
+ </relation>
1039
+ <relation type='adoptedFrom'>
1040
+ <description>identical adopted from</description>
1041
+ <bibitem>
1042
+ <title>--</title>
1043
+ <docidentifier>ABC 12</docidentifier>
1044
+ </bibitem>
1045
+ </relation>
1046
+ <relation type='adoptedFrom'>
1047
+ <description>modified adopted from</description>
1048
+ <bibitem>
1049
+ <title>--</title>
1050
+ <docidentifier>ABC 13</docidentifier>
1051
+ </bibitem>
1052
+ </relation>
1053
+ <relation type='related'>
1054
+ <description>related directive</description>
1055
+ <bibitem>
1056
+ <title>--</title>
1057
+ <docidentifier>ABC 14</docidentifier>
1058
+ </bibitem>
1059
+ </relation>
1060
+ <relation type='related'>
1061
+ <description>related mandate</description>
1062
+ <bibitem>
1063
+ <title>--</title>
1064
+ <docidentifier>ABC 15</docidentifier>
1065
+ </bibitem>
1066
+ </relation>
1067
+ <ext>
1068
+ <doctype>article</doctype>
1069
+ <editorialgroup>
1070
+ <technical-committee/>
1071
+ <subcommittee/>
1072
+ <workgroup/>
1073
+ </editorialgroup>
1074
+ <stagename>International standard</stagename>
1075
+ </ext>
1076
+ </bibdata>
1077
+ <sections> </sections>
1078
+ </iso-standard>
1079
+ OUTPUT
1080
+ end
1081
+ end
1082
+
1083
+ it "reads scripts into blank HTML document" do
1084
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
1085
+ = Document title
1086
+ Author
1087
+ :docfile: test.adoc
1088
+ :novalid:
1089
+ :no-isobib:
1090
+ :no-pdf:
1091
+ INPUT
1092
+ html = File.read("test.html", encoding: "utf-8")
1093
+ expect(html).to match(%r{<script>})
1094
+ end
1095
+
1096
+ it "uses default fonts" do
1097
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
1098
+ = Document title
1099
+ Author
1100
+ :docfile: test.adoc
1101
+ :novalid:
1102
+ :no-isobib:
1103
+ :no-pdf:
1104
+ INPUT
1105
+ html = File.read("test.html", encoding: "utf-8")
1106
+ expect(html)
1107
+ .to match(%r[\bpre[^{]+\{[^{]+font-family: "Courier New", monospace;]m)
1108
+ expect(html)
1109
+ .to match(%r[blockquote[^{]+\{[^{]+font-family: "Cambria", serif;]m)
1110
+ expect(html)
1111
+ .to match(%r[\.h2Annex[^{]+\{[^{]+font-family: "Cambria", serif;]m)
1112
+ end
1113
+
1114
+ it "uses default fonts for alt doc" do
1115
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
1116
+ = Document title
1117
+ Author
1118
+ :docfile: test.adoc
1119
+ :novalid:
1120
+ :no-isobib:
1121
+ :no-pdf:
1122
+ INPUT
1123
+ html = File.read("test_alt.html", encoding: "utf-8")
1124
+ expect(html)
1125
+ .to match(%r[\bpre[^{]+\{[^{]+font-family: "Space Mono", monospace;]m)
1126
+ expect(html)
1127
+ .to match(%r[blockquote[^{]+\{[^{]+font-family: "Lato", sans-serif;]m)
1128
+ expect(html)
1129
+ .to match(%r[\.h2Annex[^{]+\{[^{]+font-family: "Lato", sans-serif;]m)
1130
+ end
1131
+
1132
+ it "uses Chinese fonts" do
1133
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
1134
+ = Document title
1135
+ Author
1136
+ :docfile: test.adoc
1137
+ :novalid:
1138
+ :no-isobib:
1139
+ :script: Hans
1140
+ :no-pdf:
1141
+ INPUT
1142
+ html = File.read("test.html", encoding: "utf-8")
1143
+ expect(html)
1144
+ .to match(%r[\bpre[^{]+\{[^{]+font-family: "Courier New", monospace;]m)
1145
+ expect(html)
1146
+ .to match(%r[blockquote[^{]+\{[^{]+font-family: "Source Han Sans", serif;]m)
1147
+ expect(html)
1148
+ .to match(%r[\.h2Annex[^{]+\{[^{]+font-family: "Source Han Sans", sans-serif;]m)
1149
+ end
1150
+
1151
+ it "uses specified fonts" do
1152
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
1153
+ = Document title
1154
+ Author
1155
+ :docfile: test.adoc
1156
+ :novalid:
1157
+ :no-isobib:
1158
+ :script: Hans
1159
+ :body-font: Zapf Chancery
1160
+ :header-font: Comic Sans
1161
+ :monospace-font: Andale Mono
1162
+ :no-pdf:
1163
+ INPUT
1164
+ html = File.read("test.html", encoding: "utf-8")
1165
+ expect(html).to match(%r[\bpre[^{]+\{[^{]+font-family: Andale Mono;]m)
1166
+ expect(html)
1167
+ .to match(%r[blockquote[^{]+\{[^{]+font-family: Zapf Chancery;]m)
1168
+ expect(html).to match(%r[\.h2Annex[^{]+\{[^{]+font-family: Comic Sans;]m)
1169
+ end
1170
+
1171
+ it "strips MS-specific CSS" do
1172
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
1173
+ = Document title
1174
+ Author
1175
+ :docfile: test.adoc
1176
+ :novalid:
1177
+ :no-isobib:
1178
+ :no-pdf:
1179
+ INPUT
1180
+ word = File.read("test.doc", encoding: "utf-8")
1181
+ html = File.read("test.html", encoding: "utf-8")
1182
+ expect(word).to match(%r[mso-style-name: "Intro Title";]m)
1183
+ expect(html).not_to match(%r[mso-style-name: "Intro Title";]m)
1184
+ end
1185
+ end