metanorma-iso 2.1.6 → 2.1.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +3 -1
  3. data/.github/workflows/release.yml +24 -0
  4. data/lib/isodoc/iso/html/html_iso_titlepage.html +2 -2
  5. data/lib/isodoc/iso/html/style-human.css +34 -2
  6. data/lib/isodoc/iso/html/style-human.scss +35 -1
  7. data/lib/isodoc/iso/html/style-iso.css +34 -2
  8. data/lib/isodoc/iso/html/style-iso.scss +36 -1
  9. data/lib/isodoc/iso/i18n-en.yaml +4 -0
  10. data/lib/isodoc/iso/i18n-fr.yaml +5 -0
  11. data/lib/isodoc/iso/i18n-ru.yaml +4 -0
  12. data/lib/isodoc/iso/i18n-zh-Hans.yaml +5 -0
  13. data/lib/isodoc/iso/init.rb +4 -0
  14. data/lib/isodoc/iso/iso.amendment.xsl +195 -197
  15. data/lib/isodoc/iso/iso.international-standard.xsl +195 -197
  16. data/lib/isodoc/iso/presentation_xml_convert.rb +22 -6
  17. data/lib/isodoc/iso/xref.rb +35 -4
  18. data/lib/metanorma/iso/base.rb +4 -0
  19. data/lib/metanorma/iso/biblio.rng +8 -5
  20. data/lib/metanorma/iso/cleanup.rb +5 -1
  21. data/lib/metanorma/iso/front_id.rb +63 -38
  22. data/lib/metanorma/iso/section.rb +5 -0
  23. data/lib/metanorma/iso/validate.rb +3 -2
  24. data/lib/metanorma/iso/version.rb +1 -1
  25. data/lib/metanorma/requirements/modspec.rb +60 -0
  26. data/lib/metanorma/requirements/requirements.rb +16 -0
  27. data/lib/metanorma-iso.rb +2 -1
  28. data/metanorma-iso.gemspec +1 -1
  29. data/spec/assets/iso.adoc +10 -0
  30. data/spec/examples/rice_img/1000-1_ed2amd3fig1a.png +0 -0
  31. data/spec/examples/rice_img/1000-1_ed2amd3fig1b.png +0 -0
  32. data/spec/examples/rice_img/1000-1_ed2amd3fig2.png +0 -0
  33. data/spec/examples/rice_img/1000-1_ed2amd3fig3.png +0 -0
  34. data/spec/examples/rice_img/1000-1_ed2amd3fig4.png +0 -0
  35. data/spec/examples/rice_img/1000-1_ed2amd3fig5_f.png +0 -0
  36. data/spec/examples/rice_img/1000-1_ed2amd3figA.png +0 -0
  37. data/spec/examples/rice_img/1000-1_ed2amd3figA1.png +0 -0
  38. data/spec/examples/rice_img/1000-1_ed2amd3figA2.png +0 -0
  39. data/spec/examples/rice_img/1000-1_ed2amd3figTab1.png +0 -0
  40. data/spec/examples/rice_img/1000-1_ed2amd3figTab2.png +0 -0
  41. data/spec/examples/rice_img/1001_ed2amd3fig1.png +0 -0
  42. data/spec/examples/rice_img/ISO_1213_1.png +0 -0
  43. data/spec/examples/rice_img/SL1000-1_ed2amd3fig1.png +0 -0
  44. data/spec/isodoc/ref_spec.rb +129 -82
  45. data/spec/metanorma/amd_spec.rb +0 -10
  46. data/spec/metanorma/base_spec.rb +15 -12
  47. data/spec/metanorma/cleanup_spec.rb +136 -0
  48. data/spec/metanorma/macros_spec.rb +99 -0
  49. data/spec/metanorma/processor_spec.rb +86 -86
  50. data/spec/metanorma/section_spec.rb +2 -2
  51. data/spec/metanorma/validate_spec.rb +41 -40
  52. data/spec/requirements/requirements_spec.rb +1299 -0
  53. data/spec/requirements/xref_spec.rb +1205 -0
  54. data/spec/vcr_cassettes/docrels.yml +385 -0
  55. data/spec/vcr_cassettes/withdrawn_iso.yml +21 -21
  56. metadata +40 -18
@@ -162,7 +162,7 @@ RSpec.describe IsoDoc do
162
162
  <eref bibitemid="ISSN">[2]</eref>
163
163
  <eref bibitemid="ISO16634">ISO 16634:--</eref>
164
164
  <eref bibitemid="ref1">ICC 167</eref>
165
- <eref bibitemid="ref10">[10]</eref>
165
+ <eref bibitemid="ref10">[4]</eref>
166
166
  <eref bibitemid="ref12">Citn</eref>
167
167
  </p>
168
168
  </foreword>
@@ -197,7 +197,7 @@ RSpec.describe IsoDoc do
197
197
  for food and animal feeding stuffs according to the Dumas combustion
198
198
  method</em> (see
199
199
 
200
- <link target="http://www.icc.or.at"/> )
200
+ <link target="http://www.icc.or.at"/> ) [ICC 167]
201
201
  </formattedref>
202
202
  <docidentifier type="ICC">ICC 167</docidentifier>
203
203
  </bibitem>
@@ -209,14 +209,14 @@ RSpec.describe IsoDoc do
209
209
  <references id="_bibliography" normative="false" obligation="informative" displayorder="3">
210
210
  <title depth="1">Bibliography</title>
211
211
  <bibitem id="ISBN" type="book">
212
- <formattedref><em>Chemicals for analytical laboratory use</em>. ISBN.</formattedref>
212
+ <formattedref><em>Chemicals for analytical laboratory use</em>. n.p.: n.d. ISBN.</formattedref>
213
+ <docidentifier type="metanorma-ordinal">[1]</docidentifier>
213
214
  <docidentifier type="ISBN">ISBN</docidentifier>
214
- <docidentifier type="metanorma">[1]</docidentifier>
215
215
  </bibitem>
216
216
  <bibitem id="ISSN" type="journal">
217
- <formattedref><em>Instruments for analytical laboratory use</em>. ISSN.</formattedref>
217
+ <formattedref><em>Instruments for analytical laboratory use</em>. n.d. ISSN.</formattedref>
218
+ <docidentifier type="metanorma-ordinal">[2]</docidentifier>
218
219
  <docidentifier type="ISSN">ISSN</docidentifier>
219
- <docidentifier type="metanorma">[2]</docidentifier>
220
220
  </bibitem>
221
221
  <note>
222
222
  <name>NOTE</name>
@@ -241,16 +241,16 @@ RSpec.describe IsoDoc do
241
241
 
242
242
  <link target="http://www.icc.or.at"/>
243
243
  )</formattedref>
244
- <docidentifier type="metanorma">[10]</docidentifier>
244
+ <docidentifier type="metanorma-ordinal">[4]</docidentifier>
245
245
  </bibitem>
246
246
  <bibitem id="ref11">
247
- <formattedref><em>Internet Calendaring and Scheduling Core Object Specification (iCalendar)</em>.</formattedref>
248
- <docidentifier type='metanorma-ordinal'>[4]</docidentifier>
247
+ <formattedref><em><span class="stddocTitle">Internet Calendaring and Scheduling Core Object Specification (iCalendar)</span></em></formattedref>
248
+ <docidentifier type='metanorma-ordinal'>[5]</docidentifier>
249
249
  <docidentifier type="IETF">IETF RFC 10</docidentifier>
250
250
  </bibitem>
251
251
  <bibitem id="ref12">
252
252
  <formattedref format="application/x-isodoc+xml">CitationWorks. 2019.
253
- <em>How to cite a reference</em>.</formattedref>
253
+ <em>How to cite a reference</em>. [IETF RFC 20]</formattedref>
254
254
  <docidentifier type="metanorma">[Citn]</docidentifier>
255
255
  <docidentifier type="IETF">IETF RFC 20</docidentifier>
256
256
  </bibitem>
@@ -261,76 +261,123 @@ RSpec.describe IsoDoc do
261
261
 
262
262
  html = <<~OUTPUT
263
263
  #{HTML_HDR}
264
- <br/>
265
- <div>
266
- <h1 class="ForewordTitle">Foreword</h1>
267
- <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">
268
- <a href="#ISO712">ISO 712</a>
269
- <a href="#ISBN">[1]</a>
270
- <a href="#ISSN">[2]</a>
271
- <a href="#ISO16634">ISO 16634:--</a>
272
- <a href="#ref1">ICC 167</a>
273
- <a href="#ref10">[10]</a>
274
- <a href="#ref12">Citn</a>
275
- </p>
276
- </div>
277
- <p class="zzSTDTitle1"/>
278
- <div>
279
- <h1>1&#160; Normative References</h1>
280
- <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>
281
- <p class="NormRef" id="ISO712">ISO 712,
282
- <i>Cereals and cereal products</i></p>
283
- <p class="NormRef" id="ISO16634">ISO 16634:-- (all parts)
284
- <a class="FootnoteRef" href="#fn:1">
285
- <sup>1</sup></a>,
286
- <i>Cereals, pulses, milled cereal products, oilseeds and animal feeding stuffs</i></p>
287
- <p class="NormRef" id="ISO20483">ISO 20483:2013-2014,
288
- <i>Cereals and pulses</i></p>
289
- <p class="NormRef" id="ref1">ICC 167,
290
- <span style="font-variant:small-caps;">Standard No I.C.C 167</span>
291
- .
292
- <i>Determination of the protein content in cereal and cereal products for food and animal feeding stuffs according to the Dumas combustion method</i>
293
- (see
294
- <a href="http://www.icc.or.at">http://www.icc.or.at</a>
295
- )</p>
296
- <div class="Note">
297
- <p>
298
- <span class="note_label">NOTE</span>&#160; This is an annotation of ISO 20483:2013-2014</p>
299
- </div>
300
- </div>
301
- <br/>
302
- <div>
303
- <h1 class="Section3">Bibliography</h1>
304
- <p class="Biblio" id="ISBN">[1]&#160; <i>Chemicals for analytical laboratory use</i>. ISBN.</p>
305
- <p class="Biblio" id="ISSN">[2]&#160; <i>Instruments for analytical laboratory use</i>. ISSN.</p>
306
- <div class="Note">
307
- <p>
308
- <span class="note_label">NOTE</span>&#160; This is an annotation of document ISSN.</p>
309
- </div>
310
- <div class="Note">
311
- <p>
312
- <span class="note_label">NOTE</span>&#160; This is another annotation of document ISSN.</p>
313
- </div>
314
- <p class="Biblio" id="ISO3696">[3]&#160; ISO 3696,
315
- <i>Water for analytical laboratory use</i></p>
316
- <p class="Biblio" id="ref10">[10]&#160; <span style="font-variant:small-caps;">Standard No I.C.C 167</span>
317
- .
318
- <i>Determination of the protein content in cereal and cereal products for food and animal feeding stuffs according to the Dumas combustion method</i>
319
- (see
320
- <a href="http://www.icc.or.at">http://www.icc.or.at</a>
321
- )</p>
322
- <p class="Biblio" id="ref11">[4]&#160; IETF RFC 10,
323
- <i>Internet Calendaring and Scheduling Core Object Specification (iCalendar)</i>.</p>
324
- <p class="Biblio" id="ref12">Citn&#160; IETF RFC 20, CitationWorks. 2019.
325
- <i>How to cite a reference</i>
326
- .</p>
327
- </div>
328
- <aside class="footnote" id="fn:1">
329
- <p>Under preparation. (Stage at the time of publication ISO/DIS 16634)</p>
330
- </aside>
331
- </div>
332
- </body>
333
- </html>
264
+ <br/>
265
+ <div>
266
+ <h1 class='ForewordTitle'>Foreword</h1>
267
+ <p id='_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f'>
268
+ <a href='#ISO712'>ISO 712</a>
269
+ <a href='#ISBN'>[1]</a>
270
+ <a href='#ISSN'>[2]</a>
271
+ <a href='#ISO16634'>ISO 16634:--</a>
272
+ <a href='#ref1'>ICC 167</a>
273
+ <a href='#ref10'>[4]</a>
274
+ <a href='#ref12'>Citn</a>
275
+ </p>
276
+ </div>
277
+ <p class='zzSTDTitle1'/>
278
+ <div>
279
+ <h1>1  Normative References</h1>
280
+ <p>
281
+ The following documents are referred to in the text in such a way that
282
+ some or all of their content constitutes requirements of this
283
+ document. For dated references, only the edition cited applies. For
284
+ undated references, the latest edition of the referenced document
285
+ (including any amendments) applies.
286
+ </p>
287
+ <p id='ISO712' class='NormRef'>
288
+ ISO 712,
289
+ <i>Cereals and cereal products</i>
290
+ </p>
291
+ <p id='ISO16634' class='NormRef'>
292
+ ISO 16634:-- (all parts)
293
+ <a class='FootnoteRef' href='#fn:1'>
294
+ <sup>1</sup>
295
+ </a>
296
+ ,
297
+ <i>Cereals, pulses, milled cereal products, oilseeds and animal feeding stuffs</i>
298
+ </p>
299
+ <p id='ISO20483' class='NormRef'>
300
+ ISO 20483:2013-2014,
301
+ <i>Cereals and pulses</i>
302
+ </p>
303
+ <p id='ref1' class='NormRef'>
304
+ ICC 167,
305
+ <span style='font-variant:small-caps;'>Standard No I.C.C 167</span>
306
+ .
307
+ <i>
308
+ Determination of the protein content in cereal and cereal products
309
+ for food and animal feeding stuffs according to the Dumas combustion
310
+ method
311
+ </i>
312
+ (see
313
+ <a href='http://www.icc.or.at'>http://www.icc.or.at</a>
314
+ ) [ICC 167]
315
+ </p>
316
+ <div class='Note'>
317
+ <p>
318
+ <span class='note_label'>NOTE</span>
319
+   This is an annotation of ISO 20483:2013-2014
320
+ </p>
321
+ </div>
322
+ </div>
323
+ <br/>
324
+ <div>
325
+ <h1 class='Section3'>Bibliography</h1>
326
+ <p id='ISBN' class='Biblio'>
327
+ [1] 
328
+ <i>Chemicals for analytical laboratory use</i>
329
+ . n.p.: n.d. ISBN.
330
+ </p>
331
+ <p id='ISSN' class='Biblio'>
332
+ [2] 
333
+ <i>Instruments for analytical laboratory use</i>
334
+ . n.d. ISSN.
335
+ </p>
336
+ <div class='Note'>
337
+ <p>
338
+ <span class='note_label'>NOTE</span>
339
+   This is an annotation of document ISSN.
340
+ </p>
341
+ </div>
342
+ <div class='Note'>
343
+ <p>
344
+ <span class='note_label'>NOTE</span>
345
+   This is another annotation of document ISSN.
346
+ </p>
347
+ </div>
348
+ <p id='ISO3696' class='Biblio'>
349
+ [3]  ISO 3696,
350
+ <i>Water for analytical laboratory use</i>
351
+ </p>
352
+ <p id='ref10' class='Biblio'>
353
+ [4] 
354
+ <span style='font-variant:small-caps;'>Standard No I.C.C 167</span>
355
+ .
356
+ <i>
357
+ Determination of the protein content in cereal and cereal products
358
+ for food and animal feeding stuffs according to the Dumas combustion
359
+ method
360
+ </i>
361
+ (see
362
+ <a href='http://www.icc.or.at'>http://www.icc.or.at</a>
363
+ )
364
+ </p>
365
+ <p id='ref11' class='Biblio'>
366
+ [5]  IETF RFC 10,
367
+ <i>Internet Calendaring and Scheduling Core Object Specification (iCalendar)</i>
368
+ </p>
369
+ <p id='ref12' class='Biblio'>
370
+ Citn  IETF RFC 20, CitationWorks. 2019.
371
+ <i>How to cite a reference</i>
372
+ . [IETF RFC 20]
373
+ </p>
374
+ </div>
375
+ <aside id='fn:1' class='footnote'>
376
+ <p>Under preparation. (Stage at the time of publication ISO/DIS 16634)</p>
377
+ </aside>
378
+ </div>
379
+ </body>
380
+ </html>
334
381
  OUTPUT
335
382
  expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({})
336
383
  .convert("test", input, true))
@@ -372,14 +419,14 @@ RSpec.describe IsoDoc do
372
419
  <em>
373
420
  <span class='stddocTitle'>IGNF. (IGN France) Registry</span>
374
421
  </em>
375
- [website]. Available from:
422
+ [website]. n.d. Available from:
376
423
  <span class='biburl'>
377
424
  <link target='https://registre.ign.fr/ign/IGNF/'>https://registre.ign.fr/ign/IGNF/</link>
378
425
  </span>
379
426
  .
380
427
  </formattedref>
381
428
  <uri>https://registre.ign.fr/ign/IGNF/</uri>
382
- <docidentifier type='metanorma'>2</docidentifier>
429
+ <docidentifier type='metanorma-ordinal'>[1]</docidentifier>
383
430
  </bibitem>
384
431
  </references>
385
432
  </iso-standard>
@@ -174,7 +174,6 @@ RSpec.describe Metanorma::ISO do
174
174
  :title-intro-fr: Introduction Française
175
175
  :title-main-fr: Titre Principal
176
176
  :title-part-fr: Part du Titre
177
- :library-ics: 1,2,3
178
177
  :copyright-year: 2017
179
178
  :updates: ISO 17301-1:2016
180
179
  :created-date: 2016-05-01
@@ -273,15 +272,6 @@ RSpec.describe Metanorma::ISO do
273
272
  <workgroup number="3" type="C">WG</workgroup>
274
273
  <workgroup number="31" type="C1">WG1</workgroup>
275
274
  </approvalgroup>
276
- <ics>
277
- <code>1</code>
278
- </ics>
279
- <ics>
280
- <code>2</code>
281
- </ics>
282
- <ics>
283
- <code>3</code>
284
- </ics>
285
275
  <structuredidentifier>
286
276
  <project-number amendment="1" origyr="2016-05-01" part="1">17301</project-number>
287
277
  </structuredidentifier>
@@ -66,7 +66,6 @@ RSpec.describe Metanorma::ISO do
66
66
  :title-intro-fr: Introduction Française
67
67
  :title-main-fr: Titre Principal
68
68
  :title-part-fr: Part du Titre
69
- :library-ics: 1,2,3
70
69
  :copyright-year: 2000
71
70
  :horizontal: true
72
71
  INPUT
@@ -146,15 +145,6 @@ RSpec.describe Metanorma::ISO do
146
145
  <workgroup number="3a" type="Ca">WGa</workgroup>
147
146
  <workgroup number="31a" type="C1a">WG1a</workgroup>
148
147
  </approvalgroup>
149
- <ics>
150
- <code>1</code>
151
- </ics>
152
- <ics>
153
- <code>2</code>
154
- </ics>
155
- <ics>
156
- <code>3</code>
157
- </ics>
158
148
  <structuredidentifier>
159
149
  <project-number part="1">ISO 1000</project-number>
160
150
  </structuredidentifier>
@@ -940,8 +930,8 @@ RSpec.describe Metanorma::ISO do
940
930
  INPUT
941
931
  expect(xmlpp(output.sub(%r{<boilerplate>.*</boilerplate>}m, "")))
942
932
  .to be_equivalent_to xmlpp(<<~"OUTPUT")
943
- <iso-standard xmlns="https://www.metanorma.org/ns/iso" type="semantic" version="#{Metanorma::ISO::VERSION}">
944
- <bibdata type='standard'>
933
+ <iso-standard xmlns="https://www.metanorma.org/ns/iso" type="semantic" version="#{Metanorma::ISO::VERSION}">
934
+ <bibdata type='standard'>
945
935
  <contributor>
946
936
  <role type='author'/>
947
937
  <organization>
@@ -1008,6 +998,9 @@ RSpec.describe Metanorma::ISO do
1008
998
  <title type='title-intro' format='text/plain' language='en' script='Latn'>Rubber latex</title>
1009
999
  <title type='title-main' format='text/plain' language='en' script='Latn'>Sampling</title>
1010
1000
  <title type='main' format='text/plain' language='en' script='Latn'>Rubber latex&#8201;&#8212;&#8201;Sampling</title>
1001
+ <title type='title-intro' format='text/plain' language='fr' script='Latn'>Latex de caoutchouc</title>
1002
+ <title type='title-main' format='text/plain' language='fr' script='Latn'>Échantillonnage</title>
1003
+ <title type='main' format='text/plain' language='fr' script='Latn'>Latex de caoutchouc — Échantillonnage</title>
1011
1004
  <uri type='src'>https://www.iso.org/standard/23281.html</uri>
1012
1005
  <uri type='obp'>https://www.iso.org/obp/ui/#!iso:std:23281:en</uri>
1013
1006
  <uri type='rss'>https://www.iso.org/contents/data/standard/02/32/23281.detail.rss</uri>
@@ -1025,6 +1018,7 @@ RSpec.describe Metanorma::ISO do
1025
1018
  </contributor>
1026
1019
  <edition>3</edition>
1027
1020
  <language>en</language>
1021
+ <language>fr</language>
1028
1022
  <script>Latn</script>
1029
1023
  <abstract format='text/plain' language='en' script='Latn'>
1030
1024
  This International Standard specifies procedures for sampling natural
@@ -1033,6 +1027,15 @@ RSpec.describe Metanorma::ISO do
1033
1027
  contained in drums, tank cars or tanks. The procedures may also be
1034
1028
  used for sampling plastics dispersions.
1035
1029
  </abstract>
1030
+ <abstract format='text/plain' language='fr' script='Latn'>
1031
+ La présente Norme internationale spécifie des méthodes
1032
+ d’échantillonnage pour des concentrés de latex de caoutchouc naturel
1033
+ et pour échantillonner des latex de caoutchouc synthétique et des
1034
+ latex artificiels. Elle s’applique également à l’échantillonnage de
1035
+ latex de caoutchouc contenus dans des fûts, citernes routières ou de
1036
+ stockage. Le mode opératoire peut aussi être utilisé pour
1037
+ l’échantillonnage de dispersions de plastiques.
1038
+ </abstract>
1036
1039
  <status>
1037
1040
  <stage>90</stage>
1038
1041
  <substage>93</substage>
@@ -1505,5 +1505,141 @@ RSpec.describe Metanorma::ISO do
1505
1505
  expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1506
1506
  .to be_equivalent_to xmlpp(output)
1507
1507
  end
1508
+
1509
+ it "does not allows subterms outside of vocabulary document" do
1510
+ input = <<~INPUT
1511
+ = Document title
1512
+ Author
1513
+ :docfile: test.adoc
1514
+ :nodoc:
1515
+ :novalid:
1516
+ :no-isobib:
1517
+
1518
+ == Terms and definitions
1519
+
1520
+ === Term1
1521
+
1522
+ === Term2
1523
+
1524
+ ==== Term2a
1525
+ INPUT
1526
+ output = <<~OUTPUT
1527
+ #{BLANK_HDR}
1528
+ <sections>
1529
+ <clause id='_' obligation='normative'>
1530
+ <title>Terms and definitions</title>
1531
+ <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
1532
+ <p id='_'>
1533
+ ISO and IEC maintain terminology databases for use in standardization at
1534
+ the following addresses:
1535
+ </p>
1536
+ <ul id='_'>
1537
+ <li>
1538
+ <p id='_'>
1539
+ ISO Online browsing platform: available at
1540
+ <link target='https://www.iso.org/obp'/>
1541
+ </p>
1542
+ </li>
1543
+ <li>
1544
+ <p id='_'>
1545
+ IEC Electropedia: available at
1546
+ <link target='https://www.electropedia.org'/>
1547
+ </p>
1548
+ </li>
1549
+ </ul>
1550
+ <term id='term-Term1'>
1551
+ <preferred>
1552
+ <expression>
1553
+ <name>Term1</name>
1554
+ </expression>
1555
+ </preferred>
1556
+ </term>
1557
+ <terms id='_' obligation='normative'>
1558
+ <title>Term2</title>
1559
+ <term id='term-Term2a'>
1560
+ <preferred>
1561
+ <expression>
1562
+ <name>Term2a</name>
1563
+ </expression>
1564
+ </preferred>
1565
+ </term>
1566
+ </terms>
1567
+ </clause>
1568
+ </sections>
1569
+ </iso-standard>
1570
+ OUTPUT
1571
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1572
+ .to be_equivalent_to xmlpp(output)
1573
+ end
1574
+
1575
+ it "allows subterms in vocabulary document" do
1576
+ input = <<~INPUT
1577
+ = Document title
1578
+ Author
1579
+ :docfile: test.adoc
1580
+ :nodoc:
1581
+ :novalid:
1582
+ :no-isobib:
1583
+ :docsubtype: vocabulary
1584
+
1585
+ == Terms and definitions
1586
+
1587
+ === Term1
1588
+
1589
+ === Term2
1590
+
1591
+ ==== Term2a
1592
+ INPUT
1593
+ output = <<~OUTPUT
1594
+ #{BLANK_HDR.sub(%r{</doctype>}, '</doctype><subdoctype>vocabulary</subdoctype>')}
1595
+ <sections>
1596
+ <terms id='_' obligation='normative'>
1597
+ <title>Terms and definitions</title>
1598
+ <p id='_'>
1599
+ ISO and IEC maintain terminology databases for use in standardization at
1600
+ the following addresses:
1601
+ </p>
1602
+ <ul id='_'>
1603
+ <li>
1604
+ <p id='_'>
1605
+ ISO Online browsing platform: available at
1606
+ <link target='https://www.iso.org/obp'/>
1607
+ </p>
1608
+ </li>
1609
+ <li>
1610
+ <p id='_'>
1611
+ IEC Electropedia: available at
1612
+ <link target='https://www.electropedia.org'/>
1613
+ </p>
1614
+ </li>
1615
+ </ul>
1616
+ <term id='term-Term1'>
1617
+ <preferred>
1618
+ <expression>
1619
+ <name>Term1</name>
1620
+ </expression>
1621
+ </preferred>
1622
+ </term>
1623
+ <term id='term-Term2'>
1624
+ <preferred>
1625
+ <expression>
1626
+ <name>Term2</name>
1627
+ </expression>
1628
+ </preferred>
1629
+ <term id='term-Term2a'>
1630
+ <preferred>
1631
+ <expression>
1632
+ <name>Term2a</name>
1633
+ </expression>
1634
+ </preferred>
1635
+ </term>
1636
+ </term>
1637
+ </terms>
1638
+ </sections>
1639
+ </iso-standard>
1640
+ OUTPUT
1641
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1642
+ .to be_equivalent_to xmlpp(output)
1643
+ end
1508
1644
  end
1509
1645
  end
@@ -0,0 +1,99 @@
1
+ require "spec_helper"
2
+
3
+ RSpec.describe Metanorma::Standoc do
4
+ it "processes embed macro with document in a different flavour" do
5
+ input = <<~INPUT
6
+ #{ASCIIDOC_BLANK_HDR}
7
+
8
+ [[clause1]]
9
+ == Clause 1
10
+
11
+ embed::spec/assets/iso.adoc[]
12
+ INPUT
13
+ output = <<~OUTPUT
14
+ <standard-document xmlns='https://www.metanorma.org/ns/standoc' type='semantic' version='#{Metanorma::Standoc::VERSION}'>
15
+ <bibdata type='standard'>
16
+ <title language='en' format='text/plain'>Document title</title>
17
+ <language>en</language>
18
+ <script>Latn</script>
19
+ <status>
20
+ <stage>published</stage>
21
+ </status>
22
+ <copyright>
23
+ <from>2022</from>
24
+ </copyright>
25
+ <ext>
26
+ <doctype>standard</doctype>
27
+ </ext>
28
+ <relation type='derivedFrom'>
29
+ <bibitem>
30
+ <title language='en' format='text/plain' type='main'>
31
+ Medical devices — Quality management systems — Requirements for
32
+ regulatory purposes
33
+ </title>
34
+ <title language='en' format='text/plain' type='title-main'>
35
+ Medical devices — Quality management systems — Requirements for
36
+ regulatory purposes
37
+ </title>
38
+ <title language='fr' format='text/plain' type='main'>
39
+ Dispositifs médicaux — Systèmes de management de la qualité —
40
+ Exigences à des fins réglementaires
41
+ </title>
42
+ <title language='fr' format='text/plain' type='title-main'>
43
+ Dispositifs médicaux — Systèmes de management de la qualité —
44
+ Exigences à des fins réglementaires
45
+ </title>
46
+ <contributor>
47
+ <role type='author'/>
48
+ <organization>
49
+ <name>International Organization for Standardization</name>
50
+ <abbreviation>ISO</abbreviation>
51
+ </organization>
52
+ </contributor>
53
+ <contributor>
54
+ <role type='publisher'/>
55
+ <organization>
56
+ <name>International Organization for Standardization</name>
57
+ <abbreviation>ISO</abbreviation>
58
+ </organization>
59
+ </contributor>
60
+ <language>en</language>
61
+ <script>Latn</script>
62
+ <status>
63
+ <stage abbreviation='IS'>60</stage>
64
+ <substage>60</substage>
65
+ </status>
66
+ <copyright>
67
+ <from>2022</from>
68
+ <owner>
69
+ <organization>
70
+ <name>International Organization for Standardization</name>
71
+ <abbreviation>ISO</abbreviation>
72
+ </organization>
73
+ </owner>
74
+ </copyright>
75
+ <ext>
76
+ <doctype>standard</doctype>
77
+ <editorialgroup>
78
+ <agency>ISO</agency>
79
+ </editorialgroup>
80
+ <approvalgroup>
81
+ <agency>ISO</agency>
82
+ </approvalgroup>
83
+ <stagename>International standard</stagename>
84
+ </ext>
85
+ </bibitem>
86
+ </relation>
87
+ </bibdata>
88
+ <sections>
89
+ <clause id='clause1' inline-header='false' obligation='normative'>
90
+ <title>Clause 1</title>
91
+ </clause>
92
+ </sections>
93
+ </standard-document>
94
+ OUTPUT
95
+ expect(xmlpp(strip_guid(Asciidoctor
96
+ .convert(input, backend: :standoc, header_footer: true))))
97
+ .to be_equivalent_to xmlpp(output)
98
+ end
99
+ end