metanorma-standoc 2.0.2 → 2.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/lib/metanorma/standoc/base.rb +73 -23
  3. data/lib/metanorma/standoc/basicdoc.rng +5 -3
  4. data/lib/metanorma/standoc/biblio.rng +5 -3
  5. data/lib/metanorma/standoc/blocks.rb +4 -4
  6. data/lib/metanorma/standoc/cleanup_amend.rb +33 -30
  7. data/lib/metanorma/standoc/cleanup_boilerplate.rb +29 -5
  8. data/lib/metanorma/standoc/cleanup_image.rb +117 -3
  9. data/lib/metanorma/standoc/cleanup_ref.rb +32 -3
  10. data/lib/metanorma/standoc/cleanup_ref_dl.rb +25 -16
  11. data/lib/metanorma/standoc/cleanup_section.rb +2 -2
  12. data/lib/metanorma/standoc/cleanup_terms_designations.rb +4 -2
  13. data/lib/metanorma/standoc/cleanup_text.rb +39 -17
  14. data/lib/metanorma/standoc/cleanup_xref.rb +82 -13
  15. data/lib/metanorma/standoc/converter.rb +2 -1
  16. data/lib/metanorma/standoc/inline.rb +21 -12
  17. data/lib/metanorma/standoc/isodoc.rng +73 -3
  18. data/lib/metanorma/standoc/macros.rb +14 -2
  19. data/lib/metanorma/standoc/macros_embed.rb +35 -14
  20. data/lib/metanorma/standoc/macros_note.rb +4 -3
  21. data/lib/metanorma/standoc/processor.rb +6 -1
  22. data/lib/metanorma/standoc/ref.rb +20 -16
  23. data/lib/metanorma/standoc/ref_utility.rb +8 -6
  24. data/lib/metanorma/standoc/render.rb +7 -3
  25. data/lib/metanorma/standoc/table.rb +8 -10
  26. data/lib/metanorma/standoc/term_lookup_cleanup.rb +16 -10
  27. data/lib/metanorma/standoc/terms.rb +10 -7
  28. data/lib/metanorma/standoc/utils.rb +3 -1
  29. data/lib/metanorma/standoc/validate.rb +81 -7
  30. data/lib/metanorma/standoc/version.rb +1 -1
  31. data/metanorma-standoc.gemspec +2 -2
  32. data/spec/assets/a2.adoc +4 -2
  33. data/spec/assets/a3.adoc +2 -2
  34. data/spec/assets/a3a.adoc +7 -0
  35. data/spec/metanorma/base_spec.rb +1 -1
  36. data/spec/metanorma/cleanup_blocks_spec.rb +136 -0
  37. data/spec/metanorma/cleanup_spec.rb +34 -23
  38. data/spec/metanorma/cleanup_terms_spec.rb +16 -4
  39. data/spec/metanorma/inline_spec.rb +31 -0
  40. data/spec/metanorma/isobib_cache_spec.rb +2 -2
  41. data/spec/metanorma/macros_plantuml_spec.rb +41 -42
  42. data/spec/metanorma/macros_spec.rb +267 -4
  43. data/spec/metanorma/processor_spec.rb +17 -13
  44. data/spec/metanorma/refs_spec.rb +632 -460
  45. data/spec/metanorma/section_spec.rb +1 -1
  46. data/spec/metanorma/validate_spec.rb +108 -0
  47. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +48 -48
  48. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec1.yml +13 -13
  49. data/spec/vcr_cassettes/hide_refs.yml +100 -100
  50. data/spec/vcr_cassettes/isobib_get_123.yml +12 -12
  51. data/spec/vcr_cassettes/isobib_get_123_1.yml +25 -25
  52. data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +35 -35
  53. data/spec/vcr_cassettes/isobib_get_123_2001.yml +11 -11
  54. data/spec/vcr_cassettes/isobib_get_124.yml +13 -13
  55. data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +18 -18
  56. data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +86 -66
  57. metadata +10 -9
@@ -1307,10 +1307,10 @@ RSpec.describe Metanorma::Standoc do
1307
1307
  <title>Clause 1.2</title>
1308
1308
  </clause>
1309
1309
  </clause>
1310
+ <floating-title id='_' depth='1' type='floating-title'>Another top-level floating title</floating-title>
1310
1311
  <clause id='_' inline-header='false' obligation='normative'>
1311
1312
  <title>Clause 2</title>
1312
1313
  </clause>
1313
- <floating-title id='_' depth='1' type='floating-title'>Another top-level floating title</floating-title>
1314
1314
  </sections>
1315
1315
  </standard-document>
1316
1316
  OUTPUT
@@ -478,6 +478,114 @@ RSpec.describe Metanorma::Standoc do
478
478
  expect(File.exist?("test.xml")).to be false
479
479
  end
480
480
 
481
+ it "does not warn and abort if columns and rows not out of bounds" do
482
+ FileUtils.rm_f "test.xml"
483
+ FileUtils.rm_f "test.err"
484
+ begin
485
+ input = <<~INPUT
486
+ = Document title
487
+ Author
488
+ :docfile: test.adoc
489
+ :nodoc:
490
+
491
+ == Clause
492
+
493
+ [cols="1,1,1,1"]
494
+ |===
495
+ 3.2+| a | a
496
+
497
+ | a
498
+ | a | a | a | a
499
+ |===
500
+ INPUT
501
+ expect { Asciidoctor.convert(input, *OPTIONS) }.not_to raise_error(SystemExit)
502
+ rescue SystemExit
503
+ end
504
+ expect(File.read("test.err"))
505
+ .not_to include "Table exceeds maximum number of columns defined"
506
+ expect(File.read("test.err"))
507
+ .not_to include "Table rows in table are inconsistent: check rowspan"
508
+ end
509
+
510
+ xit "warns and aborts if columns out of bounds against colgroup" do
511
+ FileUtils.rm_f "test.xml"
512
+ FileUtils.rm_f "test.err"
513
+ begin
514
+ input = <<~INPUT
515
+ = Document title
516
+ Author
517
+ :docfile: test.adoc
518
+ :nodoc:
519
+
520
+ [cols="1,1,1,1"]
521
+ |===
522
+ 5+| a
523
+
524
+ | a 4+| a
525
+ | a | a |a |a
526
+ |===
527
+ INPUT
528
+ expect { Asciidoctor.convert(input, *OPTIONS) }.to raise_error(SystemExit)
529
+ rescue SystemExit
530
+ end
531
+ expect(File.read("test.err"))
532
+ .to include "Table exceeds maximum number of columns defined (4)"
533
+ expect(File.read("test.err"))
534
+ .not_to include "Table rows in table are inconsistent: check rowspan"
535
+ end
536
+
537
+ xit "warns and aborts if columns out of bounds against cell count per row" do
538
+ FileUtils.rm_f "test.xml"
539
+ FileUtils.rm_f "test.err"
540
+ begin
541
+ input = <<~INPUT
542
+ = Document title
543
+ Author
544
+ :docfile: test.adoc
545
+ :nodoc:
546
+
547
+ |===
548
+ 2.3+| a | a
549
+
550
+ | a | a | a
551
+ | a | a | a
552
+ |===
553
+ INPUT
554
+ expect { Asciidoctor.convert(input, *OPTIONS) }.to raise_error(SystemExit)
555
+ rescue SystemExit
556
+ end
557
+ expect(File.read("test.err"))
558
+ .to include "Table exceeds maximum number of columns defined (3)"
559
+ expect(File.read("test.err"))
560
+ .not_to include "Table rows in table are inconsistent: check rowspan"
561
+ end
562
+
563
+ it "warns and aborts if rows out of bounds" do
564
+ FileUtils.rm_f "test.xml"
565
+ FileUtils.rm_f "test.err"
566
+ begin
567
+ input = <<~INPUT
568
+ = Document title
569
+ Author
570
+ :docfile: test.adoc
571
+ :nodoc:
572
+
573
+ |===
574
+ .4+| a | a | a | a
575
+
576
+ | a | a | a
577
+ | a | a | a
578
+ |===
579
+ INPUT
580
+ expect { Asciidoctor.convert(input, *OPTIONS) }.to raise_error(SystemExit)
581
+ rescue SystemExit
582
+ end
583
+ expect(File.read("test.err"))
584
+ .not_to include "Table exceeds maximum number of columns defined"
585
+ expect(File.read("test.err"))
586
+ .to include "Table rows in table are inconsistent: check rowspan"
587
+ end
588
+
481
589
  it "err file succesfully created for docfile path" do
482
590
  FileUtils.rm_rf "test"
483
591
  FileUtils.mkdir_p "test"