metanorma-iso 1.9.4 → 1.10.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ubuntu.yml +41 -0
  3. data/Gemfile +3 -4
  4. data/Makefile +44 -0
  5. data/Rakefile +1 -1
  6. data/bin/rspec +1 -2
  7. data/lib/asciidoctor/iso/basicdoc.rng +32 -5
  8. data/lib/asciidoctor/iso/biblio.rng +2 -0
  9. data/lib/asciidoctor/iso/cleanup.rb +7 -6
  10. data/lib/asciidoctor/iso/front.rb +9 -1
  11. data/lib/asciidoctor/iso/isodoc.rng +430 -76
  12. data/lib/asciidoctor/iso/isostandard-amd.rng +1 -1
  13. data/lib/asciidoctor/iso/isostandard.rng +9 -23
  14. data/lib/asciidoctor/iso/reqt.rng +24 -3
  15. data/lib/asciidoctor/iso/validate.rb +7 -7
  16. data/lib/asciidoctor/iso/validate_section.rb +1 -1
  17. data/lib/isodoc/iso/html/isodoc.css +1 -2
  18. data/lib/isodoc/iso/html/isodoc.scss +1 -1
  19. data/lib/isodoc/iso/html/wordstyle.css +16 -4
  20. data/lib/isodoc/iso/html/wordstyle.scss +16 -4
  21. data/lib/isodoc/iso/i18n.rb +10 -9
  22. data/lib/isodoc/iso/iso.amendment.xsl +200 -20
  23. data/lib/isodoc/iso/iso.international-standard.xsl +200 -20
  24. data/lib/isodoc/iso/presentation_xml_convert.rb +9 -10
  25. data/lib/isodoc/iso/sections.rb +2 -0
  26. data/lib/isodoc/iso/word_cleanup.rb +94 -0
  27. data/lib/isodoc/iso/word_convert.rb +12 -89
  28. data/lib/metanorma/iso/version.rb +1 -1
  29. data/metanorma-iso.gemspec +4 -3
  30. data/spec/asciidoctor/base_spec.rb +685 -178
  31. data/spec/asciidoctor/blank_spec.rb +38 -0
  32. data/spec/asciidoctor/blocks_spec.rb +22 -47
  33. data/spec/asciidoctor/cleanup_spec.rb +34 -20
  34. data/spec/asciidoctor/inline_spec.rb +10 -2
  35. data/spec/asciidoctor/refs_spec.rb +87 -4
  36. data/spec/asciidoctor/section_spec.rb +3 -3
  37. data/spec/isodoc/i18n_spec.rb +29 -15
  38. data/spec/isodoc/inline_spec.rb +56 -26
  39. data/spec/isodoc/section_spec.rb +1 -1
  40. data/spec/isodoc/table_spec.rb +6 -8
  41. data/spec/isodoc/terms_spec.rb +11 -11
  42. data/spec/isodoc/xref_spec.rb +1397 -1376
  43. data/spec/metanorma/processor_spec.rb +4 -1
  44. data/spec/spec_helper.rb +14 -1
  45. data/spec/vcr_cassettes/docrels.yml +783 -0
  46. data/spec/vcr_cassettes/sortrefs.yml +599 -0
  47. metadata +38 -19
@@ -399,6 +399,7 @@ RSpec.describe IsoDoc do
399
399
  <iso-standard xmlns="http://riboseinc.com/isoxml">
400
400
  <sections>
401
401
  <terms id="Terms">
402
+ <term id="B"><preferred><expression><name>B</name></expression></preferred>
402
403
  <p>
403
404
  <ul>
404
405
  <li><concept><refterm>term0</refterm>
@@ -476,6 +477,7 @@ RSpec.describe IsoDoc do
476
477
  </concept></li>
477
478
  </ul>
478
479
  </p>
480
+ </term>
479
481
  </terms>
480
482
  <clause id="clause1"><title>Clause 1</title></clause>
481
483
  </sections>
@@ -499,6 +501,9 @@ RSpec.describe IsoDoc do
499
501
  <iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
500
502
  <sections>
501
503
  <terms id="Terms" displayorder="2"><title>2</title>
504
+ <term id='B'>
505
+ <name>2.1</name>
506
+ <preferred>B</preferred>
502
507
  <p>
503
508
  <ul>
504
509
  <li>
@@ -570,6 +575,7 @@ RSpec.describe IsoDoc do
570
575
  </li>
571
576
  </ul>
572
577
  </p>
578
+ </term>
573
579
  </terms>
574
580
  <clause id="clause1" displayorder="3"><title depth="1">3<tab/>Clause 1</title></clause>
575
581
  </sections>
@@ -608,6 +614,8 @@ RSpec.describe IsoDoc do
608
614
  </div>
609
615
  <div id='Terms'>
610
616
  <h1>2</h1>
617
+ <p class='TermNum' id='B'>2.1</p>
618
+ <p class='Terms' style='text-align:left;'>B</p>
611
619
  <p>
612
620
  <ul>
613
621
  <li>
@@ -698,6 +706,14 @@ RSpec.describe IsoDoc do
698
706
  </foreword></preface>
699
707
  <sections>
700
708
  <terms id="Terms">
709
+ <clause id="A">
710
+ <ul>
711
+ <li><concept><refterm>term1</refterm>
712
+ <renderterm>term</renderterm>
713
+ <xref target='clause1'/>
714
+ </concept></li>
715
+ </ul>
716
+ </clause>
701
717
  <term id="clause1">
702
718
  <ul>
703
719
  <li><concept><refterm>term1</refterm>
@@ -715,32 +731,38 @@ RSpec.describe IsoDoc do
715
731
  </iso-standard>
716
732
  INPUT
717
733
  presxml = <<~OUTPUT
718
- <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
719
- <preface>
720
- <foreword id='A' displayorder='1'>
721
- <ul>
722
- <li>term</li>
723
- </ul>
724
- </foreword>
725
- </preface>
726
- <sections>
727
- <terms id='Terms' displayorder='2'>
728
- <title>1</title>
729
- <term id='clause1'>
730
- <name>1.1</name>
731
- <ul>
732
- <li>
733
- <em>term</em>
734
- (
735
- <xref target='clause1'>1.1</xref>
736
- )
737
- </li>
738
- <li>term</li>
739
- </ul>
740
- </term>
741
- </terms>
742
- </sections>
743
- </iso-standard>
734
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
735
+ <preface>
736
+ <foreword id='A' displayorder='1'>
737
+ <ul>
738
+ <li>term</li>
739
+ </ul>
740
+ </foreword>
741
+ </preface>
742
+ <sections>
743
+ <terms id='Terms' displayorder='2'>
744
+ <title>1</title>
745
+ <clause id='A' inline-header='true'>
746
+ <title>1.1</title>
747
+ <ul>
748
+ <li> term </li>
749
+ </ul>
750
+ </clause>
751
+ <term id='clause1'>
752
+ <name>1.2</name>
753
+ <ul>
754
+ <li>
755
+ <em>term</em>
756
+ (
757
+ <xref target='clause1'>1.2</xref>
758
+ )
759
+ </li>
760
+ <li>term</li>
761
+ </ul>
762
+ </term>
763
+ </terms>
764
+ </sections>
765
+ </iso-standard>
744
766
  OUTPUT
745
767
  expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({})
746
768
  .convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
@@ -752,6 +774,7 @@ RSpec.describe IsoDoc do
752
774
  <sections>
753
775
  <clause id="clause1"><title>Clause 1</title></clause>
754
776
  <terms id="A">
777
+ <term id="B"><preferred><expression><name>B</name></expression></preferred<
755
778
  <p>
756
779
  <ul>
757
780
  <li>
@@ -784,6 +807,7 @@ RSpec.describe IsoDoc do
784
807
  <li><concept ital="true" ref="true" linkmention="false" linkref="true"><refterm>term</refterm><renderterm>term</renderterm><xref target='clause1'/></concept></li>
785
808
  <li><concept ital="true" ref="true" linkmention="false" linkref="false"><refterm>term</refterm><renderterm>term</renderterm><xref target='clause1'/></concept></li>
786
809
  </ul></p>
810
+ </term>
787
811
  </terms>
788
812
  </sections>
789
813
  </iso-standard>
@@ -793,6 +817,9 @@ RSpec.describe IsoDoc do
793
817
  <sections>
794
818
  <clause id="clause1" displayorder="1"><title depth="1">1<tab/>Clause 1</title></clause>
795
819
  <terms id="A" displayorder="2"><title>2</title>
820
+ <term id='B'>
821
+ <name>2.1</name>
822
+ <preferred>B</preferred>
796
823
  <p>
797
824
  <ul>
798
825
  <li>
@@ -821,6 +848,7 @@ RSpec.describe IsoDoc do
821
848
  <li><em>term</em> (<xref target="clause1">Clause 1</xref>)</li>
822
849
  <li><em>term</em> (Clause 1)</li>
823
850
  </ul></p>
851
+ </term>
824
852
  </terms>
825
853
  </sections>
826
854
  </iso-standard>
@@ -833,6 +861,8 @@ RSpec.describe IsoDoc do
833
861
  </div>
834
862
  <div id='A'>
835
863
  <h1>2</h1>
864
+ <p class='TermNum' id='B'>2.1</p>
865
+ <p class='Terms' style='text-align:left;'>B</p>
836
866
  <p>
837
867
  <ul>
838
868
  <li>
@@ -27,7 +27,7 @@ RSpec.describe IsoDoc do
27
27
  <terms id="I" obligation="normative">
28
28
  <title>Normal Terms</title>
29
29
  <term id="J">
30
- <preferred>Term2</preferred>
30
+ <preferred><expression><name>Term2</name></expression></preferred>
31
31
  </term>
32
32
  </terms>
33
33
  <definitions id="K">
@@ -368,14 +368,12 @@ RSpec.describe IsoDoc do
368
368
  </td>
369
369
  </tr>
370
370
  </tfoot>
371
- </table>
372
- <table class="dl">
373
- <tr>
374
- <td align="left" valign="top">
375
- <p align="left" class="MsoNormal" style="margin-left:0pt;text-align:left;">Drago</p>
376
- </td>
377
- <td valign="top">A type of rice</td>
378
- </tr>
371
+ <dl>
372
+ <dt>
373
+ <p align='left' style='margin-left:0pt;text-align:left;' class='MsoNormal'>Drago</p>
374
+ </dt>
375
+ <dd>A type of rice</dd>
376
+ </dl>
379
377
  </table>
380
378
  </div>
381
379
  OUTPUT
@@ -7,9 +7,9 @@ RSpec.describe IsoDoc do
7
7
  <sections>
8
8
  <terms id="_terms_and_definitions" obligation="normative"><title>Terms and Definitions</title>
9
9
  <term id="paddy1">
10
- <preferred>paddy</preferred>
10
+ <preferred><expression><name>paddy</name></expression></preferred>
11
11
  <domain>rice</domain>
12
- <definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
12
+ <definition><verbaldefinition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></verbaldefinition></definition>
13
13
  <termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f892">
14
14
  <p id="_65c9a509-9a89-4b54-a890-274126aeb55c">Foreign seeds, husks, bran, sand, dust.</p>
15
15
  <ul>
@@ -31,11 +31,11 @@ RSpec.describe IsoDoc do
31
31
  </term>
32
32
 
33
33
  <term id="paddy">
34
- <preferred>paddy</preferred>
35
- <admitted>paddy rice</admitted>
36
- <admitted>rough rice</admitted>
37
- <deprecates>cargo rice</deprecates>
38
- <definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
34
+ <preferred><expression><name>paddy</name></expression></preferred>
35
+ <admitted><expression><name>paddy rice</name></expression></admitted>
36
+ <admitted><expression><name>rough rice</name></expression></admitted>
37
+ <deprecates><expression><name>cargo rice</name></expression></deprecates>
38
+ <definition><verbaldefinition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></verbaldefinition></definition>
39
39
  <termnote id="_671a1994-4783-40d0-bc81-987d06ffb74e">
40
40
  <p id="_19830f33-e46c-42cc-94ca-a5ef101132d5">The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p>
41
41
  </termnote>
@@ -53,11 +53,11 @@ RSpec.describe IsoDoc do
53
53
  </termsource>
54
54
  </term>
55
55
  <term id="A">
56
- <preferred>term1</preferred>
57
- <definition>term1 definition</definition>
56
+ <preferred><expression><name>term1</name></expression></preferred>
57
+ <definition><verbaldefinition>term1 definition</verbaldefinition></definition>
58
58
  <term id="B">
59
- <preferred>term2</preferred>
60
- <definition>term2 definition</definition>
59
+ <preferred><expression><name>term2</name></expression></preferred>
60
+ <definition><verbaldefinition>term2 definition</verbaldefinition></definition>
61
61
  </term>
62
62
  </term>
63
63
  </terms>