metanorma-iso 2.2.1 → 2.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (119) hide show
  1. checksums.yaml +4 -4
  2. data/lib/isodoc/iso/html/header-dis.html +111 -29
  3. data/lib/isodoc/iso/html/isodoc-dis.css +65 -64
  4. data/lib/isodoc/iso/html/isodoc-dis.scss +65 -64
  5. data/lib/isodoc/iso/html/style-human.css +2 -3
  6. data/lib/isodoc/iso/html/style-human.scss +0 -1
  7. data/lib/isodoc/iso/html/style-iso.css +2 -3
  8. data/lib/isodoc/iso/html/style-iso.scss +0 -1
  9. data/lib/isodoc/iso/html/wordstyle-dis.css +10 -4
  10. data/lib/isodoc/iso/html/wordstyle-dis.scss +10 -4
  11. data/lib/isodoc/iso/i18n-en.yaml +13 -8
  12. data/lib/isodoc/iso/i18n-fr.yaml +9 -3
  13. data/lib/isodoc/iso/i18n-ru.yaml +9 -2
  14. data/lib/isodoc/iso/i18n-zh-Hans.yaml +1 -2
  15. data/lib/isodoc/iso/iso.amendment.xsl +226 -40
  16. data/lib/isodoc/iso/iso.international-standard.xsl +226 -40
  17. data/lib/isodoc/iso/presentation_bibdata.rb +13 -9
  18. data/lib/isodoc/iso/presentation_xml_convert.rb +5 -3
  19. data/lib/isodoc/iso/presentation_xref.rb +10 -7
  20. data/lib/isodoc/iso/sections.rb +1 -1
  21. data/lib/isodoc/iso/word_convert.rb +6 -4
  22. data/lib/isodoc/iso/word_dis_cleanup.rb +24 -3
  23. data/lib/isodoc/iso/word_dis_convert.rb +4 -1
  24. data/lib/metanorma/iso/base.rb +2 -1
  25. data/lib/metanorma/iso/basicdoc.rng +0 -27
  26. data/lib/metanorma/iso/biblio-standoc.rng +164 -0
  27. data/lib/metanorma/iso/biblio.rng +50 -18
  28. data/lib/metanorma/iso/isodoc.rng +68 -206
  29. data/lib/metanorma/iso/isostandard-amd.rng +3 -54
  30. data/lib/metanorma/iso/isostandard-compile.rng +7 -0
  31. data/lib/metanorma/iso/isostandard.rng +1 -195
  32. data/lib/metanorma/iso/relaton-iso.rng +225 -0
  33. data/lib/metanorma/iso/validate.rb +6 -6
  34. data/lib/metanorma/iso/version.rb +1 -1
  35. data/lib/metanorma/requirements/modspec.rb +22 -38
  36. data/metanorma-iso.gemspec +5 -2
  37. metadata +7 -86
  38. data/.github/workflows/rake.yml +0 -15
  39. data/.github/workflows/release.yml +0 -24
  40. data/.github/workflows/ubuntu.yml +0 -41
  41. data/Rakefile +0 -8
  42. data/bin/rspec +0 -17
  43. data/spec/assets/header.html +0 -7
  44. data/spec/assets/html.css +0 -2
  45. data/spec/assets/htmlcover.html +0 -4
  46. data/spec/assets/htmlintro.html +0 -5
  47. data/spec/assets/i18n.yaml +0 -2
  48. data/spec/assets/iso.adoc +0 -10
  49. data/spec/assets/iso.headless.html +0 -33
  50. data/spec/assets/iso.xml +0 -71
  51. data/spec/assets/rice_image1.png +0 -0
  52. data/spec/assets/scripts.html +0 -3
  53. data/spec/assets/std.css +0 -2
  54. data/spec/assets/word.css +0 -2
  55. data/spec/assets/wordcover.html +0 -3
  56. data/spec/assets/wordintro.html +0 -4
  57. data/spec/examples/103_01_02.html +0 -247
  58. data/spec/examples/english.yaml +0 -69
  59. data/spec/examples/iso_123_.xml +0 -45
  60. data/spec/examples/iso_123_all_parts.xml +0 -45
  61. data/spec/examples/iso_123_no_year_note.xml +0 -46
  62. data/spec/examples/iso_124_.xml +0 -41
  63. data/spec/examples/iso_216_.xml +0 -47
  64. data/spec/examples/iso_iec_12382_.xml +0 -48
  65. data/spec/examples/rice.adoc +0 -714
  66. data/spec/examples/rice.preview.html +0 -1870
  67. data/spec/examples/rice.sh +0 -4
  68. data/spec/examples/rice_img/1000-1_ed2amd3fig1a.png +0 -0
  69. data/spec/examples/rice_img/1000-1_ed2amd3fig1b.png +0 -0
  70. data/spec/examples/rice_img/1000-1_ed2amd3fig2.png +0 -0
  71. data/spec/examples/rice_img/1000-1_ed2amd3fig3.png +0 -0
  72. data/spec/examples/rice_img/1000-1_ed2amd3fig4.png +0 -0
  73. data/spec/examples/rice_img/1000-1_ed2amd3fig5_f.png +0 -0
  74. data/spec/examples/rice_img/1000-1_ed2amd3figA.png +0 -0
  75. data/spec/examples/rice_img/1000-1_ed2amd3figA1.png +0 -0
  76. data/spec/examples/rice_img/1000-1_ed2amd3figA2.png +0 -0
  77. data/spec/examples/rice_img/1000-1_ed2amd3figTab1.png +0 -0
  78. data/spec/examples/rice_img/1000-1_ed2amd3figTab2.png +0 -0
  79. data/spec/examples/rice_img/1001_ed2amd3fig1.png +0 -0
  80. data/spec/examples/rice_img/ISO_1213_1.png +0 -0
  81. data/spec/examples/rice_img/SL1000-1_ed2amd3fig1.png +0 -0
  82. data/spec/examples/rice_img/rice_image1.png +0 -0
  83. data/spec/examples/rice_img/rice_image2.png +0 -0
  84. data/spec/examples/rice_img/rice_image3_1.png +0 -0
  85. data/spec/examples/rice_img/rice_image3_2.png +0 -0
  86. data/spec/examples/rice_img/rice_image3_3.png +0 -0
  87. data/spec/isodoc/amd_spec.rb +0 -986
  88. data/spec/isodoc/blocks_spec.rb +0 -1174
  89. data/spec/isodoc/i18n_spec.rb +0 -1579
  90. data/spec/isodoc/inline_spec.rb +0 -1060
  91. data/spec/isodoc/iso_spec.rb +0 -255
  92. data/spec/isodoc/metadata_spec.rb +0 -701
  93. data/spec/isodoc/postproc_spec.rb +0 -1089
  94. data/spec/isodoc/ref_spec.rb +0 -439
  95. data/spec/isodoc/section_spec.rb +0 -998
  96. data/spec/isodoc/table_spec.rb +0 -420
  97. data/spec/isodoc/terms_spec.rb +0 -314
  98. data/spec/isodoc/word_dis_spec.rb +0 -2064
  99. data/spec/isodoc/xref_spec.rb +0 -1747
  100. data/spec/metanorma/amd_spec.rb +0 -724
  101. data/spec/metanorma/base_spec.rb +0 -1384
  102. data/spec/metanorma/blank_spec.rb +0 -38
  103. data/spec/metanorma/blocks_spec.rb +0 -624
  104. data/spec/metanorma/cleanup_spec.rb +0 -1645
  105. data/spec/metanorma/inline_spec.rb +0 -203
  106. data/spec/metanorma/lists_spec.rb +0 -197
  107. data/spec/metanorma/macros_spec.rb +0 -99
  108. data/spec/metanorma/processor_spec.rb +0 -161
  109. data/spec/metanorma/refs_spec.rb +0 -672
  110. data/spec/metanorma/section_spec.rb +0 -492
  111. data/spec/metanorma/table_spec.rb +0 -329
  112. data/spec/metanorma/validate_spec.rb +0 -2153
  113. data/spec/relaton/render_spec.rb +0 -568
  114. data/spec/requirements/requirement_components_spec.rb +0 -622
  115. data/spec/requirements/requirements_spec.rb +0 -1681
  116. data/spec/requirements/xref_spec.rb +0 -1211
  117. data/spec/spec_helper.rb +0 -313
  118. data/spec/vcr_cassettes/docrels.yml +0 -385
  119. data/spec/vcr_cassettes/withdrawn_iso.yml +0 -295
@@ -1,998 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe IsoDoc do
4
- it "processes section names" do
5
- input = <<~INPUT
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">
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><expression><name>Term2</name></expression></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>
86
- INPUT
87
-
88
- presxml = <<~OUTPUT
89
- <iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
90
- <preface>
91
- <foreword obligation="informative" displayorder="1">
92
- <title>Foreword</title>
93
- <p id="A">This is a preamble</p>
94
- </foreword>
95
- <introduction id="B" obligation="informative" displayorder="2">
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" displayorder="3">
105
- <title depth="1">1<tab/>Scope</title>
106
- <p id="E">Text</p>
107
- </clause>
108
- <clause id="H" obligation="normative" displayorder="5">
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"><name>3.1.1</name>
113
- <preferred><strong>Term2</strong></preferred>
114
- </term>
115
- </terms>
116
- <definitions id="K" inline-header="true"><title>3.2</title>
117
- <dl>
118
- <dt>Symbol</dt>
119
- <dd>Definition</dd>
120
- </dl>
121
- </definitions>
122
- </clause>
123
- <definitions id="L" displayorder="6"><title>4</title>
124
- <dl>
125
- <dt>Symbol</dt>
126
- <dd>Definition</dd>
127
- </dl>
128
- </definitions>
129
- <clause id="M" inline-header="false" obligation="normative" displayorder="7">
130
- <title depth="1">5<tab/>Clause 4</title>
131
- <clause id="N" inline-header="false" obligation="normative">
132
- <title depth="2">5.1<tab/>Introduction</title>
133
- </clause>
134
- <clause id="O" inline-header="false" obligation="normative">
135
- <title depth="2">5.2<tab/>Clause 4.2</title>
136
- </clause>
137
- </clause>
138
- </sections>
139
- <annex id="P" inline-header="false" obligation="normative" displayorder="8">
140
- <title><strong>Annex A</strong><br/><span class='obligation'>(normative)</span><br/><br/><strong>Annex</strong></title>
141
- <clause id="Q" inline-header="false" obligation="normative">
142
- <title depth="2">A.1<tab/>Annex A.1</title>
143
- <clause id="Q1" inline-header="false" obligation="normative">
144
- <title depth="3">A.1.1<tab/>Annex A.1a</title>
145
- </clause>
146
- </clause>
147
- <appendix id="Q2" inline-header="false" obligation="normative">
148
- <title depth="2">Appendix 1<tab/>An Appendix</title>
149
- <clause id="Q2a" inline-header="false" obligation="normative">
150
- <title depth="3">Appendix 1.1<tab/>Appendix subclause</title>
151
- </clause>
152
- </appendix>
153
- <references id="Q3" normative="false">
154
- <title depth="2">A.2<tab/>Annex Bibliography</title>
155
- </references>
156
- </annex>
157
- <bibliography>
158
- <references id="R" normative="true" obligation="informative" displayorder="4">
159
- <title depth="1">2<tab/>Normative References</title>
160
- </references>
161
- <clause id="S" obligation="informative" displayorder="9">
162
- <title depth="1">Bibliography</title>
163
- <references id="T" normative="false" obligation="informative">
164
- <title depth="2">Bibliography Subsection</title>
165
- </references>
166
- </clause>
167
- </bibliography>
168
- </iso-standard>
169
- OUTPUT
170
-
171
- html = <<~OUTPUT
172
- #{HTML_HDR}
173
- <br/>
174
- <div>
175
- <h1 class="ForewordTitle">Foreword</h1>
176
- <p id="A">This is a preamble</p>
177
- </div>
178
- <br/>
179
- <div class="Section3" id="B">
180
- <h1 class="IntroTitle">0&#160; Introduction</h1>
181
- <div id="C">
182
- <h2>0.1&#160; Introduction Subsection</h2>
183
- </div>
184
- <p>This is patent boilerplate</p>
185
- </div>
186
- <p class="zzSTDTitle1"/>
187
- <div id="D">
188
- <h1>1&#160; Scope</h1>
189
- <p id="E">Text</p>
190
- </div>
191
- <div>
192
- <h1>2&#160; Normative References</h1>
193
- </div>
194
- <div id="H">
195
- <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;"><b>Term2</b></p>
200
- </div>
201
- <div id="K">
202
- <span class="zzMoveToFollowing">
203
- <b>3.2&#160; </b>
204
- </span>
205
- <dl>
206
- <dt>
207
- <p>Symbol</p>
208
- </dt>
209
- <dd>Definition</dd>
210
- </dl>
211
- </div>
212
- </div>
213
- <div class="Symbols" id="L">
214
- <h1>4</h1>
215
- <dl>
216
- <dt>
217
- <p>Symbol</p>
218
- </dt>
219
- <dd>Definition</dd>
220
- </dl>
221
- </div>
222
- <div id="M">
223
- <h1>5&#160; Clause 4</h1>
224
- <div id="N">
225
- <h2>5.1&#160; Introduction</h2>
226
- </div>
227
- <div id="O">
228
- <h2>5.2&#160; Clause 4.2</h2>
229
- </div>
230
- </div>
231
- <br/>
232
- <div class="Section3" id="P">
233
- <h1 class="Annex">
234
- <b>Annex A</b>
235
- <br/>(normative)
236
- <br/>
237
- <br/>
238
- <b>Annex</b></h1>
239
- <div id="Q">
240
- <h2>A.1&#160; Annex A.1</h2>
241
- <div id="Q1">
242
- <h3>A.1.1&#160; Annex A.1a</h3>
243
- </div>
244
- </div>
245
- <div id="Q2">
246
- <h2>Appendix 1&#160; An Appendix</h2>
247
- <div id="Q2a">
248
- <h3>Appendix 1.1&#160; Appendix subclause</h3>
249
- </div>
250
- </div>
251
- <div>
252
- <h2 class="Section3">A.2&#160; Annex Bibliography</h2>
253
- </div>
254
- </div>
255
- <br/>
256
- <div>
257
- <h1 class="Section3">Bibliography</h1>
258
- <div>
259
- <h2 class="Section3">Bibliography Subsection</h2>
260
- </div>
261
- </div>
262
- </div>
263
- </body>
264
- </html>
265
- OUTPUT
266
-
267
- word = <<~OUTPUT
268
- <body lang="EN-US" link="blue" vlink="#954F72">
269
- <div class="WordSection1">
270
- <p>&#160;</p>
271
- </div>
272
- <p>
273
- <br class="section" clear="all"/>
274
- </p>
275
- <div class="WordSection2">
276
- <p>
277
- <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
278
- </p>
279
- <div>
280
- <h1 class="ForewordTitle">Foreword</h1>
281
- <p id="A" class='ForewordText'>This is a preamble</p>
282
- </div>
283
- <p>
284
- <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
285
- </p>
286
- <div class="Section3" id="B">
287
- <h1 class="IntroTitle">0
288
- <span style="mso-tab-count:1">&#160; </span>
289
- Introduction</h1>
290
- <div id="C">
291
- <h2>0.1
292
- <span style="mso-tab-count:1">&#160; </span>
293
- Introduction Subsection</h2>
294
- </div>
295
- <p>This is patent boilerplate</p>
296
- </div>
297
- <p>&#160;</p>
298
- </div>
299
- <p>
300
- <br class="section" clear="all"/>
301
- </p>
302
- <div class="WordSection3">
303
- <p class="zzSTDTitle1"/>
304
- <div id="D">
305
- <h1>1
306
- <span style="mso-tab-count:1">&#160; </span>
307
- Scope</h1>
308
- <p id="E">Text</p>
309
- </div>
310
- <div>
311
- <h1>2
312
- <span style="mso-tab-count:1">&#160; </span>
313
- Normative References</h1>
314
- </div>
315
- <div id="H">
316
- <h1>3
317
- <span style="mso-tab-count:1">&#160; </span>
318
- Terms, Definitions, Symbols and Abbreviated Terms</h1>
319
- <div id="I">
320
- <h2>3.1
321
- <span style="mso-tab-count:1">&#160; </span>
322
- Normal Terms</h2>
323
- <p class="TermNum" id="J">3.1.1</p>
324
- <p class="Terms" style="text-align:left;"><b>Term2</b></p>
325
- </div>
326
- <div id="K">
327
- <span class="zzMoveToFollowing">
328
- <b>3.2
329
- <span style="mso-tab-count:1">&#160; </span></b>
330
- </span>
331
- <table class="dl">
332
- <tr>
333
- <td align="left" valign="top">
334
- <p align="left" style="margin-left:0pt;text-align:left;">Symbol</p>
335
- </td>
336
- <td valign="top">Definition</td>
337
- </tr>
338
- </table>
339
- </div>
340
- </div>
341
- <div class="Symbols" id="L">
342
- <h1>4</h1>
343
- <table class="dl">
344
- <tr>
345
- <td align="left" valign="top">
346
- <p align="left" style="margin-left:0pt;text-align:left;">Symbol</p>
347
- </td>
348
- <td valign="top">Definition</td>
349
- </tr>
350
- </table>
351
- </div>
352
- <div id="M">
353
- <h1>5
354
- <span style="mso-tab-count:1">&#160; </span>
355
- Clause 4</h1>
356
- <div id="N">
357
- <h2>5.1
358
- <span style="mso-tab-count:1">&#160; </span>
359
- Introduction</h2>
360
- </div>
361
- <div id="O">
362
- <h2>5.2
363
- <span style="mso-tab-count:1">&#160; </span>
364
- Clause 4.2</h2>
365
- </div>
366
- </div>
367
- <p>
368
- <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
369
- </p>
370
- <div class="Section3" id="P">
371
- <h1 class="Annex">
372
- <br/><span style='font-weight:normal;'>(normative)</span>
373
- <br/>
374
- <br/>
375
- <b>Annex</b></h1>
376
- <div id="Q">
377
- <h2>A.1
378
- <span style="mso-tab-count:1">&#160; </span>
379
- Annex A.1</h2>
380
- <div id="Q1">
381
- <h3>A.1.1
382
- <span style="mso-tab-count:1">&#160; </span>
383
- Annex A.1a</h3>
384
- </div>
385
- </div>
386
- <div id="Q2">
387
- <h2>Appendix 1
388
- <span style="mso-tab-count:1">&#160; </span>
389
- An Appendix</h2>
390
- <div id="Q2a">
391
- <h3>Appendix 1.1
392
- <span style="mso-tab-count:1">&#160; </span>
393
- Appendix subclause</h3>
394
- </div>
395
- </div>
396
- <div>
397
- <h2 class="BiblioTitle">A.2
398
- <span style="mso-tab-count:1">&#160; </span>
399
- Annex Bibliography</h2>
400
- </div>
401
- </div>
402
- <p>
403
- <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
404
- </p>
405
- <div>
406
- <h1 class="BiblioTitle">Bibliography</h1>
407
- <div>
408
- <h2 class="BiblioTitle">Bibliography Subsection</h2>
409
- </div>
410
- </div>
411
- </div>
412
- <br clear="all" style="page-break-before:left;mso-break-type:section-break"/>
413
- <div class="colophon"/>
414
- </body>
415
- OUTPUT
416
- expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({})
417
- .convert("test", input, true)))
418
- .to be_equivalent_to xmlpp(presxml)
419
- expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({})
420
- .convert("test", presxml, true)))
421
- .to be_equivalent_to xmlpp(html)
422
- expect(xmlpp(IsoDoc::Iso::WordConvert.new({})
423
- .convert("test", presxml, true)
424
- .sub(/^.*<body /m, "<body ").sub(%r{</body>.*$}m, "</body>")))
425
- .to be_equivalent_to xmlpp(word)
426
- end
427
-
428
- it "processes subclauses with and without titles" do
429
- input = <<~INPUT
430
- <iso-standard xmlns="http://riboseinc.com/isoxml">
431
- <sections>
432
- <clause id="D" obligation="normative">
433
- <title>Scope</title>
434
- <clause id="D1" obligation="normative">
435
- <title>Scope 1</title>
436
- </clause>
437
- <clause id="D2" obligation="normative">
438
- </clause>
439
- </clause>
440
- </sections>
441
- </iso-standard>
442
- INPUT
443
-
444
- presxml = <<~OUTPUT
445
- <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
446
- <sections>
447
- <clause id='D' obligation='normative' displayorder="1">
448
- <title depth='1'>1<tab/>Scope</title>
449
- <clause id='D1' obligation='normative'>
450
- <title depth='2'>1.1<tab/>Scope 1</title>
451
- </clause>
452
- <clause id='D2' obligation='normative' inline-header="true">
453
- <title>1.2</title>
454
- </clause>
455
- </clause>
456
- </sections>
457
- </iso-standard>
458
- OUTPUT
459
-
460
- html = <<~OUTPUT
461
- <html xmlns:epub='http://www.idpf.org/2007/ops' lang='en'>
462
- <head/>
463
- <body lang='en'>
464
- <div class='title-section'>
465
- <p>&#160;</p>
466
- </div>
467
- <br/>
468
- <div class='prefatory-section'>
469
- <p>&#160;</p>
470
- </div>
471
- <br/>
472
- <div class='main-section'>
473
- <p class='zzSTDTitle1'/>
474
- <div id='D'>
475
- <h1>1&#160; Scope</h1>
476
- <div id='D1'>
477
- <h2>1.1&#160; Scope 1</h2>
478
- </div>
479
- <div id='D2'>
480
- <span class='zzMoveToFollowing'>
481
- <b>1.2&#160; </b>
482
- </span>
483
- </div>
484
- </div>
485
- </div>
486
- </body>
487
- </html>
488
- OUTPUT
489
- expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({})
490
- .convert("test", input, true)))
491
- .to be_equivalent_to xmlpp(presxml)
492
- expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({})
493
- .convert("test", presxml, true)))
494
- .to be_equivalent_to xmlpp(html)
495
- end
496
-
497
- it "processes simple terms & definitions" do
498
- input = <<~INPUT
499
- <iso-standard xmlns="http://riboseinc.com/isoxml">
500
- <sections>
501
- <terms id="H" obligation="normative">
502
- <title>Terms, Definitions, Symbols and Abbreviated Terms</title>
503
- <term id="J">
504
- <name>1.1</name>
505
- <preferred>Term2</preferred>
506
- </term>
507
- </terms>
508
- </sections>
509
- </iso-standard>
510
- INPUT
511
- output = <<~OUTPUT
512
- #{HTML_HDR}
513
- <p class="zzSTDTitle1"/>
514
- <div id="H">
515
- <h1>Terms, Definitions, Symbols and Abbreviated Terms</h1>
516
- <p class="TermNum" id="J">1.1</p>
517
- <p class="Terms" style="text-align:left;">Term2</p>
518
- </div>
519
- </div>
520
- </body>
521
- </html>
522
- OUTPUT
523
- expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({})
524
- .convert("test", input, true))).to be_equivalent_to xmlpp(output)
525
- end
526
-
527
- it "processes multiple terms & definitions sections" do
528
- input = <<~INPUT
529
- #{BLANK_HDR.sub(%r{<doctype>standard</doctype>}, '<doctype>standard</doctype><subdoctype>vocabulary</subdoctype>')}
530
- <sections>
531
- <terms id='A' obligation='normative'>
532
- <title>Terms and definitions</title>
533
- <p id='A1'>No terms and definitions are listed in this document.</p>
534
- </terms>
535
- <clause id='B' inline-header='false' obligation='normative'>
536
- <title>Clause</title>
537
- </clause>
538
- <terms id='C' obligation='normative'>
539
- <title>More terms</title>
540
- </terms>
541
- </sections>
542
- </iso-standard>
543
- INPUT
544
- presxml = <<~OUTPUT
545
- <iso-standard xmlns='https://www.metanorma.org/ns/iso' type='presentation' version="#{Metanorma::ISO::VERSION}">
546
- <bibdata type='standard'>
547
- <contributor>
548
- <role type='author'/>
549
- <organization>
550
- <name>International Organization for Standardization</name>
551
- <abbreviation>ISO</abbreviation>
552
- </organization>
553
- </contributor>
554
- <contributor>
555
- <role type='publisher'/>
556
- <organization>
557
- <name>International Organization for Standardization</name>
558
- <abbreviation>ISO</abbreviation>
559
- </organization>
560
- </contributor>
561
- <language current='true'>en</language>
562
- <script current='true'>Latn</script>
563
- <status>
564
- <stage abbreviation='IS'>60</stage>
565
- <substage>60</substage>
566
- </status>
567
- <copyright>
568
- <from>#{Time.new.year}</from>
569
- <owner>
570
- <organization>
571
- <name>International Organization for Standardization</name>
572
- <abbreviation>ISO</abbreviation>
573
- </organization>
574
- </owner>
575
- </copyright>
576
- <ext>
577
- <doctype>standard</doctype>
578
- <subdoctype>vocabulary</subdoctype>
579
- <editorialgroup identifier='ISO'>
580
- <agency>ISO</agency>
581
- </editorialgroup>
582
- <approvalgroup identifier='ISO'>
583
- <agency>ISO</agency>
584
- </approvalgroup>
585
- <stagename>International standard</stagename>
586
- </ext>
587
- </bibdata>
588
- <sections>
589
- <terms id='A' obligation='normative' displayorder='1'>
590
- <title depth='1'>
591
- 1
592
- <tab/>
593
- Terms and definitions
594
- </title>
595
- <p id='A1'>No terms and definitions are listed in this document.</p>
596
- </terms>
597
- <clause id='B' inline-header='false' obligation='normative' displayorder='2'>
598
- <title depth='1'>
599
- 2
600
- <tab/>
601
- Clause
602
- </title>
603
- </clause>
604
- <terms id='C' obligation='normative' displayorder='3'>
605
- <title depth='1'>
606
- 3
607
- <tab/>
608
- More terms
609
- </title>
610
- </terms>
611
- </sections>
612
- </iso-standard>
613
- OUTPUT
614
- output = <<~OUTPUT
615
- <html lang='en'>
616
- <head/>
617
- <body lang='en'>
618
- <div class='title-section'>
619
- <p>&#160;</p>
620
- </div>
621
- <br/>
622
- <div class='prefatory-section'>
623
- <p>&#160;</p>
624
- </div>
625
- <br/>
626
- <div class='main-section'>
627
- <p class='zzSTDTitle1'/>
628
- <div id='A'>
629
- <h1> 1 &#160; Terms and definitions </h1>
630
- <p id='A1'>No terms and definitions are listed in this document.</p>
631
- </div>
632
- <div id='B'>
633
- <h1> 2 &#160; Clause </h1>
634
- </div>
635
- <div id='C'>
636
- <h1> 3 &#160; More terms </h1>
637
- </div>
638
- </div>
639
- </body>
640
- </html>
641
- OUTPUT
642
- expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({})
643
- .convert("test", input, true)
644
- .gsub(%r{<localized-strings>.*</localized-strings>}m, "")
645
- .gsub(%r{<boilerplate>.*</boilerplate>}m, "")))
646
- .to be_equivalent_to xmlpp(presxml)
647
- expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({})
648
- .convert("test", presxml, true))).to be_equivalent_to xmlpp(output)
649
- end
650
-
651
- it "processes inline section headers" do
652
- output = IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true)
653
- <iso-standard xmlns="http://riboseinc.com/isoxml">
654
- <sections>
655
- <clause id="M" inline-header="false" obligation="normative">
656
- <title>Clause 4</title>
657
- <clause id="N" inline-header="false" obligation="normative">
658
- <title>Introduction</title>
659
- </clause>
660
- <clause id="O" inline-header="true" obligation="normative">
661
- <title>Clause 4.2</title>
662
- <p>Hello</p>
663
- </clause>
664
- </clause>
665
- </sections>
666
- </iso-standard>
667
- INPUT
668
- expect(xmlpp(output)).to be_equivalent_to xmlpp(<<~"OUTPUT")
669
- #{HTML_HDR}
670
- <p class="zzSTDTitle1"/>
671
- <div id="M">
672
- <h1>Clause 4</h1>
673
- <div id="N">
674
- <h2>Introduction</h2>
675
- </div>
676
- <div id="O">
677
- <span class="zzMoveToFollowing"><b>Clause 4.2&#160; </b></span>
678
- <p>Hello</p>
679
- </div>
680
- </div>
681
- </div>
682
- </body>
683
- </html>
684
- OUTPUT
685
- end
686
-
687
- it "adds colophon to published standard (Word)" do
688
- output = IsoDoc::Iso::WordConvert.new({}).convert("test", <<~"INPUT", true)
689
- <iso-standard xmlns="http://riboseinc.com/isoxml">
690
- <bibdata>
691
- <status>
692
- <stage>60</stage>
693
- </status>
694
- </bibdata>
695
- <sections/>
696
- </iso-standard>
697
- INPUT
698
- expect(xmlpp(output.sub(/^.*<body /m, "<body ").sub(%r{</body>.*$}m,
699
- "</body>")))
700
- .to be_equivalent_to xmlpp(<<~"OUTPUT")
701
- <body lang="EN-US" link="blue" vlink="#954F72">
702
- <div class="WordSection1">
703
- <p>&#160;</p>
704
- </div>
705
- <p><br clear="all" class="section"/></p>
706
- <div class="WordSection2">
707
- <p>&#160;</p>
708
- </div>
709
- <p><br clear="all" class="section"/></p>
710
- <div class="WordSection3">
711
- <p class="zzSTDTitle"/>
712
- </div>
713
- <br clear="all" style="page-break-before:left;mso-break-type:section-break"/>
714
- <div class="colophon"/>
715
- </body>
716
- OUTPUT
717
- end
718
-
719
- it "does not add colophon to draft standard (Word)" do
720
- output = IsoDoc::Iso::WordConvert.new({}).convert("test", <<~"INPUT", true)
721
- <iso-standard xmlns="http://riboseinc.com/isoxml">
722
- <bibdata>
723
- <status>
724
- <stage>30</stage>
725
- </status>
726
- </bibdata>
727
- <sections/>
728
- </iso-standard>
729
- INPUT
730
- expect(xmlpp(output.sub(/^.*<body /m, "<body ").sub(%r{</body>.*$}m,
731
- "</body>")))
732
- .to be_equivalent_to xmlpp(<<~"OUTPUT")
733
- <body lang="EN-US" link="blue" vlink="#954F72">
734
- <div class="WordSection1">
735
- <p>&#160;</p>
736
- </div>
737
- <p><br clear="all" class="section"/></p>
738
- <div class="WordSection2">
739
- <p>&#160;</p>
740
- </div>
741
- <p><br clear="all" class="section"/></p>
742
- <div class="WordSection3">
743
- <p class="zzSTDTitle1"/>
744
- </div>
745
- </body>
746
- OUTPUT
747
- end
748
-
749
- it "processes middle title" do
750
- expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({})
751
- .convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
752
- <iso-standard xmlns="http://riboseinc.com/isoxml">
753
- <bibdata>
754
- <title format="text/plain" language="en" type="title-intro">Introduction</title>
755
- <title format="text/plain" language="en" type="title-main">Main Title — Title</title>
756
- <title format="text/plain" language="en" type="title-part">Title Part</title>
757
- <ext>
758
- <structuredidentifier>
759
- <project-number origyr="2016-05-01" part="1">17301</project-number>
760
- </structuredidentifier>
761
- </ext>
762
- </bibdata>
763
- <sections/>
764
- </iso-standard>
765
- INPUT
766
- #{HTML_HDR}
767
- <p class='zzSTDTitle1'>Introduction &#8212; Main Title&#8201;&#8212;&#8201;Title &#8212; </p>
768
- <p class='zzSTDTitle2'>
769
- Part&#160;1:
770
- <br/><b>Title Part</b>
771
- </p>
772
- </div>
773
- </body>
774
- </html>
775
- OUTPUT
776
- end
777
-
778
- it "generates an index in English" do
779
- input = <<~INPUT
780
- <iso-standard xmlns="https://open.ribose.com/standards/bipm">
781
- <bibdata>
782
- <language>en</language>
783
- <script>Latn</script>
784
- </bibdata>
785
- <sections>
786
- <clause id="A">
787
- <index><primary>&#xE9;long&#xE9;</primary></index>
788
- <index><primary>&#xEA;tre</primary><secondary>Husserl</secondary><tertiary>en allemand</tertiary></index>
789
- <index><primary><em>Eman</em>cipation</primary></index>
790
- <index><primary><em>Eman</em>cipation</primary><secondary>dans la France</secondary></index>
791
- <index><primary><em>Eman</em>cipation</primary><secondary>dans la France</secondary><tertiary>en Bretagne</tertiary></index>
792
- <clause id="B">
793
- <index><primary><em>Eman</em>cipation</primary></index>
794
- <index><primary>zebra</primary></index>
795
- <index><primary><em>Eman</em>cipation</primary><secondary>dans les &#xC9;tats-Unis</secondary></index>
796
- <index><primary><em>Eman</em>cipation</primary><secondary>dans la France</secondary><tertiary>&#xE0; Paris</tertiary></index>
797
- <index-xref also="true"><primary>&#xEA;tre</primary><secondary>Husserl</secondary><target>zebra</target></index-xref>
798
- <index-xref also="true"><primary>&#xEA;tre</primary><secondary>Husserl</secondary><target><em>Eman</em>cipation</target></index-xref>
799
- <index-xref also="false"><primary>&#xEA;tre</primary><secondary>Husserl</secondary><target>zebra</target></index-xref>
800
- <index-xref also="false"><primary><em>Dasein</em></primary><target>&#xEA;tre</target></index-xref>
801
- <index-xref also="false"><primary><em>Dasein</em></primary><target><em>Eman</em>cipation</target></index-xref>
802
- </clause>
803
- </clause>
804
- </sections>
805
- </bipm-standard>
806
- INPUT
807
- presxml = <<~OUTPUT
808
- <iso-standard xmlns='https://open.ribose.com/standards/bipm' type='presentation'>
809
- <bibdata>
810
- <language current='true'>en</language>
811
- <script current='true'>Latn</script>
812
- </bibdata>
813
- <sections>
814
- <clause id='A' displayorder="1">
815
- <title>1</title>
816
- <bookmark id='_'/>
817
- <bookmark id='_'/>
818
- <bookmark id='_'/>
819
- <bookmark id='_'/>
820
- <bookmark id='_'/>
821
- <clause id='B' inline-header='true'>
822
- <title>1.1</title>
823
- <bookmark id='_'/>
824
- <bookmark id='_'/>
825
- <bookmark id='_'/>
826
- <bookmark id='_'/>
827
- </clause>
828
- </clause>
829
- </sections>
830
- <indexsect id='_' displayorder="2">
831
- <title>Index</title>
832
- <ul>
833
- <li>
834
- <em>Dasein</em>
835
- , see
836
- <em>Eman</em>
837
- cipation, &#xEA;tre
838
- </li>
839
- <li>
840
- &#xE9;long&#xE9;,
841
- <xref target='_' pagenumber='true'>Clause 1</xref>
842
- </li>
843
- <li>
844
- <em>Eman</em>
845
- cipation,
846
- <xref target='_' pagenumber='true'>Clause 1</xref>
847
- ,
848
- <xref target='_' pagenumber='true'>1.1</xref>
849
- <ul>
850
- <li>
851
- dans la France,
852
- <xref target='_' pagenumber='true'>Clause 1</xref>
853
- <ul>
854
- <li>
855
- &#xE0; Paris,
856
- <xref target='_' pagenumber='true'>1.1</xref>
857
- </li>
858
- <li>
859
- en Bretagne,
860
- <xref target='_' pagenumber='true'>Clause 1</xref>
861
- </li>
862
- </ul>
863
- </li>
864
- <li>
865
- dans les &#xC9;tats-Unis,
866
- <xref target='_' pagenumber='true'>1.1</xref>
867
- </li>
868
- </ul>
869
- </li>
870
- <li>
871
- &#xEA;tre
872
- <ul>
873
- <li>
874
- Husserl, see zebra, see also
875
- <em>Eman</em>
876
- cipation, zebra
877
- <ul>
878
- <li>
879
- en allemand,
880
- <xref target='_' pagenumber='true'>Clause 1</xref>
881
- </li>
882
- </ul>
883
- </li>
884
- </ul>
885
- </li>
886
- <li>
887
- zebra,
888
- <xref target='_' pagenumber='true'>1.1</xref>
889
- </li>
890
- </ul>
891
- </indexsect>
892
- </iso-standard>
893
- OUTPUT
894
- html = <<~OUTPUT
895
- <html lang='en'>
896
- <head/>
897
- <body lang='en'>
898
- <div class='title-section'>
899
- <p>&#160;</p>
900
- </div>
901
- <br/>
902
- <div class='prefatory-section'>
903
- <p>&#160;</p>
904
- </div>
905
- <br/>
906
- <div class='main-section'>
907
- <p class='zzSTDTitle1'/>
908
- <div id='A'>
909
- <h1>1</h1>
910
- <a id='_'/>
911
- <a id='_'/>
912
- <a id='_'/>
913
- <a id='_'/>
914
- <a id='_'/>
915
- <div id='B'>
916
- <span class='zzMoveToFollowing'>
917
- <b>1.1&#160; </b>
918
- </span>
919
- <a id='_'/>
920
- <a id='_'/>
921
- <a id='_'/>
922
- <a id='_'/>
923
- </div>
924
- </div>
925
- <div id='_'>
926
- <h1>Index</h1>
927
- <ul>
928
- <li>
929
- <i>Dasein</i>
930
- , see
931
- <i>Eman</i>
932
- cipation, &#234;tre
933
- </li>
934
- <li>
935
- &#233;long&#233;,
936
- <a href='#_'>Clause 1</a>
937
- </li>
938
- <li>
939
- <i>Eman</i>
940
- cipation,
941
- <a href='#_'>Clause 1</a>
942
- ,
943
- <a href='#_'>1.1</a>
944
- <ul>
945
- <li>
946
- dans la France,
947
- <a href='#_'>Clause 1</a>
948
- <ul>
949
- <li>
950
- &#224; Paris,
951
- <a href='#_'>1.1</a>
952
- </li>
953
- <li>
954
- en Bretagne,
955
- <a href='#_'>Clause 1</a>
956
- </li>
957
- </ul>
958
- </li>
959
- <li>
960
- dans les &#201;tats-Unis,
961
- <a href='#_'>1.1</a>
962
- </li>
963
- </ul>
964
- </li>
965
- <li>
966
- &#234;tre
967
- <ul>
968
- <li>
969
- Husserl, see zebra, see also
970
- <i>Eman</i>
971
- cipation, zebra
972
- <ul>
973
- <li>
974
- en allemand,
975
- <a href='#_'>Clause 1</a>
976
- </li>
977
- </ul>
978
- </li>
979
- </ul>
980
- </li>
981
- <li>
982
- zebra,
983
- <a href='#_'>1.1</a>
984
- </li>
985
- </ul>
986
- </div>
987
- </div>
988
- </body>
989
- </html>
990
- OUTPUT
991
- expect(xmlpp(strip_guid(IsoDoc::Iso::PresentationXMLConvert.new({})
992
- .convert("test", input, true)
993
- .gsub(%r{<localized-strings>.*</localized-strings>}m, ""))))
994
- .to be_equivalent_to xmlpp(presxml)
995
- expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({})
996
- .convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
997
- end
998
- end