metanorma-iso 1.4.0 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/macos.yml +0 -1
- data/.github/workflows/ubuntu.yml +6 -3
- data/.github/workflows/windows.yml +0 -1
- data/Gemfile +1 -0
- data/Rakefile +2 -0
- data/lib/asciidoctor/iso/base.rb +8 -19
- data/lib/asciidoctor/iso/cleanup.rb +2 -3
- data/lib/asciidoctor/iso/front.rb +0 -1
- data/lib/asciidoctor/iso/front_id.rb +1 -1
- data/lib/asciidoctor/iso/isodoc.rng +12 -6
- data/lib/asciidoctor/iso/section.rb +5 -11
- data/lib/asciidoctor/iso/term_lookup_cleanup.rb +0 -1
- data/lib/asciidoctor/iso/validate_section.rb +30 -44
- data/lib/isodoc/iso/base_convert.rb +3 -64
- data/lib/isodoc/iso/html/htmlstyle.css +47 -0
- data/lib/isodoc/iso/html/htmlstyle.scss +0 -1
- data/lib/isodoc/iso/html/isodoc.css +862 -0
- data/lib/isodoc/iso/html/isodoc.scss +0 -1
- data/lib/isodoc/iso/html/style-human.css +968 -0
- data/lib/isodoc/iso/html/style-iso.css +996 -0
- data/lib/isodoc/iso/html/wordstyle.css +1515 -0
- data/lib/isodoc/iso/html/wordstyle.scss +0 -1
- data/lib/isodoc/iso/html_convert.rb +2 -1
- data/lib/{asciidoctor → isodoc}/iso/i18n-en.yaml +0 -0
- data/lib/{asciidoctor → isodoc}/iso/i18n-fr.yaml +0 -0
- data/lib/{asciidoctor → isodoc}/iso/i18n-zh-Hans.yaml +0 -0
- data/lib/isodoc/iso/i18n.rb +19 -0
- data/lib/isodoc/iso/init.rb +33 -0
- data/lib/isodoc/iso/iso.amendment.xsl +32 -0
- data/lib/isodoc/iso/iso.international-standard.xsl +32 -0
- data/lib/isodoc/iso/metadata.rb +1 -1
- data/lib/isodoc/iso/pdf_convert.rb +1 -1
- data/lib/isodoc/iso/presentation_xml_convert.rb +99 -1
- data/lib/isodoc/iso/sections.rb +3 -8
- data/lib/isodoc/iso/word_convert.rb +2 -1
- data/lib/isodoc/iso/xref.rb +2 -0
- data/lib/metanorma/iso/processor.rb +0 -4
- data/lib/metanorma/iso/version.rb +1 -1
- data/metanorma-iso.gemspec +4 -3
- data/spec/asciidoctor-iso/cleanup_spec.rb +4 -4
- data/spec/asciidoctor-iso/inline_spec.rb +1 -1
- data/spec/asciidoctor-iso/refs_spec.rb +3 -3
- data/spec/asciidoctor-iso/section_spec.rb +9 -6
- data/spec/asciidoctor-iso/validate_spec.rb +13 -21
- data/spec/isodoc/amd_spec.rb +309 -153
- data/spec/isodoc/blocks_spec.rb +362 -28
- data/spec/isodoc/i18n_spec.rb +468 -108
- data/spec/isodoc/inline_spec.rb +99 -31
- data/spec/isodoc/iso_spec.rb +95 -29
- data/spec/isodoc/postproc_spec.rb +114 -149
- data/spec/isodoc/ref_spec.rb +176 -4
- data/spec/isodoc/section_spec.rb +148 -82
- data/spec/isodoc/table_spec.rb +142 -5
- data/spec/isodoc/terms_spec.rb +78 -53
- data/spec/isodoc/xref_spec.rb +831 -658
- data/spec/metanorma/processor_spec.rb +2 -1
- metadata +34 -13
data/spec/isodoc/blocks_spec.rb
CHANGED
@@ -1,8 +1,256 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
RSpec.describe IsoDoc do
|
4
|
-
|
4
|
+
it "renders figures (HTML)" do
|
5
5
|
expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
6
|
+
<iso-standard xmlns='http://riboseinc.com/isoxml'>
|
7
|
+
<preface>
|
8
|
+
<foreword id='fwd'>
|
9
|
+
<p>
|
10
|
+
</p>
|
11
|
+
</foreword>
|
12
|
+
</preface>
|
13
|
+
<sections>
|
14
|
+
<clause id='scope' type="scope">
|
15
|
+
<title>Scope</title>
|
16
|
+
<figure id='N'>
|
17
|
+
<name>Figure 1 — Split-it-right sample divider</name>
|
18
|
+
<image src='rice_images/rice_image1.png' id='_8357ede4-6d44-4672-bac4-9a85e82ab7f0' mimetype='image/png'/>
|
19
|
+
</figure>
|
20
|
+
<p>
|
21
|
+
</p>
|
22
|
+
</clause>
|
23
|
+
<terms id='terms'/>
|
24
|
+
<clause id='widgets'>
|
25
|
+
<title>Widgets</title>
|
26
|
+
<clause id='widgets1'>
|
27
|
+
<figure id='note1'>
|
28
|
+
<name>Figure 2 — Split-it-right sample divider</name>
|
29
|
+
<image src='rice_images/rice_image1.png' id='_8357ede4-6d44-4672-bac4-9a85e82ab7f0' mimetype='image/png'/>
|
30
|
+
</figure>
|
31
|
+
<figure id='note2'>
|
32
|
+
<name>Figure 3 — Split-it-right sample divider</name>
|
33
|
+
<image src='rice_images/rice_image1.png' id='_8357ede4-6d44-4672-bac4-9a85e82ab7f0' mimetype='image/png'/>
|
34
|
+
</figure>
|
35
|
+
<p>
|
36
|
+
</p>
|
37
|
+
</clause>
|
38
|
+
</clause>
|
39
|
+
</sections>
|
40
|
+
<annex id='annex1'>
|
41
|
+
<clause id='annex1a'>
|
42
|
+
<figure id='AN'>
|
43
|
+
<name>Figure A.1 — Split-it-right sample divider</name>
|
44
|
+
<image src='rice_images/rice_image1.png' id='_8357ede4-6d44-4672-bac4-9a85e82ab7f0' mimetype='image/png'/>
|
45
|
+
</figure>
|
46
|
+
</clause>
|
47
|
+
<clause id='annex1b'>
|
48
|
+
<figure id='Anote1'>
|
49
|
+
<name>Figure A.2 — Split-it-right sample divider</name>
|
50
|
+
<image src='rice_images/rice_image1.png' id='_8357ede4-6d44-4672-bac4-9a85e82ab7f0' mimetype='image/png'/>
|
51
|
+
</figure>
|
52
|
+
<figure id='Anote2'>
|
53
|
+
<name>Figure A.3 — Split-it-right sample divider</name>
|
54
|
+
<image src='rice_images/rice_image1.png' id='_8357ede4-6d44-4672-bac4-9a85e82ab7f0' mimetype='image/png'/>
|
55
|
+
</figure>
|
56
|
+
</clause>
|
57
|
+
</annex>
|
58
|
+
</iso-standard>
|
59
|
+
INPUT
|
60
|
+
#{HTML_HDR}
|
61
|
+
<br/>
|
62
|
+
<div id="fwd">
|
63
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
64
|
+
<p>
|
65
|
+
</p>
|
66
|
+
</div>
|
67
|
+
<p class="zzSTDTitle1"/>
|
68
|
+
<div id="scope">
|
69
|
+
<h1>Scope</h1>
|
70
|
+
<div id="N" class="figure">
|
71
|
+
|
72
|
+
<img src="rice_images/rice_image1.png" height="auto" width="auto"/>
|
73
|
+
<p class="FigureTitle" style="text-align:center;">Figure 1 — Split-it-right sample divider</p></div>
|
74
|
+
<p>
|
75
|
+
</p>
|
76
|
+
</div>
|
77
|
+
<div id="terms"><h1/>
|
78
|
+
</div>
|
79
|
+
<div id="widgets">
|
80
|
+
<h1>Widgets</h1>
|
81
|
+
<div id="widgets1">
|
82
|
+
<div id="note1" class="figure">
|
83
|
+
|
84
|
+
<img src="rice_images/rice_image1.png" height="auto" width="auto"/>
|
85
|
+
<p class="FigureTitle" style="text-align:center;">Figure 2 — Split-it-right sample divider</p></div>
|
86
|
+
<div id="note2" class="figure">
|
87
|
+
|
88
|
+
<img src="rice_images/rice_image1.png" height="auto" width="auto"/>
|
89
|
+
<p class="FigureTitle" style="text-align:center;">Figure 3 — Split-it-right sample divider</p></div>
|
90
|
+
<p> </p>
|
91
|
+
</div>
|
92
|
+
</div>
|
93
|
+
<br/>
|
94
|
+
<div id="annex1" class="Section3">
|
95
|
+
<div id="annex1a">
|
96
|
+
<div id="AN" class="figure">
|
97
|
+
|
98
|
+
<img src="rice_images/rice_image1.png" height="auto" width="auto"/>
|
99
|
+
<p class="FigureTitle" style="text-align:center;">Figure A.1 — Split-it-right sample divider</p></div>
|
100
|
+
</div>
|
101
|
+
<div id="annex1b">
|
102
|
+
<div id="Anote1" class="figure">
|
103
|
+
|
104
|
+
<img src="rice_images/rice_image1.png" height="auto" width="auto"/>
|
105
|
+
<p class="FigureTitle" style="text-align:center;">Figure A.2 — Split-it-right sample divider</p></div>
|
106
|
+
<div id="Anote2" class="figure">
|
107
|
+
|
108
|
+
<img src="rice_images/rice_image1.png" height="auto" width="auto"/>
|
109
|
+
<p class="FigureTitle" style="text-align:center;">Figure A.3 — Split-it-right sample divider</p></div>
|
110
|
+
</div>
|
111
|
+
</div>
|
112
|
+
</div>
|
113
|
+
</body>
|
114
|
+
</html>
|
115
|
+
OUTPUT
|
116
|
+
end
|
117
|
+
|
118
|
+
it "renders subfigures (HTML)" do
|
119
|
+
expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
120
|
+
<iso-standard xmlns='http://riboseinc.com/isoxml'>
|
121
|
+
<preface>
|
122
|
+
<foreword id='fwd'>
|
123
|
+
<p>
|
124
|
+
<xref target='N'/>
|
125
|
+
<xref target='note1'/>
|
126
|
+
<xref target='note2'/>
|
127
|
+
<xref target='AN'/>
|
128
|
+
<xref target='Anote1'/>
|
129
|
+
<xref target='Anote2'/>
|
130
|
+
</p>
|
131
|
+
</foreword>
|
132
|
+
</preface>
|
133
|
+
<sections>
|
134
|
+
<clause id='scope' type="scope">
|
135
|
+
<title>Scope</title>
|
136
|
+
</clause>
|
137
|
+
<terms id='terms'/>
|
138
|
+
<clause id='widgets'>
|
139
|
+
<title>Widgets</title>
|
140
|
+
<clause id='widgets1'>
|
141
|
+
<figure id='N'>
|
142
|
+
<name>Figure 1</name>
|
143
|
+
<figure id='note1'>
|
144
|
+
<name>a) — Split-it-right sample divider</name>
|
145
|
+
<image src='rice_images/rice_image1.png' id='_8357ede4-6d44-4672-bac4-9a85e82ab7f0' mimetype='image/png'/>
|
146
|
+
</figure>
|
147
|
+
<figure id='note2'>
|
148
|
+
<name>b) — Split-it-right sample divider</name>
|
149
|
+
<image src='rice_images/rice_image1.png' id='_8357ede4-6d44-4672-bac4-9a85e82ab7f0' mimetype='image/png'/>
|
150
|
+
</figure>
|
151
|
+
</figure>
|
152
|
+
<p>
|
153
|
+
<xref target='note1'/>
|
154
|
+
<xref target='note2'/>
|
155
|
+
</p>
|
156
|
+
</clause>
|
157
|
+
</clause>
|
158
|
+
</sections>
|
159
|
+
<annex id='annex1'>
|
160
|
+
<clause id='annex1a'> </clause>
|
161
|
+
<clause id='annex1b'>
|
162
|
+
<figure id='AN'>
|
163
|
+
<name>Figure A.1</name>
|
164
|
+
<figure id='Anote1'>
|
165
|
+
<name>a) — Split-it-right sample divider</name>
|
166
|
+
<image src='rice_images/rice_image1.png' id='_8357ede4-6d44-4672-bac4-9a85e82ab7f0' mimetype='image/png'/>
|
167
|
+
</figure>
|
168
|
+
<figure id='Anote2'>
|
169
|
+
<name>b) — Split-it-right sample divider</name>
|
170
|
+
<image src='rice_images/rice_image1.png' id='_8357ede4-6d44-4672-bac4-9a85e82ab7f0' mimetype='image/png'/>
|
171
|
+
</figure>
|
172
|
+
</figure>
|
173
|
+
</clause>
|
174
|
+
</annex>
|
175
|
+
</iso-standard>
|
176
|
+
INPUT
|
177
|
+
<html lang='en'>
|
178
|
+
<head/>
|
179
|
+
<body lang='en'>
|
180
|
+
<div class='title-section'>
|
181
|
+
<p> </p>
|
182
|
+
</div>
|
183
|
+
<br/>
|
184
|
+
<div class='prefatory-section'>
|
185
|
+
<p> </p>
|
186
|
+
</div>
|
187
|
+
<br/>
|
188
|
+
<div class='main-section'>
|
189
|
+
<br/>
|
190
|
+
<div id='fwd'>
|
191
|
+
<h1 class='ForewordTitle'>Foreword</h1>
|
192
|
+
<p>
|
193
|
+
<a href='#N'/>
|
194
|
+
<a href='#note1'/>
|
195
|
+
<a href='#note2'/>
|
196
|
+
<a href='#AN'/>
|
197
|
+
<a href='#Anote1'/>
|
198
|
+
<a href='#Anote2'/>
|
199
|
+
</p>
|
200
|
+
</div>
|
201
|
+
<p class='zzSTDTitle1'/>
|
202
|
+
<div id='scope'>
|
203
|
+
<h1>Scope</h1>
|
204
|
+
</div>
|
205
|
+
<div id='terms'>
|
206
|
+
<h1/>
|
207
|
+
</div>
|
208
|
+
<div id='widgets'>
|
209
|
+
<h1>Widgets</h1>
|
210
|
+
<div id='widgets1'>
|
211
|
+
<div id='N' class='figure'>
|
212
|
+
<div id='note1' class='figure'>
|
213
|
+
<img src='rice_images/rice_image1.png' height='auto' width='auto'/>
|
214
|
+
<p class='FigureTitle' style='text-align:center;'>a) — Split-it-right sample divider</p>
|
215
|
+
</div>
|
216
|
+
<div id='note2' class='figure'>
|
217
|
+
<img src='rice_images/rice_image1.png' height='auto' width='auto'/>
|
218
|
+
<p class='FigureTitle' style='text-align:center;'>b) — Split-it-right sample divider</p>
|
219
|
+
</div>
|
220
|
+
<p class='FigureTitle' style='text-align:center;'>Figure 1</p>
|
221
|
+
</div>
|
222
|
+
<p>
|
223
|
+
<a href='#note1'/>
|
224
|
+
<a href='#note2'/>
|
225
|
+
</p>
|
226
|
+
</div>
|
227
|
+
</div>
|
228
|
+
<br/>
|
229
|
+
<div id='annex1' class='Section3'>
|
230
|
+
<div id='annex1a'>
|
231
|
+
</div>
|
232
|
+
<div id='annex1b'>
|
233
|
+
<div id='AN' class='figure'>
|
234
|
+
<div id='Anote1' class='figure'>
|
235
|
+
<img src='rice_images/rice_image1.png' height='auto' width='auto'/>
|
236
|
+
<p class='FigureTitle' style='text-align:center;'>a) — Split-it-right sample divider</p>
|
237
|
+
</div>
|
238
|
+
<div id='Anote2' class='figure'>
|
239
|
+
<img src='rice_images/rice_image1.png' height='auto' width='auto'/>
|
240
|
+
<p class='FigureTitle' style='text-align:center;'>b) — Split-it-right sample divider</p>
|
241
|
+
</div>
|
242
|
+
<p class='FigureTitle' style='text-align:center;'>Figure A.1</p>
|
243
|
+
</div>
|
244
|
+
</div>
|
245
|
+
</div>
|
246
|
+
</div>
|
247
|
+
</body>
|
248
|
+
</html>
|
249
|
+
OUTPUT
|
250
|
+
end
|
251
|
+
|
252
|
+
it "processes formulae (Presentation XML)" do
|
253
|
+
expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
6
254
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
7
255
|
<preface><foreword>
|
8
256
|
<formula id="_be9158af-7e93-4ee2-90c5-26d31c181934" unnumbered="true">
|
@@ -22,6 +270,82 @@ RSpec.describe IsoDoc do
|
|
22
270
|
</formula>
|
23
271
|
</foreword></preface>
|
24
272
|
</iso-standard>
|
273
|
+
INPUT
|
274
|
+
<?xml version='1.0'?>
|
275
|
+
<iso-standard xmlns='http://riboseinc.com/isoxml'>
|
276
|
+
<preface>
|
277
|
+
<foreword>
|
278
|
+
<formula id='_be9158af-7e93-4ee2-90c5-26d31c181934' unnumbered='true'>
|
279
|
+
<stem type='AsciiMath'>r = 1 %</stem>
|
280
|
+
<dl id='_e4fe94fe-1cde-49d9-b1ad-743293b7e21d'>
|
281
|
+
<dt>
|
282
|
+
<stem type='AsciiMath'>r</stem>
|
283
|
+
</dt>
|
284
|
+
<dd>
|
285
|
+
<p id='_1b99995d-ff03-40f5-8f2e-ab9665a69b77'>is the repeatability limit.</p>
|
286
|
+
</dd>
|
287
|
+
<dt>
|
288
|
+
<stem type='AsciiMath'>s_1</stem>
|
289
|
+
</dt>
|
290
|
+
<dd>
|
291
|
+
<p id='_1b99995d-ff03-40f5-8f2e-ab9665a69b77'>is the other repeatability limit.</p>
|
292
|
+
</dd>
|
293
|
+
</dl>
|
294
|
+
<note id='_83083c7a-6c85-43db-a9fa-4d8edd0c9fc0'>
|
295
|
+
<name>NOTE</name>
|
296
|
+
<p id='_511aaa98-4116-42af-8e5b-c87cdf5bfdc8'>
|
297
|
+
[durationUnits] is essentially a duration statement without the "P"
|
298
|
+
prefix. "P" is unnecessary because between "G" and "U" duration is
|
299
|
+
always expressed.
|
300
|
+
</p>
|
301
|
+
</note>
|
302
|
+
</formula>
|
303
|
+
<formula id='_be9158af-7e93-4ee2-90c5-26d31c181935'>
|
304
|
+
<name>1</name>
|
305
|
+
<stem type='AsciiMath'>r = 1 %</stem>
|
306
|
+
</formula>
|
307
|
+
</foreword>
|
308
|
+
</preface>
|
309
|
+
</iso-standard>
|
310
|
+
OUTPUT
|
311
|
+
end
|
312
|
+
|
313
|
+
it "processes formulae (HTML)" do
|
314
|
+
expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
315
|
+
<iso-standard xmlns='http://riboseinc.com/isoxml'>
|
316
|
+
<preface>
|
317
|
+
<foreword>
|
318
|
+
<formula id='_be9158af-7e93-4ee2-90c5-26d31c181934' unnumbered='true'>
|
319
|
+
<stem type='AsciiMath'>r = 1 %</stem>
|
320
|
+
<dl id='_e4fe94fe-1cde-49d9-b1ad-743293b7e21d'>
|
321
|
+
<dt>
|
322
|
+
<stem type='AsciiMath'>r</stem>
|
323
|
+
</dt>
|
324
|
+
<dd>
|
325
|
+
<p id='_1b99995d-ff03-40f5-8f2e-ab9665a69b77'>is the repeatability limit.</p>
|
326
|
+
</dd>
|
327
|
+
<dt>
|
328
|
+
<stem type='AsciiMath'>s_1</stem>
|
329
|
+
</dt>
|
330
|
+
<dd>
|
331
|
+
<p id='_1b99995d-ff03-40f5-8f2e-ab9665a69b77'>is the other repeatability limit.</p>
|
332
|
+
</dd>
|
333
|
+
</dl>
|
334
|
+
<note id='_83083c7a-6c85-43db-a9fa-4d8edd0c9fc0'>
|
335
|
+
<p id='_511aaa98-4116-42af-8e5b-c87cdf5bfdc8'>
|
336
|
+
[durationUnits] is essentially a duration statement without the "P"
|
337
|
+
prefix. "P" is unnecessary because between "G" and "U" duration is
|
338
|
+
always expressed.
|
339
|
+
</p>
|
340
|
+
</note>
|
341
|
+
</formula>
|
342
|
+
<formula id='_be9158af-7e93-4ee2-90c5-26d31c181935'>
|
343
|
+
<name>1</name>
|
344
|
+
<stem type='AsciiMath'>r = 1 %</stem>
|
345
|
+
</formula>
|
346
|
+
</foreword>
|
347
|
+
</preface>
|
348
|
+
</iso-standard>
|
25
349
|
INPUT
|
26
350
|
#{HTML_HDR}
|
27
351
|
<br/>
|
@@ -49,7 +373,6 @@ RSpec.describe IsoDoc do
|
|
49
373
|
</dl>
|
50
374
|
<div id='_83083c7a-6c85-43db-a9fa-4d8edd0c9fc0' class='Note'>
|
51
375
|
<p>
|
52
|
-
<span class='note_label'>NOTE</span>
|
53
376
|
  [durationUnits] is essentially a duration statement without
|
54
377
|
the "P" prefix. "P" is unnecessary because between "G" and "U"
|
55
378
|
duration is always expressed.
|
@@ -73,29 +396,40 @@ RSpec.describe IsoDoc do
|
|
73
396
|
|
74
397
|
it "processes formulae (Word)" do
|
75
398
|
expect(xmlpp(IsoDoc::Iso::WordConvert.new({}).convert("test", <<~"INPUT", true).sub(%r{^.*<div>\s*<h1 class="ForewordTitle">}m, '<div><h1 class="ForewordTitle">').sub(%r{<p>\ </p>\s*</div>.*$}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
76
|
-
<iso-standard xmlns=
|
77
|
-
|
78
|
-
<
|
79
|
-
|
80
|
-
<
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
</
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
399
|
+
<iso-standard xmlns='http://riboseinc.com/isoxml'>
|
400
|
+
<preface>
|
401
|
+
<foreword>
|
402
|
+
<formula id='_be9158af-7e93-4ee2-90c5-26d31c181934' unnumbered='true'>
|
403
|
+
<stem type='AsciiMath'>r = 1 %</stem>
|
404
|
+
<dl id='_e4fe94fe-1cde-49d9-b1ad-743293b7e21d'>
|
405
|
+
<dt>
|
406
|
+
<stem type='AsciiMath'>r</stem>
|
407
|
+
</dt>
|
408
|
+
<dd>
|
409
|
+
<p id='_1b99995d-ff03-40f5-8f2e-ab9665a69b77'>is the repeatability limit.</p>
|
410
|
+
</dd>
|
411
|
+
<dt>
|
412
|
+
<stem type='AsciiMath'>s_1</stem>
|
413
|
+
</dt>
|
414
|
+
<dd>
|
415
|
+
<p id='_1b99995d-ff03-40f5-8f2e-ab9665a69b77'>is the other repeatability limit.</p>
|
416
|
+
</dd>
|
417
|
+
</dl>
|
418
|
+
<note id='_83083c7a-6c85-43db-a9fa-4d8edd0c9fc0'>
|
419
|
+
<p id='_511aaa98-4116-42af-8e5b-c87cdf5bfdc8'>
|
420
|
+
[durationUnits] is essentially a duration statement without the "P"
|
421
|
+
prefix. "P" is unnecessary because between "G" and "U" duration is
|
422
|
+
always expressed.
|
423
|
+
</p>
|
424
|
+
</note>
|
425
|
+
</formula>
|
426
|
+
<formula id='_be9158af-7e93-4ee2-90c5-26d31c181935'>
|
427
|
+
<name>1</name>
|
428
|
+
<stem type='AsciiMath'>r = 1 %</stem>
|
429
|
+
</formula>
|
430
|
+
</foreword>
|
431
|
+
</preface>
|
432
|
+
</iso-standard>
|
99
433
|
INPUT
|
100
434
|
<div>
|
101
435
|
<h1 class='ForewordTitle'>Foreword</h1>
|
@@ -129,7 +463,7 @@ RSpec.describe IsoDoc do
|
|
129
463
|
</table>
|
130
464
|
<div id='_83083c7a-6c85-43db-a9fa-4d8edd0c9fc0' class='Note'>
|
131
465
|
<p class='Note'>
|
132
|
-
<span class='note_label'
|
466
|
+
<span class='note_label'/>
|
133
467
|
<span style='mso-tab-count:1'>  </span>
|
134
468
|
[durationUnits] is essentially a duration statement without the "P"
|
135
469
|
prefix. "P" is unnecessary because between "G" and "U" duration is
|
@@ -167,7 +501,7 @@ RSpec.describe IsoDoc do
|
|
167
501
|
<p id="_511aaa98-4116-42af-8e5b-c87cdf5bfdc8">[durationUnits] is essentially a duration statement without the "P" prefix. "P" is unnecessary because between "G" and "U" duration is always expressed.</p>
|
168
502
|
</note>
|
169
503
|
</formula>
|
170
|
-
<formula id="_be9158af-7e93-4ee2-90c5-26d31c181935">
|
504
|
+
<formula id="_be9158af-7e93-4ee2-90c5-26d31c181935"><name>1</name>
|
171
505
|
<stem type="AsciiMath">r = 1 %</stem>
|
172
506
|
</formula>
|
173
507
|
</foreword></preface>
|
@@ -184,7 +518,7 @@ RSpec.describe IsoDoc do
|
|
184
518
|
</span>
|
185
519
|
<p id='_1b99995d-ff03-40f5-8f2e-ab9665a69b77'>is the repeatability limit.</p>
|
186
520
|
|
187
|
-
<div id="_83083c7a-6c85-43db-a9fa-4d8edd0c9fc0" class="Note"><p
|
521
|
+
<div id="_83083c7a-6c85-43db-a9fa-4d8edd0c9fc0" class="Note"><p>  [durationUnits] is essentially a duration statement without the "P" prefix. "P" is unnecessary because between "G" and "U" duration is always expressed.</p></div>
|
188
522
|
</div>
|
189
523
|
|
190
524
|
<div id="_be9158af-7e93-4ee2-90c5-26d31c181935"><div class="formula"><p><span class="stem">(#(r = 1 %)#)</span>  (1)</p></div></div>
|
data/spec/isodoc/i18n_spec.rb
CHANGED
@@ -2,7 +2,7 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
RSpec.describe IsoDoc do
|
4
4
|
it "processes English" do
|
5
|
-
|
5
|
+
input = <<~INPUT
|
6
6
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
7
7
|
<bibdata>
|
8
8
|
<language>en</language>
|
@@ -17,7 +17,7 @@ RSpec.describe IsoDoc do
|
|
17
17
|
</clause>
|
18
18
|
<p>This is patent boilerplate</p>
|
19
19
|
</introduction></preface><sections>
|
20
|
-
<clause id="D" obligation="normative">
|
20
|
+
<clause id="D" obligation="normative" type="scope">
|
21
21
|
<title>Scope</title>
|
22
22
|
<p id="E">Text</p>
|
23
23
|
</clause>
|
@@ -70,6 +70,98 @@ RSpec.describe IsoDoc do
|
|
70
70
|
</bibliography>
|
71
71
|
</iso-standard>
|
72
72
|
INPUT
|
73
|
+
|
74
|
+
presxml = <<~OUTPUT
|
75
|
+
<iso-standard xmlns='http://riboseinc.com/isoxml'>
|
76
|
+
<bibdata>
|
77
|
+
<language>en</language>
|
78
|
+
</bibdata>
|
79
|
+
<preface>
|
80
|
+
<foreword obligation='informative'>
|
81
|
+
<title>Foreword</title>
|
82
|
+
<p id='A'>This is a preamble</p>
|
83
|
+
</foreword>
|
84
|
+
<introduction id='B' obligation='informative'>
|
85
|
+
<title depth='1'>0<tab/>Introduction</title>
|
86
|
+
<clause id='C' inline-header='false' obligation='informative'>
|
87
|
+
<title depth='2'>0.1<tab/>Introduction Subsection</title>
|
88
|
+
</clause>
|
89
|
+
<p>This is patent boilerplate</p>
|
90
|
+
</introduction>
|
91
|
+
</preface>
|
92
|
+
<sections>
|
93
|
+
<clause id='D' obligation='normative' type='scope'>
|
94
|
+
<title depth='1'>1<tab/>Scope</title>
|
95
|
+
<p id='E'>Text</p>
|
96
|
+
</clause>
|
97
|
+
<clause id='H' obligation='normative'>
|
98
|
+
<title depth='1'>3<tab/>Terms, definitions, symbols and abbreviated terms</title>
|
99
|
+
<terms id='I' obligation='normative'>
|
100
|
+
<title depth='2'>3.1<tab/>Normal Terms</title>
|
101
|
+
<term id='J'>
|
102
|
+
<name>3.1.1</name>
|
103
|
+
<preferred>Term2</preferred>
|
104
|
+
</term>
|
105
|
+
</terms>
|
106
|
+
<definitions id='K' inline-header='true'>
|
107
|
+
<title>3.2</title>
|
108
|
+
<dl>
|
109
|
+
<dt>Symbol</dt>
|
110
|
+
<dd>Definition</dd>
|
111
|
+
</dl>
|
112
|
+
</definitions>
|
113
|
+
</clause>
|
114
|
+
<definitions id='L'>
|
115
|
+
<title>4</title>
|
116
|
+
<dl>
|
117
|
+
<dt>Symbol</dt>
|
118
|
+
<dd>Definition</dd>
|
119
|
+
</dl>
|
120
|
+
</definitions>
|
121
|
+
<clause id='M' inline-header='false' obligation='normative'>
|
122
|
+
<title depth='1'>5<tab/>Clause 4</title>
|
123
|
+
<clause id='N' inline-header='false' obligation='normative'>
|
124
|
+
<title depth='2'>5.1<tab/>Introduction</title>
|
125
|
+
</clause>
|
126
|
+
<clause id='O' inline-header='false' obligation='normative'>
|
127
|
+
<title depth='2'>5.2<tab/>Clause 4.2</title>
|
128
|
+
</clause>
|
129
|
+
</clause>
|
130
|
+
</sections>
|
131
|
+
<annex id='P' inline-header='false' obligation='normative'>
|
132
|
+
<title>
|
133
|
+
<strong>Annex A</strong>
|
134
|
+
<br/>
|
135
|
+
(normative)
|
136
|
+
<br/>
|
137
|
+
<br/>
|
138
|
+
<strong>Annex</strong>
|
139
|
+
</title>
|
140
|
+
<clause id='Q' inline-header='false' obligation='normative'>
|
141
|
+
<title depth='2'>A.1<tab/>Annex A.1</title>
|
142
|
+
<clause id='Q1' inline-header='false' obligation='normative'>
|
143
|
+
<title depth='3'>A.1.1<tab/>Annex A.1a</title>
|
144
|
+
</clause>
|
145
|
+
</clause>
|
146
|
+
<appendix id='Q2' inline-header='false' obligation='normative'>
|
147
|
+
<title depth='2'>Appendix 1<tab/>An Appendix</title>
|
148
|
+
</appendix>
|
149
|
+
</annex>
|
150
|
+
<bibliography>
|
151
|
+
<references id='R' obligation='informative' normative='true'>
|
152
|
+
<title depth='1'>2<tab/>Normative References</title>
|
153
|
+
</references>
|
154
|
+
<clause id='S' obligation='informative'>
|
155
|
+
<title depth='1'>Bibliography</title>
|
156
|
+
<references id='T' obligation='informative' normative='false'>
|
157
|
+
<title depth='2'>Bibliography Subsection</title>
|
158
|
+
</references>
|
159
|
+
</clause>
|
160
|
+
</bibliography>
|
161
|
+
</iso-standard>
|
162
|
+
OUTPUT
|
163
|
+
|
164
|
+
html = <<~OUTPUT
|
73
165
|
#{HTML_HDR}
|
74
166
|
<br/>
|
75
167
|
<div>
|
@@ -90,7 +182,7 @@ RSpec.describe IsoDoc do
|
|
90
182
|
<p id="E">Text</p>
|
91
183
|
</div>
|
92
184
|
<div>
|
93
|
-
<h1>2  Normative
|
185
|
+
<h1>2  Normative References</h1>
|
94
186
|
</div>
|
95
187
|
<div id="H"><h1>3  Terms, definitions, symbols and abbreviated terms</h1>
|
96
188
|
<div id="I"><h2>3.1  Normal Terms</h2>
|
@@ -98,11 +190,14 @@ RSpec.describe IsoDoc do
|
|
98
190
|
<p class="TermNum" id="J">3.1.1</p>
|
99
191
|
<p class="Terms" style="text-align:left;">Term2</p>
|
100
192
|
|
101
|
-
</div><div id="K"
|
193
|
+
</div><div id="K">
|
194
|
+
<span class='zzMoveToFollowing'>
|
195
|
+
<b>3.2  </b>
|
196
|
+
</span>
|
102
197
|
<dl><dt><p>Symbol</p></dt><dd>Definition</dd></dl>
|
103
198
|
</div></div>
|
104
199
|
<div id="L" class="Symbols">
|
105
|
-
<h1>4
|
200
|
+
<h1>4</h1>
|
106
201
|
<dl>
|
107
202
|
<dt>
|
108
203
|
<p>Symbol</p>
|
@@ -143,10 +238,12 @@ RSpec.describe IsoDoc do
|
|
143
238
|
</body>
|
144
239
|
</html>
|
145
240
|
OUTPUT
|
241
|
+
expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
|
242
|
+
expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
|
146
243
|
end
|
147
244
|
|
148
245
|
it "defaults to English" do
|
149
|
-
expect(xmlpp(IsoDoc::Iso::
|
246
|
+
expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
150
247
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
151
248
|
<bibdata>
|
152
249
|
<language>tlh</language>
|
@@ -161,7 +258,7 @@ RSpec.describe IsoDoc do
|
|
161
258
|
</clause>
|
162
259
|
<p>This is patent boilerplate</p>
|
163
260
|
</introduction></preface><sections>
|
164
|
-
<clause id="D" obligation="normative">
|
261
|
+
<clause id="D" obligation="normative" type="scope">
|
165
262
|
<title>Scope</title>
|
166
263
|
<p id="E">Text</p>
|
167
264
|
</clause>
|
@@ -214,84 +311,147 @@ RSpec.describe IsoDoc do
|
|
214
311
|
</bibliography>
|
215
312
|
</iso-standard>
|
216
313
|
INPUT
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
<
|
224
|
-
<
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
<
|
230
|
-
|
231
|
-
|
232
|
-
<
|
233
|
-
<
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
</
|
239
|
-
<
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
314
|
+
<iso-standard xmlns='http://riboseinc.com/isoxml'>
|
315
|
+
<bibdata>
|
316
|
+
<language>tlh</language>
|
317
|
+
</bibdata>
|
318
|
+
<preface>
|
319
|
+
<foreword obligation='informative'>
|
320
|
+
<title>Foreword</title>
|
321
|
+
<p id='A'>This is a preamble</p>
|
322
|
+
</foreword>
|
323
|
+
<introduction id='B' obligation='informative'>
|
324
|
+
<title depth='1'>
|
325
|
+
0
|
326
|
+
<tab/>
|
327
|
+
Introduction
|
328
|
+
</title>
|
329
|
+
<clause id='C' inline-header='false' obligation='informative'>
|
330
|
+
<title depth='2'>
|
331
|
+
0.1
|
332
|
+
<tab/>
|
333
|
+
Introduction Subsection
|
334
|
+
</title>
|
335
|
+
</clause>
|
336
|
+
<p>This is patent boilerplate</p>
|
337
|
+
</introduction>
|
338
|
+
</preface>
|
339
|
+
<sections>
|
340
|
+
<clause id='D' obligation='normative' type='scope'>
|
341
|
+
<title depth='1'>
|
342
|
+
1
|
343
|
+
<tab/>
|
344
|
+
Scope
|
345
|
+
</title>
|
346
|
+
<p id='E'>Text</p>
|
347
|
+
</clause>
|
348
|
+
<clause id='H' obligation='normative'>
|
349
|
+
<title depth='1'>
|
350
|
+
3
|
351
|
+
<tab/>
|
352
|
+
Terms, definitions, symbols and abbreviated terms
|
353
|
+
</title>
|
354
|
+
<terms id='I' obligation='normative'>
|
355
|
+
<title depth='2'>
|
356
|
+
3.1
|
357
|
+
<tab/>
|
358
|
+
Normal Terms
|
359
|
+
</title>
|
360
|
+
<term id='J'>
|
361
|
+
<name>3.1.1</name>
|
362
|
+
<preferred>Term2</preferred>
|
363
|
+
</term>
|
364
|
+
</terms>
|
365
|
+
<definitions id='K' inline-header='true'>
|
366
|
+
<title>3.2</title>
|
250
367
|
<dl>
|
251
|
-
<dt>
|
252
|
-
<p>Symbol</p>
|
253
|
-
</dt>
|
368
|
+
<dt>Symbol</dt>
|
254
369
|
<dd>Definition</dd>
|
255
370
|
</dl>
|
256
|
-
</
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
<
|
263
|
-
|
264
|
-
|
265
|
-
|
371
|
+
</definitions>
|
372
|
+
</clause>
|
373
|
+
<definitions id='L'>
|
374
|
+
<title>4</title>
|
375
|
+
<dl>
|
376
|
+
<dt>Symbol</dt>
|
377
|
+
<dd>Definition</dd>
|
378
|
+
</dl>
|
379
|
+
</definitions>
|
380
|
+
<clause id='M' inline-header='false' obligation='normative'>
|
381
|
+
<title depth='1'>
|
382
|
+
5
|
383
|
+
<tab/>
|
384
|
+
Clause 4
|
385
|
+
</title>
|
386
|
+
<clause id='N' inline-header='false' obligation='normative'>
|
387
|
+
<title depth='2'>
|
388
|
+
5.1
|
389
|
+
<tab/>
|
390
|
+
Introduction
|
391
|
+
</title>
|
392
|
+
</clause>
|
393
|
+
<clause id='O' inline-header='false' obligation='normative'>
|
394
|
+
<title depth='2'>
|
395
|
+
5.2
|
396
|
+
<tab/>
|
397
|
+
Clause 4.2
|
398
|
+
</title>
|
399
|
+
</clause>
|
400
|
+
</clause>
|
401
|
+
</sections>
|
402
|
+
<annex id='P' inline-header='false' obligation='normative'>
|
403
|
+
<title>
|
404
|
+
<strong>Annex A</strong>
|
266
405
|
<br/>
|
267
|
-
|
268
|
-
<h1 class="Annex"><b>Annex A</b><br/>(normative)<br/><br/><b>Annex</b></h1>
|
269
|
-
<div id="Q"><h2>A.1  Annex A.1</h2>
|
270
|
-
|
271
|
-
<div id="Q1"><h3>A.1.1  Annex A.1a</h3>
|
272
|
-
|
273
|
-
</div>
|
274
|
-
</div>
|
275
|
-
<div id="Q2"><h2>Appendix 1  An Appendix</h2>
|
276
|
-
|
277
|
-
</div>
|
278
|
-
</div>
|
406
|
+
(normative)
|
279
407
|
<br/>
|
280
|
-
<
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
408
|
+
<br/>
|
409
|
+
<strong>Annex</strong>
|
410
|
+
</title>
|
411
|
+
<clause id='Q' inline-header='false' obligation='normative'>
|
412
|
+
<title depth='2'>
|
413
|
+
A.1
|
414
|
+
<tab/>
|
415
|
+
Annex A.1
|
416
|
+
</title>
|
417
|
+
<clause id='Q1' inline-header='false' obligation='normative'>
|
418
|
+
<title depth='3'>
|
419
|
+
A.1.1
|
420
|
+
<tab/>
|
421
|
+
Annex A.1a
|
422
|
+
</title>
|
423
|
+
</clause>
|
424
|
+
</clause>
|
425
|
+
<appendix id='Q2' inline-header='false' obligation='normative'>
|
426
|
+
<title depth='2'>
|
427
|
+
Appendix 1
|
428
|
+
<tab/>
|
429
|
+
An Appendix
|
430
|
+
</title>
|
431
|
+
</appendix>
|
432
|
+
</annex>
|
433
|
+
<bibliography>
|
434
|
+
<references id='R' obligation='informative' normative='true'>
|
435
|
+
<title depth='1'>
|
436
|
+
2
|
437
|
+
<tab/>
|
438
|
+
Normative References
|
439
|
+
</title>
|
440
|
+
</references>
|
441
|
+
<clause id='S' obligation='informative'>
|
442
|
+
<title depth='1'>Bibliography</title>
|
443
|
+
<references id='T' obligation='informative' normative='false'>
|
444
|
+
<title depth='2'>Bibliography Subsection</title>
|
445
|
+
</references>
|
446
|
+
</clause>
|
447
|
+
</bibliography>
|
448
|
+
</iso-standard>
|
289
449
|
OUTPUT
|
290
450
|
end
|
291
451
|
|
292
452
|
it "processes French" do
|
293
|
-
|
294
|
-
|
453
|
+
input = <<~INPUT
|
454
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
295
455
|
<bibdata>
|
296
456
|
<language>fr</language>
|
297
457
|
</bibdata>
|
@@ -305,7 +465,7 @@ RSpec.describe IsoDoc do
|
|
305
465
|
</clause>
|
306
466
|
<p>This is patent boilerplate</p>
|
307
467
|
</introduction></preface><sections>
|
308
|
-
<clause id="D" obligation="normative">
|
468
|
+
<clause id="D" obligation="normative" type="scope">
|
309
469
|
<title>Scope</title>
|
310
470
|
<p id="E">Text</p>
|
311
471
|
</clause>
|
@@ -344,7 +504,7 @@ RSpec.describe IsoDoc do
|
|
344
504
|
<title>Annex A.1a</title>
|
345
505
|
</clause>
|
346
506
|
</clause>
|
347
|
-
|
507
|
+
<appendix id="Q2" inline-header="false" obligation="normative">
|
348
508
|
<title>An Appendix</title>
|
349
509
|
</appendix>
|
350
510
|
</annex><bibliography><references id="R" obligation="informative" normative="true">
|
@@ -357,11 +517,102 @@ RSpec.describe IsoDoc do
|
|
357
517
|
</clause>
|
358
518
|
</bibliography>
|
359
519
|
</iso-standard>
|
360
|
-
|
520
|
+
INPUT
|
521
|
+
|
522
|
+
presxml = <<~OUTPUT
|
523
|
+
<iso-standard xmlns='http://riboseinc.com/isoxml'>
|
524
|
+
<bibdata>
|
525
|
+
<language>fr</language>
|
526
|
+
</bibdata>
|
527
|
+
<preface>
|
528
|
+
<foreword obligation='informative'>
|
529
|
+
<title>Foreword</title>
|
530
|
+
<p id='A'>This is a preamble</p>
|
531
|
+
</foreword>
|
532
|
+
<introduction id='B' obligation='informative'>
|
533
|
+
<title depth='1'>0<tab/>Introduction</title>
|
534
|
+
<clause id='C' inline-header='false' obligation='informative'>
|
535
|
+
<title depth='2'>0.1<tab/>Introduction Subsection</title>
|
536
|
+
</clause>
|
537
|
+
<p>This is patent boilerplate</p>
|
538
|
+
</introduction>
|
539
|
+
</preface>
|
540
|
+
<sections>
|
541
|
+
<clause id='D' obligation='normative' type='scope'>
|
542
|
+
<title depth='1'>1<tab/>Scope</title>
|
543
|
+
<p id='E'>Text</p>
|
544
|
+
</clause>
|
545
|
+
<clause id='H' obligation='normative'>
|
546
|
+
<title depth='1'>3<tab/>Terms, definitions, symbols and abbreviated terms</title>
|
547
|
+
<terms id='I' obligation='normative'>
|
548
|
+
<title depth='2'>3.1<tab/>Normal Terms</title>
|
549
|
+
<term id='J'>
|
550
|
+
<name>3.1.1</name>
|
551
|
+
<preferred>Term2</preferred>
|
552
|
+
</term>
|
553
|
+
</terms>
|
554
|
+
<definitions id='K' inline-header='true'>
|
555
|
+
<title>3.2</title>
|
556
|
+
<dl>
|
557
|
+
<dt>Symbol</dt>
|
558
|
+
<dd>Definition</dd>
|
559
|
+
</dl>
|
560
|
+
</definitions>
|
561
|
+
</clause>
|
562
|
+
<definitions id='L'>
|
563
|
+
<title>4</title>
|
564
|
+
<dl>
|
565
|
+
<dt>Symbol</dt>
|
566
|
+
<dd>Definition</dd>
|
567
|
+
</dl>
|
568
|
+
</definitions>
|
569
|
+
<clause id='M' inline-header='false' obligation='normative'>
|
570
|
+
<title depth='1'>5<tab/>Clause 4</title>
|
571
|
+
<clause id='N' inline-header='false' obligation='normative'>
|
572
|
+
<title depth='2'>5.1<tab/>Introduction</title>
|
573
|
+
</clause>
|
574
|
+
<clause id='O' inline-header='false' obligation='normative'>
|
575
|
+
<title depth='2'>5.2<tab/>Clause 4.2</title>
|
576
|
+
</clause>
|
577
|
+
</clause>
|
578
|
+
</sections>
|
579
|
+
<annex id='P' inline-header='false' obligation='normative'>
|
580
|
+
<title>
|
581
|
+
<strong>Annexe A</strong>
|
582
|
+
<br/>
|
583
|
+
(normative)
|
584
|
+
<br/>
|
585
|
+
<br/>
|
586
|
+
<strong>Annex</strong>
|
587
|
+
</title>
|
588
|
+
<clause id='Q' inline-header='false' obligation='normative'>
|
589
|
+
<title depth='2'>A.1<tab/>Annex A.1</title>
|
590
|
+
<clause id='Q1' inline-header='false' obligation='normative'>
|
591
|
+
<title depth='3'>A.1.1<tab/>Annex A.1a</title>
|
592
|
+
</clause>
|
593
|
+
</clause>
|
594
|
+
<appendix id='Q2' inline-header='false' obligation='normative'>
|
595
|
+
<title depth='2'>Appendice 1<tab/>An Appendix</title>
|
596
|
+
</appendix>
|
597
|
+
</annex>
|
598
|
+
<bibliography>
|
599
|
+
<references id='R' obligation='informative' normative='true'>
|
600
|
+
<title depth='1'>2<tab/>Normative References</title>
|
601
|
+
</references>
|
602
|
+
<clause id='S' obligation='informative'>
|
603
|
+
<title depth='1'>Bibliography</title>
|
604
|
+
<references id='T' obligation='informative' normative='false'>
|
605
|
+
<title depth='2'>Bibliography Subsection</title>
|
606
|
+
</references>
|
607
|
+
</clause>
|
608
|
+
</bibliography>
|
609
|
+
</iso-standard>
|
610
|
+
OUTPUT
|
611
|
+
html = <<~OUTPUT
|
361
612
|
#{HTML_HDR.gsub(/"en"/, '"fr"')}
|
362
613
|
<br/>
|
363
614
|
<div>
|
364
|
-
<h1 class="ForewordTitle">
|
615
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
365
616
|
<p id="A">This is a preamble</p>
|
366
617
|
</div>
|
367
618
|
<br/>
|
@@ -374,23 +625,26 @@ RSpec.describe IsoDoc do
|
|
374
625
|
</div>
|
375
626
|
<p class="zzSTDTitle1"/>
|
376
627
|
<div id="D">
|
377
|
-
<h1>1 
|
628
|
+
<h1>1  Scope</h1>
|
378
629
|
<p id="E">Text</p>
|
379
630
|
</div>
|
380
631
|
<div>
|
381
|
-
<h1>2 
|
632
|
+
<h1>2  Normative References</h1>
|
382
633
|
</div>
|
383
|
-
<div id="H"><h1>3  Terms,
|
634
|
+
<div id="H"><h1>3  Terms, definitions, symbols and abbreviated terms</h1>
|
384
635
|
<div id="I"><h2>3.1  Normal Terms</h2>
|
385
636
|
|
386
637
|
<p class="TermNum" id="J">3.1.1</p>
|
387
638
|
<p class="Terms" style="text-align:left;">Term2</p>
|
388
639
|
|
389
|
-
</div><div id="K"
|
640
|
+
</div><div id="K">
|
641
|
+
<span class='zzMoveToFollowing'>
|
642
|
+
<b>3.2  </b>
|
643
|
+
</span>
|
390
644
|
<dl><dt><p>Symbol</p></dt><dd>Definition</dd></dl>
|
391
645
|
</div></div>
|
392
646
|
<div id="L" class="Symbols">
|
393
|
-
<h1>4
|
647
|
+
<h1>4</h1>
|
394
648
|
<dl>
|
395
649
|
<dt>
|
396
650
|
<p>Symbol</p>
|
@@ -422,7 +676,7 @@ RSpec.describe IsoDoc do
|
|
422
676
|
</div>
|
423
677
|
<br/>
|
424
678
|
<div>
|
425
|
-
<h1 class="Section3">
|
679
|
+
<h1 class="Section3">Bibliography</h1>
|
426
680
|
<div>
|
427
681
|
<h2 class="Section3">Bibliography Subsection</h2>
|
428
682
|
</div>
|
@@ -431,10 +685,12 @@ RSpec.describe IsoDoc do
|
|
431
685
|
</body>
|
432
686
|
</html>
|
433
687
|
OUTPUT
|
688
|
+
expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
|
689
|
+
expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
|
434
690
|
end
|
435
691
|
|
436
|
-
|
437
|
-
|
692
|
+
it "processes Simplified Chinese" do
|
693
|
+
input = <<~INPUT
|
438
694
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
439
695
|
<bibdata>
|
440
696
|
<language>zh</language>
|
@@ -450,7 +706,7 @@ RSpec.describe IsoDoc do
|
|
450
706
|
</clause>
|
451
707
|
<p>This is patent boilerplate</p>
|
452
708
|
</introduction></preface><sections>
|
453
|
-
<clause id="D" obligation="normative">
|
709
|
+
<clause id="D" obligation="normative" type="scope">
|
454
710
|
<title>Scope</title>
|
455
711
|
<p id="E"><eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom><referenceTo>1</referenceTo></locality></eref></p>
|
456
712
|
</clause>
|
@@ -513,42 +769,144 @@ RSpec.describe IsoDoc do
|
|
513
769
|
</bibliography>
|
514
770
|
</iso-standard>
|
515
771
|
INPUT
|
772
|
+
presxml = <<~OUTPUT
|
773
|
+
<iso-standard xmlns='http://riboseinc.com/isoxml'>
|
774
|
+
<bibdata>
|
775
|
+
<language>zh</language>
|
776
|
+
<script>Hans</script>
|
777
|
+
</bibdata>
|
778
|
+
<preface>
|
779
|
+
<foreword obligation='informative'>
|
780
|
+
<title>Foreword</title>
|
781
|
+
<p id='A'>This is a preamble</p>
|
782
|
+
</foreword>
|
783
|
+
<introduction id='B' obligation='informative'>
|
784
|
+
<title depth='1'>0<tab/>Introduction</title>
|
785
|
+
<clause id='C' inline-header='false' obligation='informative'>
|
786
|
+
<title depth='2'>0.1<tab/>Introduction Subsection</title>
|
787
|
+
</clause>
|
788
|
+
<p>This is patent boilerplate</p>
|
789
|
+
</introduction>
|
790
|
+
</preface>
|
791
|
+
<sections>
|
792
|
+
<clause id='D' obligation='normative' type="scope">
|
793
|
+
<title depth='1'>1<tab/>Scope</title>
|
794
|
+
<p id='E'>
|
795
|
+
<eref type='inline' bibitemid='ISO712'><locality type='table'><referenceFrom>1</referenceFrom><referenceTo>1</referenceTo></locality>ISO 712、第1–1表</eref>
|
796
|
+
</p>
|
797
|
+
</clause>
|
798
|
+
<clause id='H' obligation='normative'>
|
799
|
+
<title depth='1'>3<tab/>Terms, definitions, symbols and abbreviated terms</title>
|
800
|
+
<terms id='I' obligation='normative'>
|
801
|
+
<title depth='2'>3.1<tab/>Normal Terms</title>
|
802
|
+
<term id='J'>
|
803
|
+
<name>3.1.1</name>
|
804
|
+
<preferred>Term2</preferred>
|
805
|
+
</term>
|
806
|
+
</terms>
|
807
|
+
<definitions id='K' inline-header="true">
|
808
|
+
<title>3.2</title>
|
809
|
+
<dl>
|
810
|
+
<dt>Symbol</dt>
|
811
|
+
<dd>Definition</dd>
|
812
|
+
</dl>
|
813
|
+
</definitions>
|
814
|
+
</clause>
|
815
|
+
<definitions id='L'>
|
816
|
+
<title>4</title>
|
817
|
+
<dl>
|
818
|
+
<dt>Symbol</dt>
|
819
|
+
<dd>Definition</dd>
|
820
|
+
</dl>
|
821
|
+
</definitions>
|
822
|
+
<clause id='M' inline-header='false' obligation='normative'>
|
823
|
+
<title depth='1'>5<tab/>Clause 4</title>
|
824
|
+
<clause id='N' inline-header='false' obligation='normative'>
|
825
|
+
<title depth='2'>5.1<tab/>Introduction</title>
|
826
|
+
</clause>
|
827
|
+
<clause id='O' inline-header='false' obligation='normative'>
|
828
|
+
<title depth='2'>5.2<tab/>Clause 4.2</title>
|
829
|
+
</clause>
|
830
|
+
</clause>
|
831
|
+
</sections>
|
832
|
+
<annex id='P' inline-header='false' obligation='normative'>
|
833
|
+
<title><strong>附件A</strong><br/>(规范性附录)<br/><br/><strong>Annex</strong>
|
834
|
+
</title>
|
835
|
+
<clause id='Q' inline-header='false' obligation='normative'>
|
836
|
+
<title depth='2'>A.1<tab/>Annex A.1</title>
|
837
|
+
<clause id='Q1' inline-header='false' obligation='normative'>
|
838
|
+
<title depth='3'>A.1.1<tab/>Annex A.1a</title>
|
839
|
+
</clause>
|
840
|
+
</clause>
|
841
|
+
<appendix id='Q2' inline-header='false' obligation='normative'>
|
842
|
+
<title depth='2'>附录1<tab/>An Appendix</title>
|
843
|
+
</appendix>
|
844
|
+
</annex>
|
845
|
+
<bibliography>
|
846
|
+
<references id='R' obligation='informative' normative='true'>
|
847
|
+
<title depth='1'>2<tab/>Normative References</title>
|
848
|
+
<bibitem id='ISO712' type='standard'>
|
849
|
+
<title format='text/plain'>Cereals and cereal products</title>
|
850
|
+
<docidentifier>ISO 712</docidentifier>
|
851
|
+
<contributor>
|
852
|
+
<role type='publisher'/>
|
853
|
+
<organization>
|
854
|
+
<abbreviation>ISO</abbreviation>
|
855
|
+
</organization>
|
856
|
+
</contributor>
|
857
|
+
</bibitem>
|
858
|
+
</references>
|
859
|
+
<clause id='S' obligation='informative'>
|
860
|
+
<title depth='1'>Bibliography</title>
|
861
|
+
<references id='T' obligation='informative' normative='false'>
|
862
|
+
<title depth="2">Bibliography Subsection</title>
|
863
|
+
</references>
|
864
|
+
</clause>
|
865
|
+
</bibliography>
|
866
|
+
</iso-standard>
|
867
|
+
OUTPUT
|
868
|
+
|
869
|
+
html = <<~OUTPUT
|
516
870
|
#{HTML_HDR.gsub(/"en"/, '"zh"')}
|
517
871
|
<br/>
|
518
872
|
<div>
|
519
|
-
<h1 class="ForewordTitle"
|
873
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
520
874
|
<p id="A">This is a preamble</p>
|
521
875
|
</div>
|
522
876
|
<br/>
|
523
877
|
<div class="Section3" id="B">
|
524
|
-
<h1 class="IntroTitle">0&#
|
525
|
-
<div id="C"><h2>0.1&#
|
878
|
+
<h1 class="IntroTitle">0 Introduction</h1>
|
879
|
+
<div id="C"><h2>0.1 Introduction Subsection</h2>
|
526
880
|
|
527
881
|
</div>
|
528
882
|
<p>This is patent boilerplate</p>
|
529
883
|
</div>
|
530
884
|
<p class="zzSTDTitle1"/>
|
531
885
|
<div id="D">
|
532
|
-
<h1>1&#
|
886
|
+
<h1>1 Scope</h1>
|
533
887
|
<p id="E">
|
534
|
-
|
888
|
+
<a href='#ISO712'>ISO 712、第1–1表</a>
|
535
889
|
</p>
|
536
890
|
</div>
|
537
891
|
<div>
|
538
|
-
<h1>2&#
|
539
|
-
<p id="ISO712" class="NormRef">ISO 712, <i>
|
892
|
+
<h1>2 Normative References</h1>
|
893
|
+
<p id="ISO712" class="NormRef">ISO 712, <i>Cereals and cereal products</i></p>
|
540
894
|
</div>
|
541
|
-
<div id="H"
|
542
|
-
|
895
|
+
<div id="H">
|
896
|
+
<h1>3 Terms, definitions, symbols and abbreviated terms</h1>
|
897
|
+
<div id="I"><h2>3.1 Normal Terms</h2>
|
543
898
|
|
544
899
|
<p class="TermNum" id="J">3.1.1</p>
|
545
900
|
<p class="Terms" style="text-align:left;">Term2</p>
|
546
901
|
|
547
|
-
</div><div id="K"
|
902
|
+
</div><div id="K">
|
903
|
+
<span class='zzMoveToFollowing'>
|
904
|
+
<b>3.2 </b>
|
905
|
+
</span>
|
548
906
|
<dl><dt><p>Symbol</p></dt><dd>Definition</dd></dl>
|
549
907
|
</div></div>
|
550
908
|
<div id="L" class="Symbols">
|
551
|
-
<h1>4
|
909
|
+
<h1>4</h1>
|
552
910
|
<dl>
|
553
911
|
<dt>
|
554
912
|
<p>Symbol</p>
|
@@ -557,30 +915,30 @@ RSpec.describe IsoDoc do
|
|
557
915
|
</dl>
|
558
916
|
</div>
|
559
917
|
<div id="M">
|
560
|
-
<h1>5&#
|
561
|
-
<div id="N"><h2>5.1&#
|
918
|
+
<h1>5 Clause 4</h1>
|
919
|
+
<div id="N"><h2>5.1 Introduction</h2>
|
562
920
|
|
563
921
|
</div>
|
564
|
-
<div id="O"><h2>5.2&#
|
922
|
+
<div id="O"><h2>5.2 Clause 4.2</h2>
|
565
923
|
|
566
924
|
</div>
|
567
925
|
</div>
|
568
926
|
<br/>
|
569
927
|
<div id="P" class="Section3">
|
570
|
-
<h1 class="Annex">附件A
|
571
|
-
<div id="Q"><h2>A.1&#
|
928
|
+
<h1 class="Annex"><b>附件A</b><br/>(规范性附录)<br/><br/><b>Annex</b></h1>
|
929
|
+
<div id="Q"><h2>A.1 Annex A.1</h2>
|
572
930
|
|
573
|
-
<div id="Q1"><h3>A.1.1&#
|
931
|
+
<div id="Q1"><h3>A.1.1 Annex A.1a</h3>
|
574
932
|
|
575
933
|
</div>
|
576
934
|
</div>
|
577
|
-
<div id="Q2"><h2>附录1&#
|
935
|
+
<div id="Q2"><h2>附录1 An Appendix</h2>
|
578
936
|
|
579
937
|
</div>
|
580
938
|
</div>
|
581
939
|
<br/>
|
582
940
|
<div>
|
583
|
-
<h1 class="Section3"
|
941
|
+
<h1 class="Section3">Bibliography</h1>
|
584
942
|
<div>
|
585
943
|
<h2 class="Section3">Bibliography Subsection</h2>
|
586
944
|
</div>
|
@@ -589,6 +947,8 @@ RSpec.describe IsoDoc do
|
|
589
947
|
</body>
|
590
948
|
</html>
|
591
949
|
OUTPUT
|
950
|
+
expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
|
951
|
+
expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
|
592
952
|
end
|
593
953
|
|
594
954
|
end
|