metanorma-iso 1.6.0 → 1.7.3

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