metanorma-iec 1.1.3 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/asciidoctor/iec/converter.rb +6 -15
- data/lib/asciidoctor/iec/isodoc.rng +12 -6
- data/lib/isodoc/iec/base_convert.rb +9 -41
- data/lib/isodoc/iec/html_convert.rb +2 -0
- data/lib/isodoc/iec/i18n-en.yaml +13 -0
- data/lib/isodoc/iec/i18n-fr.yaml +13 -0
- data/lib/isodoc/iec/i18n-zh-Hans.yaml +11 -0
- data/lib/isodoc/iec/i18n.rb +19 -0
- data/lib/isodoc/iec/init.rb +29 -0
- data/lib/isodoc/iec/presentation_xml_convert.rb +26 -1
- data/lib/isodoc/iec/word_convert.rb +3 -1
- data/lib/isodoc/iec/xref.rb +1 -1
- data/lib/metanorma/iec/version.rb +1 -1
- data/metanorma-iec.gemspec +2 -2
- data/spec/asciidoctor-iec/blocks_spec.rb +1 -1
- data/spec/asciidoctor-iec/cleanup_spec.rb +2 -2
- data/spec/asciidoctor-iec/iev_spec.rb +74 -1
- data/spec/asciidoctor-iec/inline_spec.rb +1 -1
- data/spec/asciidoctor-iec/section_spec.rb +17 -15
- data/spec/isodoc/blocks_spec.rb +66 -1
- data/spec/isodoc/i18n_spec.rb +296 -244
- data/spec/isodoc/iev_spec.rb +221 -14
- data/spec/isodoc/inline_spec.rb +97 -73
- data/spec/isodoc/iso_spec.rb +6 -0
- data/spec/isodoc/postproc_spec.rb +15 -29
- data/spec/isodoc/ref_spec.rb +129 -2
- data/spec/isodoc/section_spec.rb +112 -102
- data/spec/isodoc/terms_spec.rb +67 -53
- data/spec/metanorma/processor_spec.rb +2 -1
- metadata +8 -9
- data/lib/asciidoctor/iec/i18n-en.yaml +0 -12
- data/lib/asciidoctor/iec/i18n-fr.yaml +0 -11
- data/lib/asciidoctor/iec/i18n-zh-Hans.yaml +0 -9
data/spec/isodoc/iso_spec.rb
CHANGED
@@ -75,6 +75,7 @@ RSpec.describe IsoDoc::Iec do
|
|
75
75
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
76
76
|
<preface><foreword>
|
77
77
|
<example id="samplecode">
|
78
|
+
<name>EXAMPLE</name>
|
78
79
|
<p>Hello</p>
|
79
80
|
</example>
|
80
81
|
</foreword></preface>
|
@@ -101,9 +102,11 @@ RSpec.describe IsoDoc::Iec do
|
|
101
102
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
102
103
|
<preface><foreword>
|
103
104
|
<example id="samplecode">
|
105
|
+
<name>EXAMPLE 1</name>
|
104
106
|
<p>Hello</p>
|
105
107
|
</example>
|
106
108
|
<example id="samplecode2">
|
109
|
+
<name>EXAMPLE 2</name>
|
107
110
|
<p>Hello</p>
|
108
111
|
</example>
|
109
112
|
</foreword></preface>
|
@@ -132,6 +135,7 @@ RSpec.describe IsoDoc::Iec do
|
|
132
135
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
133
136
|
<preface><foreword>
|
134
137
|
<example id="samplecode">
|
138
|
+
<name>EXAMPLE</name>
|
135
139
|
<p>Hello</p>
|
136
140
|
</example>
|
137
141
|
</foreword></preface>
|
@@ -170,9 +174,11 @@ RSpec.describe IsoDoc::Iec do
|
|
170
174
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
171
175
|
<preface><foreword>
|
172
176
|
<example id="samplecode">
|
177
|
+
<name>EXAMPLE 1</name>
|
173
178
|
<p>Hello</p>
|
174
179
|
</example>
|
175
180
|
<example id="samplecode2">
|
181
|
+
<name>EXAMPLE 2</name>
|
176
182
|
<p>Hello</p>
|
177
183
|
</example>
|
178
184
|
</foreword></preface>
|
@@ -103,12 +103,14 @@ RSpec.describe IsoDoc do
|
|
103
103
|
IsoDoc::Iec::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", <<~"INPUT", false)
|
104
104
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
105
105
|
<sections>
|
106
|
-
<terms id="_terms_and_definitions" obligation="normative"><title>Terms and Definitions</title>
|
106
|
+
<terms id="_terms_and_definitions" obligation="normative"><title>1<tab/>Terms and Definitions</title>
|
107
107
|
|
108
|
-
<term id="paddy1"
|
108
|
+
<term id="paddy1">
|
109
|
+
<name>1.1</name>
|
110
|
+
<preferred>paddy</preferred>
|
109
111
|
<definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
|
110
112
|
<termsource status="modified">
|
111
|
-
<origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality
|
113
|
+
<origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality>ISO 7301:2011, 3.1</origin>
|
112
114
|
<modification>
|
113
115
|
<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>
|
114
116
|
</modification>
|
@@ -156,9 +158,11 @@ RSpec.describe IsoDoc do
|
|
156
158
|
IsoDoc::Iec::HtmlConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", <<~"INPUT", false)
|
157
159
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
158
160
|
<sections>
|
159
|
-
<terms id="_terms_and_definitions" obligation="normative"><title>Terms and Definitions</title>
|
161
|
+
<terms id="_terms_and_definitions" obligation="normative"><title>1<tab/>Terms and Definitions</title>
|
160
162
|
|
161
|
-
<term id="paddy1"
|
163
|
+
<term id="paddy1">
|
164
|
+
<name>1.1</name>
|
165
|
+
<preferred>paddy</preferred>
|
162
166
|
<domain>rice</domain>
|
163
167
|
<definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
|
164
168
|
<termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f892">
|
@@ -180,7 +184,9 @@ RSpec.describe IsoDoc do
|
|
180
184
|
</modification>
|
181
185
|
</termsource></term>
|
182
186
|
|
183
|
-
<term id="paddy"
|
187
|
+
<term id="paddy">
|
188
|
+
<name>1.2</name>
|
189
|
+
<preferred>paddy</preferred><admitted>paddy rice</admitted>
|
184
190
|
<admitted>rough rice</admitted>
|
185
191
|
<deprecates>cargo rice</deprecates>
|
186
192
|
<definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
|
@@ -233,20 +239,11 @@ RSpec.describe IsoDoc do
|
|
233
239
|
<br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
|
234
240
|
</p>
|
235
241
|
<div class="Section3"><a name="P" id="P"></a>
|
236
|
-
<h1 class='Annex'>
|
237
|
-
<b>Annex A</b>
|
238
|
-
<br/>
|
239
|
-
<br/>
|
240
|
-
(normative)
|
241
|
-
<br/>
|
242
|
-
<br/>
|
243
|
-
<b/>
|
244
|
-
</h1>
|
245
242
|
<div class="example"><a name="_63112cbc-cde0-435f-9553-e0b8c4f5851c" id="_63112cbc-cde0-435f-9553-e0b8c4f5851c"></a>
|
246
|
-
<p class="example"><span
|
243
|
+
<p class="example"><span style="mso-tab-count:1">  </span>'1M', '01M', and '0001M' all describe the calendar month January.</p>
|
247
244
|
</div>
|
248
245
|
<div class="example"><a name="_63112cbc-cde0-435f-9553-e0b8c4f5851d" id="_63112cbc-cde0-435f-9553-e0b8c4f5851d"></a>
|
249
|
-
<p class="example"><span
|
246
|
+
<p class="example"><span style="mso-tab-count:1">  </span>'2M', '02M', and '0002M' all describe the calendar month February.</p>
|
250
247
|
</div>
|
251
248
|
</div>
|
252
249
|
</div>
|
@@ -279,18 +276,7 @@ RSpec.describe IsoDoc do
|
|
279
276
|
<br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
|
280
277
|
</p>
|
281
278
|
<div class="Section3"><a name="P" id="P"></a>
|
282
|
-
|
283
|
-
<b>Annex A</b>
|
284
|
-
<br/>
|
285
|
-
<br/>
|
286
|
-
(normative)
|
287
|
-
<br/>
|
288
|
-
<br/>
|
289
|
-
<b/>
|
290
|
-
</h1>
|
291
|
-
<p class="Sourcecode" style='page-break-after:avoid;'><a name="A" id="A"></a>puts "Hello, world."</p>
|
292
|
-
<p class='SourceTitle' style='text-align:center;'>Figure A.1</p>
|
293
|
-
<p class="TableTitle" style="text-align:center;">Table A.1</p>
|
279
|
+
<p class="Sourcecode"><a name="A" id="A"></a>puts "Hello, world."</p>
|
294
280
|
<div align='center' class='table_container'>
|
295
281
|
<table class='MsoISOTable' style='mso-table-anchor-horizontal:column;mso-table-overlap:never;border-spacing:0;border-width:1px;'>
|
296
282
|
<a name='samplecode' id='samplecode'/>
|
data/spec/isodoc/ref_spec.rb
CHANGED
@@ -2,7 +2,7 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
RSpec.describe IsoDoc::Iec do
|
4
4
|
it "processes IsoXML bibliographies" do
|
5
|
-
|
5
|
+
input = <<~INPUT
|
6
6
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
7
7
|
<bibdata>
|
8
8
|
<language>en</language>
|
@@ -124,6 +124,131 @@ RSpec.describe IsoDoc::Iec do
|
|
124
124
|
</bibliography>
|
125
125
|
</iso-standard>
|
126
126
|
INPUT
|
127
|
+
|
128
|
+
presxml = <<~OUTPUT
|
129
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
130
|
+
<bibdata>
|
131
|
+
<language>en</language>
|
132
|
+
</bibdata>
|
133
|
+
<preface><foreword>
|
134
|
+
<p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">
|
135
|
+
<eref bibitemid="ISO712">[110]</eref>
|
136
|
+
<eref bibitemid="ISBN">[1]</eref>
|
137
|
+
<eref bibitemid="ISSN">[2]</eref>
|
138
|
+
<eref bibitemid="ISO16634">ISO 16634:--</eref>
|
139
|
+
<eref bibitemid="ref1">ICC 167</eref>
|
140
|
+
<eref bibitemid="ref10">[10]</eref>
|
141
|
+
<eref bibitemid="ref12">Citn</eref>
|
142
|
+
<eref bibitemid="zip_ffs">[5]</eref>
|
143
|
+
</p>
|
144
|
+
</foreword></preface>
|
145
|
+
<bibliography><references id="_normative_references" obligation="informative" normative="true"><title depth="1">1<tab/>Normative References</title>
|
146
|
+
<p>The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.</p>
|
147
|
+
<bibitem id="ISO712" type="standard">
|
148
|
+
<title format="text/plain">Cereals or cereal products</title>
|
149
|
+
<title type="main" format="text/plain">Cereals and cereal products</title>
|
150
|
+
<docidentifier type="ISO">ISO 712</docidentifier>
|
151
|
+
<docidentifier type="metanorma">[110]</docidentifier>
|
152
|
+
<contributor>
|
153
|
+
<role type="publisher"/>
|
154
|
+
<organization>
|
155
|
+
<name>International Organization for Standardization</name>
|
156
|
+
</organization>
|
157
|
+
</contributor>
|
158
|
+
</bibitem>
|
159
|
+
<bibitem id="ISO16634" type="standard">
|
160
|
+
<title language="x" format="text/plain">Cereals, pulses, milled cereal products, xxxx, oilseeds and animal feeding stuffs</title>
|
161
|
+
<title language="en" format="text/plain">Cereals, pulses, milled cereal products, oilseeds and animal feeding stuffs</title>
|
162
|
+
<docidentifier type="ISO">ISO 16634:-- (all parts)</docidentifier>
|
163
|
+
<date type="published"><on>--</on></date>
|
164
|
+
<contributor>
|
165
|
+
<role type="publisher"/>
|
166
|
+
<organization>
|
167
|
+
<abbreviation>ISO</abbreviation>
|
168
|
+
</organization>
|
169
|
+
</contributor>
|
170
|
+
<note format="text/plain" reference="1" type="ISO DATE">Under preparation. (Stage at the time of publication ISO/DIS 16634)</note>
|
171
|
+
<extent type="part">
|
172
|
+
<referenceFrom>all</referenceFrom>
|
173
|
+
</extent>
|
174
|
+
|
175
|
+
</bibitem>
|
176
|
+
<bibitem id="ISO20483" type="standard">
|
177
|
+
<title format="text/plain">Cereals and pulses</title>
|
178
|
+
<docidentifier type="ISO">ISO 20483:2013-2014</docidentifier>
|
179
|
+
<date type="published"><from>2013</from><to>2014</to></date>
|
180
|
+
<contributor>
|
181
|
+
<role type="publisher"/>
|
182
|
+
<organization>
|
183
|
+
<name>International Organization for Standardization</name>
|
184
|
+
</organization>
|
185
|
+
</contributor>
|
186
|
+
</bibitem>
|
187
|
+
<bibitem id="ref1">
|
188
|
+
<formattedref format="application/x-isodoc+xml"><smallcap>Standard No I.C.C 167</smallcap>. <em>Determination of the protein content in cereal and cereal products for food and animal feeding stuffs according to the Dumas combustion method</em> (see <link target="http://www.icc.or.at"/>)</formattedref>
|
189
|
+
<docidentifier type="ICC">167</docidentifier>
|
190
|
+
</bibitem>
|
191
|
+
<note><name>NOTE</name><p>This is an annotation of ISO 20483:2013-2014</p></note>
|
192
|
+
<bibitem id="zip_ffs"><formattedref format="application/x-isodoc+xml">Title 5</formattedref><docidentifier type="metanorma">[5]</docidentifier></bibitem>
|
193
|
+
|
194
|
+
|
195
|
+
</references><references id="_bibliography" obligation="informative" normative="false">
|
196
|
+
<title depth="1">Bibliography</title>
|
197
|
+
<bibitem id="ISBN" type="ISBN">
|
198
|
+
<title format="text/plain">Chemicals for analytical laboratory use</title>
|
199
|
+
<docidentifier type="ISBN">ISBN</docidentifier>
|
200
|
+
<docidentifier type="metanorma">[1]</docidentifier>
|
201
|
+
<contributor>
|
202
|
+
<role type="publisher"/>
|
203
|
+
<organization>
|
204
|
+
<abbreviation>ISBN</abbreviation>
|
205
|
+
</organization>
|
206
|
+
</contributor>
|
207
|
+
</bibitem>
|
208
|
+
<bibitem id="ISSN" type="ISSN">
|
209
|
+
<title format="text/plain">Instruments for analytical laboratory use</title>
|
210
|
+
<docidentifier type="ISSN">ISSN</docidentifier>
|
211
|
+
<docidentifier type="metanorma">[2]</docidentifier>
|
212
|
+
<contributor>
|
213
|
+
<role type="publisher"/>
|
214
|
+
<organization>
|
215
|
+
<abbreviation>ISSN</abbreviation>
|
216
|
+
</organization>
|
217
|
+
</contributor>
|
218
|
+
</bibitem>
|
219
|
+
<note><name>NOTE</name><p>This is an annotation of document ISSN.</p></note>
|
220
|
+
<note><name>NOTE</name><p>This is another annotation of document ISSN.</p></note>
|
221
|
+
<bibitem id="ISO3696" type="standard">
|
222
|
+
<title format="text/plain">Water for analytical laboratory use</title>
|
223
|
+
<docidentifier type="ISO">ISO 3696</docidentifier>
|
224
|
+
<contributor>
|
225
|
+
<role type="publisher"/>
|
226
|
+
<organization>
|
227
|
+
<abbreviation>ISO</abbreviation>
|
228
|
+
</organization>
|
229
|
+
</contributor>
|
230
|
+
</bibitem>
|
231
|
+
<bibitem id="ref10">
|
232
|
+
<formattedref format="application/x-isodoc+xml"><smallcap>Standard No I.C.C 167</smallcap>. <em>Determination of the protein content in cereal and cereal products for food and animal feeding stuffs according to the Dumas combustion method</em> (see <link target="http://www.icc.or.at"/>)</formattedref>
|
233
|
+
<docidentifier type="metanorma">[10]</docidentifier>
|
234
|
+
</bibitem>
|
235
|
+
<bibitem id="ref11">
|
236
|
+
<title>Internet Calendaring and Scheduling Core Object Specification (iCalendar)</title>
|
237
|
+
<docidentifier type="IETF">RFC 10</docidentifier>
|
238
|
+
</bibitem>
|
239
|
+
<bibitem id="ref12">
|
240
|
+
<formattedref format="application/x-isodoc+xml">CitationWorks. 2019. <em>How to cite a reference</em>.</formattedref>
|
241
|
+
<docidentifier type="metanorma">[Citn]</docidentifier>
|
242
|
+
<docidentifier type="IETF">RFC 20</docidentifier>
|
243
|
+
</bibitem>
|
244
|
+
|
245
|
+
|
246
|
+
</references>
|
247
|
+
</bibliography>
|
248
|
+
</iso-standard>
|
249
|
+
OUTPUT
|
250
|
+
|
251
|
+
html = <<~OUTPUT
|
127
252
|
#{HTML_HDR}
|
128
253
|
<div>
|
129
254
|
<h1 class='ForewordTitle'>FOREWORD</h1>
|
@@ -141,7 +266,7 @@ RSpec.describe IsoDoc::Iec do
|
|
141
266
|
</div>
|
142
267
|
#{IEC_TITLE1}
|
143
268
|
<div>
|
144
|
-
<h1>1  Normative
|
269
|
+
<h1>1  Normative References</h1>
|
145
270
|
<p>
|
146
271
|
The following documents are referred to in the text in such a way that
|
147
272
|
some or all of their content constitutes requirements of this
|
@@ -244,6 +369,8 @@ RSpec.describe IsoDoc::Iec do
|
|
244
369
|
</html>
|
245
370
|
|
246
371
|
OUTPUT
|
372
|
+
expect(xmlpp(IsoDoc::Iec::PresentationXMLConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
|
373
|
+
expect(xmlpp(IsoDoc::Iec::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
|
247
374
|
end
|
248
375
|
|
249
376
|
end
|
data/spec/isodoc/section_spec.rb
CHANGED
@@ -2,7 +2,7 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
RSpec.describe IsoDoc do
|
4
4
|
it "processes section names" do
|
5
|
-
|
5
|
+
input = <<~INPUT
|
6
6
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
7
7
|
<preface>
|
8
8
|
<foreword obligation="informative">
|
@@ -14,7 +14,7 @@ RSpec.describe IsoDoc do
|
|
14
14
|
</clause>
|
15
15
|
<p>This is patent boilerplate</p>
|
16
16
|
</introduction></preface><sections>
|
17
|
-
<clause id="D" obligation="normative">
|
17
|
+
<clause id="D" obligation="normative" type="scope">
|
18
18
|
<title>Scope</title>
|
19
19
|
<p id="E">Text</p>
|
20
20
|
</clause>
|
@@ -67,6 +67,74 @@ RSpec.describe IsoDoc do
|
|
67
67
|
</bibliography>
|
68
68
|
</iso-standard>
|
69
69
|
INPUT
|
70
|
+
|
71
|
+
presxml = <<~OUTPUT
|
72
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
73
|
+
<preface>
|
74
|
+
<foreword obligation="informative">
|
75
|
+
<title>Foreword</title>
|
76
|
+
<p id="A">This is a preamble</p>
|
77
|
+
</foreword>
|
78
|
+
<introduction id="B" obligation="informative"><title depth="1">0<tab/>Introduction</title><clause id="C" inline-header="false" obligation="informative">
|
79
|
+
<title depth="2">0.1<tab/>Introduction Subsection</title>
|
80
|
+
</clause>
|
81
|
+
<p>This is patent boilerplate</p>
|
82
|
+
</introduction></preface><sections>
|
83
|
+
<clause id="D" obligation="normative" type="scope">
|
84
|
+
<title depth="1">1<tab/>Scope</title>
|
85
|
+
<p id="E">Text</p>
|
86
|
+
</clause>
|
87
|
+
|
88
|
+
<clause id="H" obligation="normative"><title depth="1">3<tab/>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
|
89
|
+
<title depth="2">3.1<tab/>Normal Terms</title>
|
90
|
+
<term id="J"><name>3.1.1</name>
|
91
|
+
<preferred>Term2</preferred>
|
92
|
+
</term>
|
93
|
+
</terms>
|
94
|
+
<definitions id="K"><title>3.2</title>
|
95
|
+
<dl>
|
96
|
+
<dt>Symbol</dt>
|
97
|
+
<dd>Definition</dd>
|
98
|
+
</dl>
|
99
|
+
</definitions>
|
100
|
+
</clause>
|
101
|
+
<definitions id="L"><title>4</title>
|
102
|
+
<dl>
|
103
|
+
<dt>Symbol</dt>
|
104
|
+
<dd>Definition</dd>
|
105
|
+
</dl>
|
106
|
+
</definitions>
|
107
|
+
<clause id="M" inline-header="false" obligation="normative"><title depth="1">5<tab/>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
|
108
|
+
<title depth="2">5.1<tab/>Introduction</title>
|
109
|
+
</clause>
|
110
|
+
<clause id="O" inline-header="false" obligation="normative">
|
111
|
+
<title depth="2">5.2<tab/>Clause 4.2</title>
|
112
|
+
</clause></clause>
|
113
|
+
|
114
|
+
</sections><annex id="P" inline-header="false" obligation="normative">
|
115
|
+
<title><strong>Annex A</strong><br/>(normative)<br/><br/><strong>Annex</strong></title>
|
116
|
+
<clause id="Q" inline-header="false" obligation="normative">
|
117
|
+
<title depth="2">A.1<tab/>Annex A.1</title>
|
118
|
+
<clause id="Q1" inline-header="false" obligation="normative">
|
119
|
+
<title depth="3">A.1.1<tab/>Annex A.1a</title>
|
120
|
+
</clause>
|
121
|
+
</clause>
|
122
|
+
<appendix id="Q2" inline-header="false" obligation="normative">
|
123
|
+
<title depth="2">Appendix 1<tab/>An Appendix</title>
|
124
|
+
</appendix>
|
125
|
+
</annex><bibliography><references id="R" obligation="informative" normative="true">
|
126
|
+
<title depth="1">2<tab/>Normative References</title>
|
127
|
+
</references><clause id="S" obligation="informative">
|
128
|
+
<title depth="1">Bibliography</title>
|
129
|
+
<references id="T" obligation="informative" normative="false">
|
130
|
+
<title depth="2">Bibliography Subsection</title>
|
131
|
+
</references>
|
132
|
+
</clause>
|
133
|
+
</bibliography>
|
134
|
+
</iso-standard>
|
135
|
+
OUTPUT
|
136
|
+
|
137
|
+
html = <<~OUTPUT
|
70
138
|
<html xmlns:epub="http://www.idpf.org/2007/ops" lang="en">
|
71
139
|
<head/>
|
72
140
|
<body lang="en">
|
@@ -88,7 +156,7 @@ RSpec.describe IsoDoc do
|
|
88
156
|
</div>
|
89
157
|
<br/>
|
90
158
|
<div class="Section3" id="B">
|
91
|
-
<h1 class="IntroTitle">0 
|
159
|
+
<h1 class="IntroTitle">0  Introduction</h1>
|
92
160
|
<div id="C">
|
93
161
|
<h2>0.1  Introduction Subsection</h2>
|
94
162
|
</div>
|
@@ -100,7 +168,7 @@ RSpec.describe IsoDoc do
|
|
100
168
|
<p id="E">Text</p>
|
101
169
|
</div>
|
102
170
|
<div>
|
103
|
-
<h1>2  Normative
|
171
|
+
<h1>2  Normative References</h1>
|
104
172
|
</div>
|
105
173
|
<div id="H"><h1>3  Terms, definitions, symbols and abbreviated terms</h1>
|
106
174
|
<div id="I">
|
@@ -108,11 +176,11 @@ RSpec.describe IsoDoc do
|
|
108
176
|
<p class="TermNum" id="J">3.1.1</p>
|
109
177
|
<p class="Terms" style="text-align:left;">Term2</p>
|
110
178
|
|
111
|
-
</div><div id="K"><h2>3.2
|
179
|
+
</div><div id="K"><h2>3.2</h2>
|
112
180
|
<dl><dt><p>Symbol</p></dt><dd>Definition</dd></dl>
|
113
181
|
</div></div>
|
114
182
|
<div id="L" class="Symbols">
|
115
|
-
<h1>4
|
183
|
+
<h1>4</h1>
|
116
184
|
<dl>
|
117
185
|
<dt>
|
118
186
|
<p>Symbol</p>
|
@@ -131,7 +199,7 @@ RSpec.describe IsoDoc do
|
|
131
199
|
</div>
|
132
200
|
<br/>
|
133
201
|
<div id="P" class="Section3">
|
134
|
-
<h1 class="Annex"><b>Annex A</b><br
|
202
|
+
<h1 class="Annex"><b>Annex A</b><br/>(normative)<br/><br/><b>Annex</b></h1>
|
135
203
|
<div id="Q">
|
136
204
|
<h2>A.1  Annex A.1</h2>
|
137
205
|
<div id="Q1">
|
@@ -154,74 +222,8 @@ RSpec.describe IsoDoc do
|
|
154
222
|
</body>
|
155
223
|
</html>
|
156
224
|
OUTPUT
|
157
|
-
end
|
158
|
-
|
159
|
-
it "processes section names (Word)" do
|
160
|
-
expect(xmlpp(IsoDoc::Iec::WordConvert.new({}).convert("test", <<~"INPUT", true).sub(/^.*<body /m, "<body ").sub(%r{</body>.*$}m, "</body>"))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
161
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
162
|
-
<preface>
|
163
|
-
<foreword obligation="informative">
|
164
|
-
<title>Foreword</title>
|
165
|
-
<p id="A">This is a preamble</p>
|
166
|
-
</foreword>
|
167
|
-
<introduction id="B" obligation="informative"><title>Introduction</title><clause id="C" inline-header="false" obligation="informative">
|
168
|
-
<title>Introduction Subsection</title>
|
169
|
-
</clause>
|
170
|
-
<p>This is patent boilerplate</p>
|
171
|
-
</introduction></preface><sections>
|
172
|
-
<clause id="D" obligation="normative">
|
173
|
-
<title>Scope</title>
|
174
|
-
<p id="E">Text</p>
|
175
|
-
</clause>
|
176
|
-
|
177
|
-
<clause id="H" obligation="normative"><title>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
|
178
|
-
<title>Normal Terms</title>
|
179
|
-
<term id="J">
|
180
|
-
<preferred>Term2</preferred>
|
181
|
-
</term>
|
182
|
-
</terms>
|
183
|
-
<definitions id="K">
|
184
|
-
<dl>
|
185
|
-
<dt>Symbol</dt>
|
186
|
-
<dd>Definition</dd>
|
187
|
-
</dl>
|
188
|
-
</definitions>
|
189
|
-
</clause>
|
190
|
-
<definitions id="L">
|
191
|
-
<dl>
|
192
|
-
<dt>Symbol</dt>
|
193
|
-
<dd>Definition</dd>
|
194
|
-
</dl>
|
195
|
-
</definitions>
|
196
|
-
<clause id="M" inline-header="false" obligation="normative"><title>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
|
197
|
-
<title>Introduction</title>
|
198
|
-
</clause>
|
199
|
-
<clause id="O" inline-header="false" obligation="normative">
|
200
|
-
<title>Clause 4.2</title>
|
201
|
-
</clause></clause>
|
202
225
|
|
203
|
-
|
204
|
-
<title>Annex</title>
|
205
|
-
<clause id="Q" inline-header="false" obligation="normative">
|
206
|
-
<title>Annex A.1</title>
|
207
|
-
<clause id="Q1" inline-header="false" obligation="normative">
|
208
|
-
<title>Annex A.1a</title>
|
209
|
-
</clause>
|
210
|
-
</clause>
|
211
|
-
<appendix id="Q2" inline-header="false" obligation="normative">
|
212
|
-
<title>An Appendix</title>
|
213
|
-
</appendix>
|
214
|
-
</annex><bibliography><references id="R" obligation="informative" normative="true">
|
215
|
-
<title>Normative References</title>
|
216
|
-
</references><clause id="S" obligation="informative">
|
217
|
-
<title>Bibliography</title>
|
218
|
-
<references id="T" obligation="informative" normative="false">
|
219
|
-
<title>Bibliography Subsection</title>
|
220
|
-
</references>
|
221
|
-
</clause>
|
222
|
-
</bibliography>
|
223
|
-
</iso-standard>
|
224
|
-
INPUT
|
226
|
+
word = <<~OUTPUT
|
225
227
|
<body lang="EN-US" link="blue" vlink="#954F72">
|
226
228
|
<div class="WordSection2">
|
227
229
|
<p><br clear="all" style="mso-special-character:line-break;page-break-before:always"/></p>
|
@@ -233,7 +235,7 @@ OUTPUT
|
|
233
235
|
</div>
|
234
236
|
<p><br clear="all" style="mso-special-character:line-break;page-break-before:always"/></p>
|
235
237
|
<div class="Section3" id="B">
|
236
|
-
<h1 class="IntroTitle">0<span style="mso-tab-count:1">  </span>
|
238
|
+
<h1 class="IntroTitle">0<span style="mso-tab-count:1">  </span>Introduction</h1>
|
237
239
|
<div id="C">
|
238
240
|
<h2>0.1<span style="mso-tab-count:1">  </span>Introduction Subsection</h2>
|
239
241
|
</div>
|
@@ -249,7 +251,7 @@ OUTPUT
|
|
249
251
|
<p id="E">Text</p>
|
250
252
|
</div>
|
251
253
|
<div>
|
252
|
-
<h1>2<span style="mso-tab-count:1">  </span>Normative
|
254
|
+
<h1>2<span style="mso-tab-count:1">  </span>Normative References</h1>
|
253
255
|
</div>
|
254
256
|
<div id="H"><h1>3<span style="mso-tab-count:1">  </span>Terms, definitions, symbols and abbreviated terms</h1>
|
255
257
|
<div id="I">
|
@@ -257,11 +259,11 @@ OUTPUT
|
|
257
259
|
<p class="TermNum" id="J">3.1.1</p>
|
258
260
|
<p class="Terms" style="text-align:left;">Term2</p>
|
259
261
|
|
260
|
-
</div><div id="K"><h2>3.2
|
262
|
+
</div><div id="K"><h2>3.2</h2>
|
261
263
|
<table class="dl"><tr><td valign="top" align="left"><p align="left" style="margin-left:0pt;text-align:left;">Symbol</p></td><td valign="top">Definition</td></tr></table>
|
262
264
|
</div></div>
|
263
265
|
<div id="L" class="Symbols">
|
264
|
-
<h1>4
|
266
|
+
<h1>4</h1>
|
265
267
|
<table class="dl">
|
266
268
|
<tr>
|
267
269
|
<td valign="top" align="left">
|
@@ -282,7 +284,7 @@ OUTPUT
|
|
282
284
|
</div>
|
283
285
|
<p><br clear="all" style="mso-special-character:line-break;page-break-before:always"/></p>
|
284
286
|
<div id="P" class="Section3">
|
285
|
-
<h1 class="Annex"><b>Annex A</b><br
|
287
|
+
<h1 class="Annex"><b>Annex A</b><br/>(normative)<br/><br/><b>Annex</b></h1>
|
286
288
|
<div id="Q">
|
287
289
|
<h2>A.1<span style="mso-tab-count:1">  </span>Annex A.1</h2>
|
288
290
|
<div id="Q1">
|
@@ -305,10 +307,13 @@ OUTPUT
|
|
305
307
|
<div class="colophon"/>
|
306
308
|
</body>
|
307
309
|
OUTPUT
|
310
|
+
expect(xmlpp(IsoDoc::Iec::PresentationXMLConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
|
311
|
+
expect(xmlpp(IsoDoc::Iec::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
|
312
|
+
expect(xmlpp(IsoDoc::Iec::WordConvert.new({}).convert("test", presxml, true).sub(/^.*<body /m, "<body ").sub(%r{</body>.*$}m, "</body>"))).to be_equivalent_to xmlpp(word)
|
308
313
|
end
|
309
314
|
|
310
315
|
it "processes subclauses with and without titles" do
|
311
|
-
expect(xmlpp(IsoDoc::Iec::
|
316
|
+
expect(xmlpp(IsoDoc::Iec::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
312
317
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
313
318
|
<sections>
|
314
319
|
<clause id="D" obligation="normative">
|
@@ -322,24 +327,27 @@ OUTPUT
|
|
322
327
|
</sections>
|
323
328
|
</iso-standard>
|
324
329
|
INPUT
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
</
|
339
|
-
</
|
340
|
-
|
341
|
-
|
342
|
-
</
|
330
|
+
<iso-standard xmlns='http://riboseinc.com/isoxml'>
|
331
|
+
<sections>
|
332
|
+
<clause id='D' obligation='normative'>
|
333
|
+
<title depth='1'>
|
334
|
+
1
|
335
|
+
<tab/>
|
336
|
+
Scope
|
337
|
+
</title>
|
338
|
+
<clause id='D1' obligation='normative'>
|
339
|
+
<title depth='2'>
|
340
|
+
1.1
|
341
|
+
<tab/>
|
342
|
+
Scope 1
|
343
|
+
</title>
|
344
|
+
</clause>
|
345
|
+
<clause id='D2' obligation='normative'>
|
346
|
+
<title>1.2</title>
|
347
|
+
</clause>
|
348
|
+
</clause>
|
349
|
+
</sections>
|
350
|
+
</iso-standard>
|
343
351
|
OUTPUT
|
344
352
|
end
|
345
353
|
|
@@ -348,8 +356,9 @@ OUTPUT
|
|
348
356
|
expect(xmlpp(IsoDoc::Iec::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
349
357
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
350
358
|
<sections>
|
351
|
-
<terms id="H" obligation="normative"><title>Terms, Definitions, Symbols and Abbreviated Terms</title>
|
359
|
+
<terms id="H" obligation="normative"><title>1<tab/>Terms, Definitions, Symbols and Abbreviated Terms</title>
|
352
360
|
<term id="J">
|
361
|
+
<name>1.1</name>
|
353
362
|
<preferred>Term2</preferred>
|
354
363
|
</term>
|
355
364
|
</terms>
|
@@ -376,11 +385,12 @@ OUTPUT
|
|
376
385
|
expect(xmlpp(IsoDoc::Iec::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
377
386
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
378
387
|
<sections>
|
379
|
-
<clause id="M" inline-header="false" obligation="normative"><title>Clause 4</title
|
380
|
-
|
388
|
+
<clause id="M" inline-header="false" obligation="normative"><title>1<tab/>Clause 4</title>
|
389
|
+
<clause id="N" inline-header="false" obligation="normative">
|
390
|
+
<title>1.1<tab/>Introduction</title>
|
381
391
|
</clause>
|
382
392
|
<clause id="O" inline-header="true" obligation="normative">
|
383
|
-
<title>Clause 4.2</title>
|
393
|
+
<title>1.2<tab/>Clause 4.2</title>
|
384
394
|
</clause></clause>
|
385
395
|
|
386
396
|
</sections>
|