metanorma-iso 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. checksums.yaml +7 -0
  2. data/.gitattributes +4 -0
  3. data/.gitignore +11 -0
  4. data/.hound.yml +3 -0
  5. data/.oss-guides.rubocop.yml +1077 -0
  6. data/.rubocop.ribose.yml +66 -0
  7. data/.rubocop.tb.yml +650 -0
  8. data/.rubocop.yml +15 -0
  9. data/.travis.yml +21 -0
  10. data/CODE_OF_CONDUCT.md +46 -0
  11. data/Gemfile +7 -0
  12. data/LICENSE +25 -0
  13. data/Makefile +39 -0
  14. data/README.adoc +882 -0
  15. data/Rakefile +6 -0
  16. data/asciidoctor-iso.gemspec.old +50 -0
  17. data/bin/rspec +18 -0
  18. data/docs/customisation.adoc +186 -0
  19. data/docs/guidance.adoc +436 -0
  20. data/docs/htmloutput.adoc +115 -0
  21. data/docs/quickstart.adoc +375 -0
  22. data/lib/asciidoctor-iso.rb +11 -0
  23. data/lib/asciidoctor/iso/base.rb +48 -0
  24. data/lib/asciidoctor/iso/biblio.rng +836 -0
  25. data/lib/asciidoctor/iso/cleanup.rb +39 -0
  26. data/lib/asciidoctor/iso/converter.rb +19 -0
  27. data/lib/asciidoctor/iso/front.rb +131 -0
  28. data/lib/asciidoctor/iso/isodoc.rng +1059 -0
  29. data/lib/asciidoctor/iso/isostandard.rnc +176 -0
  30. data/lib/asciidoctor/iso/isostandard.rng +1001 -0
  31. data/lib/asciidoctor/iso/section.rb +72 -0
  32. data/lib/asciidoctor/iso/validate.rb +190 -0
  33. data/lib/asciidoctor/iso/validate_requirements.rb +105 -0
  34. data/lib/asciidoctor/iso/validate_section.rb +214 -0
  35. data/lib/asciidoctor/iso/validate_style.rb +134 -0
  36. data/lib/asciidoctor/iso/version.rb +5 -0
  37. data/lib/isodoc/iso/html/header.html +206 -0
  38. data/lib/isodoc/iso/html/html_iso_intro.html +34 -0
  39. data/lib/isodoc/iso/html/html_iso_titlepage.html +34 -0
  40. data/lib/isodoc/iso/html/htmlstyle.scss +46 -0
  41. data/lib/isodoc/iso/html/isodoc.scss +696 -0
  42. data/lib/isodoc/iso/html/scripts.html +174 -0
  43. data/lib/isodoc/iso/html/style-human.scss +1277 -0
  44. data/lib/isodoc/iso/html/style-iso.scss +1257 -0
  45. data/lib/isodoc/iso/html/word_iso_intro.html +72 -0
  46. data/lib/isodoc/iso/html/word_iso_titlepage.html +62 -0
  47. data/lib/isodoc/iso/html/wordstyle.scss +1175 -0
  48. data/lib/isodoc/iso/html_convert.rb +118 -0
  49. data/lib/isodoc/iso/metadata.rb +107 -0
  50. data/lib/isodoc/iso/word_convert.rb +141 -0
  51. data/lib/metanorma/iso.rb +7 -0
  52. data/lib/metanorma/iso/processor.rb +44 -0
  53. data/spec/asciidoctor-iso/base_spec.rb +350 -0
  54. data/spec/asciidoctor-iso/blocks_spec.rb +469 -0
  55. data/spec/asciidoctor-iso/cleanup_spec.rb +765 -0
  56. data/spec/asciidoctor-iso/inline_spec.rb +162 -0
  57. data/spec/asciidoctor-iso/isobib_cache_spec.rb +332 -0
  58. data/spec/asciidoctor-iso/lists_spec.rb +190 -0
  59. data/spec/asciidoctor-iso/macros_spec.rb +111 -0
  60. data/spec/asciidoctor-iso/refs_spec.rb +643 -0
  61. data/spec/asciidoctor-iso/section_spec.rb +334 -0
  62. data/spec/asciidoctor-iso/table_spec.rb +307 -0
  63. data/spec/asciidoctor-iso/validate_spec.rb +907 -0
  64. data/spec/assets/header.html +7 -0
  65. data/spec/assets/html.css +2 -0
  66. data/spec/assets/htmlcover.html +4 -0
  67. data/spec/assets/htmlintro.html +5 -0
  68. data/spec/assets/i18n.yaml +2 -0
  69. data/spec/assets/iso.doc +1093 -0
  70. data/spec/assets/iso.headless.html +33 -0
  71. data/spec/assets/iso.html +278 -0
  72. data/spec/assets/iso.xml +8 -0
  73. data/spec/assets/rice_image1.png +0 -0
  74. data/spec/assets/scripts.html +3 -0
  75. data/spec/assets/std.css +2 -0
  76. data/spec/assets/word.css +2 -0
  77. data/spec/assets/wordcover.html +3 -0
  78. data/spec/assets/wordintro.html +4 -0
  79. data/spec/examples/103_01_02.html +247 -0
  80. data/spec/examples/english.yaml +69 -0
  81. data/spec/examples/iso_123_.xml +45 -0
  82. data/spec/examples/iso_123_all_parts.xml +45 -0
  83. data/spec/examples/iso_123_no_year_note.xml +46 -0
  84. data/spec/examples/iso_124_.xml +41 -0
  85. data/spec/examples/iso_216_.xml +47 -0
  86. data/spec/examples/iso_iec_12382_.xml +48 -0
  87. data/spec/examples/rice.adoc +715 -0
  88. data/spec/examples/rice.preview.html +1877 -0
  89. data/spec/examples/rice.sh +4 -0
  90. data/spec/examples/rice_images/rice_image1.png +0 -0
  91. data/spec/examples/rice_images/rice_image2.png +0 -0
  92. data/spec/examples/rice_images/rice_image3_1.png +0 -0
  93. data/spec/examples/rice_images/rice_image3_2.png +0 -0
  94. data/spec/examples/rice_images/rice_image3_3.png +0 -0
  95. data/spec/isodoc/i18n_spec.rb +642 -0
  96. data/spec/isodoc/iso_spec.rb +168 -0
  97. data/spec/isodoc/metadata_spec.rb +152 -0
  98. data/spec/isodoc/postproc_spec.rb +405 -0
  99. data/spec/isodoc/section_spec.rb +522 -0
  100. data/spec/isodoc/xref_spec.rb +1337 -0
  101. data/spec/metanorma/processor_spec.rb +70 -0
  102. data/spec/spec_helper.rb +227 -0
  103. metadata +402 -0
@@ -0,0 +1,522 @@
1
+ require "spec_helper"
2
+
3
+ RSpec.describe IsoDoc do
4
+ it "processes section names" do
5
+ expect(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
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
+ <patent-notice>
16
+ <p>This is patent boilerplate</p>
17
+ </patent-notice>
18
+ </introduction></preface><sections>
19
+ <clause id="D" obligation="normative">
20
+ <title>Scope</title>
21
+ <p id="E">Text</p>
22
+ </clause>
23
+
24
+ <clause id="H" obligation="normative"><title>Terms, Definitions, Symbols and Abbreviated Terms</title><terms id="I" obligation="normative">
25
+ <title>Normal Terms</title>
26
+ <term id="J">
27
+ <preferred>Term2</preferred>
28
+ </term>
29
+ </terms>
30
+ <definitions id="K">
31
+ <dl>
32
+ <dt>Symbol</dt>
33
+ <dd>Definition</dd>
34
+ </dl>
35
+ </definitions>
36
+ </clause>
37
+ <definitions id="L">
38
+ <dl>
39
+ <dt>Symbol</dt>
40
+ <dd>Definition</dd>
41
+ </dl>
42
+ </definitions>
43
+ <clause id="M" inline-header="false" obligation="normative"><title>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
44
+ <title>Introduction</title>
45
+ </clause>
46
+ <clause id="O" inline-header="false" obligation="normative">
47
+ <title>Clause 4.2</title>
48
+ </clause></clause>
49
+
50
+ </sections><annex id="P" inline-header="false" obligation="normative">
51
+ <title>Annex</title>
52
+ <clause id="Q" inline-header="false" obligation="normative">
53
+ <title>Annex A.1</title>
54
+ <clause id="Q1" inline-header="false" obligation="normative">
55
+ <title>Annex A.1a</title>
56
+ </clause>
57
+ </clause>
58
+ <appendix id="Q2" inline-header="false" obligation="normative">
59
+ <title>An Appendix</title>
60
+ </appendix>
61
+ </annex><bibliography><references id="R" obligation="informative">
62
+ <title>Normative References</title>
63
+ </references><clause id="S" obligation="informative">
64
+ <title>Bibliography</title>
65
+ <references id="T" obligation="informative">
66
+ <title>Bibliography Subsection</title>
67
+ </references>
68
+ </clause>
69
+ </bibliography>
70
+ </iso-standard>
71
+ INPUT
72
+ #{HTML_HDR}
73
+ <br/>
74
+ <div>
75
+ <h1 class="ForewordTitle">Foreword</h1>
76
+ <p id="A">This is a preamble</p>
77
+ </div>
78
+ <br/>
79
+ <div class="Section3" id="B">
80
+ <h1 class="IntroTitle">0.&#160; Introduction</h1>
81
+ <div id="C">
82
+ <h2>0.1. Introduction Subsection</h2>
83
+ </div>
84
+ <p>This is patent boilerplate</p>
85
+ </div>
86
+ <p class="zzSTDTitle1"/>
87
+ <div id="D">
88
+ <h1>1.&#160; Scope</h1>
89
+ <p id="E">Text</p>
90
+ </div>
91
+ <div>
92
+ <h1>2.&#160; Normative references</h1>
93
+ <p>There are no normative references in this document.</p>
94
+ </div>
95
+ <div id="H"><h1>3.&#160; Terms, definitions, symbols and abbreviated terms</h1><p>For the purposes of this document,
96
+ the following terms and definitions apply.</p>
97
+ <p>ISO and IEC maintain terminological databases for use in
98
+ standardization at the following addresses:</p>
99
+
100
+ <ul>
101
+ <li> <p>ISO Online browsing platform: available at
102
+ <a href="http://www.iso.org/obp">http://www.iso.org/obp</a></p> </li>
103
+ <li> <p>IEC Electropedia: available at
104
+ <a href="http://www.electropedia.org">http://www.electropedia.org</a>
105
+ </p> </li> </ul>
106
+ <div id="I">
107
+ <h2>3.1. Normal Terms</h2>
108
+ <p class="TermNum" id="J">3.1.1</p>
109
+ <p class="Terms" style="text-align:left;">Term2</p>
110
+
111
+ </div><div id="K"><h2>3.2. Symbols and abbreviated terms</h2>
112
+ <dl><dt><p>Symbol</p></dt><dd>Definition</dd></dl>
113
+ </div></div>
114
+ <div id="L" class="Symbols">
115
+ <h1>4.&#160; Symbols and abbreviated terms</h1>
116
+ <dl>
117
+ <dt>
118
+ <p>Symbol</p>
119
+ </dt>
120
+ <dd>Definition</dd>
121
+ </dl>
122
+ </div>
123
+ <div id="M">
124
+ <h1>5.&#160; Clause 4</h1>
125
+ <div id="N">
126
+ <h2>5.1. Introduction</h2>
127
+ </div>
128
+ <div id="O">
129
+ <h2>5.2. Clause 4.2</h2>
130
+ </div>
131
+ </div>
132
+ <br/>
133
+ <div id="P" class="Section3">
134
+ <h1 class="Annex"><b>Annex A</b><br/>(normative)<br/><br/><b>Annex</b></h1>
135
+ <div id="Q">
136
+ <h2>A.1. Annex A.1</h2>
137
+ <div id="Q1">
138
+ <h3>A.1.1. Annex A.1a</h3>
139
+ </div>
140
+ </div>
141
+ <div id="Q2">
142
+ <h2>Appendix 1. An Appendix</h2>
143
+ </div>
144
+
145
+ </div>
146
+ <br/>
147
+ <div>
148
+ <h1 class="Section3">Bibliography</h1>
149
+ <div>
150
+ <h2 class="Section3">Bibliography Subsection</h2>
151
+ </div>
152
+ </div>
153
+ </div>
154
+ </body>
155
+ </html>
156
+ OUTPUT
157
+ end
158
+
159
+ it "processes section names (Word)" do
160
+ expect(IsoDoc::Iso::WordConvert.new({}).convert("test", <<~"INPUT", true).sub(/^.*<body /m, "<body ")).to be_equivalent_to <<~"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
+ <patent-notice>
171
+ <p>This is patent boilerplate</p>
172
+ </patent-notice>
173
+ </introduction></preface><sections>
174
+ <clause id="D" obligation="normative">
175
+ <title>Scope</title>
176
+ <p id="E">Text</p>
177
+ </clause>
178
+
179
+ <clause id="H" obligation="normative"><title>Terms, Definitions, Symbols and Abbreviated Terms</title><terms id="I" obligation="normative">
180
+ <title>Normal Terms</title>
181
+ <term id="J">
182
+ <preferred>Term2</preferred>
183
+ </term>
184
+ </terms>
185
+ <definitions id="K">
186
+ <dl>
187
+ <dt>Symbol</dt>
188
+ <dd>Definition</dd>
189
+ </dl>
190
+ </definitions>
191
+ </clause>
192
+ <definitions id="L">
193
+ <dl>
194
+ <dt>Symbol</dt>
195
+ <dd>Definition</dd>
196
+ </dl>
197
+ </definitions>
198
+ <clause id="M" inline-header="false" obligation="normative"><title>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
199
+ <title>Introduction</title>
200
+ </clause>
201
+ <clause id="O" inline-header="false" obligation="normative">
202
+ <title>Clause 4.2</title>
203
+ </clause></clause>
204
+
205
+ </sections><annex id="P" inline-header="false" obligation="normative">
206
+ <title>Annex</title>
207
+ <clause id="Q" inline-header="false" obligation="normative">
208
+ <title>Annex A.1</title>
209
+ <clause id="Q1" inline-header="false" obligation="normative">
210
+ <title>Annex A.1a</title>
211
+ </clause>
212
+ </clause>
213
+ <appendix id="Q2" inline-header="false" obligation="normative">
214
+ <title>An Appendix</title>
215
+ </appendix>
216
+ </annex><bibliography><references id="R" obligation="informative">
217
+ <title>Normative References</title>
218
+ </references><clause id="S" obligation="informative">
219
+ <title>Bibliography</title>
220
+ <references id="T" obligation="informative">
221
+ <title>Bibliography Subsection</title>
222
+ </references>
223
+ </clause>
224
+ </bibliography>
225
+ </iso-standard>
226
+ INPUT
227
+ <body lang="EN-US" link="blue" vlink="#954F72">
228
+ <div class="WordSection1">
229
+ <p>&#160;</p>
230
+ </div>
231
+ <br clear="all" class="section"/>
232
+ <div class="WordSection2">
233
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
234
+ <div>
235
+ <h1 class="ForewordTitle">Foreword</h1>
236
+ <p id="A">This is a preamble</p>
237
+ </div>
238
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
239
+ <div class="Section3" id="B">
240
+ <h1 class="IntroTitle">0.<span style="mso-tab-count:1">&#160; </span>Introduction</h1>
241
+ <div id="C">
242
+ <h2>0.1. Introduction Subsection</h2>
243
+ </div>
244
+ <p>This is patent boilerplate</p>
245
+ </div>
246
+ <p>&#160;</p>
247
+ </div>
248
+ <br clear="all" class="section"/>
249
+ <div class="WordSection3">
250
+ <p class="zzSTDTitle1"/>
251
+ <div id="D">
252
+ <h1>1.<span style="mso-tab-count:1">&#160; </span>Scope</h1>
253
+ <p id="E">Text</p>
254
+ </div>
255
+ <div>
256
+ <h1>2.<span style="mso-tab-count:1">&#160; </span>Normative references</h1>
257
+ <p>There are no normative references in this document.</p>
258
+ </div>
259
+ <div id="H"><h1>3.<span style="mso-tab-count:1">&#160; </span>Terms, definitions, symbols and abbreviated terms</h1><p>For the purposes of this document,
260
+ the following terms and definitions apply.</p>
261
+ <p>ISO and IEC maintain terminological databases for use in
262
+ standardization at the following addresses:</p>
263
+
264
+ <ul>
265
+ <li> <p>ISO Online browsing platform: available at
266
+ <a href="http://www.iso.org/obp">http://www.iso.org/obp</a></p> </li>
267
+ <li> <p>IEC Electropedia: available at
268
+ <a href="http://www.electropedia.org">http://www.electropedia.org</a>
269
+ </p> </li> </ul>
270
+ <div id="I">
271
+ <h2>3.1. Normal Terms</h2>
272
+ <p class="TermNum" id="J">3.1.1</p>
273
+ <p class="Terms" style="text-align:left;">Term2</p>
274
+
275
+ </div><div id="K"><h2>3.2. Symbols and abbreviated terms</h2>
276
+ <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>
277
+ </div></div>
278
+ <div id="L" class="Symbols">
279
+ <h1>4.<span style="mso-tab-count:1">&#160; </span>Symbols and abbreviated terms</h1>
280
+ <table class="dl">
281
+ <tr>
282
+ <td valign="top" align="left">
283
+ <p align="left" style="margin-left:0pt;text-align:left;">Symbol</p>
284
+ </td>
285
+ <td valign="top">Definition</td>
286
+ </tr>
287
+ </table>
288
+ </div>
289
+ <div id="M">
290
+ <h1>5.<span style="mso-tab-count:1">&#160; </span>Clause 4</h1>
291
+ <div id="N">
292
+ <h2>5.1. Introduction</h2>
293
+ </div>
294
+ <div id="O">
295
+ <h2>5.2. Clause 4.2</h2>
296
+ </div>
297
+ </div>
298
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
299
+ <div id="P" class="Section3">
300
+ <h1 class="Annex"><b>Annex A</b><br/>(normative)<br/><br/><b>Annex</b></h1>
301
+ <div id="Q">
302
+ <h2>A.1. Annex A.1</h2>
303
+ <div id="Q1">
304
+ <h3>A.1.1. Annex A.1a</h3>
305
+ </div>
306
+ </div>
307
+ <div id="Q2">
308
+ <h2>Appendix 1. An Appendix</h2>
309
+ </div>
310
+ </div>
311
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
312
+ <div>
313
+ <h1 class="Section3">Bibliography</h1>
314
+ <div>
315
+ <h2 class="Section3">Bibliography Subsection</h2>
316
+ </div>
317
+ </div>
318
+ </div>
319
+ <br clear="all" style="page-break-before:left;mso-break-type:section-break"/>
320
+ <div class="colophon"/>
321
+ </body>
322
+ </html>
323
+ OUTPUT
324
+ end
325
+
326
+ it "processes simple terms & definitions" do
327
+ expect(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
328
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
329
+ <sections>
330
+ <terms id="H" obligation="normative"><title>Terms, Definitions, Symbols and Abbreviated Terms</title>
331
+ <term id="J">
332
+ <preferred>Term2</preferred>
333
+ </term>
334
+ </terms>
335
+ </sections>
336
+ </iso-standard>
337
+ INPUT
338
+ #{HTML_HDR}
339
+ <p class="zzSTDTitle1"/>
340
+ <div id="H"><h1>1.&#160; Terms and definitions</h1><p>For the purposes of this document,
341
+ the following terms and definitions apply.</p>
342
+ <p>ISO and IEC maintain terminological databases for use in
343
+ standardization at the following addresses:</p>
344
+
345
+ <ul>
346
+ <li> <p>ISO Online browsing platform: available at
347
+ <a href="http://www.iso.org/obp">http://www.iso.org/obp</a></p> </li>
348
+ <li> <p>IEC Electropedia: available at
349
+ <a href="http://www.electropedia.org">http://www.electropedia.org</a>
350
+ </p> </li> </ul>
351
+ <p class="TermNum" id="J">1.1</p>
352
+ <p class="Terms" style="text-align:left;">Term2</p>
353
+ </div>
354
+ </div>
355
+ </body>
356
+ </html>
357
+ OUTPUT
358
+ end
359
+
360
+ it "processes terms & definitions with external source" do
361
+ expect(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
362
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
363
+ <termdocsource type="inline" bibitemid="ISO712"/>
364
+ <sections>
365
+ <terms id="H" obligation="normative"><title>Terms, Definitions, Symbols and Abbreviated Terms</title>
366
+ <term id="J">
367
+ <preferred>Term2</preferred>
368
+ </term>
369
+ </terms>
370
+ </sections>
371
+ <bibliography>
372
+ <references id="_normative_references" obligation="informative"><title>Normative References</title>
373
+ <bibitem id="ISO712" type="standard">
374
+ <title format="text/plain">Cereals and cereal products?~@~I?~@~T?~@~IDetermination of moisture content?~@~I?~@~T?~@~IReference method</title>
375
+ <docidentifier>ISO 712</docidentifier>
376
+ <contributor>
377
+ <role type="publisher"/>
378
+ <organization>
379
+ <name>International Organization for Standardization</name>
380
+ </organization>
381
+ </contributor>
382
+ </bibitem></references>
383
+ </bibliography>
384
+ </iso-standard>
385
+ INPUT
386
+ #{HTML_HDR}
387
+ <p class="zzSTDTitle1"/>
388
+ <div>
389
+ <h1>1.&#160; Normative references</h1>
390
+ <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>
391
+ <p id="ISO712" class="NormRef">ISO 712, <i> Cereals and cereal products?~@~I?~@~T?~@~IDetermination of moisture content?~@~I?~@~T?~@~IReference method</i></p>
392
+ </div>
393
+ <div id="H"><h1>2.&#160; Terms and definitions</h1><p>For the purposes of this document, the terms and definitions
394
+ given in ISO 712 and the following apply.</p>
395
+ <p>ISO and IEC maintain terminological databases for use in
396
+ standardization at the following addresses:</p>
397
+
398
+ <ul>
399
+ <li> <p>ISO Online browsing platform: available at
400
+ <a href="http://www.iso.org/obp">http://www.iso.org/obp</a></p> </li>
401
+ <li> <p>IEC Electropedia: available at
402
+ <a href="http://www.electropedia.org">http://www.electropedia.org</a>
403
+ </p> </li> </ul>
404
+ <p class="TermNum" id="J">2.1</p>
405
+ <p class="Terms" style="text-align:left;">Term2</p>
406
+ </div>
407
+ </div>
408
+ </body>
409
+ </html>
410
+ OUTPUT
411
+ end
412
+
413
+ it "processes empty terms & definitions with external source" do
414
+ expect(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
415
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
416
+ <termdocsource type="inline" bibitemid="ISO712"/>
417
+ <termdocsource type="inline" bibitemid="ISO712"/>
418
+ <termdocsource type="inline" bibitemid="ISO712"/>
419
+ <sections>
420
+ <terms id="H" obligation="normative"><title>Terms, Definitions, Symbols and Abbreviated Terms</title>
421
+ </terms>
422
+ </sections>
423
+ <bibliography>
424
+ <references id="_normative_references" obligation="informative"><title>Normative References</title>
425
+ <bibitem id="ISO712" type="standard">
426
+ <title format="text/plain">Cereals and cereal products?~@~I?~@~T?~@~IDetermination of moisture content?~@~I?~@~T?~@~IReference method</title>
427
+ <docidentifier>ISO 712</docidentifier>
428
+ <contributor>
429
+ <role type="publisher"/>
430
+ <organization>
431
+ <abbreviation>ISO</abbreviation>
432
+ </organization>
433
+ </contributor>
434
+ </bibitem></references>
435
+ </bibliography>
436
+ </iso-standard>
437
+ INPUT
438
+ #{HTML_HDR}
439
+ <p class="zzSTDTitle1"/>
440
+ <div>
441
+ <h1>1.&#160; Normative references</h1>
442
+ <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>
443
+ <p id="ISO712" class="NormRef">ISO 712, <i> Cereals and cereal products?~@~I?~@~T?~@~IDetermination of moisture content?~@~I?~@~T?~@~IReference method</i></p>
444
+ </div>
445
+ <div id="H"><h1>2.&#160; Terms and definitions</h1><p>For the purposes of this document,
446
+ the terms and definitions given in ISO 712, ISO 712 and ISO 712 apply.</p>
447
+ <p>ISO and IEC maintain terminological databases for use in
448
+ standardization at the following addresses:</p>
449
+
450
+ <ul>
451
+ <li> <p>ISO Online browsing platform: available at
452
+ <a href="http://www.iso.org/obp">http://www.iso.org/obp</a></p> </li>
453
+ <li> <p>IEC Electropedia: available at
454
+ <a href="http://www.electropedia.org">http://www.electropedia.org</a>
455
+ </p> </li> </ul>
456
+ </div>
457
+ </div>
458
+ </body>
459
+ </html>
460
+ OUTPUT
461
+ end
462
+
463
+ it "processes empty terms & definitions" do
464
+ expect(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
465
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
466
+ <sections>
467
+ <terms id="H" obligation="normative"><title>Terms, Definitions, Symbols and Abbreviated Terms</title>
468
+ </terms>
469
+ </sections>
470
+ </iso-standard>
471
+ INPUT
472
+ #{HTML_HDR}
473
+ <p class="zzSTDTitle1"/>
474
+ <div id="H"><h1>1.&#160; Terms and definitions</h1><p>No terms and definitions are listed in this document.</p>
475
+ <p>ISO and IEC maintain terminological databases for use in
476
+ standardization at the following addresses:</p>
477
+
478
+ <ul>
479
+ <li> <p>ISO Online browsing platform: available at
480
+ <a href="http://www.iso.org/obp">http://www.iso.org/obp</a></p> </li>
481
+ <li> <p>IEC Electropedia: available at
482
+ <a href="http://www.electropedia.org">http://www.electropedia.org</a>
483
+ </p> </li> </ul>
484
+ </div>
485
+ </div>
486
+ </body>
487
+ </html>
488
+ OUTPUT
489
+ end
490
+
491
+ it "processes inline section headers" do
492
+ expect(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
493
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
494
+ <sections>
495
+ <clause id="M" inline-header="false" obligation="normative"><title>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
496
+ <title>Introduction</title>
497
+ </clause>
498
+ <clause id="O" inline-header="true" obligation="normative">
499
+ <title>Clause 4.2</title>
500
+ </clause></clause>
501
+
502
+ </sections>
503
+ </iso-standard>
504
+ INPUT
505
+ #{HTML_HDR}
506
+ <p class="zzSTDTitle1"/>
507
+ <div id="M">
508
+ <h1>1.&#160; Clause 4</h1>
509
+ <div id="N">
510
+ <h2>1.1. Introduction</h2>
511
+ </div>
512
+ <div id="O">
513
+ <span class="zzMoveToFollowing"><b>1.2. Clause 4.2 </b></span>
514
+ </div>
515
+ </div>
516
+ </div>
517
+ </body>
518
+ </html>
519
+ OUTPUT
520
+ end
521
+
522
+ end