metanorma-iso 2.1.0 → 2.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/html2doc/lists.rb +145 -10
- data/lib/isodoc/iso/base_convert.rb +11 -1
- data/lib/isodoc/iso/html/html_iso_titlepage.html +2 -0
- data/lib/isodoc/iso/html/isodoc-dis.css +216 -278
- data/lib/isodoc/iso/html/isodoc-dis.scss +294 -288
- data/lib/isodoc/iso/html/isodoc.css +38 -13
- data/lib/isodoc/iso/html/isodoc.scss +38 -12
- data/lib/isodoc/iso/html/style-human.css +14 -1
- data/lib/isodoc/iso/html/style-human.scss +10 -1
- data/lib/isodoc/iso/html/style-iso.css +35 -23
- data/lib/isodoc/iso/html/style-iso.scss +31 -23
- data/lib/isodoc/iso/html/word_iso_intro-dis.html +1 -6
- data/lib/isodoc/iso/html/word_iso_titlepage-dis.html +24 -13
- data/lib/isodoc/iso/html/word_iso_titlepage-prf.html +58 -0
- data/lib/isodoc/iso/html/word_iso_titlepage.html +10 -6
- data/lib/isodoc/iso/html/wordstyle-dis.css +12 -62
- data/lib/isodoc/iso/html/wordstyle-dis.scss +7 -56
- data/lib/isodoc/iso/html_convert.rb +7 -2
- data/lib/isodoc/iso/i18n-en.yaml +32 -4
- data/lib/isodoc/iso/i18n-fr.yaml +29 -3
- data/lib/isodoc/iso/i18n-ru.yaml +32 -4
- data/lib/isodoc/iso/i18n-zh-Hans.yaml +32 -3
- data/lib/isodoc/iso/i18n.rb +1 -1
- data/lib/isodoc/iso/iso.amendment.xsl +1570 -246
- data/lib/isodoc/iso/iso.international-standard.xsl +1570 -246
- data/lib/isodoc/iso/metadata.rb +67 -67
- data/lib/isodoc/iso/presentation_bibdata.rb +74 -0
- data/lib/isodoc/iso/presentation_xml_convert.rb +16 -5
- data/lib/isodoc/iso/presentation_xref.rb +10 -4
- data/lib/isodoc/iso/sections.rb +3 -3
- data/lib/isodoc/iso/word_cleanup.rb +3 -0
- data/lib/isodoc/iso/word_convert.rb +8 -5
- data/lib/isodoc/iso/word_dis_cleanup.rb +235 -0
- data/lib/isodoc/iso/word_dis_convert.rb +48 -100
- data/lib/isodoc/iso/xref.rb +34 -6
- data/lib/metanorma/iso/base.rb +20 -1
- data/lib/metanorma/iso/biblio.rng +134 -39
- data/lib/metanorma/iso/boilerplate-fr.xml +3 -0
- data/lib/metanorma/iso/boilerplate-ru.xml +3 -0
- data/lib/metanorma/iso/boilerplate.xml +3 -0
- data/lib/metanorma/iso/cleanup.rb +49 -11
- data/lib/metanorma/iso/front.rb +38 -6
- data/lib/metanorma/iso/front_id.rb +2 -0
- data/lib/metanorma/iso/isodoc.rng +16 -0
- data/lib/metanorma/iso/isostandard.rng +30 -12
- data/lib/metanorma/iso/macros.rb +29 -0
- data/lib/metanorma/iso/validate_section.rb +0 -12
- data/lib/metanorma/iso/version.rb +1 -1
- data/spec/isodoc/amd_spec.rb +20 -46
- data/spec/isodoc/blocks_spec.rb +499 -2
- data/spec/isodoc/i18n_spec.rb +145 -80
- data/spec/isodoc/iso_spec.rb +50 -169
- data/spec/isodoc/metadata_spec.rb +240 -99
- data/spec/isodoc/postproc_spec.rb +43 -7
- data/spec/isodoc/section_spec.rb +9 -9
- data/spec/isodoc/word_dis_spec.rb +1332 -146
- data/spec/isodoc/xref_spec.rb +87 -13
- data/spec/metanorma/amd_spec.rb +39 -23
- data/spec/metanorma/base_spec.rb +174 -44
- data/spec/metanorma/blocks_spec.rb +54 -0
- data/spec/metanorma/lists_spec.rb +2 -2
- data/spec/metanorma/section_spec.rb +2 -2
- data/spec/metanorma/validate_spec.rb +8 -19
- data/spec/spec_helper.rb +17 -7
- data/spec/vcr_cassettes/withdrawn_iso.yml +30 -30
- metadata +7 -8
- data/docs/asciiiso-syntax.adoc +0 -307
- data/docs/guidance.adoc +0 -487
- data/docs/navigation.adoc +0 -23
- data/docs/quickstart.adoc +0 -179
- data/lib/isodoc/iso/presentation_inline.rb +0 -90
data/spec/isodoc/amd_spec.rb
CHANGED
@@ -745,32 +745,28 @@ RSpec.describe IsoDoc do
|
|
745
745
|
</iso-standard>
|
746
746
|
INPUT
|
747
747
|
output = <<~OUTPUT
|
748
|
-
{:
|
749
|
-
:agency=>"ISO",
|
750
|
-
:circulateddate=>"XXX",
|
751
|
-
:confirmeddate=>"XXX",
|
752
|
-
:copieddate=>"XXX",
|
748
|
+
{:agency=>"ISO",
|
753
749
|
:createddate=>"2016-05-01",
|
754
750
|
:docnumber=>"ISO/PreNWIP3 17301-1:2016/Amd.1",
|
755
751
|
:docnumber_lang=>"ISO/PreNWIP3 17301-1:2016/Amd.1(E)",
|
756
752
|
:docnumber_reference=>"ISO/PreNWIP3 17301-1:2016/Amd.1:2017(E)",
|
757
753
|
:docnumeric=>"17301",
|
758
|
-
:docsubtitle=>"Introduction Française
|
754
|
+
:docsubtitle=>"Introduction Française — Titre Principal — Partie 1: Part du Titre",
|
759
755
|
:docsubtitleamd=>"Fraction massique de matière étrangère, riz usiné (non gluant), diviseurs d’échantillon et recommandations relatives aux conditions d’entreposage et de transport",
|
760
|
-
:docsubtitleamdlabel=>"AMENDMENT
|
761
|
-
:docsubtitlecorrlabel=>"RECTIFICATIF TECHNIQUE
|
756
|
+
:docsubtitleamdlabel=>"AMENDMENT 1",
|
757
|
+
:docsubtitlecorrlabel=>"RECTIFICATIF TECHNIQUE 2",
|
762
758
|
:docsubtitleintro=>"Introduction Française",
|
763
759
|
:docsubtitlemain=>"Titre Principal",
|
764
760
|
:docsubtitlepart=>"Part du Titre",
|
765
|
-
:docsubtitlepartlabel=>"Partie
|
766
|
-
:doctitle=>"Introduction
|
761
|
+
:docsubtitlepartlabel=>"Partie 1",
|
762
|
+
:doctitle=>"Introduction — Main Title — Title — Part 1: Title Part",
|
767
763
|
:doctitleamd=>"Mass fraction of extraneous matter, milled rice (nonglutinous), sample dividers and recommendations relating to storage and transport conditions",
|
768
|
-
:doctitleamdlabel=>"AMENDMENT
|
769
|
-
:doctitlecorrlabel=>"TECHNICAL CORRIGENDUM
|
764
|
+
:doctitleamdlabel=>"AMENDMENT 1",
|
765
|
+
:doctitlecorrlabel=>"TECHNICAL CORRIGENDUM 2",
|
770
766
|
:doctitleintro=>"Introduction",
|
771
767
|
:doctitlemain=>"Main Title — Title",
|
772
768
|
:doctitlepart=>"Title Part",
|
773
|
-
:doctitlepartlabel=>"Part
|
769
|
+
:doctitlepartlabel=>"Part 1",
|
774
770
|
:doctype=>"Amendment",
|
775
771
|
:doctype_display=>"Amendment",
|
776
772
|
:docyear=>"2017",
|
@@ -779,13 +775,8 @@ RSpec.describe IsoDoc do
|
|
779
775
|
:edition=>"2",
|
780
776
|
:editorialgroup=>["A 1", "B 2", "C 3"],
|
781
777
|
:ics=>"1, 2, 3",
|
782
|
-
:implementeddate=>"XXX",
|
783
|
-
:issueddate=>"XXX",
|
784
778
|
:lang=>"en",
|
785
|
-
:obsoleteddate=>"XXX",
|
786
|
-
:publisheddate=>"XXX",
|
787
779
|
:publisher=>"International Organization for Standardization",
|
788
|
-
:receiveddate=>"XXX",
|
789
780
|
:revdate=>"2000-01-01",
|
790
781
|
:revdate_monthyear=>"January 2000",
|
791
782
|
:sc=>"B 2",
|
@@ -795,13 +786,9 @@ RSpec.describe IsoDoc do
|
|
795
786
|
:stage_int=>10,
|
796
787
|
:stageabbr=>"NWIP",
|
797
788
|
:statusabbr=>"PreNWIP3",
|
789
|
+
:substage_int=>"20",
|
798
790
|
:tc=>"A 1",
|
799
|
-
:transmitteddate=>"XXX",
|
800
|
-
:unchangeddate=>"XXX",
|
801
791
|
:unpublished=>true,
|
802
|
-
:updateddate=>"XXX",
|
803
|
-
:vote_endeddate=>"XXX",
|
804
|
-
:vote_starteddate=>"XXX",
|
805
792
|
:wg=>"C 3"}
|
806
793
|
OUTPUT
|
807
794
|
expect(metadata(c.info(Nokogiri::XML(input), nil)))
|
@@ -910,32 +897,28 @@ RSpec.describe IsoDoc do
|
|
910
897
|
</iso-standard>
|
911
898
|
INPUT
|
912
899
|
output = <<~OUTPUT
|
913
|
-
{:
|
914
|
-
:agency=>"ISO",
|
915
|
-
:circulateddate=>"XXX",
|
916
|
-
:confirmeddate=>"XXX",
|
917
|
-
:copieddate=>"XXX",
|
900
|
+
{:agency=>"ISO",
|
918
901
|
:createddate=>"2016-05-01",
|
919
902
|
:docnumber=>"ISO/PreNWIP3 17301-1:2016/Amd.1",
|
920
903
|
:docnumber_lang=>"ISO/PreNWIP3 17301-1:2016/Amd.1(E)",
|
921
904
|
:docnumber_reference=>"ISO/PreNWIP3 17301-1:2016/Amd.1:2017(E)",
|
922
905
|
:docnumeric=>"17301",
|
923
|
-
:docsubtitle=>"Introduction
|
906
|
+
:docsubtitle=>"Introduction — Main Title — Title — Part 1: Title Part",
|
924
907
|
:docsubtitleamd=>"Mass fraction of extraneous matter, milled rice (nonglutinous), sample dividers and recommendations relating to storage and transport conditions",
|
925
|
-
:docsubtitleamdlabel=>"AMENDMENT
|
926
|
-
:docsubtitlecorrlabel=>"TECHNICAL CORRIGENDUM
|
908
|
+
:docsubtitleamdlabel=>"AMENDMENT 1",
|
909
|
+
:docsubtitlecorrlabel=>"TECHNICAL CORRIGENDUM 2",
|
927
910
|
:docsubtitleintro=>"Introduction",
|
928
911
|
:docsubtitlemain=>"Main Title — Title",
|
929
912
|
:docsubtitlepart=>"Title Part",
|
930
|
-
:docsubtitlepartlabel=>"Part
|
931
|
-
:doctitle=>"Introduction Française
|
913
|
+
:docsubtitlepartlabel=>"Part 1",
|
914
|
+
:doctitle=>"Introduction Française — Titre Principal — Partie 1: Part du Titre",
|
932
915
|
:doctitleamd=>"Fraction massique de matière étrangère, riz usiné (non gluant), diviseurs d’échantillon et recommandations relatives aux conditions d’entreposage et de transport",
|
933
|
-
:doctitleamdlabel=>"AMENDMENT
|
934
|
-
:doctitlecorrlabel=>"RECTIFICATIF TECHNIQUE
|
916
|
+
:doctitleamdlabel=>"AMENDMENT 1",
|
917
|
+
:doctitlecorrlabel=>"RECTIFICATIF TECHNIQUE 2",
|
935
918
|
:doctitleintro=>"Introduction Française",
|
936
919
|
:doctitlemain=>"Titre Principal",
|
937
920
|
:doctitlepart=>"Part du Titre",
|
938
|
-
:doctitlepartlabel=>"Partie
|
921
|
+
:doctitlepartlabel=>"Partie 1",
|
939
922
|
:doctype=>"Amendment",
|
940
923
|
:doctype_display=>"Amendment",
|
941
924
|
:docyear=>"2017",
|
@@ -944,13 +927,8 @@ RSpec.describe IsoDoc do
|
|
944
927
|
:edition=>"2",
|
945
928
|
:editorialgroup=>["A 1", "B 2", "C 3"],
|
946
929
|
:ics=>"1, 2, 3",
|
947
|
-
:implementeddate=>"XXX",
|
948
|
-
:issueddate=>"XXX",
|
949
930
|
:lang=>"fr",
|
950
|
-
:obsoleteddate=>"XXX",
|
951
|
-
:publisheddate=>"XXX",
|
952
931
|
:publisher=>"International Organization for Standardization",
|
953
|
-
:receiveddate=>"XXX",
|
954
932
|
:revdate=>"2000-01-01",
|
955
933
|
:revdate_monthyear=>"Janvier 2000",
|
956
934
|
:sc=>"B 2",
|
@@ -960,13 +938,9 @@ RSpec.describe IsoDoc do
|
|
960
938
|
:stage_int=>10,
|
961
939
|
:stageabbr=>"NWIP",
|
962
940
|
:statusabbr=>"PreNWIP3",
|
941
|
+
:substage_int=>"20",
|
963
942
|
:tc=>"A 1",
|
964
|
-
:transmitteddate=>"XXX",
|
965
|
-
:unchangeddate=>"XXX",
|
966
943
|
:unpublished=>true,
|
967
|
-
:updateddate=>"XXX",
|
968
|
-
:vote_endeddate=>"XXX",
|
969
|
-
:vote_starteddate=>"XXX",
|
970
944
|
:wg=>"C 3"}
|
971
945
|
OUTPUT
|
972
946
|
expect(metadata(c.info(Nokogiri::XML(input), nil)))
|
data/spec/isodoc/blocks_spec.rb
CHANGED
@@ -1,6 +1,183 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
RSpec.describe IsoDoc do
|
4
|
+
it "processes examples" do
|
5
|
+
input = <<~INPUT
|
6
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
7
|
+
<preface>
|
8
|
+
<foreword>
|
9
|
+
<example id="samplecode">
|
10
|
+
<name>Title</name>
|
11
|
+
<p>Hello</p>
|
12
|
+
</example>
|
13
|
+
</foreword>
|
14
|
+
</preface>
|
15
|
+
</iso-standard>
|
16
|
+
INPUT
|
17
|
+
presxml = <<~OUTPUT
|
18
|
+
<?xml version='1.0'?>
|
19
|
+
<iso-standard type="presentation" xmlns="http://riboseinc.com/isoxml">
|
20
|
+
<preface>
|
21
|
+
<foreword displayorder="1">
|
22
|
+
<example id="samplecode">
|
23
|
+
<name>EXAMPLE — Title</name>
|
24
|
+
<p>Hello</p>
|
25
|
+
</example>
|
26
|
+
</foreword>
|
27
|
+
</preface>
|
28
|
+
</iso-standard>
|
29
|
+
OUTPUT
|
30
|
+
|
31
|
+
html = <<~OUTPUT
|
32
|
+
#{HTML_HDR}
|
33
|
+
<br/>
|
34
|
+
<div>
|
35
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
36
|
+
<div id="samplecode" class="example">
|
37
|
+
<p><span class="example_label">EXAMPLE — Title</span>  Hello</p>
|
38
|
+
</div>
|
39
|
+
</div>
|
40
|
+
<p class="zzSTDTitle1"/>
|
41
|
+
</div>
|
42
|
+
</body>
|
43
|
+
</html>
|
44
|
+
OUTPUT
|
45
|
+
|
46
|
+
word = <<~OUTPUT
|
47
|
+
<body lang="EN-US" link="blue" vlink="#954F72">
|
48
|
+
<div class="WordSection1">
|
49
|
+
<p> </p>
|
50
|
+
</div>
|
51
|
+
<p>
|
52
|
+
<br clear="all" class="section"/>
|
53
|
+
</p>
|
54
|
+
<div class="WordSection2">
|
55
|
+
<p>
|
56
|
+
<br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
|
57
|
+
</p>
|
58
|
+
<div>
|
59
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
60
|
+
<div id="samplecode" class="example">
|
61
|
+
<p><span class="example_label">EXAMPLE — Title</span><span style="mso-tab-count:1">  </span>Hello</p>
|
62
|
+
</div>
|
63
|
+
</div>
|
64
|
+
<p> </p>
|
65
|
+
</div>
|
66
|
+
<p>
|
67
|
+
<br clear="all" class="section"/>
|
68
|
+
</p>
|
69
|
+
<div class="WordSection3">
|
70
|
+
<p class="zzSTDTitle1"/>
|
71
|
+
</div>
|
72
|
+
<br clear="all" style="page-break-before:left;mso-break-type:section-break"/>
|
73
|
+
<div class="colophon"/>
|
74
|
+
</body>
|
75
|
+
OUTPUT
|
76
|
+
expect(IsoDoc::Iso::PresentationXMLConvert.new({})
|
77
|
+
.convert("test", input, true)).to be_equivalent_to xmlpp(presxml)
|
78
|
+
expect(IsoDoc::Iso::HtmlConvert.new({})
|
79
|
+
.convert("test", presxml, true)).to be_equivalent_to xmlpp(html)
|
80
|
+
output = IsoDoc::Iso::WordConvert.new({}).convert("test", presxml, true)
|
81
|
+
expect(xmlpp(output
|
82
|
+
.sub(/^.*<body/m, "<body").sub(%r{</body>.*$}m, "</body>")))
|
83
|
+
.to be_equivalent_to xmlpp(word)
|
84
|
+
end
|
85
|
+
|
86
|
+
it "processes sequences of examples" do
|
87
|
+
input = <<~INPUT
|
88
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
89
|
+
<preface>
|
90
|
+
<foreword>
|
91
|
+
<example id="samplecode">
|
92
|
+
<quote>Hello</quote>
|
93
|
+
</example>
|
94
|
+
<example id="samplecode2">
|
95
|
+
<name>Title</name>
|
96
|
+
<p>Hello</p>
|
97
|
+
</example>
|
98
|
+
</foreword>
|
99
|
+
</preface>
|
100
|
+
</iso-standard>
|
101
|
+
INPUT
|
102
|
+
presxml = <<~OUTPUT
|
103
|
+
<?xml version='1.0'?>
|
104
|
+
<iso-standard type="presentation" xmlns="http://riboseinc.com/isoxml">
|
105
|
+
<preface>
|
106
|
+
<foreword displayorder="1">
|
107
|
+
<example id="samplecode">
|
108
|
+
<name>EXAMPLE 1</name>
|
109
|
+
<quote>Hello</quote>
|
110
|
+
</example>
|
111
|
+
<example id="samplecode2">
|
112
|
+
<name>EXAMPLE 2 — Title</name>
|
113
|
+
<p>Hello</p>
|
114
|
+
</example>
|
115
|
+
</foreword>
|
116
|
+
</preface>
|
117
|
+
</iso-standard>
|
118
|
+
OUTPUT
|
119
|
+
html = <<~OUTPUT
|
120
|
+
#{HTML_HDR}
|
121
|
+
<br/>
|
122
|
+
<div>
|
123
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
124
|
+
<div id="samplecode" class="example">
|
125
|
+
<p><span class="example_label">EXAMPLE 1</span>  </p>
|
126
|
+
<div class="Quote">Hello</div>
|
127
|
+
</div>
|
128
|
+
<div id="samplecode2" class="example">
|
129
|
+
<p><span class="example_label">EXAMPLE 2 — Title</span>  Hello</p>
|
130
|
+
</div>
|
131
|
+
</div>
|
132
|
+
<p class="zzSTDTitle1"/>
|
133
|
+
</div>
|
134
|
+
</body>
|
135
|
+
</html>
|
136
|
+
OUTPUT
|
137
|
+
word = <<~OUTPUT
|
138
|
+
<body lang="EN-US" link="blue" vlink="#954F72">
|
139
|
+
<div class="WordSection1">
|
140
|
+
<p> </p>
|
141
|
+
</div>
|
142
|
+
<p>
|
143
|
+
<br clear="all" class="section"/>
|
144
|
+
</p>
|
145
|
+
<div class="WordSection2">
|
146
|
+
<p>
|
147
|
+
<br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
|
148
|
+
</p>
|
149
|
+
<div>
|
150
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
151
|
+
<div id="samplecode" class="example">
|
152
|
+
<p><span class="example_label">EXAMPLE 1</span><span style="mso-tab-count:1">  </span></p>
|
153
|
+
<div class="Quote">Hello</div>
|
154
|
+
</div>
|
155
|
+
<div id="samplecode2" class="example">
|
156
|
+
<p><span class="example_label">EXAMPLE 2 — Title</span><span style="mso-tab-count:1">  </span>Hello</p>
|
157
|
+
</div>
|
158
|
+
</div>
|
159
|
+
<p> </p>
|
160
|
+
</div>
|
161
|
+
<p>
|
162
|
+
<br clear="all" class="section"/>
|
163
|
+
</p>
|
164
|
+
<div class="WordSection3">
|
165
|
+
<p class="zzSTDTitle1"/>
|
166
|
+
</div>
|
167
|
+
<br clear="all" style="page-break-before:left;mso-break-type:section-break"/>
|
168
|
+
<div class="colophon"/>
|
169
|
+
</body>
|
170
|
+
OUTPUT
|
171
|
+
expect(IsoDoc::Iso::PresentationXMLConvert.new({})
|
172
|
+
.convert("test", input, true)).to be_equivalent_to xmlpp(presxml)
|
173
|
+
expect(IsoDoc::Iso::HtmlConvert.new({})
|
174
|
+
.convert("test", presxml, true)).to be_equivalent_to xmlpp(html)
|
175
|
+
output = IsoDoc::Iso::WordConvert.new({}).convert("test", presxml, true)
|
176
|
+
expect(xmlpp(output
|
177
|
+
.sub(/^.*<body/m, "<body").sub(%r{</body>.*$}m, "</body>")))
|
178
|
+
.to be_equivalent_to xmlpp(word)
|
179
|
+
end
|
180
|
+
|
4
181
|
it "processes admonitions" do
|
5
182
|
input = <<~INPUT
|
6
183
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
@@ -105,6 +282,75 @@ RSpec.describe IsoDoc do
|
|
105
282
|
.to be_equivalent_to xmlpp(output)
|
106
283
|
end
|
107
284
|
|
285
|
+
it "processes editorial notes" do
|
286
|
+
input = <<~INPUT
|
287
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
288
|
+
<preface><foreword>
|
289
|
+
<admonition id="_70234f78-64e5-4dfc-8b6f-f3f037348b6a" type="editorial">
|
290
|
+
<p id="_e94663cc-2473-4ccc-9a72-983a74d989f2">Only use paddy or parboiled rice for the determination of husked rice yield.</p>
|
291
|
+
<p id="_e94663cc-2473-4ccc-9a72-983a74d989f3">Para 2.</p>
|
292
|
+
</admonition>
|
293
|
+
</foreword></preface>
|
294
|
+
</iso-standard>
|
295
|
+
INPUT
|
296
|
+
presxml = <<~INPUT
|
297
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml" type='presentation'>
|
298
|
+
<preface><foreword displayorder="1">
|
299
|
+
<admonition id="_70234f78-64e5-4dfc-8b6f-f3f037348b6a" type="editorial">
|
300
|
+
<p id='_e94663cc-2473-4ccc-9a72-983a74d989f2'>
|
301
|
+
Only use paddy or parboiled rice for the
|
302
|
+
determination of husked rice yield.
|
303
|
+
</p>
|
304
|
+
<p id="_e94663cc-2473-4ccc-9a72-983a74d989f3">Para 2.</p>
|
305
|
+
</admonition>
|
306
|
+
</foreword></preface>
|
307
|
+
</iso-standard>
|
308
|
+
INPUT
|
309
|
+
html = <<~OUTPUT
|
310
|
+
#{HTML_HDR}
|
311
|
+
<br/>
|
312
|
+
<div>
|
313
|
+
<h1 class='ForewordTitle'>Foreword</h1>
|
314
|
+
<div id='_70234f78-64e5-4dfc-8b6f-f3f037348b6a' class='zzHelp'>
|
315
|
+
<p>
|
316
|
+
Only use paddy or parboiled rice for the
|
317
|
+
determination of husked rice yield.
|
318
|
+
</p>
|
319
|
+
<p id='_e94663cc-2473-4ccc-9a72-983a74d989f3'>Para 2.</p>
|
320
|
+
</div>
|
321
|
+
</div>
|
322
|
+
<p class='zzSTDTitle1'/>
|
323
|
+
</div>
|
324
|
+
</body>
|
325
|
+
</html>
|
326
|
+
OUTPUT
|
327
|
+
word = <<~OUTPUT
|
328
|
+
<div class='WordSection2'>
|
329
|
+
<p>
|
330
|
+
<br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
|
331
|
+
</p>
|
332
|
+
<div>
|
333
|
+
<h1 class='ForewordTitle'>Foreword</h1>
|
334
|
+
<div id='_70234f78-64e5-4dfc-8b6f-f3f037348b6a' class='zzHelp'>
|
335
|
+
<p> Only use paddy or parboiled rice for the determination of husked rice yield. </p>
|
336
|
+
<p class='ForewordText' id='_e94663cc-2473-4ccc-9a72-983a74d989f3'>Para 2.</p>
|
337
|
+
</div>
|
338
|
+
</div>
|
339
|
+
<p> </p>
|
340
|
+
</div>
|
341
|
+
OUTPUT
|
342
|
+
expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({})
|
343
|
+
.convert("test", input, true)))
|
344
|
+
.to be_equivalent_to xmlpp(presxml)
|
345
|
+
expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({})
|
346
|
+
.convert("test", presxml, true)))
|
347
|
+
.to be_equivalent_to xmlpp(html)
|
348
|
+
expect(xmlpp(Nokogiri::XML(IsoDoc::Iso::WordConvert.new({})
|
349
|
+
.convert("test", presxml, true))
|
350
|
+
.at("//div[@class = 'WordSection2']").to_xml))
|
351
|
+
.to be_equivalent_to xmlpp(word)
|
352
|
+
end
|
353
|
+
|
108
354
|
it "renders figures" do
|
109
355
|
input = <<~INPUT
|
110
356
|
<iso-standard xmlns='http://riboseinc.com/isoxml'>
|
@@ -618,8 +864,8 @@ RSpec.describe IsoDoc do
|
|
618
864
|
end
|
619
865
|
|
620
866
|
it "processes formulae with single definition list entry" do
|
621
|
-
output = IsoDoc::Iso::HtmlConvert.new({})
|
622
|
-
|
867
|
+
output = IsoDoc::Iso::HtmlConvert.new({})
|
868
|
+
.convert("test", <<~"INPUT", true)
|
623
869
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
624
870
|
<preface>
|
625
871
|
<foreword>
|
@@ -674,4 +920,255 @@ RSpec.describe IsoDoc do
|
|
674
920
|
</html>
|
675
921
|
OUTPUT
|
676
922
|
end
|
923
|
+
|
924
|
+
it "adds ordered list classes for HTML" do
|
925
|
+
input = <<~INPUT
|
926
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
927
|
+
<preface><foreword>
|
928
|
+
<ol>
|
929
|
+
<li><p>A</p></li>
|
930
|
+
<li><p>B</p></li>
|
931
|
+
<li><ol>
|
932
|
+
<li>C</li>
|
933
|
+
<li>D</li>
|
934
|
+
<li><ol>
|
935
|
+
<li>E</li>
|
936
|
+
<li>F</li>
|
937
|
+
<li><ol>
|
938
|
+
<li>G</li>
|
939
|
+
<li>H</li>
|
940
|
+
<li><ol>
|
941
|
+
<li>I</li>
|
942
|
+
<li>J</li>
|
943
|
+
<li><ol>
|
944
|
+
<li>K</li>
|
945
|
+
<li>L</li>
|
946
|
+
<li>M</li>
|
947
|
+
</ol></li>
|
948
|
+
<li>N</li>
|
949
|
+
</ol></li>
|
950
|
+
<li>O</li>
|
951
|
+
</ol></li>
|
952
|
+
<li>P</li>
|
953
|
+
</ol></li>
|
954
|
+
<li>Q</li>
|
955
|
+
</ol></li>
|
956
|
+
<li>R</li>
|
957
|
+
</ol>
|
958
|
+
</foreword></preface>
|
959
|
+
</iso-standard>
|
960
|
+
INPUT
|
961
|
+
presxml = <<~INPUT
|
962
|
+
<iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
|
963
|
+
<preface>
|
964
|
+
<foreword displayorder='1'>
|
965
|
+
<ol type='alphabet'>
|
966
|
+
<li>
|
967
|
+
<p>A</p>
|
968
|
+
</li>
|
969
|
+
<li>
|
970
|
+
<p>B</p>
|
971
|
+
</li>
|
972
|
+
<li>
|
973
|
+
<ol type='arabic'>
|
974
|
+
<li>C</li>
|
975
|
+
<li>D</li>
|
976
|
+
<li>
|
977
|
+
<ol type='roman'>
|
978
|
+
<li>E</li>
|
979
|
+
<li>F</li>
|
980
|
+
<li>
|
981
|
+
<ol type='alphabet_upper'>
|
982
|
+
<li>G</li>
|
983
|
+
<li>H</li>
|
984
|
+
<li>
|
985
|
+
<ol type='roman_upper'>
|
986
|
+
<li>I</li>
|
987
|
+
<li>J</li>
|
988
|
+
<li>
|
989
|
+
<ol type='alphabet'>
|
990
|
+
<li>K</li>
|
991
|
+
<li>L</li>
|
992
|
+
<li>M</li>
|
993
|
+
</ol>
|
994
|
+
</li>
|
995
|
+
<li>N</li>
|
996
|
+
</ol>
|
997
|
+
</li>
|
998
|
+
<li>O</li>
|
999
|
+
</ol>
|
1000
|
+
</li>
|
1001
|
+
<li>P</li>
|
1002
|
+
</ol>
|
1003
|
+
</li>
|
1004
|
+
<li>Q</li>
|
1005
|
+
</ol>
|
1006
|
+
</li>
|
1007
|
+
<li>R</li>
|
1008
|
+
</ol>
|
1009
|
+
</foreword>
|
1010
|
+
</preface>
|
1011
|
+
</iso-standard>
|
1012
|
+
INPUT
|
1013
|
+
html = <<~OUTPUT
|
1014
|
+
#{HTML_HDR}
|
1015
|
+
<br/>
|
1016
|
+
<div>
|
1017
|
+
<h1 class='ForewordTitle'>Foreword</h1>
|
1018
|
+
<ol type='a' class='alphabet'>
|
1019
|
+
<li>
|
1020
|
+
<p>A</p>
|
1021
|
+
</li>
|
1022
|
+
<li>
|
1023
|
+
<p>B</p>
|
1024
|
+
</li>
|
1025
|
+
<li>
|
1026
|
+
<ol type='1' class='arabic'>
|
1027
|
+
<li>C</li>
|
1028
|
+
<li>D</li>
|
1029
|
+
<li>
|
1030
|
+
<ol type='i' class='roman'>
|
1031
|
+
<li>E</li>
|
1032
|
+
<li>F</li>
|
1033
|
+
<li>
|
1034
|
+
<ol type='A' class='alphabet_upper'>
|
1035
|
+
<li>G</li>
|
1036
|
+
<li>H</li>
|
1037
|
+
<li>
|
1038
|
+
<ol type='I' class='roman_upper'>
|
1039
|
+
<li>I</li>
|
1040
|
+
<li>J</li>
|
1041
|
+
<li>
|
1042
|
+
<ol type='a' class='alphabet'>
|
1043
|
+
<li>K</li>
|
1044
|
+
<li>L</li>
|
1045
|
+
<li>M</li>
|
1046
|
+
</ol>
|
1047
|
+
</li>
|
1048
|
+
<li>N</li>
|
1049
|
+
</ol>
|
1050
|
+
</li>
|
1051
|
+
<li>O</li>
|
1052
|
+
</ol>
|
1053
|
+
</li>
|
1054
|
+
<li>P</li>
|
1055
|
+
</ol>
|
1056
|
+
</li>
|
1057
|
+
<li>Q</li>
|
1058
|
+
</ol>
|
1059
|
+
</li>
|
1060
|
+
<li>R</li>
|
1061
|
+
</ol>
|
1062
|
+
</div>
|
1063
|
+
<p class='zzSTDTitle1'/>
|
1064
|
+
</div>
|
1065
|
+
</body>
|
1066
|
+
</html>
|
1067
|
+
OUTPUT
|
1068
|
+
expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({})
|
1069
|
+
.convert("test", input, true)))
|
1070
|
+
.to be_equivalent_to xmlpp(presxml)
|
1071
|
+
expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({})
|
1072
|
+
.convert("test", presxml, true)))
|
1073
|
+
.to be_equivalent_to xmlpp(html)
|
1074
|
+
end
|
1075
|
+
|
1076
|
+
it "processes ordered lists with start" do
|
1077
|
+
input = <<~INPUT
|
1078
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
1079
|
+
<preface><foreword>
|
1080
|
+
<ol start="4">
|
1081
|
+
<li>List</li>
|
1082
|
+
</ol>
|
1083
|
+
</foreword></preface>
|
1084
|
+
</iso-standard>
|
1085
|
+
INPUT
|
1086
|
+
presxml = <<~INPUT
|
1087
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml" type='presentation'>
|
1088
|
+
<preface>
|
1089
|
+
<foreword displayorder='1'>
|
1090
|
+
<ol start='4' type='alphabet'>
|
1091
|
+
<li>List</li>
|
1092
|
+
</ol>
|
1093
|
+
</foreword>
|
1094
|
+
</preface>
|
1095
|
+
</iso-standard>
|
1096
|
+
INPUT
|
1097
|
+
html = <<~OUTPUT
|
1098
|
+
#{HTML_HDR}
|
1099
|
+
<br/>
|
1100
|
+
<div>
|
1101
|
+
<h1 class='ForewordTitle'>Foreword</h1>
|
1102
|
+
<ol type='a' start='4' class='alphabet'>
|
1103
|
+
<li>List</li>
|
1104
|
+
</ol>
|
1105
|
+
</div>
|
1106
|
+
<p class='zzSTDTitle1'/>
|
1107
|
+
</div>
|
1108
|
+
</body>
|
1109
|
+
</html>
|
1110
|
+
OUTPUT
|
1111
|
+
word = <<~OUTPUT
|
1112
|
+
<div class='WordSection2'>
|
1113
|
+
<p>
|
1114
|
+
<br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
|
1115
|
+
</p>
|
1116
|
+
<div>
|
1117
|
+
<h1 class='ForewordTitle'>Foreword</h1>
|
1118
|
+
<ol type='a' start='4'>
|
1119
|
+
<li>List</li>
|
1120
|
+
</ol>
|
1121
|
+
</div>
|
1122
|
+
<p> </p>
|
1123
|
+
</div>
|
1124
|
+
OUTPUT
|
1125
|
+
|
1126
|
+
expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({})
|
1127
|
+
.convert("test", input, true)))
|
1128
|
+
.to be_equivalent_to xmlpp(presxml)
|
1129
|
+
expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({})
|
1130
|
+
.convert("test", presxml, true)))
|
1131
|
+
.to be_equivalent_to xmlpp(html)
|
1132
|
+
expect(xmlpp(Nokogiri::XML(IsoDoc::Iso::WordConvert.new({})
|
1133
|
+
.convert("test", presxml, true))
|
1134
|
+
.at("//div[@class = 'WordSection2']").to_xml))
|
1135
|
+
.to be_equivalent_to xmlpp(word)
|
1136
|
+
end
|
1137
|
+
|
1138
|
+
it "ignores intervening ul in numbering ol" do
|
1139
|
+
input = <<~INPUT
|
1140
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
1141
|
+
<preface><foreword>
|
1142
|
+
<ul>
|
1143
|
+
<li>A</li>
|
1144
|
+
<li>
|
1145
|
+
<ol>
|
1146
|
+
<li>List</li>
|
1147
|
+
</ol>
|
1148
|
+
</li>
|
1149
|
+
</ul>
|
1150
|
+
</foreword></preface>
|
1151
|
+
</iso-standard>
|
1152
|
+
INPUT
|
1153
|
+
presxml = <<~INPUT
|
1154
|
+
<iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
|
1155
|
+
<preface>
|
1156
|
+
<foreword displayorder='1'>
|
1157
|
+
<ul>
|
1158
|
+
<li>A</li>
|
1159
|
+
<li>
|
1160
|
+
<ol type='alphabet'>
|
1161
|
+
<li>List</li>
|
1162
|
+
</ol>
|
1163
|
+
</li>
|
1164
|
+
</ul>
|
1165
|
+
</foreword>
|
1166
|
+
</preface>
|
1167
|
+
</iso-standard>
|
1168
|
+
INPUT
|
1169
|
+
expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({})
|
1170
|
+
.convert("test", input, true)))
|
1171
|
+
.to be_equivalent_to xmlpp(presxml)
|
1172
|
+
|
1173
|
+
end
|
677
1174
|
end
|