metanorma-iso 1.8.1 → 1.8.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -101,20 +101,6 @@ RSpec.describe Asciidoctor::ISO do
101
101
  <title>Terms, definitions, symbols and abbreviated terms</title>
102
102
  <terms id="_" obligation="normative">
103
103
  <title>Normal Terms</title>
104
- <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
105
- <p id="_">ISO and IEC maintain terminological databases for use in standardization at the following addresses:</p>
106
- <ul id="_">
107
- <li>
108
- <p id="_">ISO Online browsing platform: available at
109
-
110
- <link target="http://www.iso.org/obp"/></p>
111
- </li>
112
- <li>
113
- <p id="_">IEC Electropedia: available at
114
-
115
- <link target="http://www.electropedia.org"/></p>
116
- </li>
117
- </ul>
118
104
  <term id="term-term2">
119
105
  <preferred>Term2</preferred>
120
106
  </term>
@@ -517,7 +517,8 @@ RSpec.describe Asciidoctor::ISO do
517
517
  <<iso123>>
518
518
  INPUT
519
519
  expect(File.read("test.err"))
520
- .to include "iso123 does not have a corresponding anchor ID in the bibliography"
520
+ .to include "iso123 does not have a corresponding anchor ID "\
521
+ "in the bibliography"
521
522
  end
522
523
 
523
524
  it "warns that undated reference has locality" do
@@ -530,9 +531,10 @@ RSpec.describe Asciidoctor::ISO do
530
531
  [bibliography]
531
532
  == Normative References
532
533
  * [[[iso123,ISO 123]]] _Standard_
533
- INPUT
534
- expect(File.read("test.err"))
535
- .to include "undated reference ISO 123 should not contain specific elements"
534
+ INPUT
535
+ expect(File.read("test.err"))
536
+ .to include "undated reference ISO 123 should not contain "\
537
+ "specific elements"
536
538
  end
537
539
 
538
540
  it "do not warn that undated reference which is a bibliographic reference has locality" do
@@ -545,9 +547,10 @@ RSpec.describe Asciidoctor::ISO do
545
547
  [bibliography]
546
548
  == Bibliography
547
549
  * [[[iso123,1]]] _Standard_
548
- INPUT
549
- expect(File.read("test.err"))
550
- .not_to include "undated reference [1] should not contain specific elements"
550
+ INPUT
551
+ expect(File.read("test.err"))
552
+ .not_to include "undated reference [1] should not contain specific "\
553
+ "elements"
551
554
  end
552
555
 
553
556
  it "do not warn that undated IEV reference has locality" do
@@ -560,9 +563,10 @@ RSpec.describe Asciidoctor::ISO do
560
563
  [bibliography]
561
564
  == Normative References
562
565
  * [[[iev,IEV]]] _Standard_
563
- INPUT
564
- expect(File.read("test.err"))
565
- .not_to include "undated reference IEV should not contain specific elements"
566
+ INPUT
567
+ expect(File.read("test.err"))
568
+ .not_to include "undated reference IEV should not contain specific "\
569
+ "elements"
566
570
  end
567
571
 
568
572
  it "do not warn that in print has locality" do
@@ -575,8 +579,10 @@ RSpec.describe Asciidoctor::ISO do
575
579
  [bibliography]
576
580
  == Normative References
577
581
  * [[[iev,ISO 123:--]]] _Standard_
578
- INPUT
579
- expect(File.read("test.err")).not_to include "undated reference ISO 123 should not contain specific elements"
582
+ INPUT
583
+ expect(File.read("test.err"))
584
+ .not_to include "undated reference ISO 123 should not contain specific "\
585
+ "elements"
580
586
  end
581
587
 
582
588
  it "warns of Non-reference in bibliography" do
@@ -641,7 +647,8 @@ RSpec.describe Asciidoctor::ISO do
641
647
  == Clause
642
648
  ISO 12121
643
649
  INPUT
644
- expect(File.read("test.err")).not_to include "number not broken up in threes"
650
+ expect(File.read("test.err"))
651
+ .not_to include "number not broken up in threes"
645
652
  end
646
653
 
647
654
  it "Style warning if decimal point" do
@@ -681,7 +688,8 @@ RSpec.describe Asciidoctor::ISO do
681
688
  == Clause
682
689
  95 ± 5 %
683
690
  INPUT
684
- expect(File.read("test.err")).to include "unbracketed tolerance before percent sign"
691
+ expect(File.read("test.err"))
692
+ .to include "unbracketed tolerance before percent sign"
685
693
  end
686
694
 
687
695
  it "Style warning if dots in abbreviation" do
@@ -721,7 +729,8 @@ RSpec.describe Asciidoctor::ISO do
721
729
  == Clause
722
730
  5 °
723
731
  INPUT
724
- expect(File.read("test.err")).to include "space between number and degrees/minutes/seconds"
732
+ expect(File.read("test.err"))
733
+ .to include "space between number and degrees/minutes/seconds"
725
734
  end
726
735
 
727
736
  it "Style warning if no space between number and SI unit" do
@@ -731,7 +740,8 @@ RSpec.describe Asciidoctor::ISO do
731
740
  == Clause
732
741
  A measurement of 5Bq was taken.
733
742
  INPUT
734
- expect(File.read("test.err")).to include "no space between number and SI unit"
743
+ expect(File.read("test.err"))
744
+ .to include "no space between number and SI unit"
735
745
  end
736
746
 
737
747
  it "Style warning if mins used" do
@@ -777,7 +787,8 @@ RSpec.describe Asciidoctor::ISO do
777
787
  == Symbols and Abbreviated Terms
778
788
  INPUT
779
789
  expect(File.read("test.err"))
780
- .to include "Only one Symbols and Abbreviated Terms section in the standard"
790
+ .to include "Only one Symbols and Abbreviated Terms section "\
791
+ "in the standard"
781
792
  end
782
793
 
783
794
  it "Style warning if Symbols and Abbreviated Terms contains extraneous matter" do
@@ -789,7 +800,8 @@ RSpec.describe Asciidoctor::ISO do
789
800
  Paragraph
790
801
  INPUT
791
802
  expect(File.read("test.err"))
792
- .to include "Symbols and Abbreviated Terms can only contain a definition list"
803
+ .to include "Symbols and Abbreviated Terms can only contain "\
804
+ "a definition list"
793
805
  end
794
806
 
795
807
  it "Warning if missing foreword" do
@@ -902,7 +914,9 @@ RSpec.describe Asciidoctor::ISO do
902
914
 
903
915
  Paragraph
904
916
  INPUT
905
- expect(File.read("test.err")).to include "Normative References must be followed by Terms and Definitions"
917
+ expect(File.read("test.err"))
918
+ .to include "Normative References must be followed by "\
919
+ "Terms and Definitions"
906
920
 
907
921
  Asciidoctor.convert(<<~"INPUT", *OPTIONS)
908
922
  = Document title
@@ -924,7 +938,9 @@ RSpec.describe Asciidoctor::ISO do
924
938
 
925
939
  Paragraph
926
940
  INPUT
927
- expect(File.read("test.err")).not_to include "Normative References must be followed by Terms and Definitions"
941
+ expect(File.read("test.err"))
942
+ .not_to include "Normative References must be followed by "\
943
+ "Terms and Definitions"
928
944
  end
929
945
 
930
946
  it "Warning if there are no clauses in the document" do
@@ -944,7 +960,8 @@ RSpec.describe Asciidoctor::ISO do
944
960
  == Symbols and Abbreviated Terms
945
961
 
946
962
  INPUT
947
- expect(File.read("test.err")).to include "Document must contain at least one clause"
963
+ expect(File.read("test.err"))
964
+ .to include "Document must contain at least one clause"
948
965
 
949
966
  Asciidoctor.convert(<<~"INPUT", *OPTIONS)
950
967
  = Document title
@@ -967,7 +984,8 @@ RSpec.describe Asciidoctor::ISO do
967
984
  == Symbols and Abbreviated Terms
968
985
 
969
986
  INPUT
970
- expect(File.read("test.err")).not_to include "Document must contain at least one clause"
987
+ expect(File.read("test.err"))
988
+ .not_to include "Document must contain at least one clause"
971
989
  end
972
990
 
973
991
  it "Warning if scope occurs after Terms and Definitions" do
@@ -989,7 +1007,8 @@ RSpec.describe Asciidoctor::ISO do
989
1007
  == Scope
990
1008
 
991
1009
  INPUT
992
- expect(File.read("test.err")).to include "Scope must occur before Terms and Definitions"
1010
+ expect(File.read("test.err"))
1011
+ .to include "Scope must occur before Terms and Definitions"
993
1012
 
994
1013
  Asciidoctor.convert(<<~"INPUT", *OPTIONS)
995
1014
  = Document title
@@ -1014,7 +1033,8 @@ RSpec.describe Asciidoctor::ISO do
1014
1033
  == Scope
1015
1034
 
1016
1035
  INPUT
1017
- expect(File.read("test.err")).not_to include "Scope must occur before Terms and Definitions"
1036
+ expect(File.read("test.err"))
1037
+ .not_to include "Scope must occur before Terms and Definitions"
1018
1038
  end
1019
1039
 
1020
1040
  it "Warning if Symbols and Abbreviated Terms does not occur immediately after Terms and Definitions" do
@@ -1036,7 +1056,8 @@ RSpec.describe Asciidoctor::ISO do
1036
1056
  == Symbols and Abbreviated Terms
1037
1057
 
1038
1058
  INPUT
1039
- expect(File.read("test.err")).to include "Only annexes and references can follow clauses"
1059
+ expect(File.read("test.err"))
1060
+ .to include "Only annexes and references can follow clauses"
1040
1061
 
1041
1062
  Asciidoctor.convert(<<~"INPUT", *OPTIONS)
1042
1063
  = Document title
@@ -1062,7 +1083,8 @@ RSpec.describe Asciidoctor::ISO do
1062
1083
  == Symbols and Abbreviated Terms
1063
1084
 
1064
1085
  INPUT
1065
- expect(File.read("test.err")).not_to include "Only annexes and references can follow clauses"
1086
+ expect(File.read("test.err"))
1087
+ .not_to include "Only annexes and references can follow clauses"
1066
1088
  end
1067
1089
 
1068
1090
  it "Warning if no normative references" do
@@ -1088,7 +1110,8 @@ RSpec.describe Asciidoctor::ISO do
1088
1110
  == Appendix C
1089
1111
 
1090
1112
  INPUT
1091
- expect(File.read("test.err")).to include "Document must include (references) Normative References"
1113
+ expect(File.read("test.err"))
1114
+ .to include "Document must include (references) Normative References"
1092
1115
 
1093
1116
  Asciidoctor.convert(<<~"INPUT", *OPTIONS)
1094
1117
  = Document title
@@ -1117,7 +1140,8 @@ RSpec.describe Asciidoctor::ISO do
1117
1140
  == Appendix C
1118
1141
 
1119
1142
  INPUT
1120
- expect(File.read("test.err")).not_to include "Document must include (references) Normative References"
1143
+ expect(File.read("test.err"))
1144
+ .not_to include "Document must include (references) Normative References"
1121
1145
  end
1122
1146
 
1123
1147
  it "Warning if final section is not named Bibliography" do
@@ -1149,7 +1173,8 @@ RSpec.describe Asciidoctor::ISO do
1149
1173
  == Appendix C
1150
1174
 
1151
1175
  INPUT
1152
- expect(File.read("test.err")).to include "There are sections after the final Bibliography"
1176
+ expect(File.read("test.err"))
1177
+ .to include "There are sections after the final Bibliography"
1153
1178
 
1154
1179
  Asciidoctor.convert(<<~"INPUT", *OPTIONS)
1155
1180
  = Document title
@@ -1184,7 +1209,8 @@ RSpec.describe Asciidoctor::ISO do
1184
1209
  == Appendix C
1185
1210
 
1186
1211
  INPUT
1187
- expect(File.read("test.err")).not_to include "There are sections after the final Bibliography"
1212
+ expect(File.read("test.err"))
1213
+ .not_to include "There are sections after the final Bibliography"
1188
1214
  end
1189
1215
 
1190
1216
  it "Warning if final section is not styled Bibliography" do
@@ -1212,7 +1238,8 @@ RSpec.describe Asciidoctor::ISO do
1212
1238
  == Bibliography
1213
1239
 
1214
1240
  INPUT
1215
- expect(File.read("test.err")).to include "Section not marked up as [bibliography]"
1241
+ expect(File.read("test.err"))
1242
+ .to include "Section not marked up as [bibliography]"
1216
1243
  end
1217
1244
 
1218
1245
  it "Warning if final section is not styled Bibliography false" do
@@ -1245,7 +1272,8 @@ RSpec.describe Asciidoctor::ISO do
1245
1272
  == Bibliography
1246
1273
 
1247
1274
  INPUT
1248
- expect(File.read("test.err")).not_to include "Section not marked up as [bibliography]"
1275
+ expect(File.read("test.err"))
1276
+ .not_to include "Section not marked up as [bibliography]"
1249
1277
  end
1250
1278
 
1251
1279
  it "Warning if English title intro and no French title intro" do
@@ -1536,7 +1564,8 @@ RSpec.describe Asciidoctor::ISO do
1536
1564
  [align=mid-air]
1537
1565
  Para
1538
1566
  INPUT
1539
- expect(File.read("test.err")).to include 'value of attribute "align" is invalid; must be equal to'
1567
+ expect(File.read("test.err"))
1568
+ .to include 'value of attribute "align" is invalid; must be equal to'
1540
1569
  end
1541
1570
 
1542
1571
  it "Warn if more than 7 levels of subclause" do
@@ -1568,7 +1597,8 @@ RSpec.describe Asciidoctor::ISO do
1568
1597
  ====== Clause
1569
1598
 
1570
1599
  INPUT
1571
- expect(File.read("test.err")).to include "Exceeds the maximum clause depth of 7"
1600
+ expect(File.read("test.err"))
1601
+ .to include "Exceeds the maximum clause depth of 7"
1572
1602
  end
1573
1603
 
1574
1604
  it "Do not warn if not more than 7 levels of subclause" do
@@ -1597,7 +1627,8 @@ RSpec.describe Asciidoctor::ISO do
1597
1627
  ====== Clause
1598
1628
 
1599
1629
  INPUT
1600
- expect(File.read("test.err")).not_to include "exceeds the maximum clause depth of 7"
1630
+ expect(File.read("test.err"))
1631
+ .not_to include "exceeds the maximum clause depth of 7"
1601
1632
  end
1602
1633
 
1603
1634
  it "Warn if term citation in Terms & Definitions not preceded with italicised term" do
@@ -1609,8 +1640,9 @@ RSpec.describe Asciidoctor::ISO do
1609
1640
  === Term
1610
1641
 
1611
1642
  The definition of a term (<<term>>) is a part of the specialized vocabulary of a particular field
1612
- INPUT
1613
- expect(File.read("test.err")).to include "term citation not preceded with italicised term"
1643
+ INPUT
1644
+ expect(File.read("test.err"))
1645
+ .to include "term citation not preceded with italicised term"
1614
1646
  end
1615
1647
 
1616
1648
  it "Warn if an undated reference has no associated footnote" do
@@ -1621,7 +1653,8 @@ RSpec.describe Asciidoctor::ISO do
1621
1653
  == Bibliography
1622
1654
  * [[[ISO8,ISO 8:--]]], _Title_
1623
1655
  INPUT
1624
- expect(File.read("test.err")).to include \
1625
- "Reference ISO8 does not have an associated footnote indicating unpublished status"
1656
+ expect(File.read("test.err"))
1657
+ .to include "Reference ISO8 does not have an associated footnote "\
1658
+ "indicating unpublished status"
1626
1659
  end
1627
1660
  end
@@ -25,80 +25,86 @@ WORD_HTML_CSS_WORDINTRO = {
25
25
 
26
26
  RSpec.describe IsoDoc do
27
27
  it "generates file based on string input" do
28
- IsoDoc::Iso::HtmlConvert.new(WORD_HTML_CSS.merge(filename: "test")).convert("test", <<~"INPUT", false)
29
- <iso-standard xmlns="http://riboseinc.com/isoxml">
30
- <bibdata>
31
- <title>
32
- <title format="text/plain" language="en" type="title-intro">Cereals and pulses</title>
33
- <title format="text/plain" language="en" type="title-main">Specifications and test methods</title>
34
- <title format="text/plain" language="en" type="title-part">Rice</title>
35
- </title>
36
- </bibdata>
37
- <preface>
38
- <foreword>
39
- <note>
40
- <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
41
- </note>
42
- </foreword>
43
- </preface>
44
- </iso-standard>
28
+ IsoDoc::Iso::HtmlConvert
29
+ .new(WORD_HTML_CSS.merge(filename: "test"))
30
+ .convert("test", <<~"INPUT", false)
31
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
32
+ <bibdata>
33
+ <title>
34
+ <title format="text/plain" language="en" type="title-intro">Cereals and pulses</title>
35
+ <title format="text/plain" language="en" type="title-main">Specifications and test methods</title>
36
+ <title format="text/plain" language="en" type="title-part">Rice</title>
37
+ </title>
38
+ </bibdata>
39
+ <preface>
40
+ <foreword>
41
+ <note>
42
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
43
+ </note>
44
+ </foreword>
45
+ </preface>
46
+ </iso-standard>
45
47
  INPUT
46
48
  expect(File.exist?("test.html")).to be true
47
49
  html = File.read("test.html", encoding: "UTF-8")
48
- expect(html).to match(
49
- %r{<title>Cereals and pulses&#xA0;&#x2014; Specifications and test methods&#xA0;&#x2014; Rice</title>}
50
- )
50
+ expect(html).to include "<title>Cereals and pulses&#xA0;&#x2014; "\
51
+ "Specifications and test methods&#xA0;&#x2014; Rice</title>"
51
52
  expect(html).to match(%r{cdnjs\.cloudflare\.com/ajax/libs/mathjax/})
52
53
  expect(html).to match(/delimiters: \[\['\(#\(', '\)#\)'\]\]/)
53
54
  end
54
55
 
55
56
  it "generates HTML output docs with null configuration" do
56
- IsoDoc::Iso::HtmlConvert.new(WORD_HTML_CSS.dup).convert("test", <<~"INPUT", false)
57
- <iso-standard xmlns="http://riboseinc.com/isoxml">
58
- <bibdata>
59
- <title>
60
- <title format="text/plain" language="en" type="title-intro">Cereals and pulses</title>
61
- <title format="text/plain" language="en" type="title-main">Specifications and test methods</title>
62
- <title format="text/plain" language="en" type="title-part">Rice</title>
63
- </title>
64
- </bibdata>
65
- <preface>
66
- <foreword>
67
- <note>
68
- <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
69
- </note>
70
- </foreword>
71
- </preface>
72
- </iso-standard>
73
- INPUT
57
+ IsoDoc::Iso::HtmlConvert
58
+ .new(WORD_HTML_CSS.dup)
59
+ .convert("test", <<~"INPUT", false)
60
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
61
+ <bibdata>
62
+ <title>
63
+ <title format="text/plain" language="en" type="title-intro">Cereals and pulses</title>
64
+ <title format="text/plain" language="en" type="title-main">Specifications and test methods</title>
65
+ <title format="text/plain" language="en" type="title-part">Rice</title>
66
+ </title>
67
+ </bibdata>
68
+ <preface>
69
+ <foreword>
70
+ <note>
71
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
72
+ </note>
73
+ </foreword>
74
+ </preface>
75
+ </iso-standard>
76
+ INPUT
74
77
  expect(File.exist?("test.html")).to be true
75
78
  html = File.read("test.html", encoding: "UTF-8")
76
- expect(html).to match(
77
- %r{<title>Cereals and pulses&#xA0;&#x2014; Specifications and test methods&#xA0;&#x2014; Rice</title>}
78
- )
79
+ expect(html).to include "title>Cereals and pulses&#xA0;&#x2014; "\
80
+ "Specifications and test methods&#xA0;&#x2014; Rice</title>"
79
81
  expect(html).to match(%r{cdnjs\.cloudflare\.com/ajax/libs/mathjax/})
80
82
  expect(html).to match(/delimiters: \[\['\(#\(', '\)#\)'\]\]/)
81
83
  end
82
84
 
83
85
  it "generates Word output docs with null configuration" do
84
- IsoDoc::Iso::WordConvert.new(WORD_HTML_CSS.dup).convert("test", <<~"INPUT", false)
85
- <iso-standard xmlns="http://riboseinc.com/isoxml">
86
- <preface>
87
- <foreword>
88
- <note>
89
- <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
90
- </note>
91
- </foreword>
92
- </preface>
93
- </iso-standard>
94
- INPUT
86
+ IsoDoc::Iso::WordConvert
87
+ .new(WORD_HTML_CSS.dup)
88
+ .convert("test", <<~"INPUT", false)
89
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
90
+ <preface>
91
+ <foreword>
92
+ <note>
93
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
94
+ </note>
95
+ </foreword>
96
+ </preface>
97
+ </iso-standard>
98
+ INPUT
95
99
  expect(File.exist?("test.doc")).to be true
96
100
  word = File.read("test.doc", encoding: "UTF-8")
97
101
  expect(word).to match(/<style>/)
98
102
  end
99
103
 
100
104
  it "generates HTML output docs with null configuration from file" do
101
- IsoDoc::Iso::HtmlConvert.new(WORD_HTML_CSS_SUBDIR.dup).convert("spec/assets/iso.xml", nil, false)
105
+ IsoDoc::Iso::HtmlConvert
106
+ .new(WORD_HTML_CSS_SUBDIR.dup)
107
+ .convert("spec/assets/iso.xml", nil, false)
102
108
  expect(File.exist?("spec/assets/iso.html")).to be true
103
109
  html = File.read("spec/assets/iso.html", encoding: "UTF-8")
104
110
  expect(html).to match(/<style>/)
@@ -107,7 +113,9 @@ RSpec.describe IsoDoc do
107
113
  end
108
114
 
109
115
  it "generates Word output docs with null configuration from file" do
110
- IsoDoc::Iso::WordConvert.new(WORD_HTML_CSS_SUBDIR.dup).convert("spec/assets/iso.xml", nil, false)
116
+ IsoDoc::Iso::WordConvert
117
+ .new(WORD_HTML_CSS_SUBDIR.dup)
118
+ .convert("spec/assets/iso.xml", nil, false)
111
119
  expect(File.exist?("spec/assets/iso.doc")).to be true
112
120
  word = File.read("spec/assets/iso.doc", encoding: "UTF-8")
113
121
  expect(word).to match(/<w:WordDocument>/)
@@ -116,28 +124,32 @@ RSpec.describe IsoDoc do
116
124
 
117
125
  it "generates Pdf output docs with null configuration from file" do
118
126
  mock_pdf
119
- IsoDoc::Iso::PdfConvert.new(WORD_HTML_CSS.dup).convert("spec/assets/iso.xml", nil, false)
127
+ IsoDoc::Iso::PdfConvert
128
+ .new(WORD_HTML_CSS.dup)
129
+ .convert("spec/assets/iso.xml", nil, false)
120
130
  expect(File.exist?("spec/assets/iso.pdf")).to be true
121
131
  end
122
132
 
123
133
  it "converts annex subheadings to h2Annex class for Word" do
124
- IsoDoc::Iso::WordConvert.new(WORD_HTML_CSS.dup).convert("test", <<~"INPUT", false)
125
- <iso-standard xmlns="http://riboseinc.com/isoxml">
126
- <annex id="P" inline-header="false" obligation="normative">
127
- <title>Annex</title>
128
- <clause id="Q" inline-header="false" obligation="normative">
129
- <title>A.1
130
- <tab/>
131
- Annex A.1</title>
132
- </clause>
133
- <appendix id="Q2" inline-header="false" obligation="normative">
134
- <title>Appendix 1
135
- <tab/>
136
- An Appendix</title>
137
- </appendix>
138
- </annex>
139
- </iso-standard>
140
- INPUT
134
+ IsoDoc::Iso::WordConvert
135
+ .new(WORD_HTML_CSS.dup)
136
+ .convert("test", <<~"INPUT", false)
137
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
138
+ <annex id="P" inline-header="false" obligation="normative">
139
+ <title>Annex</title>
140
+ <clause id="Q" inline-header="false" obligation="normative">
141
+ <title>A.1
142
+ <tab/>
143
+ Annex A.1</title>
144
+ </clause>
145
+ <appendix id="Q2" inline-header="false" obligation="normative">
146
+ <title>Appendix 1
147
+ <tab/>
148
+ An Appendix</title>
149
+ </appendix>
150
+ </annex>
151
+ </iso-standard>
152
+ INPUT
141
153
 
142
154
  word = File.read("test.doc", encoding: "UTF-8")
143
155
  .sub(/^.*<div class="WordSection3">/m, '<div class="WordSection3">')
@@ -170,33 +182,35 @@ RSpec.describe IsoDoc do
170
182
  end
171
183
 
172
184
  it "populates Word template with terms reference labels" do
173
- IsoDoc::Iso::WordConvert.new(WORD_HTML_CSS.dup).convert("test", <<~"INPUT", false)
174
- <iso-standard xmlns="http://riboseinc.com/isoxml">
175
- <sections>
176
- <terms id="_terms_and_definitions" obligation="normative">
177
- <title>1
178
- <tab/>
179
- Terms and Definitions</title>
180
- <term id="paddy1">
181
- <name>1.1</name>
182
- <preferred>paddy</preferred>
183
- <definition>
184
- <p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p>
185
- </definition>
186
- <termsource status="modified">
187
- <origin bibitemid="ISO7301" citeas="ISO 7301:2011" type="inline">
188
- <locality type="clause">
189
- <referenceFrom>3.1</referenceFrom>
190
- </locality>ISO 7301:2011, 3.1</origin>
191
- <modification>
192
- <p id="_e73a417d-ad39-417d-a4c8-20e4e2529489">The term &quot;cargo rice&quot; is shown as deprecated, and Note 1 to entry is not included here</p>
193
- </modification>
194
- </termsource>
195
- </term>
196
- </terms>
197
- </sections>
198
- </iso-standard>
199
- INPUT
185
+ IsoDoc::Iso::WordConvert
186
+ .new(WORD_HTML_CSS.dup)
187
+ .convert("test", <<~"INPUT", false)
188
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
189
+ <sections>
190
+ <terms id="_terms_and_definitions" obligation="normative">
191
+ <title>1
192
+ <tab/>
193
+ Terms and Definitions</title>
194
+ <term id="paddy1">
195
+ <name>1.1</name>
196
+ <preferred>paddy</preferred>
197
+ <definition>
198
+ <p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p>
199
+ </definition>
200
+ <termsource status="modified">
201
+ <origin bibitemid="ISO7301" citeas="ISO 7301:2011" type="inline">
202
+ <locality type="clause">
203
+ <referenceFrom>3.1</referenceFrom>
204
+ </locality>ISO 7301:2011, 3.1</origin>
205
+ <modification>
206
+ <p id="_e73a417d-ad39-417d-a4c8-20e4e2529489">The term &quot;cargo rice&quot; is shown as deprecated, and Note 1 to entry is not included here</p>
207
+ </modification>
208
+ </termsource>
209
+ </term>
210
+ </terms>
211
+ </sections>
212
+ </iso-standard>
213
+ INPUT
200
214
 
201
215
  word = File.read("test.doc", encoding: "UTF-8")
202
216
  .sub(/^.*<div class="WordSection3">/m, '<div class="WordSection3">')
@@ -224,139 +238,144 @@ RSpec.describe IsoDoc do
224
238
  end
225
239
 
226
240
  it "populates Word header" do
227
- IsoDoc::Iso::WordConvert.new(WORD_HTML_CSS_HEADER_HTML.dup).convert("test", <<~"INPUT", false)
228
- <iso-standard xmlns="http://riboseinc.com/isoxml">
229
- <bibdata type="article">
230
- <docidentifier>
231
- <project-number part="1">1000</project-number>
232
- </docidentifier>
233
- </bibdata>
234
- </iso-standard>
235
- INPUT
241
+ IsoDoc::Iso::WordConvert
242
+ .new(WORD_HTML_CSS_HEADER_HTML.dup)
243
+ .convert("test", <<~"INPUT", false)
244
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
245
+ <bibdata type="article">
246
+ <docidentifier>
247
+ <project-number part="1">1000</project-number>
248
+ </docidentifier>
249
+ </bibdata>
250
+ </iso-standard>
251
+ INPUT
236
252
  word = File.read("test.doc", encoding: "UTF-8")
237
253
  expect(word).to include('Content-Disposition: inline; filename="header.html"')
238
254
  end
239
255
 
240
256
  it "populates Word ToC" do
241
- IsoDoc::Iso::WordConvert.new(WORD_HTML_CSS_WORDINTRO.dup).convert("test", <<~"INPUT", false)
242
- <iso-standard xmlns="http://riboseinc.com/isoxml">
243
- <sections>
244
- <clause id="A" inline-header="false" obligation="normative">
245
- <title>1
246
- <tab/>
247
- Clause 4</title>
248
- <clause id="N" inline-header="false" obligation="normative">
249
- <title>1.1
250
- <tab/>
251
- Introduction
252
- <bookmark id="Q"/>
253
- to this
254
- <fn reference="1">
255
- <p id="_ff27c067-2785-4551-96cf-0a73530ff1e6">Formerly denoted as 15 % (m/m).</p></fn>
256
- </title>
257
- </clause>
258
- <clause id="O" inline-header="false" obligation="normative">
259
- <title>1.2
257
+ IsoDoc::Iso::WordConvert
258
+ .new(WORD_HTML_CSS_WORDINTRO.dup)
259
+ .convert("test", <<~"INPUT", false)
260
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
261
+ <sections>
262
+ <clause id="A" inline-header="false" obligation="normative">
263
+ <title>1
260
264
  <tab/>
261
- Clause 4.2</title>
262
- <p>A
263
- <fn reference="1">
264
- <p id="_ff27c067-2785-4551-96cf-0a73530ff1e6">Formerly denoted as 15 % (m/m).</p></fn>
265
- </p>
265
+ Clause 4</title>
266
+ <clause id="N" inline-header="false" obligation="normative">
267
+ <title>1.1
268
+ <tab/>
269
+ Introduction
270
+ <bookmark id="Q"/>
271
+ to this
272
+ <fn reference="1">
273
+ <p id="_ff27c067-2785-4551-96cf-0a73530ff1e6">Formerly denoted as 15 % (m/m).</p></fn>
274
+ </title>
275
+ </clause>
276
+ <clause id="O" inline-header="false" obligation="normative">
277
+ <title>1.2
278
+ <tab/>
279
+ Clause 4.2</title>
280
+ <p>A
281
+ <fn reference="1">
282
+ <p id="_ff27c067-2785-4551-96cf-0a73530ff1e6">Formerly denoted as 15 % (m/m).</p></fn>
283
+ </p>
284
+ </clause>
266
285
  </clause>
267
- </clause>
268
- </sections>
269
- </iso-standard>
270
- INPUT
286
+ </sections>
287
+ </iso-standard>
288
+ INPUT
271
289
 
272
290
  word = File.read("test.doc", encoding: "UTF-8")
273
291
  .sub(/^.*An empty word intro page\./m, "")
274
292
  .sub(%r{</div>.*$}m, "</div>")
275
293
 
276
- expect(xmlpp("<div>#{word.gsub(/_Toc\d\d+/, '_Toc')}")).to be_equivalent_to xmlpp(<<~'OUTPUT')
277
- <div>
278
- <p class="MsoToc1">
279
- <span lang="EN-GB" xml:lang="EN-GB">
280
- <span style="mso-element:field-begin"/>
281
- <span style="mso-spacerun:yes"> </span>TOC
282
- \o &quot;1-3&quot; \h \z \u
283
- <span style="mso-element:field-separator"/></span>
284
- <span class="MsoHyperlink">
285
- <span lang="EN-GB" style="mso-no-proof:yes" xml:lang="EN-GB">
286
- <a href="#_Toc">1 Clause 4
287
- <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
288
- <span style="mso-tab-count:1 dotted">. </span></span>
289
- <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
290
- <span style="mso-element:field-begin"/>
291
- </span>
292
- <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">PAGEREF _Toc \h </span>
293
- <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
294
- <span style="mso-element:field-separator"/>
295
- </span>
296
- <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">1</span>
297
- <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB"/>
298
- <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
299
- <span style="mso-element:field-end"/>
300
- </span>
301
- </a>
294
+ expect(xmlpp("<div>#{word.gsub(/_Toc\d\d+/, '_Toc')}"))
295
+ .to be_equivalent_to xmlpp(<<~'OUTPUT')
296
+ <div>
297
+ <p class="MsoToc1">
298
+ <span lang="EN-GB" xml:lang="EN-GB">
299
+ <span style="mso-element:field-begin"/>
300
+ <span style="mso-spacerun:yes"> </span>TOC
301
+ \o &quot;1-3&quot; \h \z \u
302
+ <span style="mso-element:field-separator"/></span>
303
+ <span class="MsoHyperlink">
304
+ <span lang="EN-GB" style="mso-no-proof:yes" xml:lang="EN-GB">
305
+ <a href="#_Toc">1 Clause 4
306
+ <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
307
+ <span style="mso-tab-count:1 dotted">. </span></span>
308
+ <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
309
+ <span style="mso-element:field-begin"/>
310
+ </span>
311
+ <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">PAGEREF _Toc \h </span>
312
+ <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
313
+ <span style="mso-element:field-separator"/>
314
+ </span>
315
+ <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">1</span>
316
+ <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB"/>
317
+ <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
318
+ <span style="mso-element:field-end"/>
319
+ </span>
320
+ </a>
321
+ </span>
302
322
  </span>
303
- </span>
304
- </p>
305
- <p class="MsoToc2">
306
- <span class="MsoHyperlink">
307
- <span lang="EN-GB" style="mso-no-proof:yes" xml:lang="EN-GB">
308
- <a href="#_Toc">1.1 Introduction to this
309
- <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
310
- <span style="mso-tab-count:1 dotted">. </span></span>
311
- <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
312
- <span style="mso-element:field-begin"/>
313
- </span>
314
- <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">PAGEREF _Toc \h </span>
315
- <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
316
- <span style="mso-element:field-separator"/>
317
- </span>
318
- <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">1</span>
319
- <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB"/>
320
- <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
321
- <span style="mso-element:field-end"/>
322
- </span>
323
- </a>
323
+ </p>
324
+ <p class="MsoToc2">
325
+ <span class="MsoHyperlink">
326
+ <span lang="EN-GB" style="mso-no-proof:yes" xml:lang="EN-GB">
327
+ <a href="#_Toc">1.1 Introduction to this
328
+ <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
329
+ <span style="mso-tab-count:1 dotted">. </span></span>
330
+ <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
331
+ <span style="mso-element:field-begin"/>
332
+ </span>
333
+ <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">PAGEREF _Toc \h </span>
334
+ <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
335
+ <span style="mso-element:field-separator"/>
336
+ </span>
337
+ <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">1</span>
338
+ <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB"/>
339
+ <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
340
+ <span style="mso-element:field-end"/>
341
+ </span>
342
+ </a>
343
+ </span>
324
344
  </span>
325
- </span>
326
- </p>
327
- <p class="MsoToc2">
328
- <span class="MsoHyperlink">
329
- <span lang="EN-GB" style="mso-no-proof:yes" xml:lang="EN-GB">
330
- <a href="#_Toc">1.2 Clause 4.2
331
- <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
332
- <span style="mso-tab-count:1 dotted">. </span></span>
333
- <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
334
- <span style="mso-element:field-begin"/>
335
- </span>
336
- <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">PAGEREF _Toc \h </span>
337
- <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
338
- <span style="mso-element:field-separator"/>
339
- </span>
340
- <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">1</span>
341
- <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB"/>
342
- <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
343
- <span style="mso-element:field-end"/>
344
- </span>
345
- </a>
345
+ </p>
346
+ <p class="MsoToc2">
347
+ <span class="MsoHyperlink">
348
+ <span lang="EN-GB" style="mso-no-proof:yes" xml:lang="EN-GB">
349
+ <a href="#_Toc">1.2 Clause 4.2
350
+ <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
351
+ <span style="mso-tab-count:1 dotted">. </span></span>
352
+ <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
353
+ <span style="mso-element:field-begin"/>
354
+ </span>
355
+ <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">PAGEREF _Toc \h </span>
356
+ <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
357
+ <span style="mso-element:field-separator"/>
358
+ </span>
359
+ <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">1</span>
360
+ <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB"/>
361
+ <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
362
+ <span style="mso-element:field-end"/>
363
+ </span>
364
+ </a>
365
+ </span>
346
366
  </span>
347
- </span>
348
- </p>
349
- <p class="MsoToc1">
350
- <span lang="EN-GB" xml:lang="EN-GB">
351
- <span style="mso-element:field-end"/>
352
- </span>
353
- <span lang="EN-GB" xml:lang="EN-GB">
354
- <p class="MsoNormal"> </p>
355
- </span>
356
- </p>
357
- <p class="MsoNormal"> </p>
358
- </div>
359
- OUTPUT
367
+ </p>
368
+ <p class="MsoToc1">
369
+ <span lang="EN-GB" xml:lang="EN-GB">
370
+ <span style="mso-element:field-end"/>
371
+ </span>
372
+ <span lang="EN-GB" xml:lang="EN-GB">
373
+ <p class="MsoNormal"> </p>
374
+ </span>
375
+ </p>
376
+ <p class="MsoNormal"> </p>
377
+ </div>
378
+ OUTPUT
360
379
  end
361
380
 
362
381
  it "reorders footnote numbers" do
@@ -390,10 +409,13 @@ RSpec.describe IsoDoc do
390
409
  </iso-standard>
391
410
  INPUT
392
411
 
393
- IsoDoc::Iso::HtmlConvert.new(WORD_HTML_CSS_WORDINTRO.dup).convert("test", input, false)
412
+ IsoDoc::Iso::HtmlConvert
413
+ .new(WORD_HTML_CSS_WORDINTRO.dup)
414
+ .convert("test", input, false)
394
415
 
395
416
  html = File.read("test.html", encoding: "UTF-8")
396
- .sub(/^.*<main class="main-section">/m, '<main xmlns:epub="epub" class="main-section">')
417
+ .sub(/^.*<main class="main-section">/m,
418
+ '<main xmlns:epub="epub" class="main-section">')
397
419
  .sub(%r{</main>.*$}m, "</main>")
398
420
 
399
421
  expect(xmlpp(html)).to be_equivalent_to xmlpp(<<~"OUTPUT")
@@ -436,11 +458,15 @@ RSpec.describe IsoDoc do
436
458
  </main>
437
459
  OUTPUT
438
460
 
439
- IsoDoc::Iso::WordConvert.new(WORD_HTML_CSS_WORDINTRO.dup).convert("test", input, false)
461
+ IsoDoc::Iso::WordConvert
462
+ .new(WORD_HTML_CSS_WORDINTRO.dup)
463
+ .convert("test", input, false)
440
464
 
441
465
  html = File.read("test.doc", encoding: "UTF-8")
442
- .sub(/^.*<div class="WordSection3"/m, '<body xmlns:epub="epub"><div class="WordSection3"')
443
- .sub(%r{</body>.*$}m, "</body>").gsub(/mso-bookmark:_Ref\d+/, "mso-bookmark:_Ref")
466
+ .sub(/^.*<div class="WordSection3"/m,
467
+ '<body xmlns:epub="epub"><div class="WordSection3"')
468
+ .sub(%r{</body>.*$}m, "</body>")
469
+ .gsub(/mso-bookmark:_Ref\d+/, "mso-bookmark:_Ref")
444
470
 
445
471
  expect(xmlpp(html)).to be_equivalent_to xmlpp(<<~"OUTPUT")
446
472
  <body xmlns:epub="epub">
@@ -529,75 +555,77 @@ RSpec.describe IsoDoc do
529
555
  end
530
556
 
531
557
  it "processes IsoXML terms for HTML" do
532
- IsoDoc::Iso::HtmlConvert.new(WORD_HTML_CSS.dup).convert("test", <<~"INPUT", false)
533
- <iso-standard xmlns="http://riboseinc.com/isoxml">
534
- <sections>
535
- <terms id="_terms_and_definitions" obligation="normative">
536
- <title>Terms and Definitions</title>
537
- <term id="paddy1">
538
- <name>1.1</name>
539
- <preferred>paddy</preferred>
540
- <domain>rice</domain>
541
- <definition>
542
- <p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p>
543
- </definition>
544
- <termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f892">
545
- <p id="_65c9a509-9a89-4b54-a890-274126aeb55c">Foreign seeds, husks, bran, sand, dust.</p>
546
- <ul>
547
- <li>A</li>
548
- </ul>
549
- </termexample>
550
- <termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f894">
551
- <ul>
552
- <li>A</li>
553
- </ul>
554
- </termexample>
555
- <termsource status="modified">
556
- <origin bibitemid="ISO7301" citeas="ISO 7301:2011" type="inline">
557
- <locality type="clause">
558
- <referenceFrom>3.1</referenceFrom>
559
- </locality>
560
- </origin>
561
- <modification>
562
- <p id="_e73a417d-ad39-417d-a4c8-20e4e2529489">The term &quot;cargo rice&quot; is shown as deprecated, and Note 1 to entry is not included here</p>
563
- </modification>
564
- </termsource>
565
- </term>
566
- <term id="paddy">
567
- <name>1.2</name>
568
- <preferred>paddy</preferred>
569
- <admitted>paddy rice</admitted>
570
- <admitted>rough rice</admitted>
571
- <deprecates>cargo rice</deprecates>
572
- <definition>
573
- <p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p>
574
- </definition>
575
- <termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f893">
576
- <ul>
577
- <li>A</li>
578
- </ul>
579
- </termexample>
580
- <termnote id="_671a1994-4783-40d0-bc81-987d06ffb74e">
581
- <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>
582
- </termnote>
583
- <termnote id="_671a1994-4783-40d0-bc81-987d06ffb74f">
584
- <ul>
585
- <li>A</li>
586
- </ul>
587
- <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>
588
- </termnote>
589
- <termsource status="identical">
590
- <origin bibitemid="ISO7301" citeas="ISO 7301:2011" type="inline">
591
- <locality type="clause">
592
- <referenceFrom>3.1</referenceFrom>
593
- </locality>
594
- </origin>
595
- </termsource>
596
- </term>
597
- </terms>
598
- </sections>
599
- </iso-standard>
600
- INPUT
558
+ IsoDoc::Iso::HtmlConvert
559
+ .new(WORD_HTML_CSS.dup)
560
+ .convert("test", <<~"INPUT", false)
561
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
562
+ <sections>
563
+ <terms id="_terms_and_definitions" obligation="normative">
564
+ <title>Terms and Definitions</title>
565
+ <term id="paddy1">
566
+ <name>1.1</name>
567
+ <preferred>paddy</preferred>
568
+ <domain>rice</domain>
569
+ <definition>
570
+ <p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p>
571
+ </definition>
572
+ <termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f892">
573
+ <p id="_65c9a509-9a89-4b54-a890-274126aeb55c">Foreign seeds, husks, bran, sand, dust.</p>
574
+ <ul>
575
+ <li>A</li>
576
+ </ul>
577
+ </termexample>
578
+ <termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f894">
579
+ <ul>
580
+ <li>A</li>
581
+ </ul>
582
+ </termexample>
583
+ <termsource status="modified">
584
+ <origin bibitemid="ISO7301" citeas="ISO 7301:2011" type="inline">
585
+ <locality type="clause">
586
+ <referenceFrom>3.1</referenceFrom>
587
+ </locality>
588
+ </origin>
589
+ <modification>
590
+ <p id="_e73a417d-ad39-417d-a4c8-20e4e2529489">The term &quot;cargo rice&quot; is shown as deprecated, and Note 1 to entry is not included here</p>
591
+ </modification>
592
+ </termsource>
593
+ </term>
594
+ <term id="paddy">
595
+ <name>1.2</name>
596
+ <preferred>paddy</preferred>
597
+ <admitted>paddy rice</admitted>
598
+ <admitted>rough rice</admitted>
599
+ <deprecates>cargo rice</deprecates>
600
+ <definition>
601
+ <p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p>
602
+ </definition>
603
+ <termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f893">
604
+ <ul>
605
+ <li>A</li>
606
+ </ul>
607
+ </termexample>
608
+ <termnote id="_671a1994-4783-40d0-bc81-987d06ffb74e">
609
+ <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>
610
+ </termnote>
611
+ <termnote id="_671a1994-4783-40d0-bc81-987d06ffb74f">
612
+ <ul>
613
+ <li>A</li>
614
+ </ul>
615
+ <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>
616
+ </termnote>
617
+ <termsource status="identical">
618
+ <origin bibitemid="ISO7301" citeas="ISO 7301:2011" type="inline">
619
+ <locality type="clause">
620
+ <referenceFrom>3.1</referenceFrom>
621
+ </locality>
622
+ </origin>
623
+ </termsource>
624
+ </term>
625
+ </terms>
626
+ </sections>
627
+ </iso-standard>
628
+ INPUT
601
629
  expect(File.exist?("test.html")).to be true
602
630
  html = File.read("test.html", encoding: "UTF-8")
603
631
  expect(html).to match(%r{<h2 class="TermNum" id="paddy1">1\.1</h2>})
@@ -605,18 +633,20 @@ RSpec.describe IsoDoc do
605
633
  end
606
634
 
607
635
  it "inserts default paragraph between two tables for Word" do
608
- IsoDoc::Iso::WordConvert.new(WORD_HTML_CSS.dup).convert("test", <<~"INPUT", false)
609
- <iso-standard xmlns="http://riboseinc.com/isoxml">
610
- <annex id="P" inline-header="false" obligation="normative">
611
- <example id="_63112cbc-cde0-435f-9553-e0b8c4f5851c">
612
- <p id="_158d4efa-b1c9-4aec-b325-756de8e4c968">'1M', '01M', and '0001M' all describe the calendar month January.</p>
613
- </example>
614
- <example id="_63112cbc-cde0-435f-9553-e0b8c4f5851d">
615
- <p id="_158d4efa-b1c9-4aec-b325-756de8e4c969">'2M', '02M', and '0002M' all describe the calendar month February.</p>
616
- </example>
617
- </annex>
618
- </iso-standard>
619
- INPUT
636
+ IsoDoc::Iso::WordConvert
637
+ .new(WORD_HTML_CSS.dup)
638
+ .convert("test", <<~"INPUT", false)
639
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
640
+ <annex id="P" inline-header="false" obligation="normative">
641
+ <example id="_63112cbc-cde0-435f-9553-e0b8c4f5851c">
642
+ <p id="_158d4efa-b1c9-4aec-b325-756de8e4c968">'1M', '01M', and '0001M' all describe the calendar month January.</p>
643
+ </example>
644
+ <example id="_63112cbc-cde0-435f-9553-e0b8c4f5851d">
645
+ <p id="_158d4efa-b1c9-4aec-b325-756de8e4c969">'2M', '02M', and '0002M' all describe the calendar month February.</p>
646
+ </example>
647
+ </annex>
648
+ </iso-standard>
649
+ INPUT
620
650
  word = File.read("test.doc", encoding: "UTF-8")
621
651
  .sub(/^.*<div class="WordSection3">/m, '<div class="WordSection3">')
622
652
  .sub(%r{<br[^>]*>\s*<div class="colophon".*$}m, "")
@@ -644,24 +674,26 @@ RSpec.describe IsoDoc do
644
674
  end
645
675
 
646
676
  it "processes figure keys (Word)" do
647
- IsoDoc::Iso::WordConvert.new(WORD_HTML_CSS.dup).convert("test", <<~"INPUT", false)
648
- <iso-standard xmlns="http://riboseinc.com/isoxml">
649
- <annex id="P" inline-header="false" obligation="normative">
650
- <figure id="samplecode">
651
- <p>Hello</p>
652
- <p>Key</p>
653
- <dl>
654
- <dt>
655
- <p>A</p>
656
- </dt>
657
- <dd>
658
- <p>B</p>
659
- </dd>
660
- </dl>
661
- </figure>
662
- </annex>
663
- </iso-standard>
664
- INPUT
677
+ IsoDoc::Iso::WordConvert
678
+ .new(WORD_HTML_CSS.dup)
679
+ .convert("test", <<~"INPUT", false)
680
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
681
+ <annex id="P" inline-header="false" obligation="normative">
682
+ <figure id="samplecode">
683
+ <p>Hello</p>
684
+ <p>Key</p>
685
+ <dl>
686
+ <dt>
687
+ <p>A</p>
688
+ </dt>
689
+ <dd>
690
+ <p>B</p>
691
+ </dd>
692
+ </dl>
693
+ </figure>
694
+ </annex>
695
+ </iso-standard>
696
+ INPUT
665
697
  word = File.read("test.doc", encoding: "UTF-8")
666
698
  .sub(/^.*<div class="WordSection3">/m, '<div class="WordSection3">')
667
699
  .sub(%r{<br[^>]*>\s*<div class="colophon".*$}m, "")
@@ -797,17 +829,22 @@ RSpec.describe IsoDoc do
797
829
  .sub(%r{<localized-strings>.*</localized-strings>}m, ""))
798
830
  .to be_equivalent_to xmlpp(presxml)
799
831
 
800
- IsoDoc::Iso::HtmlConvert.new(WORD_HTML_CSS.dup).convert("test", presxml, false)
832
+ IsoDoc::Iso::HtmlConvert
833
+ .new(WORD_HTML_CSS.dup)
834
+ .convert("test", presxml, false)
801
835
 
802
836
  word = File.read("test.html", encoding: "UTF-8")
803
837
  expect((word)).to include '<h1 class="IntroTitle">Warning for Stuff</h1>'
804
838
  expect((word)).to include "I am the Walrus."
805
839
 
806
- IsoDoc::Iso::WordConvert.new(WORD_HTML_CSS.dup).convert("test", presxml, false)
840
+ IsoDoc::Iso::WordConvert.new(WORD_HTML_CSS.dup)
841
+ .convert("test", presxml, false)
807
842
  word = File.read("test.doc", encoding: "UTF-8")
808
843
  expect(xmlpp(word
809
- .sub(%r{^.*<div class="boilerplate-copyright">}m, '<div class="boilerplate-copyright">')
810
- .sub(%r{</div>.*$}m, "</div></div>"))).to be_equivalent_to xmlpp(<<~"OUTPUT")
844
+ .sub(%r{^.*<div class="boilerplate-copyright">}m,
845
+ '<div class="boilerplate-copyright">')
846
+ .sub(%r{</div>.*$}m, "</div></div>")))
847
+ .to be_equivalent_to xmlpp(<<~"OUTPUT")
811
848
  <div class="boilerplate-copyright">
812
849
  <div>
813
850
  <p class="zzCopyright">
@@ -839,125 +876,129 @@ RSpec.describe IsoDoc do
839
876
  </div>
840
877
  </div>
841
878
  OUTPUT
842
- expect(word).to include '<p class="zzWarning">This document is not an ISO International Standard'
879
+ expect(word).to include '<p class="zzWarning">This document is not '\
880
+ "an ISO International Standard"
843
881
  end
844
882
 
845
883
  it "populates Word ToC" do
846
- IsoDoc::WordConvert.new(WORD_HTML_CSS_WORDINTRO.dup).convert("test", <<~"INPUT", false)
847
- <iso-standard xmlns="http://riboseinc.com/isoxml">
848
- <sections>
849
- <clause id="A" inline-header="false" obligation="normative">
850
- <title>Clause 4</title>
851
- <clause id="N" inline-header="false" obligation="normative">
852
- <title>Introduction
853
- <bookmark id="Q"/>
854
- to this
855
- <fn reference="1">
856
- <p id="_ff27c067-2785-4551-96cf-0a73530ff1e6">Formerly denoted as 15 % (m/m).</p></fn>
857
- </title>
858
- </clause>
859
- <clause id="O" inline-header="false" obligation="normative">
860
- <title>Clause 4.2</title>
861
- <p>A
862
- <fn reference="1">
863
- <p id="_ff27c067-2785-4551-96cf-0a73530ff1e6">Formerly denoted as 15 % (m/m).</p></fn>
864
- </p>
865
- <clause id="P" inline-header="false" obligation="normative">
866
- <title>Clause 4.2.1</title>
884
+ IsoDoc::WordConvert.new(WORD_HTML_CSS_WORDINTRO.dup)
885
+ .convert("test", <<~"INPUT", false)
886
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
887
+ <sections>
888
+ <clause id="A" inline-header="false" obligation="normative">
889
+ <title>Clause 4</title>
890
+ <clause id="N" inline-header="false" obligation="normative">
891
+ <title>Introduction
892
+ <bookmark id="Q"/>
893
+ to this
894
+ <fn reference="1">
895
+ <p id="_ff27c067-2785-4551-96cf-0a73530ff1e6">Formerly denoted as 15 % (m/m).</p></fn>
896
+ </title>
897
+ </clause>
898
+ <clause id="O" inline-header="false" obligation="normative">
899
+ <title>Clause 4.2</title>
900
+ <p>A
901
+ <fn reference="1">
902
+ <p id="_ff27c067-2785-4551-96cf-0a73530ff1e6">Formerly denoted as 15 % (m/m).</p></fn>
903
+ </p>
904
+ <clause id="P" inline-header="false" obligation="normative">
905
+ <title>Clause 4.2.1</title>
906
+ </clause>
867
907
  </clause>
868
908
  </clause>
869
- </clause>
870
- </sections>
871
- </iso-standard>
872
- INPUT
909
+ </sections>
910
+ </iso-standard>
911
+ INPUT
873
912
  word = File.read("test.doc")
874
- .sub(/^.*<div class="WordSection2">/m, '<div class="WordSection2">')
913
+ .sub(/^.*<div class="WordSection2">/m,
914
+ '<div class="WordSection2">')
875
915
  .sub(%r{<p class="MsoNormal">\s*<br clear="all" class="section"/>\s*</p>\s*<div class="WordSection3">.*$}m, "")
876
916
 
877
- expect(xmlpp(word.gsub(/_Toc\d\d+/, "_Toc"))).to be_equivalent_to xmlpp(<<~'OUTPUT')
878
- <div class="WordSection2">An empty word intro page.
879
- <p class="MsoToc1">
880
- <span lang="EN-GB" xml:lang="EN-GB">
881
- <span style="mso-element:field-begin"/>
882
- <span style="mso-spacerun:yes"> </span>
883
- TOC
884
- \o &quot;1-2&quot; \h \z \u
885
- <span style="mso-element:field-separator"/></span>
886
- <span class="MsoHyperlink">
887
- <span lang="EN-GB" style="mso-no-proof:yes" xml:lang="EN-GB">
888
- <a href="#_Toc">Clause 4
889
- <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
890
- <span style="mso-tab-count:1 dotted">. </span></span>
891
- <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
892
- <span style="mso-element:field-begin"/>
893
- </span>
894
- <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">PAGEREF _Toc \h </span>
895
- <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
896
- <span style="mso-element:field-separator"/>
897
- </span>
898
- <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">1</span>
899
- <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB"/>
900
- <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
901
- <span style="mso-element:field-end"/>
902
- </span>
903
- </a>
917
+ expect(xmlpp(word.gsub(/_Toc\d\d+/, "_Toc")))
918
+ .to be_equivalent_to xmlpp(<<~'OUTPUT')
919
+ <div class="WordSection2">An empty word intro page.
920
+ <p class="MsoToc1">
921
+ <span lang="EN-GB" xml:lang="EN-GB">
922
+ <span style="mso-element:field-begin"/>
923
+ <span style="mso-spacerun:yes"> </span>
924
+ TOC
925
+ \o &quot;1-2&quot; \h \z \u
926
+ <span style="mso-element:field-separator"/></span>
927
+ <span class="MsoHyperlink">
928
+ <span lang="EN-GB" style="mso-no-proof:yes" xml:lang="EN-GB">
929
+ <a href="#_Toc">Clause 4
930
+ <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
931
+ <span style="mso-tab-count:1 dotted">. </span></span>
932
+ <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
933
+ <span style="mso-element:field-begin"/>
934
+ </span>
935
+ <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">PAGEREF _Toc \h </span>
936
+ <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
937
+ <span style="mso-element:field-separator"/>
938
+ </span>
939
+ <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">1</span>
940
+ <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB"/>
941
+ <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
942
+ <span style="mso-element:field-end"/>
943
+ </span>
944
+ </a>
945
+ </span>
904
946
  </span>
905
- </span>
906
- </p>
907
- <p class="MsoToc2">
908
- <span class="MsoHyperlink">
909
- <span lang="EN-GB" style="mso-no-proof:yes" xml:lang="EN-GB">
910
- <a href="#_Toc">Introduction to this
911
- <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
912
- <span style="mso-tab-count:1 dotted">. </span></span>
913
- <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
914
- <span style="mso-element:field-begin"/>
915
- </span>
916
- <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">PAGEREF _Toc \h </span>
917
- <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
918
- <span style="mso-element:field-separator"/>
919
- </span>
920
- <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">1</span>
921
- <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB"/>
922
- <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
923
- <span style="mso-element:field-end"/>
924
- </span>
925
- </a>
947
+ </p>
948
+ <p class="MsoToc2">
949
+ <span class="MsoHyperlink">
950
+ <span lang="EN-GB" style="mso-no-proof:yes" xml:lang="EN-GB">
951
+ <a href="#_Toc">Introduction to this
952
+ <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
953
+ <span style="mso-tab-count:1 dotted">. </span></span>
954
+ <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
955
+ <span style="mso-element:field-begin"/>
956
+ </span>
957
+ <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">PAGEREF _Toc \h </span>
958
+ <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
959
+ <span style="mso-element:field-separator"/>
960
+ </span>
961
+ <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">1</span>
962
+ <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB"/>
963
+ <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
964
+ <span style="mso-element:field-end"/>
965
+ </span>
966
+ </a>
967
+ </span>
926
968
  </span>
927
- </span>
928
- </p>
929
- <p class="MsoToc2">
930
- <span class="MsoHyperlink">
931
- <span lang="EN-GB" style="mso-no-proof:yes" xml:lang="EN-GB">
932
- <a href="#_Toc">Clause 4.2
933
- <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
934
- <span style="mso-tab-count:1 dotted">. </span></span>
935
- <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
936
- <span style="mso-element:field-begin"/>
937
- </span>
938
- <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">PAGEREF _Toc \h </span>
939
- <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
940
- <span style="mso-element:field-separator"/>
941
- </span>
942
- <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">1</span>
943
- <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB"/>
944
- <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
945
- <span style="mso-element:field-end"/>
946
- </span>
947
- </a>
969
+ </p>
970
+ <p class="MsoToc2">
971
+ <span class="MsoHyperlink">
972
+ <span lang="EN-GB" style="mso-no-proof:yes" xml:lang="EN-GB">
973
+ <a href="#_Toc">Clause 4.2
974
+ <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
975
+ <span style="mso-tab-count:1 dotted">. </span></span>
976
+ <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
977
+ <span style="mso-element:field-begin"/>
978
+ </span>
979
+ <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">PAGEREF _Toc \h </span>
980
+ <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
981
+ <span style="mso-element:field-separator"/>
982
+ </span>
983
+ <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">1</span>
984
+ <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB"/>
985
+ <span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
986
+ <span style="mso-element:field-end"/>
987
+ </span>
988
+ </a>
989
+ </span>
948
990
  </span>
949
- </span>
950
- </p>
951
- <p class="MsoToc1">
952
- <span lang="EN-GB" xml:lang="EN-GB">
953
- <span style="mso-element:field-end"/>
954
- </span>
955
- <span lang="EN-GB" xml:lang="EN-GB">
956
- <p class="MsoNormal"> </p>
957
- </span>
958
- </p>
959
- <p class="MsoNormal"> </p>
960
- </div>
961
- OUTPUT
991
+ </p>
992
+ <p class="MsoToc1">
993
+ <span lang="EN-GB" xml:lang="EN-GB">
994
+ <span style="mso-element:field-end"/>
995
+ </span>
996
+ <span lang="EN-GB" xml:lang="EN-GB">
997
+ <p class="MsoNormal"> </p>
998
+ </span>
999
+ </p>
1000
+ <p class="MsoNormal"> </p>
1001
+ </div>
1002
+ OUTPUT
962
1003
  end
963
1004
  end