metanorma-iec 2.1.10 → 2.1.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/isodoc/iec/html/htmlstyle.css +1 -1
- data/lib/isodoc/iec/html/htmlstyle.scss +1 -1
- data/lib/isodoc/iec/iec.international-standard.xsl +289 -103
- data/lib/isodoc/iec/presentation_xml_convert.rb +8 -6
- data/lib/metanorma/iec/basicdoc.rng +0 -27
- data/lib/metanorma/iec/biblio-standoc.rng +164 -0
- data/lib/metanorma/iec/biblio.rng +50 -18
- data/lib/metanorma/iec/iec.rng +1 -100
- data/lib/metanorma/iec/iec_intro_en.xml +11 -12
- data/lib/metanorma/iec/iec_intro_fr.xml +11 -11
- data/lib/metanorma/iec/isodoc.rng +68 -206
- data/lib/metanorma/iec/isostandard.rng +0 -194
- data/lib/metanorma/iec/relaton-iec.rng +284 -0
- data/lib/metanorma/iec/version.rb +1 -1
- data/metanorma-iec.gemspec +5 -2
- metadata +6 -35
- data/.github/workflows/rake.yml +0 -15
- data/.github/workflows/release.yml +0 -24
- data/Rakefile +0 -8
- data/bin/rspec +0 -18
- data/spec/assets/header.html +0 -7
- data/spec/assets/html.css +0 -2
- data/spec/assets/iso.xml +0 -71
- data/spec/assets/rice_image1.png +0 -0
- data/spec/assets/word.css +0 -2
- data/spec/assets/wordintro.html +0 -4
- data/spec/assets/xref_error.adoc +0 -7
- data/spec/isodoc/blocks_spec.rb +0 -200
- data/spec/isodoc/i18n_spec.rb +0 -607
- data/spec/isodoc/iev_spec.rb +0 -888
- data/spec/isodoc/inline_spec.rb +0 -293
- data/spec/isodoc/iso_spec.rb +0 -211
- data/spec/isodoc/metadata_spec.rb +0 -251
- data/spec/isodoc/postproc_spec.rb +0 -303
- data/spec/isodoc/ref_spec.rb +0 -335
- data/spec/isodoc/section_spec.rb +0 -566
- data/spec/isodoc/terms_spec.rb +0 -192
- data/spec/metanorma/base_spec.rb +0 -1041
- data/spec/metanorma/blocks_spec.rb +0 -470
- data/spec/metanorma/cleanup_spec.rb +0 -372
- data/spec/metanorma/iev_spec.rb +0 -254
- data/spec/metanorma/inline_spec.rb +0 -145
- data/spec/metanorma/lists_spec.rb +0 -194
- data/spec/metanorma/processor_spec.rb +0 -171
- data/spec/metanorma/section_spec.rb +0 -348
- data/spec/metanorma/validate_spec.rb +0 -56
- data/spec/spec_helper.rb +0 -305
@@ -1,251 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
require "nokogiri"
|
3
|
-
|
4
|
-
RSpec.describe IsoDoc::Iec::Metadata do
|
5
|
-
it "processes IsoXML metadata" do
|
6
|
-
c = IsoDoc::Iec::HtmlConvert.new({})
|
7
|
-
arr = c.convert_init(<<~"INPUT", "test", false)
|
8
|
-
<iec-standard xmlns="http://riboseinc.com/isoxml">
|
9
|
-
INPUT
|
10
|
-
input = <<~INPUT
|
11
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
12
|
-
<bibdata type="standard">
|
13
|
-
<title type="title-intro" language="en" format="text/plain">Cereals and pulses</title>
|
14
|
-
<title type="title-main" language="en" format="text/plain">Specifications and test methods</title>
|
15
|
-
<title type="title-part" language="en" format="text/plain">Rice</title>
|
16
|
-
<title type="title-intro" language="fr" format="text/plain">Céréales et légumineuses</title>
|
17
|
-
<title type="title-main" language="fr" format="text/plain">Spécification et méthodes d'essai</title>
|
18
|
-
<title type="title-part" language="fr" format="text/plain">Riz</title>
|
19
|
-
<docidentifier type="ISO">ISO/PreCD3 17301-1</docidentifier>
|
20
|
-
<docidentifier type="iso-tc">17301</docidentifier>
|
21
|
-
<docnumber>1730</docnumber>
|
22
|
-
<date type="published"><on>2011</on></date>
|
23
|
-
<date type="accessed"><on>2012</on></date>
|
24
|
-
<date type="created"><from>2010</from><to>2011</to></date>
|
25
|
-
<date type="activated"><on>2013</on></date>
|
26
|
-
<date type="obsoleted"><on>2014</on></date>
|
27
|
-
<edition>2</edition>
|
28
|
-
<version>
|
29
|
-
<revision-date>2016-05-01</revision-date>
|
30
|
-
<draft>0.4</draft>
|
31
|
-
</version>
|
32
|
-
<contributor>
|
33
|
-
<role type="author"/>
|
34
|
-
<organization>
|
35
|
-
<name>International Organization for Standardization</name>
|
36
|
-
<abbreviation>ISO</abbreviation>
|
37
|
-
</organization>
|
38
|
-
</contributor>
|
39
|
-
<contributor>
|
40
|
-
<role type="publisher"/>
|
41
|
-
<organization>
|
42
|
-
<name>International Organization for Standardization</name>
|
43
|
-
<abbreviation>ISO</abbreviation>
|
44
|
-
</organization>
|
45
|
-
</contributor>
|
46
|
-
<language>en</language>
|
47
|
-
<script>Latn</script>
|
48
|
-
<status>
|
49
|
-
<stage abbreviation="CD">35</stage>
|
50
|
-
<substage abbreviation="3CD">20</substage>
|
51
|
-
<iteration>3</iteration>
|
52
|
-
</status>
|
53
|
-
<copyright>
|
54
|
-
<from>2016</from>
|
55
|
-
<owner>
|
56
|
-
<organization>
|
57
|
-
<abbreviation>ISO</abbreviation>
|
58
|
-
</organization>
|
59
|
-
</owner>
|
60
|
-
</copyright>
|
61
|
-
<ext>
|
62
|
-
<doctype language=''>international-standard</doctype>
|
63
|
-
<doctype language='fr'>Norme international</doctype>
|
64
|
-
<doctype language='en'>International Standard</doctype>
|
65
|
-
<horizontal language=''>true</horizontal>
|
66
|
-
<horizontal language='fr'>Norme horizontale</horizontal>
|
67
|
-
<horizontal language='en'>Horizontal Standard</horizontal>
|
68
|
-
<function language=''>emc</function>
|
69
|
-
<function language='fr'>Publication fondamentale en CEM</function>
|
70
|
-
<function language='en'>Basic EMC Publication</function>
|
71
|
-
<editorialgroup>
|
72
|
-
<technical-committee number="34">Food products</technical-committee>
|
73
|
-
<subcommittee number="4">Cereals and pulses</subcommittee>
|
74
|
-
<workgroup number="3">Rice Group</workgroup>
|
75
|
-
<secretariat>GB</secretariat>
|
76
|
-
</editorialgroup>
|
77
|
-
<structuredidentifier>
|
78
|
-
<project-number part="1">ISO/PreCD3 17301</project-number>
|
79
|
-
</structuredidentifier>
|
80
|
-
</ext>
|
81
|
-
</bibdata>
|
82
|
-
</iso-standard>
|
83
|
-
INPUT
|
84
|
-
output = <<~OUTPUT
|
85
|
-
{:accesseddate=>"2012",
|
86
|
-
:activateddate=>"2013",
|
87
|
-
:agency=>"ISO",
|
88
|
-
:createddate=>"2010–2011",
|
89
|
-
:docnumber=>"ISO/PreCD3 17301-1",
|
90
|
-
:docnumeric=>"1730",
|
91
|
-
:docsubtitle=>"Céréales et légumineuses — Spécification et méthodes d'essai — Partie 1: Riz",
|
92
|
-
:docsubtitleintro=>"Céréales et légumineuses",
|
93
|
-
:docsubtitlemain=>"Spécification et méthodes d'essai",
|
94
|
-
:docsubtitlepart=>"Riz",
|
95
|
-
:docsubtitlepartlabel=>"Partie 1",
|
96
|
-
:doctitle=>"Cereals and pulses — Specifications and test methods — Part 1: Rice",
|
97
|
-
:doctitleintro=>"Cereals and pulses",
|
98
|
-
:doctitlemain=>"Specifications and test methods",
|
99
|
-
:doctitlepart=>"Rice",
|
100
|
-
:doctitlepartlabel=>"Part 1",
|
101
|
-
:doctype=>"International Standard",
|
102
|
-
:doctype_display=>"International Standard",
|
103
|
-
:doctype_en=>"International Standard",
|
104
|
-
:doctype_fr=>"Norme International",
|
105
|
-
:docyear=>"2016",
|
106
|
-
:draft=>"0.4",
|
107
|
-
:draftinfo=>" (draft 0.4, 2016-05-01)",
|
108
|
-
:edition=>"2",
|
109
|
-
:editorialgroup=>["TC 34", "SC 4", "WG 3"],
|
110
|
-
:function=>"Emc",
|
111
|
-
:function_display=>"Basic Emc Publication",
|
112
|
-
:function_en=>"Basic Emc Publication",
|
113
|
-
:function_fr=>"Publication Fondamentale En Cem",
|
114
|
-
:horizontal=>"True",
|
115
|
-
:horizontal_display=>"Horizontal Standard",
|
116
|
-
:horizontal_en=>"Horizontal Standard",
|
117
|
-
:horizontal_fr=>"Norme Horizontale",
|
118
|
-
:lang=>"en",
|
119
|
-
:obsoleteddate=>"2014",
|
120
|
-
:publisheddate=>"2011",
|
121
|
-
:publisher=>"International Organization for Standardization",
|
122
|
-
:revdate=>"2016-05-01",
|
123
|
-
:revdate_monthyear=>"May 2016",
|
124
|
-
:sc=>"SC 4",
|
125
|
-
:script=>"Latn",
|
126
|
-
:secretariat=>"GB",
|
127
|
-
:stage=>"35",
|
128
|
-
:stage_int=>35,
|
129
|
-
:stageabbr=>"CD",
|
130
|
-
:statusabbr=>"3CD",
|
131
|
-
:tc=>"TC 34",
|
132
|
-
:tc_docnumber=>["17301"],
|
133
|
-
:unpublished=>true,
|
134
|
-
:wg=>"WG 3"}
|
135
|
-
OUTPUT
|
136
|
-
expect(metadata(c.info(Nokogiri::XML(input), nil))
|
137
|
-
.to_s.gsub(/, :/, ",\n:")).to be_equivalent_to output
|
138
|
-
end
|
139
|
-
|
140
|
-
it "processes IsoXML metadata" do
|
141
|
-
c = IsoDoc::Iec::HtmlConvert.new({})
|
142
|
-
arr = c.convert_init(<<~"INPUT", "test", false)
|
143
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
144
|
-
INPUT
|
145
|
-
input = <<~INPUT
|
146
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
147
|
-
<bibdata type="standard">
|
148
|
-
<title type="title-intro" language="en" format="text/plain">Cereals and pulses</title>
|
149
|
-
<title type="title-main" language="en" format="text/plain">Specifications and test methods</title>
|
150
|
-
<title type="title-part" language="en" format="text/plain">Rice</title>
|
151
|
-
<title type="title-intro" language="fr" format="text/plain">Céréales et légumineuses</title>
|
152
|
-
<title type="title-main" language="fr" format="text/plain">Spécification et méthodes d'essai</title>
|
153
|
-
<title type="title-part" language="fr" format="text/plain">Riz</title>
|
154
|
-
<docidentifier type="ISO">ISO/IEC/CD 17301-1-3</docidentifier>
|
155
|
-
<docidentifier type="iso-tc">17301</docidentifier>
|
156
|
-
<contributor>
|
157
|
-
<role type="author"/>
|
158
|
-
<organization>
|
159
|
-
<name>International Organization for Standardization</name>
|
160
|
-
<abbreviation>ISO</abbreviation>
|
161
|
-
</organization>
|
162
|
-
</contributor>
|
163
|
-
<contributor>
|
164
|
-
<role type="publisher"/>
|
165
|
-
<organization>
|
166
|
-
<name>International Organization for Standardization</name>
|
167
|
-
<abbreviation>ISO</abbreviation>
|
168
|
-
</organization>
|
169
|
-
</contributor>
|
170
|
-
<contributor>
|
171
|
-
<role type="publisher"/>
|
172
|
-
<organization>
|
173
|
-
<name>International Electrotechnical Commission</name>
|
174
|
-
<abbreviation>IEC</abbreviation>
|
175
|
-
</organization>
|
176
|
-
</contributor>
|
177
|
-
<language>en</language>
|
178
|
-
<script>Latn</script>
|
179
|
-
<status>
|
180
|
-
<stage abbreviation="FDIS">50</stage>
|
181
|
-
<substage abbreviation="CFDIS">20</substage>
|
182
|
-
</status>
|
183
|
-
<copyright>
|
184
|
-
<from>2016</from>
|
185
|
-
<owner>
|
186
|
-
<organization>
|
187
|
-
<name>International Organization for Standardization</name>
|
188
|
-
</organization>
|
189
|
-
</owner>
|
190
|
-
</copyright>
|
191
|
-
<relation type="obsoletes">
|
192
|
-
<locality type="clause"><referenceFrom>3.1</referenceFrom></locality>
|
193
|
-
<docidentifier>IEC 8121</docidentifier>
|
194
|
-
</relation>
|
195
|
-
<ext>
|
196
|
-
<doctype>technical-report</doctype>
|
197
|
-
<horizontal>false</horizontal>
|
198
|
-
<editorialgroup>
|
199
|
-
<technical-committee number="34" type="ABC">Food products</technical-committee>
|
200
|
-
<subcommittee number="4" type="DEF">Cereals and pulses</subcommittee>
|
201
|
-
<workgroup number="3" type="GHI">Rice Group</workgroup>
|
202
|
-
</editorialgroup>
|
203
|
-
<ics><code>1.2.3</code></ics>
|
204
|
-
<ics><code>1.2.3</code></ics>
|
205
|
-
<structuredidentifier>
|
206
|
-
<project-number part="1" subpart="3">ISO/IEC/CD 17301</project-number>
|
207
|
-
</strucuredidentifier>
|
208
|
-
</ext>
|
209
|
-
</bibdata>
|
210
|
-
</iso-standard>
|
211
|
-
INPUT
|
212
|
-
output = <<~OUTPUT
|
213
|
-
{:agency=>"ISO/IEC",
|
214
|
-
:docnumber=>"ISO/IEC/CD 17301-1-3",
|
215
|
-
:docsubtitle=>"Céréales et légumineuses — Spécification et méthodes d'essai — Partie 1–3: Riz",
|
216
|
-
:docsubtitleintro=>"Céréales et légumineuses",
|
217
|
-
:docsubtitlemain=>"Spécification et méthodes d'essai",
|
218
|
-
:docsubtitlepart=>"Riz",
|
219
|
-
:docsubtitlepartlabel=>"Partie 1–3",
|
220
|
-
:doctitle=>"Cereals and pulses — Specifications and test methods — Part 1–3: Rice",
|
221
|
-
:doctitleintro=>"Cereals and pulses",
|
222
|
-
:doctitlemain=>"Specifications and test methods",
|
223
|
-
:doctitlepart=>"Rice",
|
224
|
-
:doctitlepartlabel=>"Part 1–3",
|
225
|
-
:doctype=>"Technical Report",
|
226
|
-
:doctype_display=>"Technical Report",
|
227
|
-
:doctype_en=>"Technical Report",
|
228
|
-
:doctype_fr=>"Technical Report",
|
229
|
-
:docyear=>"2016",
|
230
|
-
:editorialgroup=>["ABC 34", "DEF 4", "GHI 3"],
|
231
|
-
:horizontal=>"False",
|
232
|
-
:ics=>"1.2.3, 1.2.3",
|
233
|
-
:lang=>"en",
|
234
|
-
:obsoletes=>"IEC 8121",
|
235
|
-
:obsoletes_part=>"3.1",
|
236
|
-
:publisher=>"International Organization for Standardization and International Electrotechnical Commission",
|
237
|
-
:sc=>"DEF 4",
|
238
|
-
:script=>"Latn",
|
239
|
-
:stage=>"50",
|
240
|
-
:stage_int=>50,
|
241
|
-
:stageabbr=>"FDIS",
|
242
|
-
:statusabbr=>"CFDIS",
|
243
|
-
:tc=>"ABC 34",
|
244
|
-
:tc_docnumber=>["17301"],
|
245
|
-
:unpublished=>true,
|
246
|
-
:wg=>"GHI 3"}
|
247
|
-
OUTPUT
|
248
|
-
expect(metadata(c.info(Nokogiri::XML(input), nil))
|
249
|
-
.to_s.gsub(/, :/, ",\n:")).to be_equivalent_to output
|
250
|
-
end
|
251
|
-
end
|
@@ -1,303 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
require "fileutils"
|
3
|
-
|
4
|
-
RSpec.describe IsoDoc do
|
5
|
-
it "generates file based on string input" do
|
6
|
-
FileUtils.rm_f "test.doc"
|
7
|
-
FileUtils.rm_f "test.html"
|
8
|
-
input = <<~INPUT
|
9
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
10
|
-
<bibdata>
|
11
|
-
<title type="title-intro" language="en" format="text/plain">Cereals and pulses</title>
|
12
|
-
<title type="title-main" language="en" format="text/plain">Specifications and test methods</title>
|
13
|
-
<title type="title-part" language="en" format="text/plain">Rice</title>
|
14
|
-
</bibdata>
|
15
|
-
<preface><foreword>
|
16
|
-
<note>
|
17
|
-
<p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
|
18
|
-
</note>
|
19
|
-
</foreword></preface>
|
20
|
-
</iso-standard>
|
21
|
-
INPUT
|
22
|
-
IsoDoc::Iec::HtmlConvert
|
23
|
-
.new({ wordstylesheet: "spec/assets/word.css",
|
24
|
-
htmlstylesheet: "spec/assets/html.css", filename: "test" })
|
25
|
-
.convert("test", input, false)
|
26
|
-
expect(File.exist?("test.html")).to be true
|
27
|
-
html = File.read("test.html", encoding: "UTF-8")
|
28
|
-
expect(html).to include "<title>Cereals and pulses — Specifications and test methods — Rice</title>"
|
29
|
-
expect(html).to match(%r{cdnjs\.cloudflare\.com/ajax/libs/mathjax/})
|
30
|
-
expect(html).to match(/delimiters: \[\['\(#\(', '\)#\)'\]\]/)
|
31
|
-
end
|
32
|
-
|
33
|
-
it "generates HTML output docs with null configuration" do
|
34
|
-
FileUtils.rm_f "test.doc"
|
35
|
-
FileUtils.rm_f "test.html"
|
36
|
-
input = <<~INPUT
|
37
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
38
|
-
<bibdata>
|
39
|
-
<title type="title-intro" language="en" format="text/plain">Cereals and pulses</title>
|
40
|
-
<title type="title-main" language="en" format="text/plain">Specifications and test methods</title>
|
41
|
-
<title type="title-part" language="en" format="text/plain">Rice</title>
|
42
|
-
</bibdata>
|
43
|
-
<preface><foreword>
|
44
|
-
<note>
|
45
|
-
<p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
|
46
|
-
</note>
|
47
|
-
</foreword></preface>
|
48
|
-
</iso-standard>
|
49
|
-
INPUT
|
50
|
-
IsoDoc::Iec::HtmlConvert
|
51
|
-
.new({ wordstylesheet: "spec/assets/word.css",
|
52
|
-
htmlstylesheet: "spec/assets/html.css" })
|
53
|
-
.convert("test", input, false)
|
54
|
-
expect(File.exist?("test.html")).to be true
|
55
|
-
html = File.read("test.html", encoding: "UTF-8")
|
56
|
-
expect(html).to include "<title>Cereals and pulses — Specifications and test methods — Rice</title>"
|
57
|
-
expect(html).to match(%r{cdnjs\.cloudflare\.com/ajax/libs/mathjax/})
|
58
|
-
expect(html).to match(/delimiters: \[\['\(#\(', '\)#\)'\]\]/)
|
59
|
-
end
|
60
|
-
|
61
|
-
it "generates Word output docs with null configuration" do
|
62
|
-
FileUtils.rm_f "test.doc"
|
63
|
-
FileUtils.rm_f "test.html"
|
64
|
-
input = <<~INPUT
|
65
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
66
|
-
<preface><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></preface>
|
71
|
-
</iso-standard>
|
72
|
-
INPUT
|
73
|
-
IsoDoc::Iec::WordConvert
|
74
|
-
.new({ wordstylesheet: "spec/assets/word.css",
|
75
|
-
htmlstylesheet: "spec/assets/html.css" })
|
76
|
-
.convert("test", input, false)
|
77
|
-
expect(File.exist?("test.doc")).to be true
|
78
|
-
word = File.read("test.doc", encoding: "UTF-8")
|
79
|
-
expect(word).to match(/<style>/)
|
80
|
-
end
|
81
|
-
|
82
|
-
it "generates HTML output docs with null configuration from file" do
|
83
|
-
FileUtils.rm_f "spec/assets/iso.doc"
|
84
|
-
FileUtils.rm_f "spec/assets/iso.html"
|
85
|
-
IsoDoc::Iec::HtmlConvert
|
86
|
-
.new({ wordstylesheet: "word.css", htmlstylesheet: "html.css" })
|
87
|
-
.convert("spec/assets/iso.xml", nil, false)
|
88
|
-
expect(File.exist?("spec/assets/iso.html")).to be true
|
89
|
-
html = File.read("spec/assets/iso.html", encoding: "UTF-8")
|
90
|
-
expect(html).to match(/<style>/)
|
91
|
-
expect(html).to match(%r{https://use.fontawesome.com})
|
92
|
-
expect(html).to match(%r{libs/jquery})
|
93
|
-
end
|
94
|
-
|
95
|
-
it "generates Word output docs with null configuration from file" do
|
96
|
-
FileUtils.rm_f "spec/assets/iso.doc"
|
97
|
-
IsoDoc::Iec::WordConvert
|
98
|
-
.new({ wordstylesheet: "word.css", htmlstylesheet: "html.css" })
|
99
|
-
.convert("spec/assets/iso.xml", nil, false)
|
100
|
-
expect(File.exist?("spec/assets/iso.doc")).to be true
|
101
|
-
word = File.read("spec/assets/iso.doc", encoding: "UTF-8")
|
102
|
-
expect(word).to match(/<w:WordDocument>/)
|
103
|
-
expect(word).to match(/<style>/)
|
104
|
-
end
|
105
|
-
|
106
|
-
it "generates Pdf output docs with null configuration from file" do
|
107
|
-
FileUtils.rm_f "spec/assets/iso.pdf"
|
108
|
-
IsoDoc::Iec::PdfConvert
|
109
|
-
.new({ wordstylesheet: "spec/assets/word.css",
|
110
|
-
htmlstylesheet: "spec/assets/html.css" })
|
111
|
-
.convert("spec/assets/iso.xml", nil, false)
|
112
|
-
expect(File.exist?("spec/assets/iso.pdf")).to be true
|
113
|
-
end
|
114
|
-
|
115
|
-
it "populates Word template with terms reference labels" do
|
116
|
-
FileUtils.rm_f "test.doc"
|
117
|
-
FileUtils.rm_f "test.html"
|
118
|
-
input = <<~INPUT
|
119
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
120
|
-
<sections>
|
121
|
-
<terms id="_terms_and_definitions" obligation="normative"><title>1<tab/>Terms and Definitions</title>
|
122
|
-
<term id="paddy1">
|
123
|
-
<name>1.1</name>
|
124
|
-
<preferred>paddy</preferred>
|
125
|
-
<definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
|
126
|
-
<termsource status="modified">[SOURCE:
|
127
|
-
<origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality>ISO 7301:2011, 3.1</origin>, modified — The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here]
|
128
|
-
</termsource></term>
|
129
|
-
</terms>
|
130
|
-
</sections>
|
131
|
-
</iso-standard>
|
132
|
-
INPUT
|
133
|
-
IsoDoc::Iec::WordConvert
|
134
|
-
.new({ wordstylesheet: "spec/assets/word.css",
|
135
|
-
htmlstylesheet: "spec/assets/html.css" })
|
136
|
-
.convert("test", input, false)
|
137
|
-
word = File.read("test.doc", encoding: "UTF-8")
|
138
|
-
.sub(/^.*<div class="WordSection3">/m, '<div class="WordSection3">')
|
139
|
-
.sub(%r{<br.*$}m, "")
|
140
|
-
expect(xmlpp(word)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
141
|
-
<div class="WordSection3">
|
142
|
-
#{IEC_TITLE1.gsub(/ /, ' ')}
|
143
|
-
<div><a name="_terms_and_definitions" id="_terms_and_definitions"></a><h1 class="main">1<span style="mso-tab-count:1">  </span>Terms and Definitions</h1>
|
144
|
-
<p class="TermNum"><a name="paddy1" id="paddy1"></a>1.1</p><p class="Terms" style="text-align:left;">paddy</p>
|
145
|
-
<p class="MsoNormal"><a name="_eb29b35e-123e-4d1c-b50b-2714d41e747f" id="_eb29b35e-123e-4d1c-b50b-2714d41e747f"></a>rice retaining its husk after threshing</p>
|
146
|
-
<p class="MsoNormal">[SOURCE: ISO 7301:2011, 3.1, modified — The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here]</p></div>
|
147
|
-
</div>
|
148
|
-
OUTPUT
|
149
|
-
end
|
150
|
-
|
151
|
-
it "processes IsoXML terms for HTML" do
|
152
|
-
FileUtils.rm_f "test.html"
|
153
|
-
FileUtils.rm_f "test.doc"
|
154
|
-
input = <<~INPUT
|
155
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
156
|
-
<sections>
|
157
|
-
<terms id="_terms_and_definitions" obligation="normative"><title>1<tab/>Terms and Definitions</title>
|
158
|
-
<term id="paddy1">
|
159
|
-
<name>1.1</name>
|
160
|
-
<preferred>paddy</preferred>
|
161
|
-
<domain>rice</domain>
|
162
|
-
<definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
|
163
|
-
<termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f892">
|
164
|
-
<p id="_65c9a509-9a89-4b54-a890-274126aeb55c">Foreign seeds, husks, bran, sand, dust.</p>
|
165
|
-
<ul>
|
166
|
-
<li>A</li>
|
167
|
-
</ul>
|
168
|
-
</termexample>
|
169
|
-
<termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f894">
|
170
|
-
<ul>
|
171
|
-
<li>A</li>
|
172
|
-
</ul>
|
173
|
-
</termexample>
|
174
|
-
<termsource status="modified">
|
175
|
-
<origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality></origin>
|
176
|
-
<modification>
|
177
|
-
<p id="_e73a417d-ad39-417d-a4c8-20e4e2529489">The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here</p>
|
178
|
-
</modification>
|
179
|
-
</termsource></term>
|
180
|
-
<term id="paddy">
|
181
|
-
<name>1.2</name>
|
182
|
-
<preferred>paddy</preferred><admitted>paddy rice</admitted>
|
183
|
-
<admitted>rough rice</admitted>
|
184
|
-
<deprecates>cargo rice</deprecates>
|
185
|
-
<definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
|
186
|
-
<termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f893">
|
187
|
-
<ul>
|
188
|
-
<li>A</li>
|
189
|
-
</ul>
|
190
|
-
</termexample>
|
191
|
-
<termnote id="_671a1994-4783-40d0-bc81-987d06ffb74e">
|
192
|
-
<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>
|
193
|
-
</termnote>
|
194
|
-
<termnote id="_671a1994-4783-40d0-bc81-987d06ffb74f">
|
195
|
-
<ul><li>A</li></ul>
|
196
|
-
<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>
|
197
|
-
</termnote>
|
198
|
-
<termsource status="identical">
|
199
|
-
<origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality></origin>
|
200
|
-
</termsource></term>
|
201
|
-
</terms>
|
202
|
-
</sections>
|
203
|
-
</iso-standard>
|
204
|
-
INPUT
|
205
|
-
IsoDoc::Iec::HtmlConvert
|
206
|
-
.new({ wordstylesheet: "spec/assets/word.css",
|
207
|
-
htmlstylesheet: "spec/assets/html.css" })
|
208
|
-
.convert("test", input, false)
|
209
|
-
expect(File.exist?("test.html")).to be true
|
210
|
-
html = File.read("test.html", encoding: "UTF-8")
|
211
|
-
expect(html).to match(%r{<h2 class="TermNum" id="paddy1">1\.1</h2>})
|
212
|
-
expect(html).to match(%r{<h2 class="TermNum" id="paddy">1\.2</h2>})
|
213
|
-
end
|
214
|
-
|
215
|
-
it "inserts default paragraph between two tables for Word" do
|
216
|
-
FileUtils.rm_f "test.doc"
|
217
|
-
FileUtils.rm_f "test.html"
|
218
|
-
input = <<~INPUT
|
219
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
220
|
-
<annex id="P" inline-header="false" obligation="normative">
|
221
|
-
<example id="_63112cbc-cde0-435f-9553-e0b8c4f5851c">
|
222
|
-
<p id="_158d4efa-b1c9-4aec-b325-756de8e4c968">'1M', '01M', and '0001M' all describe the calendar month January.</p>
|
223
|
-
</example>
|
224
|
-
<example id="_63112cbc-cde0-435f-9553-e0b8c4f5851d">
|
225
|
-
<p id="_158d4efa-b1c9-4aec-b325-756de8e4c969">'2M', '02M', and '0002M' all describe the calendar month February.</p>
|
226
|
-
</example>
|
227
|
-
</annex>
|
228
|
-
</iso-standard>
|
229
|
-
INPUT
|
230
|
-
IsoDoc::Iec::WordConvert
|
231
|
-
.new({ wordstylesheet: "spec/assets/word.css",
|
232
|
-
htmlstylesheet: "spec/assets/html.css" })
|
233
|
-
.convert("test", input, false)
|
234
|
-
word = File.read("test.doc", encoding: "UTF-8")
|
235
|
-
.sub(/^.*<div class="WordSection3">/m, '<div class="WordSection3">')
|
236
|
-
.sub(%r{<br[^>]*>\s*<div class="colophon">.*$}m, "")
|
237
|
-
expect(xmlpp(word)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
238
|
-
<div class="WordSection3">
|
239
|
-
#{IEC_TITLE1.gsub(/ /, ' ')}
|
240
|
-
<p class="MsoNormal">
|
241
|
-
<br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
|
242
|
-
</p>
|
243
|
-
<div class="Section3"><a name="P" id="P"></a>
|
244
|
-
<div class="example"><a name="_63112cbc-cde0-435f-9553-e0b8c4f5851c" id="_63112cbc-cde0-435f-9553-e0b8c4f5851c"></a>
|
245
|
-
<p class="example"><span style="mso-tab-count:1">  </span>'1M', '01M', and '0001M' all describe the calendar month January.</p>
|
246
|
-
</div>
|
247
|
-
<div class="example"><a name="_63112cbc-cde0-435f-9553-e0b8c4f5851d" id="_63112cbc-cde0-435f-9553-e0b8c4f5851d"></a>
|
248
|
-
<p class="example"><span style="mso-tab-count:1">  </span>'2M', '02M', and '0002M' all describe the calendar month February.</p>
|
249
|
-
</div>
|
250
|
-
</div>
|
251
|
-
</div>
|
252
|
-
OUTPUT
|
253
|
-
end
|
254
|
-
|
255
|
-
it "processes source code in tables (Word)" do
|
256
|
-
FileUtils.rm_f "test.doc"
|
257
|
-
FileUtils.rm_f "test.html"
|
258
|
-
input = <<~INPUT
|
259
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
260
|
-
<annex id="P" inline-header="false" obligation="normative">
|
261
|
-
<sourcecode lang="ruby" id="A">puts "Hello, world."</sourcecode>
|
262
|
-
<table id="samplecode">
|
263
|
-
<tbody>
|
264
|
-
<tr><td>
|
265
|
-
<sourcecode lang="ruby" id="B">puts "Hello, world."</sourcecode>
|
266
|
-
</td></tr>
|
267
|
-
</tbody>
|
268
|
-
</table>
|
269
|
-
</annex>
|
270
|
-
</iso-standard>
|
271
|
-
INPUT
|
272
|
-
IsoDoc::Iec::WordConvert
|
273
|
-
.new({ wordstylesheet: "spec/assets/word.css",
|
274
|
-
htmlstylesheet: "spec/assets/html.css" })
|
275
|
-
.convert("test", input, false)
|
276
|
-
word = File.read("test.doc", encoding: "UTF-8")
|
277
|
-
.sub(/^.*<div class="WordSection3">/m, '<div class="WordSection3">')
|
278
|
-
.sub(%r{<br[^>]*>\s*<div class="colophon">.*$}m, "")
|
279
|
-
expect(xmlpp(word)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
280
|
-
<div class="WordSection3">
|
281
|
-
#{IEC_TITLE1.gsub(/ /, ' ')}
|
282
|
-
<p class="MsoNormal">
|
283
|
-
<br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
|
284
|
-
</p>
|
285
|
-
<div class="Section3"><a name="P" id="P"></a>
|
286
|
-
<p class="Sourcecode"><a name="A" id="A"></a>puts "Hello, world."</p>
|
287
|
-
<div align='center' class='table_container'>
|
288
|
-
<table class='MsoISOTable' style='mso-table-anchor-horizontal:column;mso-table-overlap:never;border-spacing:0;border-width:1px;'>
|
289
|
-
<a name='samplecode' id='samplecode'/>
|
290
|
-
<tbody>
|
291
|
-
<tr>
|
292
|
-
<td style="border-top:solid windowtext 1.5pt;mso-border-top-alt:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;mso-border-bottom-alt:solid windowtext 1.5pt;" class="TABLE-cell">
|
293
|
-
<p class="CODE-TableCell"><a name="B" id="B"></a>puts "Hello, world."</p>
|
294
|
-
</td>
|
295
|
-
</tr>
|
296
|
-
</tbody>
|
297
|
-
</table>
|
298
|
-
</div>
|
299
|
-
</div>
|
300
|
-
</div>
|
301
|
-
OUTPUT
|
302
|
-
end
|
303
|
-
end
|