metanorma-iso 1.7.1 → 1.7.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +0 -4
  3. data/lib/asciidoctor/iso/base.rb +12 -12
  4. data/lib/asciidoctor/iso/cleanup.rb +1 -1
  5. data/lib/asciidoctor/iso/isodoc.rng +19 -1
  6. data/lib/asciidoctor/iso/isostandard-amd.rng +3 -0
  7. data/lib/asciidoctor/iso/isostandard.rng +6 -0
  8. data/lib/metanorma/iso/version.rb +1 -1
  9. data/spec/asciidoctor-iso/amd_spec.rb +575 -573
  10. data/spec/asciidoctor-iso/base_spec.rb +445 -454
  11. data/spec/asciidoctor-iso/blocks_spec.rb +333 -288
  12. data/spec/asciidoctor-iso/cleanup_spec.rb +813 -704
  13. data/spec/asciidoctor-iso/inline_spec.rb +116 -91
  14. data/spec/asciidoctor-iso/lists_spec.rb +128 -121
  15. data/spec/asciidoctor-iso/refs_spec.rb +308 -250
  16. data/spec/asciidoctor-iso/section_spec.rb +273 -242
  17. data/spec/asciidoctor-iso/table_spec.rb +258 -242
  18. data/spec/asciidoctor-iso/validate_spec.rb +1099 -1165
  19. data/spec/isodoc/amd_spec.rb +967 -946
  20. data/spec/isodoc/blocks_spec.rb +530 -507
  21. data/spec/isodoc/i18n_spec.rb +953 -911
  22. data/spec/isodoc/inline_spec.rb +355 -293
  23. data/spec/isodoc/iso_spec.rb +338 -314
  24. data/spec/isodoc/metadata_spec.rb +392 -382
  25. data/spec/isodoc/postproc_spec.rb +833 -656
  26. data/spec/isodoc/ref_spec.rb +374 -331
  27. data/spec/isodoc/section_spec.rb +608 -525
  28. data/spec/isodoc/table_spec.rb +472 -411
  29. data/spec/isodoc/terms_spec.rb +209 -185
  30. data/spec/isodoc/xref_spec.rb +1370 -1236
  31. data/spec/metanorma/processor_spec.rb +28 -26
  32. data/spec/spec_helper.rb +176 -193
  33. metadata +2 -4
  34. data/.rubocop.ribose.yml +0 -66
  35. data/spec/assets/xref_error.adoc +0 -7
@@ -4,572 +4,655 @@ 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
- <preface>
8
- <foreword obligation="informative">
9
- <title>Foreword</title>
10
- <p id="A">This is a preamble</p>
11
- </foreword>
12
- <introduction id="B" obligation="informative"><title>Introduction</title><clause id="C" inline-header="false" obligation="informative">
13
- <title>Introduction Subsection</title>
14
- </clause>
15
- <p>This is patent boilerplate</p>
16
- </introduction></preface><sections>
17
- <clause id="D" obligation="normative" type="scope">
18
- <title>Scope</title>
19
- <p id="E">Text</p>
20
- </clause>
21
-
22
- <clause id="H" obligation="normative"><title>Terms, Definitions, Symbols and Abbreviated Terms</title><terms id="I" obligation="normative">
23
- <title>Normal Terms</title>
24
- <term id="J">
25
- <preferred>Term2</preferred>
26
- </term>
27
- </terms>
28
- <definitions id="K">
29
- <dl>
30
- <dt>Symbol</dt>
31
- <dd>Definition</dd>
32
- </dl>
33
- </definitions>
34
- </clause>
35
- <definitions id="L">
36
- <dl>
37
- <dt>Symbol</dt>
38
- <dd>Definition</dd>
39
- </dl>
40
- </definitions>
41
- <clause id="M" inline-header="false" obligation="normative"><title>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
42
- <title>Introduction</title>
43
- </clause>
44
- <clause id="O" inline-header="false" obligation="normative">
45
- <title>Clause 4.2</title>
46
- </clause></clause>
47
-
48
- </sections><annex id="P" inline-header="false" obligation="normative">
49
- <title>Annex</title>
50
- <clause id="Q" inline-header="false" obligation="normative">
51
- <title>Annex A.1</title>
52
- <clause id="Q1" inline-header="false" obligation="normative">
53
- <title>Annex A.1a</title>
54
- </clause>
55
- </clause>
56
- <appendix id="Q2" inline-header="false" obligation="normative">
57
- <title>An Appendix</title>
58
- <clause id='Q2a' inline-header='false' obligation='normative'>
59
- <title>Appendix subclause</title>
60
- </clause>
61
- </appendix>
62
- <references id="Q3" normative="false"><title>Annex Bibliography</title></references>
63
- </annex><bibliography><references id="R" obligation="informative" normative="true">
64
- <title>Normative References</title>
65
- </references><clause id="S" obligation="informative">
66
- <title>Bibliography</title>
67
- <references id="T" obligation="informative" normative="false">
68
- <title>Bibliography Subsection</title>
69
- </references>
70
- </clause>
71
- </bibliography>
72
- </iso-standard>
7
+ <preface>
8
+ <foreword obligation="informative">
9
+ <title>Foreword</title>
10
+ <p id="A">This is a preamble</p>
11
+ </foreword>
12
+ <introduction id="B" obligation="informative">
13
+ <title>Introduction</title>
14
+ <clause id="C" inline-header="false" obligation="informative">
15
+ <title>Introduction Subsection</title>
16
+ </clause>
17
+ <p>This is patent boilerplate</p>
18
+ </introduction>
19
+ </preface>
20
+ <sections>
21
+ <clause id="D" obligation="normative" type="scope">
22
+ <title>Scope</title>
23
+ <p id="E">Text</p>
24
+ </clause>
25
+ <clause id="H" obligation="normative">
26
+ <title>Terms, Definitions, Symbols and Abbreviated Terms</title>
27
+ <terms id="I" obligation="normative">
28
+ <title>Normal Terms</title>
29
+ <term id="J">
30
+ <preferred>Term2</preferred>
31
+ </term>
32
+ </terms>
33
+ <definitions id="K">
34
+ <dl>
35
+ <dt>Symbol</dt>
36
+ <dd>Definition</dd>
37
+ </dl>
38
+ </definitions>
39
+ </clause>
40
+ <definitions id="L">
41
+ <dl>
42
+ <dt>Symbol</dt>
43
+ <dd>Definition</dd>
44
+ </dl>
45
+ </definitions>
46
+ <clause id="M" inline-header="false" obligation="normative">
47
+ <title>Clause 4</title>
48
+ <clause id="N" inline-header="false" obligation="normative">
49
+ <title>Introduction</title>
50
+ </clause>
51
+ <clause id="O" inline-header="false" obligation="normative">
52
+ <title>Clause 4.2</title>
53
+ </clause>
54
+ </clause>
55
+ </sections>
56
+ <annex id="P" inline-header="false" obligation="normative">
57
+ <title>Annex</title>
58
+ <clause id="Q" inline-header="false" obligation="normative">
59
+ <title>Annex A.1</title>
60
+ <clause id="Q1" inline-header="false" obligation="normative">
61
+ <title>Annex A.1a</title>
62
+ </clause>
63
+ </clause>
64
+ <appendix id="Q2" inline-header="false" obligation="normative">
65
+ <title>An Appendix</title>
66
+ <clause id="Q2a" inline-header="false" obligation="normative">
67
+ <title>Appendix subclause</title>
68
+ </clause>
69
+ </appendix>
70
+ <references id="Q3" normative="false">
71
+ <title>Annex Bibliography</title>
72
+ </references>
73
+ </annex>
74
+ <bibliography>
75
+ <references id="R" normative="true" obligation="informative">
76
+ <title>Normative References</title>
77
+ </references>
78
+ <clause id="S" obligation="informative">
79
+ <title>Bibliography</title>
80
+ <references id="T" normative="false" obligation="informative">
81
+ <title>Bibliography Subsection</title>
82
+ </references>
83
+ </clause>
84
+ </bibliography>
85
+ </iso-standard>
73
86
  INPUT
74
87
 
75
88
  presxml = <<~OUTPUT
76
- <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
77
- <preface>
78
- <foreword obligation='informative'>
79
- <title>Foreword</title>
80
- <p id='A'>This is a preamble</p>
81
- </foreword>
82
- <introduction id='B' obligation='informative'>
83
- <title depth='1'>0<tab/>Introduction</title>
84
- <clause id='C' inline-header='false' obligation='informative'>
85
- <title depth='2'>0.1<tab/>Introduction Subsection</title>
86
- </clause>
87
- <p>This is patent boilerplate</p>
88
- </introduction>
89
- </preface>
90
- <sections>
91
- <clause id='D' obligation='normative' type="scope">
92
- <title depth='1'>1<tab/>Scope</title>
93
- <p id='E'>Text</p>
94
- </clause>
95
- <clause id='H' obligation='normative'>
96
- <title depth='1'>3<tab/>Terms, Definitions, Symbols and Abbreviated Terms</title>
97
- <terms id='I' obligation='normative'>
98
- <title depth='2'>3.1<tab/>Normal Terms</title>
99
- <term id='J'>
100
- <name>3.1.1</name>
101
- <preferred>Term2</preferred>
102
- </term>
103
- </terms>
104
- <definitions id='K' inline-header='true'>
105
- <title>3.2</title>
106
- <dl>
107
- <dt>Symbol</dt>
108
- <dd>Definition</dd>
109
- </dl>
110
- </definitions>
111
- </clause>
112
- <definitions id='L'>
113
- <title>4</title>
114
- <dl>
115
- <dt>Symbol</dt>
116
- <dd>Definition</dd>
117
- </dl>
118
- </definitions>
119
- <clause id='M' inline-header='false' obligation='normative'>
120
- <title depth='1'>5<tab/>Clause 4</title>
121
- <clause id='N' inline-header='false' obligation='normative'>
122
- <title depth='2'>5.1<tab/>Introduction</title>
123
- </clause>
124
- <clause id='O' inline-header='false' obligation='normative'>
125
- <title depth='2'>5.2<tab/>Clause 4.2</title>
126
- </clause>
127
- </clause>
128
- </sections>
129
- <annex id='P' inline-header='false' obligation='normative'>
130
- <title>
131
- <strong>Annex A</strong>
132
- <br/>
133
- (normative)
134
- <br/>
135
- <br/>
136
- <strong>Annex</strong>
137
- </title>
138
- <clause id='Q' inline-header='false' obligation='normative'>
139
- <title depth='2'>A.1<tab/>Annex A.1</title>
140
- <clause id='Q1' inline-header='false' obligation='normative'>
141
- <title depth='3'>A.1.1<tab/>Annex A.1a</title>
142
- </clause>
143
- </clause>
144
- <appendix id='Q2' inline-header='false' obligation='normative'>
145
- <title depth='2'>Appendix 1<tab/>An Appendix</title>
146
- <clause id='Q2a' inline-header='false' obligation='normative'>
147
- <title depth='3'>
148
- Appendix 1.1
149
- <tab/>
150
- Appendix subclause
151
- </title>
152
- </clause>
153
- </appendix>
154
- <references id='Q3' normative='false'>
155
- <title depth='2'>A.2<tab/>Annex Bibliography</title>
156
- </references>
157
- </annex>
158
- <bibliography>
159
- <references id='R' obligation='informative' normative='true'>
160
- <title depth='1'>2<tab/>Normative References</title>
161
- </references>
162
- <clause id='S' obligation='informative'>
163
- <title depth='1'>Bibliography</title>
164
- <references id='T' obligation='informative' normative='false'>
165
- <title depth='2'>Bibliography Subsection</title>
166
- </references>
167
- </clause>
168
- </bibliography>
169
- </iso-standard>
170
- OUTPUT
89
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
90
+ <preface>
91
+ <foreword obligation='informative'>
92
+ <title>Foreword</title>
93
+ <p id='A'>This is a preamble</p>
94
+ </foreword>
95
+ <introduction id='B' obligation='informative'>
96
+ <title depth='1'>0<tab/>Introduction</title>
97
+ <clause id='C' inline-header='false' obligation='informative'>
98
+ <title depth='2'>0.1<tab/>Introduction Subsection</title>
99
+ </clause>
100
+ <p>This is patent boilerplate</p>
101
+ </introduction>
102
+ </preface>
103
+ <sections>
104
+ <clause id='D' obligation='normative' type="scope">
105
+ <title depth='1'>1<tab/>Scope</title>
106
+ <p id='E'>Text</p>
107
+ </clause>
108
+ <clause id='H' obligation='normative'>
109
+ <title depth='1'>3<tab/>Terms, Definitions, Symbols and Abbreviated Terms</title>
110
+ <terms id='I' obligation='normative'>
111
+ <title depth='2'>3.1<tab/>Normal Terms</title>
112
+ <term id='J'>
113
+ <name>3.1.1</name>
114
+ <preferred>Term2</preferred>
115
+ </term>
116
+ </terms>
117
+ <definitions id='K' inline-header='true'>
118
+ <title>3.2</title>
119
+ <dl>
120
+ <dt>Symbol</dt>
121
+ <dd>Definition</dd>
122
+ </dl>
123
+ </definitions>
124
+ </clause>
125
+ <definitions id='L'>
126
+ <title>4</title>
127
+ <dl>
128
+ <dt>Symbol</dt>
129
+ <dd>Definition</dd>
130
+ </dl>
131
+ </definitions>
132
+ <clause id='M' inline-header='false' obligation='normative'>
133
+ <title depth='1'>5<tab/>Clause 4</title>
134
+ <clause id='N' inline-header='false' obligation='normative'>
135
+ <title depth='2'>5.1<tab/>Introduction</title>
136
+ </clause>
137
+ <clause id='O' inline-header='false' obligation='normative'>
138
+ <title depth='2'>5.2<tab/>Clause 4.2</title>
139
+ </clause>
140
+ </clause>
141
+ </sections>
142
+ <annex id='P' inline-header='false' obligation='normative'>
143
+ <title>
144
+ <strong>Annex A</strong>
145
+ <br/>
146
+ (normative)
147
+ <br/>
148
+ <br/>
149
+ <strong>Annex</strong>
150
+ </title>
151
+ <clause id='Q' inline-header='false' obligation='normative'>
152
+ <title depth='2'>A.1<tab/>Annex A.1</title>
153
+ <clause id='Q1' inline-header='false' obligation='normative'>
154
+ <title depth='3'>A.1.1<tab/>Annex A.1a</title>
155
+ </clause>
156
+ </clause>
157
+ <appendix id='Q2' inline-header='false' obligation='normative'>
158
+ <title depth='2'>Appendix 1<tab/>An Appendix</title>
159
+ <clause id='Q2a' inline-header='false' obligation='normative'>
160
+ <title depth='3'>
161
+ Appendix 1.1
162
+ <tab/>
163
+ Appendix subclause
164
+ </title>
165
+ </clause>
166
+ </appendix>
167
+ <references id='Q3' normative='false'>
168
+ <title depth='2'>A.2<tab/>Annex Bibliography</title>
169
+ </references>
170
+ </annex>
171
+ <bibliography>
172
+ <references id='R' obligation='informative' normative='true'>
173
+ <title depth='1'>2<tab/>Normative References</title>
174
+ </references>
175
+ <clause id='S' obligation='informative'>
176
+ <title depth='1'>Bibliography</title>
177
+ <references id='T' obligation='informative' normative='false'>
178
+ <title depth='2'>Bibliography Subsection</title>
179
+ </references>
180
+ </clause>
181
+ </bibliography>
182
+ </iso-standard>
183
+ OUTPUT
171
184
 
172
185
  html = <<~OUTPUT
173
- #{HTML_HDR}
186
+ #{HTML_HDR}
187
+ <br/>
188
+ <div>
189
+ <h1 class="ForewordTitle">Foreword</h1>
190
+ <p id="A">This is a preamble</p>
191
+ </div>
192
+ <br/>
193
+ <div class="Section3" id="B">
194
+ <h1 class="IntroTitle">0&#160; Introduction</h1>
195
+ <div id="C">
196
+ <h2>0.1&#160; Introduction Subsection</h2>
197
+ </div>
198
+ <p>This is patent boilerplate</p>
199
+ </div>
200
+ <p class="zzSTDTitle1"/>
201
+ <div id="D">
202
+ <h1>1&#160; Scope</h1>
203
+ <p id="E">Text</p>
204
+ </div>
205
+ <div>
206
+ <h1>2&#160; Normative References</h1>
207
+ </div>
208
+ <div id="H">
209
+ <h1>3&#160; Terms, Definitions, Symbols and Abbreviated Terms</h1>
210
+ <div id="I">
211
+ <h2>3.1&#160; Normal Terms</h2>
212
+ <p class="TermNum" id="J">3.1.1</p>
213
+ <p class="Terms" style="text-align:left;">Term2</p>
214
+ </div>
215
+ <div id="K">
216
+ <span class="zzMoveToFollowing">
217
+ <b>3.2&#160; </b>
218
+ </span>
219
+ <dl>
220
+ <dt>
221
+ <p>Symbol</p>
222
+ </dt>
223
+ <dd>Definition</dd>
224
+ </dl>
225
+ </div>
226
+ </div>
227
+ <div class="Symbols" id="L">
228
+ <h1>4</h1>
229
+ <dl>
230
+ <dt>
231
+ <p>Symbol</p>
232
+ </dt>
233
+ <dd>Definition</dd>
234
+ </dl>
235
+ </div>
236
+ <div id="M">
237
+ <h1>5&#160; Clause 4</h1>
238
+ <div id="N">
239
+ <h2>5.1&#160; Introduction</h2>
240
+ </div>
241
+ <div id="O">
242
+ <h2>5.2&#160; Clause 4.2</h2>
243
+ </div>
244
+ </div>
245
+ <br/>
246
+ <div class="Section3" id="P">
247
+ <h1 class="Annex">
248
+ <b>Annex A</b>
249
+ <br/>(normative)
174
250
  <br/>
175
- <div>
176
- <h1 class="ForewordTitle">Foreword</h1>
177
- <p id="A">This is a preamble</p>
178
- </div>
179
251
  <br/>
180
- <div class="Section3" id="B">
181
- <h1 class="IntroTitle">0&#160; Introduction</h1>
182
- <div id="C">
183
- <h2>0.1&#160; Introduction Subsection</h2>
184
- </div>
185
- <p>This is patent boilerplate</p>
186
- </div>
187
- <p class="zzSTDTitle1"/>
188
- <div id="D">
189
- <h1>1&#160; Scope</h1>
190
- <p id="E">Text</p>
252
+ <b>Annex</b></h1>
253
+ <div id="Q">
254
+ <h2>A.1&#160; Annex A.1</h2>
255
+ <div id="Q1">
256
+ <h3>A.1.1&#160; Annex A.1a</h3>
191
257
  </div>
192
- <div>
193
- <h1>2&#160; Normative References</h1>
194
- </div>
195
- <div id="H"><h1>3&#160; Terms, Definitions, Symbols and Abbreviated Terms</h1>
196
- <div id="I">
197
- <h2>3.1&#160; Normal Terms</h2>
198
- <p class="TermNum" id="J">3.1.1</p>
199
- <p class="Terms" style="text-align:left;">Term2</p>
200
-
201
- </div><div id="K"><span class='zzMoveToFollowing'>
202
- <b>3.2&#160; </b>
203
- </span>
204
- <dl><dt><p>Symbol</p></dt><dd>Definition</dd></dl>
205
- </div></div>
206
- <div id="L" class="Symbols">
207
- <h1>4</h1>
208
- <dl>
209
- <dt>
210
- <p>Symbol</p>
211
- </dt>
212
- <dd>Definition</dd>
213
- </dl>
214
- </div>
215
- <div id="M">
216
- <h1>5&#160; Clause 4</h1>
217
- <div id="N">
218
- <h2>5.1&#160; Introduction</h2>
219
- </div>
220
- <div id="O">
221
- <h2>5.2&#160; Clause 4.2</h2>
222
- </div>
223
- </div>
224
- <br/>
225
- <div id="P" class="Section3">
226
- <h1 class="Annex"><b>Annex A</b><br/>(normative)<br/><br/><b>Annex</b></h1>
227
- <div id="Q">
228
- <h2>A.1&#160; Annex A.1</h2>
229
- <div id="Q1">
230
- <h3>A.1.1&#160; Annex A.1a</h3>
231
- </div>
232
- </div>
233
- <div id="Q2">
258
+ </div>
259
+ <div id="Q2">
234
260
  <h2>Appendix 1&#160; An Appendix</h2>
235
- <div id='Q2a'>
236
- <h3> Appendix 1.1 &#160; Appendix subclause </h3>
237
- </div>
261
+ <div id="Q2a">
262
+ <h3>Appendix 1.1 &#160; Appendix subclause </h3>
238
263
  </div>
239
- <div>
264
+ </div>
265
+ <div>
240
266
  <h2 class="Section3">A.2&#160; Annex Bibliography</h2>
241
- </div>
242
-
243
- </div>
244
- <br/>
245
- <div>
246
- <h1 class="Section3">Bibliography</h1>
247
- <div>
248
- <h2 class="Section3">Bibliography Subsection</h2>
249
- </div>
250
- </div>
251
267
  </div>
252
- </body>
253
- </html>
254
- OUTPUT
268
+ </div>
269
+ <br/>
270
+ <div>
271
+ <h1 class="Section3">Bibliography</h1>
272
+ <div>
273
+ <h2 class="Section3">Bibliography Subsection</h2>
274
+ </div>
275
+ </div>
276
+ </div>
277
+ </body>
278
+ </html>
279
+ OUTPUT
255
280
 
256
281
  word = <<~OUTPUT
257
- <body lang="EN-US" link="blue" vlink="#954F72">
258
- <div class="WordSection1">
259
- <p>&#160;</p>
260
- </div>
261
- <p><br clear="all" class="section"/></p>
262
- <div class="WordSection2">
263
- <p><br clear="all" style="mso-special-character:line-break;page-break-before:always"/></p>
264
- <div>
265
- <h1 class="ForewordTitle">Foreword</h1>
266
- <p id="A">This is a preamble</p>
267
- </div>
268
- <p><br clear="all" style="mso-special-character:line-break;page-break-before:always"/></p>
269
- <div class="Section3" id="B">
270
- <h1 class="IntroTitle">0<span style="mso-tab-count:1">&#160; </span>Introduction</h1>
271
- <div id="C">
272
- <h2>0.1<span style="mso-tab-count:1">&#160; </span>Introduction Subsection</h2>
273
- </div>
274
- <p>This is patent boilerplate</p>
275
- </div>
276
- <p>&#160;</p>
277
- </div>
278
- <p><br clear="all" class="section"/></p>
279
- <div class="WordSection3">
280
- <p class="zzSTDTitle1"/>
281
- <div id="D">
282
- <h1>1<span style="mso-tab-count:1">&#160; </span>Scope</h1>
283
- <p id="E">Text</p>
284
- </div>
285
- <div>
286
- <h1>2<span style="mso-tab-count:1">&#160; </span>Normative References</h1>
287
- </div>
288
- <div id="H"><h1>3<span style="mso-tab-count:1">&#160; </span>Terms, Definitions, Symbols and Abbreviated Terms</h1>
289
- <div id="I">
290
- <h2>3.1<span style="mso-tab-count:1">&#160; </span>Normal Terms</h2>
291
- <p class="TermNum" id="J">3.1.1</p>
292
- <p class="Terms" style="text-align:left;">Term2</p>
293
-
294
- </div><div id="K">
295
- <span class='zzMoveToFollowing'>
296
- <b>
297
- 3.2
298
- <span style='mso-tab-count:1'>&#160; </span>
299
- </b>
300
- </span>
301
- <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>
302
- </div></div>
303
- <div id="L" class="Symbols">
304
- <h1>4</h1>
305
- <table class="dl">
306
- <tr>
307
- <td valign="top" align="left">
308
- <p align="left" style="margin-left:0pt;text-align:left;">Symbol</p>
309
- </td>
310
- <td valign="top">Definition</td>
311
- </tr>
312
- </table>
313
- </div>
314
- <div id="M">
315
- <h1>5<span style="mso-tab-count:1">&#160; </span>Clause 4</h1>
316
- <div id="N">
317
- <h2>5.1<span style="mso-tab-count:1">&#160; </span>Introduction</h2>
318
- </div>
319
- <div id="O">
320
- <h2>5.2<span style="mso-tab-count:1">&#160; </span>Clause 4.2</h2>
282
+ <body lang="EN-US" link="blue" vlink="#954F72">
283
+ <div class="WordSection1">
284
+ <p> </p>
321
285
  </div>
322
- </div>
323
- <p><br clear="all" style="mso-special-character:line-break;page-break-before:always"/></p>
324
- <div id="P" class="Section3">
325
- <h1 class="Annex"><b>Annex A</b><br/>(normative)<br/><br/><b>Annex</b></h1>
326
- <div id="Q">
327
- <h2>A.1<span style="mso-tab-count:1">&#160; </span>Annex A.1</h2>
328
- <div id="Q1">
329
- <h3>A.1.1<span style="mso-tab-count:1">&#160; </span>Annex A.1a</h3>
286
+ <p>
287
+ <br class="section" clear="all"/>
288
+ </p>
289
+ <div class="WordSection2">
290
+ <p>
291
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
292
+ </p>
293
+ <div>
294
+ <h1 class="ForewordTitle">Foreword</h1>
295
+ <p id="A">This is a preamble</p>
330
296
  </div>
297
+ <p>
298
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
299
+ </p>
300
+ <div class="Section3" id="B">
301
+ <h1 class="IntroTitle">0
302
+ <span style="mso-tab-count:1">&#160; </span>
303
+ Introduction</h1>
304
+ <div id="C">
305
+ <h2>0.1
306
+ <span style="mso-tab-count:1">&#160; </span>
307
+ Introduction Subsection</h2>
308
+ </div>
309
+ <p>This is patent boilerplate</p>
310
+ </div>
311
+ <p> </p>
331
312
  </div>
332
- <div id="Q2">
333
- <h2>Appendix 1<span style="mso-tab-count:1">&#160; </span>An Appendix</h2>
334
- <div id='Q2a'>
335
- <h3>
336
- Appendix 1.1
337
- <span style='mso-tab-count:1'>&#160; </span>
338
- Appendix subclause
339
- </h3>
340
- </div>
313
+ <p>
314
+ <br class="section" clear="all"/>
315
+ </p>
316
+ <div class="WordSection3">
317
+ <p class="zzSTDTitle1"/>
318
+ <div id="D">
319
+ <h1>1
320
+ <span style="mso-tab-count:1">&#160; </span>
321
+ Scope</h1>
322
+ <p id="E">Text</p>
323
+ </div>
324
+ <div>
325
+ <h1>2
326
+ <span style="mso-tab-count:1">&#160; </span>
327
+ Normative References</h1>
328
+ </div>
329
+ <div id="H">
330
+ <h1>3
331
+ <span style="mso-tab-count:1">&#160; </span>
332
+ Terms, Definitions, Symbols and Abbreviated Terms</h1>
333
+ <div id="I">
334
+ <h2>3.1
335
+ <span style="mso-tab-count:1">&#160; </span>
336
+ Normal Terms</h2>
337
+ <p class="TermNum" id="J">3.1.1</p>
338
+ <p class="Terms" style="text-align:left;">Term2</p>
339
+ </div>
340
+ <div id="K">
341
+ <span class="zzMoveToFollowing">
342
+ <b>3.2
343
+ <span style="mso-tab-count:1">&#160; </span></b>
344
+ </span>
345
+ <table class="dl">
346
+ <tr>
347
+ <td align="left" valign="top">
348
+ <p align="left" style="margin-left:0pt;text-align:left;">Symbol</p>
349
+ </td>
350
+ <td valign="top">Definition</td>
351
+ </tr>
352
+ </table>
353
+ </div>
354
+ </div>
355
+ <div class="Symbols" id="L">
356
+ <h1>4</h1>
357
+ <table class="dl">
358
+ <tr>
359
+ <td align="left" valign="top">
360
+ <p align="left" style="margin-left:0pt;text-align:left;">Symbol</p>
361
+ </td>
362
+ <td valign="top">Definition</td>
363
+ </tr>
364
+ </table>
365
+ </div>
366
+ <div id="M">
367
+ <h1>5
368
+ <span style="mso-tab-count:1">&#160; </span>
369
+ Clause 4</h1>
370
+ <div id="N">
371
+ <h2>5.1
372
+ <span style="mso-tab-count:1">&#160; </span>
373
+ Introduction</h2>
374
+ </div>
375
+ <div id="O">
376
+ <h2>5.2
377
+ <span style="mso-tab-count:1">&#160; </span>
378
+ Clause 4.2</h2>
379
+ </div>
380
+ </div>
381
+ <p>
382
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
383
+ </p>
384
+ <div class="Section3" id="P">
385
+ <h1 class="Annex">
386
+ <b>Annex A</b>
387
+ <br/>(normative)
388
+ <br/>
389
+ <br/>
390
+ <b>Annex</b></h1>
391
+ <div id="Q">
392
+ <h2>A.1
393
+ <span style="mso-tab-count:1">&#160; </span>
394
+ Annex A.1</h2>
395
+ <div id="Q1">
396
+ <h3>A.1.1
397
+ <span style="mso-tab-count:1">&#160; </span>
398
+ Annex A.1a</h3>
399
+ </div>
400
+ </div>
401
+ <div id="Q2">
402
+ <h2>Appendix 1
403
+ <span style="mso-tab-count:1">&#160; </span>
404
+ An Appendix</h2>
405
+ <div id="Q2a">
406
+ <h3>Appendix 1.1
407
+ <span style="mso-tab-count:1">&#160; </span>
408
+ Appendix subclause</h3>
409
+ </div>
410
+ </div>
411
+ <div>
412
+ <h2 class="Section3">A.2
413
+ <span style="mso-tab-count:1">&#160; </span>
414
+ Annex Bibliography</h2>
415
+ </div>
416
+ </div>
417
+ <p>
418
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
419
+ </p>
420
+ <div>
421
+ <h1 class="Section3">Bibliography</h1>
422
+ <div>
423
+ <h2 class="Section3">Bibliography Subsection</h2>
424
+ </div>
341
425
  </div>
342
- <div>
343
- <h2 class='Section3'>
344
- A.2
345
- <span style='mso-tab-count:1'>&#160; </span>
346
- Annex Bibliography
347
- </h2>
348
426
  </div>
349
- </div>
350
- <p><br clear="all" style="mso-special-character:line-break;page-break-before:always"/></p>
351
- <div>
352
- <h1 class="Section3">Bibliography</h1>
353
- <div>
354
- <h2 class="Section3">Bibliography Subsection</h2>
355
- </div>
356
- </div>
357
- </div>
358
- <br clear="all" style="page-break-before:left;mso-break-type:section-break"/>
359
- <div class="colophon"/>
360
- </body>
361
- OUTPUT
362
- expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
363
- expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
364
- expect(xmlpp(IsoDoc::Iso::WordConvert.new({}).convert("test", presxml, true).sub(/^.*<body /m, "<body ").sub(%r{</body>.*$}m, "</body>"))).to be_equivalent_to xmlpp(word)
427
+ <br clear="all" style="page-break-before:left;mso-break-type:section-break"/>
428
+ <div class="colophon"/>
429
+ </body>
430
+ OUTPUT
431
+ expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({}).convert("test", input, true)))
432
+ .to be_equivalent_to xmlpp(presxml)
433
+ expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({}).convert("test", presxml, true)))
434
+ .to be_equivalent_to xmlpp(html)
435
+ expect(xmlpp(IsoDoc::Iso::WordConvert.new({}).convert("test", presxml, true)
436
+ .sub(/^.*<body /m, "<body ").sub(%r{</body>.*$}m, "</body>"))).to be_equivalent_to xmlpp(word)
365
437
  end
366
438
 
367
- it "processes subclauses with and without titles" do
368
- input = <<~INPUT
439
+ it "processes subclauses with and without titles" do
440
+ input = <<~INPUT
369
441
  <iso-standard xmlns="http://riboseinc.com/isoxml">
370
- <sections>
371
- <clause id="D" obligation="normative">
372
- <title>Scope</title>
373
- <clause id="D1" obligation="normative">
374
- <title>Scope 1</title>
375
- </clause>
376
- <clause id="D2" obligation="normative">
377
- </clause>
378
- </clause>
379
- </sections>
380
- </iso-standard>
381
- INPUT
442
+ <sections>
443
+ <clause id="D" obligation="normative">
444
+ <title>Scope</title>
445
+ <clause id="D1" obligation="normative">
446
+ <title>Scope 1</title>
447
+ </clause>
448
+ <clause id="D2" obligation="normative">
449
+ </clause>
450
+ </clause>
451
+ </sections>
452
+ </iso-standard>
453
+ INPUT
382
454
 
383
- presxml = <<~OUTPUT
384
- <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
385
- <sections>
386
- <clause id='D' obligation='normative'>
387
- <title depth='1'>1<tab/>Scope</title>
388
- <clause id='D1' obligation='normative'>
389
- <title depth='2'>1.1<tab/>Scope 1</title>
390
- </clause>
391
- <clause id='D2' obligation='normative' inline-header="true">
392
- <title>1.2</title>
393
- </clause>
394
- </clause>
395
- </sections>
396
- </iso-standard>
397
- OUTPUT
455
+ presxml = <<~OUTPUT
456
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
457
+ <sections>
458
+ <clause id='D' obligation='normative'>
459
+ <title depth='1'>1<tab/>Scope</title>
460
+ <clause id='D1' obligation='normative'>
461
+ <title depth='2'>1.1<tab/>Scope 1</title>
462
+ </clause>
463
+ <clause id='D2' obligation='normative' inline-header="true">
464
+ <title>1.2</title>
465
+ </clause>
466
+ </clause>
467
+ </sections>
468
+ </iso-standard>
469
+ OUTPUT
398
470
 
399
- html = <<~OUTPUT
400
- <html xmlns:epub='http://www.idpf.org/2007/ops' lang='en'>
401
- <head/>
402
- <body lang='en'>
403
- <div class='title-section'>
404
- <p>&#160;</p>
405
- </div>
406
- <br/>
407
- <div class='prefatory-section'>
408
- <p>&#160;</p>
409
- </div>
410
- <br/>
411
- <div class='main-section'>
412
- <p class='zzSTDTitle1'/>
413
- <div id='D'>
414
- <h1>1&#160; Scope</h1>
415
- <div id='D1'>
416
- <h2>1.1&#160; Scope 1</h2>
417
- </div>
418
- <div id='D2'>
419
- <span class='zzMoveToFollowing'>
420
- <b>1.2&#160; </b>
421
- </span>
422
- </div>
423
- </div>
424
- </div>
425
- </body>
426
- </html>
427
- OUTPUT
428
- expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
429
- expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
430
- end
471
+ html = <<~OUTPUT
472
+ <html xmlns:epub='http://www.idpf.org/2007/ops' lang='en'>
473
+ <head/>
474
+ <body lang='en'>
475
+ <div class='title-section'>
476
+ <p>&#160;</p>
477
+ </div>
478
+ <br/>
479
+ <div class='prefatory-section'>
480
+ <p>&#160;</p>
481
+ </div>
482
+ <br/>
483
+ <div class='main-section'>
484
+ <p class='zzSTDTitle1'/>
485
+ <div id='D'>
486
+ <h1>1&#160; Scope</h1>
487
+ <div id='D1'>
488
+ <h2>1.1&#160; Scope 1</h2>
489
+ </div>
490
+ <div id='D2'>
491
+ <span class='zzMoveToFollowing'>
492
+ <b>1.2&#160; </b>
493
+ </span>
494
+ </div>
495
+ </div>
496
+ </div>
497
+ </body>
498
+ </html>
499
+ OUTPUT
500
+ expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({}).convert("test", input, true)))
501
+ .to be_equivalent_to xmlpp(presxml)
502
+ expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({}).convert("test", presxml, true)))
503
+ .to be_equivalent_to xmlpp(html)
504
+ end
431
505
 
432
506
  it "processes simple terms & definitions" do
433
- expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
434
- <iso-standard xmlns="http://riboseinc.com/isoxml">
435
- <sections>
436
- <terms id="H" obligation="normative"><title>Terms, Definitions, Symbols and Abbreviated Terms</title>
437
- <term id="J"><name>1.1</name>
438
- <preferred>Term2</preferred>
439
- </term>
440
- </terms>
441
- </sections>
507
+ expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({})
508
+ .convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
509
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
510
+ <sections>
511
+ <terms id="H" obligation="normative">
512
+ <title>Terms, Definitions, Symbols and Abbreviated Terms</title>
513
+ <term id="J">
514
+ <name>1.1</name>
515
+ <preferred>Term2</preferred>
516
+ </term>
517
+ </terms>
518
+ </sections>
442
519
  </iso-standard>
443
- INPUT
444
- #{HTML_HDR}
445
- <p class="zzSTDTitle1"/>
446
- <div id="H"><h1>Terms, Definitions, Symbols and Abbreviated Terms</h1>
447
- <p class="TermNum" id="J">1.1</p>
448
- <p class="Terms" style="text-align:left;">Term2</p>
449
- </div>
450
- </div>
451
- </body>
452
- </html>
453
- OUTPUT
520
+ INPUT
521
+ #{HTML_HDR}
522
+ <p class="zzSTDTitle1"/>
523
+ <div id="H">
524
+ <h1>Terms, Definitions, Symbols and Abbreviated Terms</h1>
525
+ <p class="TermNum" id="J">1.1</p>
526
+ <p class="Terms" style="text-align:left;">Term2</p>
527
+ </div>
528
+ </div>
529
+ </body>
530
+ </html>
531
+ OUTPUT
454
532
  end
455
533
 
456
- it "processes inline section headers" do
457
- expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
534
+ it "processes inline section headers" do
535
+ output = IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true)
458
536
  <iso-standard xmlns="http://riboseinc.com/isoxml">
459
- <sections>
460
- <clause id="M" inline-header="false" obligation="normative"><title>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
461
- <title>Introduction</title>
462
- </clause>
463
- <clause id="O" inline-header="true" obligation="normative">
464
- <title>Clause 4.2</title>
465
- <p>Hello</p>
466
- </clause></clause>
467
-
468
- </sections>
537
+ <sections>
538
+ <clause id="M" inline-header="false" obligation="normative">
539
+ <title>Clause 4</title>
540
+ <clause id="N" inline-header="false" obligation="normative">
541
+ <title>Introduction</title>
542
+ </clause>
543
+ <clause id="O" inline-header="true" obligation="normative">
544
+ <title>Clause 4.2</title>
545
+ <p>Hello</p>
546
+ </clause>
547
+ </clause>
548
+ </sections>
469
549
  </iso-standard>
470
550
  INPUT
471
- #{HTML_HDR}
472
- <p class="zzSTDTitle1"/>
473
- <div id="M">
474
- <h1>Clause 4</h1>
475
- <div id="N">
476
- <h2>Introduction</h2>
477
- </div>
478
- <div id="O">
479
- <span class="zzMoveToFollowing"><b>Clause 4.2&#160; </b></span>
480
- <p>Hello</p>
481
- </div>
482
- </div>
483
- </div>
484
- </body>
485
- </html>
486
- OUTPUT
487
- end
551
+ expect(xmlpp(output)).to be_equivalent_to xmlpp(<<~"OUTPUT")
552
+ #{HTML_HDR}
553
+ <p class="zzSTDTitle1"/>
554
+ <div id="M">
555
+ <h1>Clause 4</h1>
556
+ <div id="N">
557
+ <h2>Introduction</h2>
558
+ </div>
559
+ <div id="O">
560
+ <span class="zzMoveToFollowing"><b>Clause 4.2&#160; </b></span>
561
+ <p>Hello</p>
562
+ </div>
563
+ </div>
564
+ </div>
565
+ </body>
566
+ </html>
567
+ OUTPUT
568
+ end
488
569
 
489
- it "adds colophon to published standard (Word)" do
490
- expect(xmlpp(IsoDoc::Iso::WordConvert.new({}).convert("test", <<~"INPUT", true).sub(/^.*<body /m, "<body ").sub(%r{</body>.*$}m, "</body>"))).to be_equivalent_to xmlpp(<<~"OUTPUT")
570
+ it "adds colophon to published standard (Word)" do
571
+ output = IsoDoc::Iso::WordConvert.new({}).convert("test", <<~"INPUT", true)
491
572
  <iso-standard xmlns="http://riboseinc.com/isoxml">
492
- <bibdata>
493
- <status>
494
- <stage>60</stage>
495
- </status>
496
- </bibdata>
497
- <sections>
498
- </sections>
573
+ <bibdata>
574
+ <status>
575
+ <stage>60</stage>
576
+ </status>
577
+ </bibdata>
578
+ <sections/>
499
579
  </iso-standard>
500
- INPUT
501
- <body lang="EN-US" link="blue" vlink="#954F72">
502
- <div class="WordSection1">
503
- <p>&#160;</p>
504
- </div>
505
- <p><br clear="all" class="section"/></p>
506
- <div class="WordSection2">
507
- <p>&#160;</p>
508
- </div>
509
- <p><br clear="all" class="section"/></p>
510
- <div class="WordSection3">
511
- <p class="zzSTDTitle1"/>
512
- </div>
513
- <br clear="all" style="page-break-before:left;mso-break-type:section-break"/>
514
- <div class="colophon"/>
515
- </body>
580
+ INPUT
581
+ expect(xmlpp(output.sub(/^.*<body /m, "<body ").sub(%r{</body>.*$}m, "</body>")))
582
+ .to be_equivalent_to xmlpp(<<~"OUTPUT")
583
+ <body lang="EN-US" link="blue" vlink="#954F72">
584
+ <div class="WordSection1">
585
+ <p>&#160;</p>
586
+ </div>
587
+ <p><br clear="all" class="section"/></p>
588
+ <div class="WordSection2">
589
+ <p>&#160;</p>
590
+ </div>
591
+ <p><br clear="all" class="section"/></p>
592
+ <div class="WordSection3">
593
+ <p class="zzSTDTitle1"/>
594
+ </div>
595
+ <br clear="all" style="page-break-before:left;mso-break-type:section-break"/>
596
+ <div class="colophon"/>
597
+ </body>
516
598
  OUTPUT
517
- end
599
+ end
518
600
 
519
- it "does not add colophon to draft standard (Word)" do
520
- expect(xmlpp(IsoDoc::Iso::WordConvert.new({}).convert("test", <<~"INPUT", true).sub(/^.*<body /m, "<body ").sub(%r{</body>.*$}m, "</body>"))).to be_equivalent_to xmlpp(<<~"OUTPUT")
601
+ it "does not add colophon to draft standard (Word)" do
602
+ output = IsoDoc::Iso::WordConvert.new({}).convert("test", <<~"INPUT", true)
521
603
  <iso-standard xmlns="http://riboseinc.com/isoxml">
522
- <bibdata>
523
- <status>
524
- <stage>30</stage>
525
- </status>
526
- </bibdata>
527
- <sections>
528
- </sections>
604
+ <bibdata>
605
+ <status>
606
+ <stage>30</stage>
607
+ </status>
608
+ </bibdata>
609
+ <sections/>
529
610
  </iso-standard>
611
+ INPUT
612
+ expect(xmlpp(output.sub(/^.*<body /m, "<body ").sub(%r{</body>.*$}m, "</body>")))
613
+ .to be_equivalent_to xmlpp(<<~"OUTPUT")
614
+ <body lang="EN-US" link="blue" vlink="#954F72">
615
+ <div class="WordSection1">
616
+ <p>&#160;</p>
617
+ </div>
618
+ <p><br clear="all" class="section"/></p>
619
+ <div class="WordSection2">
620
+ <p>&#160;</p>
621
+ </div>
622
+ <p><br clear="all" class="section"/></p>
623
+ <div class="WordSection3">
624
+ <p class="zzSTDTitle1"/>
625
+ </div>
626
+ </body>
627
+ OUTPUT
628
+ end
629
+
630
+ it "processes middle title" do
631
+ expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({})
632
+ .convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
633
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
634
+ <bibdata>
635
+ <title format="text/plain" language="en" type="title-intro">Introduction</title>
636
+ <title format="text/plain" language="en" type="title-main">Main Title — Title</title>
637
+ <title format="text/plain" language="en" type="title-part">Title Part</title>
638
+ <ext>
639
+ <structuredidentifier>
640
+ <project-number origyr="2016-05-01" part="1">17301</project-number>
641
+ </structuredidentifier>
642
+ </ext>
643
+ </bibdata>
644
+ <sections/>
645
+ </iso-standard>
530
646
  INPUT
531
- <body lang="EN-US" link="blue" vlink="#954F72">
532
- <div class="WordSection1">
533
- <p>&#160;</p>
534
- </div>
535
- <p><br clear="all" class="section"/></p>
536
- <div class="WordSection2">
537
- <p>&#160;</p>
538
- </div>
539
- <p><br clear="all" class="section"/></p>
540
- <div class="WordSection3">
541
- <p class="zzSTDTitle1"/>
647
+ #{HTML_HDR}
648
+ <p class='zzSTDTitle1'>Introduction &#8212; Main Title&#8201;&#8212;&#8201;Title &#8212; </p>
649
+ <p class='zzSTDTitle2'>
650
+ Part&#160;1:
651
+ <br/><b>Title Part</b>
652
+ </p>
542
653
  </div>
543
654
  </body>
655
+ </html>
544
656
  OUTPUT
545
- end
546
-
547
- it "processes middle title" do
548
- expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
549
- <iso-standard xmlns="http://riboseinc.com/isoxml">
550
- <bibdata>
551
- <title language='en' format='text/plain' type='title-intro'>Introduction</title>
552
- <title language='en' format='text/plain' type='title-main'>Main Title — Title</title>
553
- <title language='en' format='text/plain' type='title-part'>Title Part</title>
554
- <ext>
555
- <structuredidentifier>
556
- <project-number part='1' origyr='2016-05-01'>17301</project-number>
557
- </structuredidentifier>
558
- </ext>
559
- </bibdata>
560
- <sections/>
561
- </iso-standard>
562
- INPUT
563
- #{HTML_HDR}
564
- <p class='zzSTDTitle1'>Introduction &#8212; Main Title&#8201;&#8212;&#8201;Title &#8212; </p>
565
- <p class='zzSTDTitle2'>
566
- Part&#160;1:
567
- <br/><b>Title Part</b>
568
- </p>
569
- </div>
570
- </body>
571
- </html>
572
- OUTPUT
573
- end
574
-
657
+ end
575
658
  end