metanorma-iso 2.0.4 → 2.0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/lib/isodoc/iso/html/header.html +42 -33
  3. data/lib/isodoc/iso/html/isodoc.css +9 -7
  4. data/lib/isodoc/iso/html/isodoc.scss +7 -5
  5. data/lib/isodoc/iso/html/style-human.css +0 -1
  6. data/lib/isodoc/iso/html/style-human.scss +0 -1
  7. data/lib/isodoc/iso/html/style-iso.css +0 -1
  8. data/lib/isodoc/iso/html/style-iso.scss +0 -1
  9. data/lib/isodoc/iso/html/word_iso_titlepage.html +12 -11
  10. data/lib/isodoc/iso/html/wordstyle.css +46 -19
  11. data/lib/isodoc/iso/html/wordstyle.scss +52 -25
  12. data/lib/isodoc/iso/i18n-en.yaml +7 -2
  13. data/lib/isodoc/iso/i18n-fr.yaml +5 -2
  14. data/lib/isodoc/iso/i18n-ru.yaml +5 -2
  15. data/lib/isodoc/iso/i18n-zh-Hans.yaml +6 -2
  16. data/lib/isodoc/iso/init.rb +1 -2
  17. data/lib/isodoc/iso/iso.amendment.xsl +704 -328
  18. data/lib/isodoc/iso/iso.international-standard.xsl +704 -328
  19. data/lib/isodoc/iso/presentation_xml_convert.rb +58 -21
  20. data/lib/metanorma/iso/boilerplate-fr.xml +5 -6
  21. data/lib/metanorma/iso/boilerplate-ru.xml +4 -6
  22. data/lib/metanorma/iso/boilerplate.xml +5 -6
  23. data/lib/metanorma/iso/cleanup.rb +43 -10
  24. data/lib/metanorma/iso/front_id.rb +1 -0
  25. data/lib/metanorma/iso/processor.rb +14 -7
  26. data/lib/metanorma/iso/validate.rb +29 -1
  27. data/lib/metanorma/iso/validate_image.rb +3 -3
  28. data/lib/metanorma/iso/validate_list.rb +122 -0
  29. data/lib/metanorma/iso/validate_section.rb +39 -32
  30. data/lib/metanorma/iso/validate_style.rb +32 -2
  31. data/lib/metanorma/iso/validate_title.rb +13 -1
  32. data/lib/metanorma/iso/version.rb +1 -1
  33. data/metanorma-iso.gemspec +1 -1
  34. data/spec/isodoc/inline_spec.rb +127 -10
  35. data/spec/isodoc/postproc_spec.rb +2 -4
  36. data/spec/isodoc/terms_spec.rb +4 -4
  37. data/spec/metanorma/cleanup_spec.rb +11 -11
  38. data/spec/metanorma/refs_spec.rb +273 -61
  39. data/spec/metanorma/section_spec.rb +18 -26
  40. data/spec/metanorma/validate_spec.rb +448 -17
  41. data/spec/spec_helper.rb +6 -4
  42. data/spec/vcr_cassettes/docrels.yml +393 -0
  43. data/spec/vcr_cassettes/withdrawn_iso.yml +301 -0
  44. metadata +8 -5
@@ -138,9 +138,6 @@ RSpec.describe Metanorma::ISO do
138
138
  </organization>
139
139
  </contributor>
140
140
  <edition>1</edition>
141
- <note type="Unpublished-Status">
142
- <p id="_">Under preparation. (Stage at the time of publication ISO/FDIS 17664-1).</p>
143
- </note>
144
141
  <language>en</language>
145
142
  <language>fr</language>
146
143
  <script>Latn</script>
@@ -290,70 +287,285 @@ RSpec.describe Metanorma::ISO do
290
287
  end
291
288
 
292
289
  it "sort ISO references in Bibliography" do
293
- VCR.use_cassette "sortrefs" do
290
+ input = <<~INPUT
291
+ #{ASCIIDOC_BLANK_HDR}
292
+ [bibliography]
293
+ == Bibliography
294
+
295
+ * [[[iso1,ISO 8000-110]]]
296
+ * [[[iso2,ISO 8000-61]]]
297
+ * [[[iso3,ISO 8000-8]]]
298
+ * [[[iso4,ISO 9]]]
299
+ INPUT
300
+ output = <<~OUTPUT
301
+ #{BLANK_HDR}
302
+ <sections> </sections>
303
+ <bibliography>
304
+ <references id='_' normative='false' obligation='informative'>
305
+ <title>Bibliography</title>
306
+ <bibitem id='iso4' type='standard'>
307
+ <docidentifier>ISO 9</docidentifier>
308
+ <docnumber>9</docnumber>
309
+ <contributor>
310
+ <role type='publisher'/>
311
+ <organization>
312
+ <name>International Organization for Standardization</name>
313
+ <abbreviation>ISO</abbreviation>
314
+ </organization>
315
+ </contributor>
316
+ </bibitem>
317
+ <bibitem id='iso3' type='standard'>
318
+ <docidentifier>ISO 8000-8</docidentifier>
319
+ <docnumber>8000-8</docnumber>
320
+ <contributor>
321
+ <role type='publisher'/>
322
+ <organization>
323
+ <name>International Organization for Standardization</name>
324
+ <abbreviation>ISO</abbreviation>
325
+ </organization>
326
+ </contributor>
327
+ </bibitem>
328
+ <bibitem id='iso2' type='standard'>
329
+ <docidentifier>ISO 8000-61</docidentifier>
330
+ <docnumber>8000-61</docnumber>
331
+ <contributor>
332
+ <role type='publisher'/>
333
+ <organization>
334
+ <name>International Organization for Standardization</name>
335
+ <abbreviation>ISO</abbreviation>
336
+ </organization>
337
+ </contributor>
338
+ </bibitem>
339
+ <bibitem id='iso1' type='standard'>
340
+ <docidentifier>ISO 8000-110</docidentifier>
341
+ <docnumber>8000-110</docnumber>
342
+ <contributor>
343
+ <role type='publisher'/>
344
+ <organization>
345
+ <name>International Organization for Standardization</name>
346
+ <abbreviation>ISO</abbreviation>
347
+ </organization>
348
+ </contributor>
349
+ </bibitem>
350
+ </references>
351
+ </bibliography>
352
+ </iso-standard>
353
+ OUTPUT
354
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
355
+ .to be_equivalent_to xmlpp(output)
356
+ end
357
+
358
+ it "renders withdrawn and cancelled ISO references" do
359
+ VCR.use_cassette "withdrawn_iso", match_requests_on: %i[method uri body] do
294
360
  input = <<~INPUT
295
- #{ASCIIDOC_BLANK_HDR}
361
+ #{ISOBIB_BLANK_HDR}
362
+
363
+ <<iso1,clause=1>>
364
+ <<iso2,clause=1>>
365
+
296
366
  [bibliography]
297
367
  == Bibliography
298
368
 
299
- * [[[iso1,ISO 8000-110]]]
300
- * [[[iso2,ISO 8000-61]]]
301
- * [[[iso3,ISO 8000-8]]]
302
- * [[[iso4,ISO 9]]]
369
+ * [[[iso1,ISO 683-3:2019]]]
370
+ * [[[iso2,ISO 31-0]]]
303
371
  INPUT
304
372
  output = <<~OUTPUT
305
- #{BLANK_HDR}
306
- <sections> </sections>
307
- <bibliography>
308
- <references id='_' normative='false' obligation='informative'>
309
- <title>Bibliography</title>
310
- <bibitem id='iso4' type='standard'>
311
- <docidentifier>ISO 9</docidentifier>
312
- <docnumber>9</docnumber>
313
- <contributor>
314
- <role type='publisher'/>
315
- <organization>
316
- <name>International Organization for Standardization</name>
317
- <abbreviation>ISO</abbreviation>
318
- </organization>
319
- </contributor>
320
- </bibitem>
321
- <bibitem id='iso3' type='standard'>
322
- <docidentifier>ISO 8000-8</docidentifier>
323
- <docnumber>8000-8</docnumber>
324
- <contributor>
325
- <role type='publisher'/>
326
- <organization>
327
- <name>International Organization for Standardization</name>
328
- <abbreviation>ISO</abbreviation>
329
- </organization>
330
- </contributor>
331
- </bibitem>
332
- <bibitem id='iso2' type='standard'>
333
- <docidentifier>ISO 8000-61</docidentifier>
334
- <docnumber>8000-61</docnumber>
335
- <contributor>
336
- <role type='publisher'/>
337
- <organization>
338
- <name>International Organization for Standardization</name>
339
- <abbreviation>ISO</abbreviation>
340
- </organization>
341
- </contributor>
342
- </bibitem>
343
- <bibitem id='iso1' type='standard'>
344
- <docidentifier>ISO 8000-110</docidentifier>
345
- <docnumber>8000-110</docnumber>
346
- <contributor>
347
- <role type='publisher'/>
348
- <organization>
349
- <name>International Organization for Standardization</name>
350
- <abbreviation>ISO</abbreviation>
351
- </organization>
352
- </contributor>
353
- </bibitem>
354
- </references>
355
- </bibliography>
356
- </iso-standard>
373
+ #{BLANK_HDR}
374
+ <preface>
375
+ <foreword id='_' obligation='informative'>
376
+ <title>Foreword</title>
377
+ <p id='_'>
378
+ <eref type='inline' bibitemid='iso1' citeas='ISO 683-3:2019'>
379
+ <localityStack>
380
+ <locality type='clause'>
381
+ <referenceFrom>1</referenceFrom>
382
+ </locality>
383
+ </localityStack>
384
+ </eref>
385
+ <fn reference='1'>
386
+ <p id='_'>Cancelled and replaced by ISO 683-3:2022.</p>
387
+ </fn>
388
+ <eref type='inline' bibitemid='iso2' citeas='ISO 31-0'>
389
+ <localityStack>
390
+ <locality type='clause'>
391
+ <referenceFrom>1</referenceFrom>
392
+ </locality>
393
+ </localityStack>
394
+ </eref>
395
+ <fn reference='2'>
396
+ <p id='_'>Withdrawn.</p>
397
+ </fn>
398
+ </p>
399
+ </foreword>
400
+ </preface>
401
+ <sections> </sections>
402
+ <bibliography>
403
+ <references id='_' normative='false' obligation='informative'>
404
+ <title>Bibliography</title>
405
+ <bibitem id='iso2' type='standard'>
406
+ <fetched/>
407
+ <title type='title-intro' format='text/plain' language='en' script='Latn'>Title missing</title>
408
+ <title type='title-main' format='text/plain' language='en' script='Latn'>Legacy paper document</title>
409
+ <title type='main' format='text/plain' language='en' script='Latn'>Title missing — Legacy paper document</title>
410
+ <uri type='src'>https://www.iso.org/standard/2405.html</uri>
411
+ <uri type='rss'>https://www.iso.org/contents/data/standard/00/24/2405.detail.rss</uri>
412
+ <docidentifier type='ISO' primary='true'>ISO 31-0</docidentifier>
413
+ <docidentifier type='URN'>urn:iso:std:iso:31:-0:stage-95.99:ed-1:en</docidentifier>
414
+ <docnumber>31</docnumber>
415
+ <contributor>
416
+ <role type='publisher'/>
417
+ <organization>
418
+ <name>International Organization for Standardization</name>
419
+ <abbreviation>ISO</abbreviation>
420
+ <uri>www.iso.org</uri>
421
+ </organization>
422
+ </contributor>
423
+ <edition>1</edition>
424
+ <note type='Unpublished-Status'>
425
+ <p id='_'>Withdrawn.</p>
426
+ </note>
427
+ <language>en</language>
428
+ <script>Latn</script>
429
+ <status>
430
+ <stage>95</stage>
431
+ <substage>99</substage>
432
+ </status>
433
+ <copyright>
434
+ <from>1974</from>
435
+ <owner>
436
+ <organization>
437
+ <name>ISO</name>
438
+ </organization>
439
+ </owner>
440
+ </copyright>
441
+ <relation type='instance'>
442
+ <bibitem type='standard'>
443
+ <fetched/>
444
+ <title type='title-intro' format='text/plain' language='en' script='Latn'>Title missing</title>
445
+ <title type='title-main' format='text/plain' language='en' script='Latn'>Legacy paper document</title>
446
+ <title type='main' format='text/plain' language='en' script='Latn'>Title missing — Legacy paper document</title>
447
+ <uri type='src'>https://www.iso.org/standard/2405.html</uri>
448
+ <uri type='rss'>https://www.iso.org/contents/data/standard/00/24/2405.detail.rss</uri>
449
+ <docidentifier type='ISO' primary='true'>ISO 31-0:1974</docidentifier>
450
+ <docidentifier type='URN'>urn:iso:std:iso:31:-0:stage-95.99:ed-1:en</docidentifier>
451
+ <docnumber>31</docnumber>
452
+ <date type='published'>
453
+ <on>1974-01</on>
454
+ </date>
455
+ <contributor>
456
+ <role type='publisher'/>
457
+ <organization>
458
+ <name>International Organization for Standardization</name>
459
+ <abbreviation>ISO</abbreviation>
460
+ <uri>www.iso.org</uri>
461
+ </organization>
462
+ </contributor>
463
+ <edition>1</edition>
464
+ <note type='Unpublished-Status'>
465
+ <p id='_'>Withdrawn.</p>
466
+ </note>
467
+ <language>en</language>
468
+ <script>Latn</script>
469
+ <status>
470
+ <stage>95</stage>
471
+ <substage>99</substage>
472
+ </status>
473
+ <copyright>
474
+ <from>1974</from>
475
+ <owner>
476
+ <organization>
477
+ <name>ISO</name>
478
+ </organization>
479
+ </owner>
480
+ </copyright>
481
+ <place>Geneva</place>
482
+ </bibitem>
483
+ </relation>
484
+ <place>Geneva</place>
485
+ </bibitem>
486
+ <bibitem id='iso1' type='standard'>
487
+ <fetched/>
488
+ <title type='title-main' format='text/plain' language='en' script='Latn'>Heat-treatable steels, alloy steels and free-cutting steels</title>
489
+ <title type='title-part' format='text/plain' language='en' script='Latn'>Part 3: Case-hardening steels</title>
490
+ <title type='main' format='text/plain' language='en' script='Latn'>
491
+ Heat-treatable steels, alloy steels and free-cutting steels — Part 3:
492
+ Case-hardening steels
493
+ </title>
494
+ <uri type='src'>https://www.iso.org/standard/76389.html</uri>
495
+ <uri type='rss'>https://www.iso.org/contents/data/standard/07/63/76389.detail.rss</uri>
496
+ <docidentifier type='ISO' primary='true'>ISO 683-3:2019</docidentifier>
497
+ <docidentifier type='URN'>urn:iso:std:iso:683:-3:stage-95.99:ed-3:en</docidentifier>
498
+ <docnumber>683</docnumber>
499
+ <date type='published'>
500
+ <on>2019-01</on>
501
+ </date>
502
+ <contributor>
503
+ <role type='publisher'/>
504
+ <organization>
505
+ <name>International Organization for Standardization</name>
506
+ <abbreviation>ISO</abbreviation>
507
+ <uri>www.iso.org</uri>
508
+ </organization>
509
+ </contributor>
510
+ <edition>3</edition>
511
+ <note type='Unpublished-Status'>
512
+ <p id='_'>Cancelled and replaced by ISO 683-3:2022.</p>
513
+ </note>
514
+ <language>en</language>
515
+ <script>Latn</script>
516
+ <abstract format='text/plain' language='en' script='Latn'>
517
+ This document specifies the technical delivery requirements for —
518
+ semi-finished products, hot formed, e.g. blooms, billets, slabs (see
519
+ NOTE 1), — bars (see NOTE 1), — wire rod, — finished flat products,
520
+ and — hammer or drop forgings (see NOTE 1) manufactured from the
521
+ case-hardening non-alloy or alloy steels listed in Table 3 and
522
+ supplied in one of the heat-treatment conditions given for the
523
+ different types of products in Table 1 and in one of the surface
524
+ conditions given in Table 2. The steels are, in general, intended for
525
+ the manufacture of case-hardened machine parts. NOTE 1 Hammer-forged
526
+ semi-finished products (blooms, billets, slabs, etc.), seamless rolled
527
+ rings and hammer-forged bars are covered under semi-finished products
528
+ or bars and not under the term “hammer and drop forgings”. NOTE 2 For
529
+ International Standards relating to steels complying with the
530
+ requirements for the chemical composition in Table 3, however,
531
+ supplied in other product forms or treatment conditions than given
532
+ above or intended for special applications, and for other related
533
+ International Standards, see the Bibliography. In special cases,
534
+ variations in these technical delivery requirements or additions to
535
+ them can form the subject of an agreement at the time of enquiry and
536
+ order (see 5.2 and Annex A). In addition to this document, the general
537
+ technical delivery requirements of ISO 404 are applicable.
538
+ </abstract>
539
+ <status>
540
+ <stage>95</stage>
541
+ <substage>99</substage>
542
+ </status>
543
+ <copyright>
544
+ <from>2019</from>
545
+ <owner>
546
+ <organization>
547
+ <name>ISO</name>
548
+ </organization>
549
+ </owner>
550
+ </copyright>
551
+ <relation type='obsoletes'>
552
+ <bibitem type='standard'>
553
+ <formattedref format='text/plain'>ISO 683-3:2016</formattedref>
554
+ </bibitem>
555
+ </relation>
556
+ <relation type='updates'>
557
+ <bibitem type='standard'>
558
+ <formattedref format='text/plain'>ISO 683-3:2022</formattedref>
559
+ <date type='circulated'>
560
+ <on>2022-01-21</on>
561
+ </date>
562
+ </bibitem>
563
+ </relation>
564
+ <place>Geneva</place>
565
+ </bibitem>
566
+ </references>
567
+ </bibliography>
568
+ </iso-standard>
357
569
  OUTPUT
358
570
  expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
359
571
  .to be_equivalent_to xmlpp(output)
@@ -85,13 +85,11 @@ RSpec.describe Metanorma::ISO do
85
85
  <ul id="_">
86
86
  <li>
87
87
  <p id="_">ISO Online browsing platform: available at
88
-
89
- <link target="http://www.iso.org/obp"/></p>
88
+ <link target="https://www.iso.org/obp"/></p>
90
89
  </li>
91
90
  <li>
92
91
  <p id="_">IEC Electropedia: available at
93
-
94
- <link target="http://www.electropedia.org"/></p>
92
+ <link target="https://www.electropedia.org"/></p>
95
93
  </li>
96
94
  </ul>
97
95
  <term id="term-term1">
@@ -282,13 +280,11 @@ RSpec.describe Metanorma::ISO do
282
280
  <ul id="_">
283
281
  <li>
284
282
  <p id="_">ISO Online browsing platform: available at
285
-
286
- <link target="http://www.iso.org/obp"/></p>
283
+ <link target="https://www.iso.org/obp"/></p>
287
284
  </li>
288
285
  <li>
289
286
  <p id="_">IEC Electropedia: available at
290
-
291
- <link target="http://www.electropedia.org"/></p>
287
+ <link target="https://www.electropedia.org"/></p>
292
288
  </li>
293
289
  </ul>
294
290
  <term id="term-term1">
@@ -332,13 +328,13 @@ RSpec.describe Metanorma::ISO do
332
328
  <li>
333
329
  <p id='_'>
334
330
  ISO Online browsing platform: available at
335
- <link target='http://www.iso.org/obp'/>
331
+ <link target='https://www.iso.org/obp'/>
336
332
  </p>
337
333
  </li>
338
334
  <li>
339
335
  <p id='_'>
340
336
  IEC Electropedia: available at
341
- <link target='http://www.electropedia.org'/>
337
+ <link target='https://www.electropedia.org'/>
342
338
  </p>
343
339
  </li>
344
340
  </ul>
@@ -381,13 +377,11 @@ RSpec.describe Metanorma::ISO do
381
377
  <ul id="_">
382
378
  <li>
383
379
  <p id="_">ISO Online browsing platform: available at
384
-
385
- <link target="http://www.iso.org/obp"/></p>
380
+ <link target="https://www.iso.org/obp"/></p>
386
381
  </li>
387
382
  <li>
388
383
  <p id="_">IEC Electropedia: available at
389
-
390
- <link target="http://www.electropedia.org"/></p>
384
+ <link target="https://www.electropedia.org"/></p>
391
385
  </li>
392
386
  </ul>
393
387
  </terms>
@@ -424,13 +418,13 @@ RSpec.describe Metanorma::ISO do
424
418
  <li>
425
419
  <p id='_'>
426
420
  ISO Online browsing platform: available at
427
- <link target='http://www.iso.org/obp'/>
421
+ <link target='https://www.iso.org/obp'/>
428
422
  </p>
429
423
  </li>
430
424
  <li>
431
425
  <p id='_'>
432
426
  IEC Electropedia: available at
433
- <link target='http://www.electropedia.org'/>
427
+ <link target='https://www.electropedia.org'/>
434
428
  </p>
435
429
  </li>
436
430
  </ul>
@@ -461,26 +455,24 @@ RSpec.describe Metanorma::ISO do
461
455
 
462
456
  INPUT
463
457
  output = <<~OUTPUT
464
- #{BLANK_HDR.sub(%r{<doctype>article</doctype>}, "<doctype>article</doctype><subdoctype>vocabulary</subdoctype>")}
458
+ #{BLANK_HDR.sub(%r{<doctype>article</doctype>},
459
+ '<doctype>article</doctype><subdoctype>vocabulary</subdoctype>')}
465
460
  <sections>
466
461
  <terms id='_' obligation='normative'>
467
- <title>Terms and definitions</title>
462
+ <title>Terms and Definitions</title>
468
463
  <p id='_'>No terms and definitions are listed in this document.</p>
469
- <p id='_'>
470
- ISO and IEC maintain terminological databases for use in standardization
464
+ <p id='_'>ISO and IEC maintain terminological databases for use in standardization
471
465
  at the following addresses:
472
466
  </p>
473
467
  <ul id='_'>
474
468
  <li>
475
- <p id='_'>
476
- ISO Online browsing platform: available at
477
- <link target='http://www.iso.org/obp'/>
469
+ <p id='_'>ISO Online browsing platform: available at
470
+ <link target='https://www.iso.org/obp'/>
478
471
  </p>
479
472
  </li>
480
473
  <li>
481
- <p id='_'>
482
- IEC Electropedia: available at
483
- <link target='http://www.electropedia.org'/>
474
+ <p id='_'>IEC Electropedia: available at
475
+ <link target='https://www.electropedia.org'/>
484
476
  </p>
485
477
  </li>
486
478
  </ul>