metanorma-standoc 2.0.3 → 2.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/lib/metanorma/standoc/base.rb +61 -22
  3. data/lib/metanorma/standoc/blocks.rb +3 -3
  4. data/lib/metanorma/standoc/cleanup_boilerplate.rb +3 -3
  5. data/lib/metanorma/standoc/cleanup_ref.rb +31 -2
  6. data/lib/metanorma/standoc/cleanup_ref_dl.rb +20 -16
  7. data/lib/metanorma/standoc/cleanup_section.rb +1 -1
  8. data/lib/metanorma/standoc/cleanup_terms_designations.rb +4 -2
  9. data/lib/metanorma/standoc/cleanup_xref.rb +70 -8
  10. data/lib/metanorma/standoc/converter.rb +1 -0
  11. data/lib/metanorma/standoc/inline.rb +21 -12
  12. data/lib/metanorma/standoc/isodoc.rng +63 -3
  13. data/lib/metanorma/standoc/macros.rb +13 -1
  14. data/lib/metanorma/standoc/macros_embed.rb +1 -1
  15. data/lib/metanorma/standoc/ref.rb +5 -6
  16. data/lib/metanorma/standoc/render.rb +7 -3
  17. data/lib/metanorma/standoc/table.rb +8 -10
  18. data/lib/metanorma/standoc/term_lookup_cleanup.rb +2 -1
  19. data/lib/metanorma/standoc/utils.rb +3 -1
  20. data/lib/metanorma/standoc/version.rb +1 -1
  21. data/spec/metanorma/base_spec.rb +1 -1
  22. data/spec/metanorma/cleanup_spec.rb +10 -10
  23. data/spec/metanorma/cleanup_terms_spec.rb +1 -1
  24. data/spec/metanorma/inline_spec.rb +31 -0
  25. data/spec/metanorma/macros_plantuml_spec.rb +41 -42
  26. data/spec/metanorma/macros_spec.rb +138 -2
  27. data/spec/metanorma/processor_spec.rb +17 -13
  28. data/spec/metanorma/refs_spec.rb +129 -2
  29. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +45 -45
  30. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec1.yml +10 -10
  31. data/spec/vcr_cassettes/hide_refs.yml +39 -39
  32. data/spec/vcr_cassettes/isobib_get_123.yml +12 -12
  33. data/spec/vcr_cassettes/isobib_get_123_1.yml +23 -23
  34. data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +28 -28
  35. data/spec/vcr_cassettes/isobib_get_123_2001.yml +11 -11
  36. data/spec/vcr_cassettes/isobib_get_124.yml +12 -12
  37. data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +18 -18
  38. data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +75 -65
  39. metadata +2 -2
@@ -2496,12 +2496,12 @@ RSpec.describe Metanorma::Standoc do
2496
2496
  * [[[iso124,(*A*.footnote:[hello])XYZ]]] _Standard_
2497
2497
  INPUT
2498
2498
  output = <<~OUTPUT
2499
- #{BLANK_HDR}
2499
+ #{BLANK_HDR}
2500
2500
  <preface>
2501
2501
  <foreword id='_' obligation='informative'>
2502
2502
  <title>Foreword</title>
2503
2503
  <p id='_'>
2504
- <eref type='inline' bibitemid='iso124' citeas='[&amp;#x3c;strong&amp;#x3e;A&amp;#x3c;/strong&amp;#x3e;.&amp;#x3c;fn reference=&amp;#x22;1&amp;#x22;&amp;#x3e;&amp;#xa; &amp;#x3c;p&amp;#x3e;hello&amp;#x3c;/p&amp;#x3e;&amp;#xa;&amp;#x3c;/fn&amp;#x3e;]'/>
2504
+ <eref type='inline' bibitemid='iso124' citeas='[&amp;#x3c;strong&amp;#x3e;A&amp;#x3c;/strong&amp;#x3e;.&amp;#x3c;fn reference=&amp;#x22;1&amp;#x22;&amp;#x3e;&amp;#x3c;p&amp;#x3e;hello&amp;#x3c;/p&amp;#x3e;&amp;#xa;&amp;#x3c;/fn&amp;#x3e;]'/>
2505
2505
  </p>
2506
2506
  </foreword>
2507
2507
  </preface>
@@ -2532,6 +2532,133 @@ RSpec.describe Metanorma::Standoc do
2532
2532
  .to be_equivalent_to xmlpp(output)
2533
2533
  end
2534
2534
 
2535
+ it "processes combinations of crossreferences" do
2536
+ input = <<~INPUT
2537
+ #{ASCIIDOC_BLANK_HDR}
2538
+ == Section
2539
+
2540
+ <<ref1,clause=3;to!clause=5>>
2541
+ <<ref1,from!clause=3;to!clause=5,text>>
2542
+ <<ref1,clause=3;clause=5>>
2543
+ <<ref1,clause=3;and!clause=5>>
2544
+ <<ref1,clause=3;or!clause=5,text>>
2545
+ <<ref1,from!clause=3;to!clause=5;and!clause=8;to!clause=10>>
2546
+
2547
+ [bibliography]
2548
+ == Bibliography
2549
+
2550
+ * [[[ref1,XYZ]]] _Standard_
2551
+ INPUT
2552
+ output = <<~OUTPUT
2553
+ #{BLANK_HDR}
2554
+ <sections>
2555
+ <clause id='_' inline-header='false' obligation='normative'>
2556
+ <title>Section</title>
2557
+ <p id='_'>
2558
+ <eref type='inline' bibitemid='ref1' citeas='XYZ'>
2559
+ <localityStack connective='from'>
2560
+ <locality type='clause'>
2561
+ <referenceFrom>3</referenceFrom>
2562
+ </locality>
2563
+ </localityStack>
2564
+ <localityStack connective='to'>
2565
+ <locality type='clause'>
2566
+ <referenceFrom>5</referenceFrom>
2567
+ </locality>
2568
+ </localityStack>
2569
+ </eref>
2570
+ <eref type='inline' bibitemid='ref1' citeas='XYZ'>
2571
+ <localityStack connective='from'>
2572
+ <locality type='clause'>
2573
+ <referenceFrom>3</referenceFrom>
2574
+ </locality>
2575
+ </localityStack>
2576
+ <localityStack connective='to'>
2577
+ <locality type='clause'>
2578
+ <referenceFrom>5</referenceFrom>
2579
+ </locality>
2580
+ </localityStack>
2581
+ text
2582
+ </eref>
2583
+ <eref type='inline' bibitemid='ref1' citeas='XYZ'>
2584
+ <localityStack connective='and'>
2585
+ <locality type='clause'>
2586
+ <referenceFrom>3</referenceFrom>
2587
+ </locality>
2588
+ </localityStack>
2589
+ <localityStack connective='and'>
2590
+ <locality type='clause'>
2591
+ <referenceFrom>5</referenceFrom>
2592
+ </locality>
2593
+ </localityStack>
2594
+ </eref>
2595
+ <eref type='inline' bibitemid='ref1' citeas='XYZ'>
2596
+ <localityStack connective='and'>
2597
+ <locality type='clause'>
2598
+ <referenceFrom>3</referenceFrom>
2599
+ </locality>
2600
+ </localityStack>
2601
+ <localityStack connective='and'>
2602
+ <locality type='clause'>
2603
+ <referenceFrom>5</referenceFrom>
2604
+ </locality>
2605
+ </localityStack>
2606
+ </eref>
2607
+ <eref type='inline' bibitemid='ref1' citeas='XYZ'>
2608
+ <localityStack connective='and'>
2609
+ <locality type='clause'>
2610
+ <referenceFrom>3</referenceFrom>
2611
+ </locality>
2612
+ </localityStack>
2613
+ <localityStack connective='or'>
2614
+ <locality type='clause'>
2615
+ <referenceFrom>5</referenceFrom>
2616
+ </locality>
2617
+ </localityStack>
2618
+ text
2619
+ </eref>
2620
+ <eref type='inline' bibitemid='ref1' citeas='XYZ'>
2621
+ <localityStack connective='from'>
2622
+ <locality type='clause'>
2623
+ <referenceFrom>3</referenceFrom>
2624
+ </locality>
2625
+ </localityStack>
2626
+ <localityStack connective='to'>
2627
+ <locality type='clause'>
2628
+ <referenceFrom>5</referenceFrom>
2629
+ </locality>
2630
+ </localityStack>
2631
+ <localityStack connective='and'>
2632
+ <locality type='clause'>
2633
+ <referenceFrom>8</referenceFrom>
2634
+ </locality>
2635
+ </localityStack>
2636
+ <localityStack connective='to'>
2637
+ <locality type='clause'>
2638
+ <referenceFrom>10</referenceFrom>
2639
+ </locality>
2640
+ </localityStack>
2641
+ </eref>
2642
+ </p>
2643
+ </clause>
2644
+ </sections>
2645
+ <bibliography>
2646
+ <references id='_' normative='false' obligation='informative'>
2647
+ <title>Bibliography</title>
2648
+ <bibitem id='ref1'>
2649
+ <formattedref format='application/x-isodoc+xml'>
2650
+ <em>Standard</em>
2651
+ </formattedref>
2652
+ <docidentifier>XYZ</docidentifier>
2653
+ </bibitem>
2654
+ </references>
2655
+ </bibliography>
2656
+ </standard-document>
2657
+ OUTPUT
2658
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
2659
+ .to be_equivalent_to xmlpp(output)
2660
+ end
2661
+
2535
2662
  private
2536
2663
 
2537
2664
  def mock_isobib_get_123