isodoc 2.0.8 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/isodoc.gemspec +4 -2
  3. data/lib/isodoc/convert.rb +13 -5
  4. data/lib/isodoc/css.rb +11 -10
  5. data/lib/isodoc/function/blocks.rb +0 -39
  6. data/lib/isodoc/function/blocks_example_note.rb +36 -1
  7. data/lib/isodoc/function/inline.rb +4 -0
  8. data/lib/isodoc/function/references.rb +4 -17
  9. data/lib/isodoc/function/section.rb +5 -0
  10. data/lib/isodoc/function/to_word_html.rb +7 -11
  11. data/lib/isodoc/html_function/postprocess.rb +16 -2
  12. data/lib/isodoc/metadata.rb +2 -1
  13. data/lib/isodoc/presentation_function/bibdata.rb +50 -4
  14. data/lib/isodoc/presentation_function/block.rb +13 -1
  15. data/lib/isodoc/presentation_function/section.rb +38 -2
  16. data/lib/isodoc/presentation_xml_convert.rb +7 -2
  17. data/lib/isodoc/version.rb +1 -1
  18. data/lib/isodoc/word_function/postprocess.rb +4 -4
  19. data/lib/isodoc/word_function/postprocess_cover.rb +14 -0
  20. data/lib/isodoc/word_function/table.rb +12 -10
  21. data/lib/isodoc/xref/xref_anchor.rb +1 -1
  22. data/lib/isodoc/xref/xref_counter.rb +4 -1
  23. data/lib/isodoc/xref/xref_gen_seq.rb +3 -3
  24. data/lib/isodoc/xref/xref_sect_gen.rb +34 -36
  25. data/lib/isodoc/xref.rb +19 -8
  26. data/lib/isodoc-yaml/i18n-ar.yaml +9 -0
  27. data/lib/isodoc-yaml/i18n-de.yaml +13 -0
  28. data/lib/isodoc-yaml/i18n-en.yaml +5 -0
  29. data/lib/isodoc-yaml/i18n-es.yaml +11 -0
  30. data/lib/isodoc-yaml/i18n-fr.yaml +12 -1
  31. data/lib/isodoc-yaml/i18n-ru.yaml +13 -0
  32. data/lib/isodoc-yaml/i18n-zh-Hans.yaml +5 -0
  33. data/lib/relaton/render/config.yml +4 -0
  34. data/lib/relaton/render/general.rb +35 -0
  35. data/spec/assets/i18n.yaml +6 -0
  36. data/spec/isodoc/blocks_spec.rb +249 -62
  37. data/spec/isodoc/i18n_spec.rb +266 -197
  38. data/spec/isodoc/inline_spec.rb +81 -107
  39. data/spec/isodoc/metadata_spec.rb +5 -3
  40. data/spec/isodoc/postproc_spec.rb +539 -397
  41. data/spec/isodoc/presentation_xml_spec.rb +107 -0
  42. data/spec/isodoc/ref_spec.rb +142 -92
  43. data/spec/isodoc/section_spec.rb +4 -4
  44. data/spec/isodoc/xref_numbering_spec.rb +31 -0
  45. data/spec/isodoc/xref_spec.rb +106 -106
  46. metadata +24 -8
@@ -1360,6 +1360,113 @@ RSpec.describe IsoDoc do
1360
1360
  .to be_equivalent_to xmlpp(presxml)
1361
1361
  end
1362
1362
 
1363
+ it "passes font names to Presentation XML" do
1364
+ input = <<~INPUT
1365
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
1366
+ <bibdata/>
1367
+ <sections>
1368
+ <clause id="A" inline-header="false" obligation="normative">
1369
+ <title>Section</title>
1370
+ <figure id="B1">
1371
+ <name>First</name>
1372
+ </figure>
1373
+ </clause>
1374
+ </sections>
1375
+ </iso-standard>
1376
+ INPUT
1377
+ presxml = <<~OUTPUT
1378
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
1379
+ <bibdata/>
1380
+ <presentation-metadata>
1381
+ <name>font-license-agreement</name>
1382
+ <value>no-install-fonts</value>
1383
+ </presentation-metadata>
1384
+ <presentation-metadata>
1385
+ <name>fonts</name>
1386
+ <value>font2</value>
1387
+ </presentation-metadata>
1388
+ <presentation-metadata>
1389
+ <name>fonts</name>
1390
+ <value>font1</value>
1391
+ </presentation-metadata>
1392
+ <sections>
1393
+ <clause id='A' inline-header='false' obligation='normative' displayorder='1'>
1394
+ <title depth='1'>
1395
+ 1.
1396
+ <tab/>
1397
+ Section
1398
+ </title>
1399
+ <figure id='B1'>
1400
+ <name>Figure 1&#xA0;&#x2014; First</name>
1401
+ </figure>
1402
+ </clause>
1403
+ </sections>
1404
+ </iso-standard>
1405
+ OUTPUT
1406
+ expect(xmlpp(IsoDoc::PresentationXMLConvert
1407
+ .new({ fonts: "font1; font2", fontlicenseagreement: "no-install-fonts" })
1408
+ .convert("test", input, true))
1409
+ .sub(%r{<localized-strings>.*</localized-strings>}m, ""))
1410
+ .to be_equivalent_to xmlpp(presxml)
1411
+ end
1412
+
1413
+ it "skips numbering of hidden sections" do
1414
+ input = <<~INPUT
1415
+ <standard-document xmlns="https://www.metanorma.org/ns/standoc" type="semantic">
1416
+ <bibdata/>
1417
+ <sections><clause id="_scope" type="scope" inline-header="false" obligation="normative">
1418
+ <title>Scope</title>
1419
+ <p id="_8d98c053-85d7-e8cc-75bb-183a14209d61">A</p>
1420
+
1421
+ <p id="_2141c040-93a4-785a-73f0-ffad4fa1779f"><eref type="inline" bibitemid="_607373b1-0cc4-fcdb-c482-fd86ae572bd1" citeas="ISO 639-2"/></p>
1422
+ </clause>
1423
+
1424
+ <terms id="_terms_and_definitions" obligation="normative">
1425
+ <title>Terms and definitions</title><p id="_36938d4b-05e5-bd0f-a082-0415db50e8f7">No terms and definitions are listed in this document.</p>
1426
+
1427
+ </terms>
1428
+ </sections><bibliography><references hidden="true" normative="true">
1429
+ <title>Normative references</title>
1430
+ </references>
1431
+ </bibliography></standard-document>
1432
+ INPUT
1433
+ presxml = <<~OUTPUT
1434
+ <standard-document xmlns="https://www.metanorma.org/ns/standoc" type="presentation">
1435
+ <bibdata/>
1436
+ <sections>
1437
+ <clause id='_scope' type='scope' inline-header='false' obligation='normative' displayorder='1'>
1438
+ <title depth='1'>
1439
+ 1.
1440
+ <tab/>
1441
+ Scope
1442
+ </title>
1443
+ <p id='_8d98c053-85d7-e8cc-75bb-183a14209d61'>A</p>
1444
+ <p id='_2141c040-93a4-785a-73f0-ffad4fa1779f'>
1445
+ <eref type='inline' bibitemid='_607373b1-0cc4-fcdb-c482-fd86ae572bd1' citeas='ISO 639-2'>ISO 639-2</eref>
1446
+ </p>
1447
+ </clause>
1448
+ <terms id='_terms_and_definitions' obligation='normative' displayorder='3'>
1449
+ <title depth='1'>
1450
+ 2.
1451
+ <tab/>
1452
+ Terms and definitions
1453
+ </title>
1454
+ <p id='_36938d4b-05e5-bd0f-a082-0415db50e8f7'>No terms and definitions are listed in this document.</p>
1455
+ </terms>
1456
+ </sections>
1457
+ <bibliography>
1458
+ <references hidden='true' normative='true' displayorder='2'>
1459
+ <title depth='1'>Normative references</title>
1460
+ </references>
1461
+ </bibliography>
1462
+ </standard-document>
1463
+ OUTPUT
1464
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
1465
+ .convert("test", input, true))
1466
+ .sub(%r{<localized-strings>.*</localized-strings>}m, ""))
1467
+ .to be_equivalent_to xmlpp(presxml)
1468
+ end
1469
+
1363
1470
  private
1364
1471
 
1365
1472
  def mock_symbols
@@ -68,7 +68,7 @@ RSpec.describe IsoDoc do
68
68
  <bibitem id="zip_ffs"><formattedref format="application/x-isodoc+xml">Title 5</formattedref><docidentifier type="metanorma">[5]</docidentifier></bibitem>
69
69
  </references><references id="_bibliography" obligation="informative" normative="false">
70
70
  <title>Bibliography</title>
71
- <bibitem id="ISBN" type="ISBN">
71
+ <bibitem id="ISBN" type="book">
72
72
  <title format="text/plain">Chemicals for analytical laboratory use</title>
73
73
  <docidentifier type="ISBN">ISBN</docidentifier>
74
74
  <contributor>
@@ -78,7 +78,7 @@ RSpec.describe IsoDoc do
78
78
  </organization>
79
79
  </contributor>
80
80
  </bibitem>
81
- <bibitem id="ISSN" type="ISSN">
81
+ <bibitem id="ISSN" type="journal">
82
82
  <title format="text/plain">Instruments for analytical laboratory use</title>
83
83
  <docidentifier type="ISSN">ISSN</docidentifier>
84
84
  <contributor>
@@ -159,51 +159,18 @@ RSpec.describe IsoDoc do
159
159
  amendments) applies.
160
160
  </p>
161
161
  <bibitem id='ISO712' type='standard'>
162
- <title format='text/plain'>Cereals or cereal products</title>
163
- <title type='main' format='text/plain'>Cereals and cereal products</title>
162
+ <formattedref>International Organization for Standardization. <em>Cereals and cereal products</em>.</formattedref>
164
163
  <docidentifier type='ISO'>ISO 712</docidentifier>
165
164
  <docidentifier type='metanorma'>[110]</docidentifier>
166
- <contributor>
167
- <role type='publisher'/>
168
- <organization>
169
- <name>International Organization for Standardization</name>
170
- </organization>
171
- </contributor>
172
165
  </bibitem>
173
166
  <bibitem id='ISO16634' type='standard'>
174
- <title language='x' format='text/plain'>
175
- Cereals, pulses, milled cereal products, xxxx, oilseeds and animal
176
- feeding stuffs
177
- </title>
178
- <title language='en' format='text/plain'>Cereals, pulses, milled cereal products, oilseeds and animal feeding stuffs</title>
167
+ <formattedref><em>Cereals, pulses, milled cereal products, oilseeds and animal feeding stuffs</em>.</formattedref>
179
168
  <docidentifier type='ISO'>ISO 16634:-- (all parts)</docidentifier>
180
- <date type='published'>
181
- <on>--</on>
182
- </date>
183
- <contributor>
184
- <role type='publisher'/>
185
- <organization>
186
- <abbreviation>ISO</abbreviation>
187
- </organization>
188
- </contributor>
189
169
  <note format='text/plain' type='Unpublished-Status' reference='1'>Under preparation. (Stage at the time of publication ISO/DIS 16634)</note>
190
- <extent type='part'>
191
- <referenceFrom>all</referenceFrom>
192
- </extent>
193
170
  </bibitem>
194
171
  <bibitem id='ISO20483' type='standard'>
195
- <title format='text/plain'>Cereals and pulses</title>
172
+ <formattedref>International Organization for Standardization. <em>Cereals and pulses</em>. 2013&#x2013;2014.</formattedref>
196
173
  <docidentifier type='ISO'>ISO 20483:2013-2014</docidentifier>
197
- <date type='published'>
198
- <from>2013</from>
199
- <to>2014</to>
200
- </date>
201
- <contributor>
202
- <role type='publisher'/>
203
- <organization>
204
- <name>International Organization for Standardization</name>
205
- </organization>
206
- </contributor>
207
174
  </bibitem>
208
175
  <bibitem id='ref1'>
209
176
  <formattedref format='application/x-isodoc+xml'>
@@ -216,7 +183,7 @@ RSpec.describe IsoDoc do
216
183
  </em>
217
184
  (see
218
185
  <link target='http://www.icc.or.at'/>
219
- )
186
+ ) [ICC/167]
220
187
  </formattedref>
221
188
  <docidentifier type='ICC'>ICC/167</docidentifier>
222
189
  </bibitem>
@@ -231,27 +198,15 @@ RSpec.describe IsoDoc do
231
198
  </references>
232
199
  <references id='_bibliography' obligation='informative' normative='false' displayorder="3">
233
200
  <title depth="1">Bibliography</title>
234
- <bibitem id='ISBN' type='ISBN'>
235
- <title format='text/plain'>Chemicals for analytical laboratory use</title>
201
+ <bibitem id='ISBN' type='book'>
202
+ <formattedref><em>Chemicals for analytical laboratory use</em>. ISBN.</formattedref>
236
203
  <docidentifier type='metanorma-ordinal'>[1]</docidentifier>
237
204
  <docidentifier type='ISBN'>ISBN</docidentifier>
238
- <contributor>
239
- <role type='publisher'/>
240
- <organization>
241
- <abbreviation>ISBN</abbreviation>
242
- </organization>
243
- </contributor>
244
205
  </bibitem>
245
- <bibitem id='ISSN' type='ISSN'>
246
- <title format='text/plain'>Instruments for analytical laboratory use</title>
206
+ <bibitem id='ISSN' type='journal'>
207
+ <formattedref><em>Instruments for analytical laboratory use</em>. ISSN.</formattedref>
247
208
  <docidentifier type='metanorma-ordinal'>[2]</docidentifier>
248
209
  <docidentifier type='ISSN'>ISSN</docidentifier>
249
- <contributor>
250
- <role type='publisher'/>
251
- <organization>
252
- <abbreviation>ISSN</abbreviation>
253
- </organization>
254
- </contributor>
255
210
  </bibitem>
256
211
  <note>
257
212
  <name>NOTE</name>
@@ -262,15 +217,9 @@ RSpec.describe IsoDoc do
262
217
  <p>This is another annotation of document ISSN.</p>
263
218
  </note>
264
219
  <bibitem id='ISO3696' type='standard'>
265
- <title format='text/plain'>Water for analytical laboratory use</title>
220
+ <formattedref><em>Water for analytical laboratory use</em>.</formattedref>
266
221
  <docidentifier type='metanorma-ordinal'>[3]</docidentifier>
267
222
  <docidentifier type='ISO'>ISO 3696</docidentifier>
268
- <contributor>
269
- <role type='publisher'/>
270
- <organization>
271
- <abbreviation>ISO</abbreviation>
272
- </organization>
273
- </contributor>
274
223
  </bibitem>
275
224
  <bibitem id='ref10'>
276
225
  <formattedref format='application/x-isodoc+xml'>
@@ -288,11 +237,11 @@ RSpec.describe IsoDoc do
288
237
  <docidentifier type='metanorma'>[10]</docidentifier>
289
238
  </bibitem>
290
239
  <bibitem id="ref10a" hidden="true">
291
- <title>Internet Calendaring and Scheduling Core Object Specification (iCalendar)</title>
240
+ <formattedref><em>Internet Calendaring and Scheduling Core Object Specification (iCalendar)</em>.</formattedref>
292
241
  <docidentifier type="IETF">IETF RFC 20</docidentifier>
293
242
  </bibitem>
294
243
  <bibitem id='ref11'>
295
- <title>Internet Calendaring and Scheduling Core Object Specification (iCalendar)</title>
244
+ <formattedref><em>Internet Calendaring and Scheduling Core Object Specification (iCalendar)</em>.</formattedref>
296
245
  <docidentifier type='metanorma-ordinal'>[4]</docidentifier>
297
246
  <docidentifier type='IETF'>IETF RFC 10</docidentifier>
298
247
  </bibitem>
@@ -300,18 +249,18 @@ RSpec.describe IsoDoc do
300
249
  <formattedref format='application/x-isodoc+xml'>
301
250
  CitationWorks. 2019.
302
251
  <em>How to cite a reference</em>
303
- .
252
+ . [IETF RFC 20]
304
253
  </formattedref>
305
254
  <docidentifier type='metanorma'>[Citn]</docidentifier>
306
255
  <docidentifier type='IETF'>IETF RFC 20</docidentifier>
307
256
  </bibitem>
308
257
  <bibitem id="ref10b">
309
- <title>Internet Calendaring and Scheduling Core Object Specification (iCalendar)</title>
258
+ <formattedref><em>Internet Calendaring and Scheduling Core Object Specification (iCalendar)</em>.</formattedref>
310
259
  <docidentifier type='metanorma-ordinal'>[5]</docidentifier>
311
260
  <docidentifier type="IETF">IETF RFC 20</docidentifier>
312
261
  </bibitem>
313
262
  <bibitem id='ref10c'>
314
- <title>Internet Calendaring and Scheduling Core Object Specification (iCalendar)</title>
263
+ <formattedref><em>Internet Calendaring and Scheduling Core Object Specification (iCalendar)</em>.</formattedref>
315
264
  <docidentifier type='metanorma-ordinal'>[6]</docidentifier>
316
265
  <docidentifier type='DOI'>DOI ABC 20</docidentifier>
317
266
  </bibitem>
@@ -321,8 +270,8 @@ RSpec.describe IsoDoc do
321
270
  PRESXML
322
271
 
323
272
  html = <<~OUTPUT
324
- #{HTML_HDR}
325
- <br/>
273
+ #{HTML_HDR}
274
+ <br/>
326
275
  <div>
327
276
  <h1 class='ForewordTitle'>Foreword</h1>
328
277
  <p id='_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f'>
@@ -340,15 +289,16 @@ RSpec.describe IsoDoc do
340
289
  <div>
341
290
  <h1>1.&#160; Normative References</h1>
342
291
  <p>
343
- The following documents are referred to in the text in such a way that
344
- some or all of their content constitutes requirements of this
292
+ The following documents are referred to in the text in such a way
293
+ that some or all of their content constitutes requirements of this
345
294
  document. For dated references, only the edition cited applies. For
346
295
  undated references, the latest edition of the referenced document
347
296
  (including any amendments) applies.
348
297
  </p>
349
298
  <p id='ISO712' class='NormRef'>
350
- [110], ISO 712,
299
+ [110], ISO 712, International Organization for Standardization.
351
300
  <i>Cereals and cereal products</i>
301
+ .
352
302
  </p>
353
303
  <p id='ISO16634' class='NormRef'>
354
304
  ISO 16634:-- (all parts)
@@ -357,23 +307,25 @@ RSpec.describe IsoDoc do
357
307
  </a>
358
308
  ,
359
309
  <i>Cereals, pulses, milled cereal products, oilseeds and animal feeding stuffs</i>
310
+ .
360
311
  </p>
361
312
  <p id='ISO20483' class='NormRef'>
362
- ISO 20483:2013-2014,
313
+ ISO 20483:2013-2014, International Organization for Standardization.
363
314
  <i>Cereals and pulses</i>
315
+ . 2013&#8211;2014.
364
316
  </p>
365
317
  <p id='ref1' class='NormRef'>
366
318
  ICC/167,
367
319
  <span style='font-variant:small-caps;'>Standard No I.C.C 167</span>
368
- .
320
+ .
369
321
  <i>
370
- Determination of the protein content in cereal and cereal products
322
+ Determination of the protein content in cereal and cereal products
371
323
  for food and animal feeding stuffs according to the Dumas combustion
372
324
  method
373
325
  </i>
374
326
  (see
375
327
  <a href='http://www.icc.or.at'>http://www.icc.or.at</a>
376
- )
328
+ ) [ICC/167]
377
329
  </p>
378
330
  <div class='Note'>
379
331
  <p>
@@ -389,10 +341,12 @@ RSpec.describe IsoDoc do
389
341
  <p id='ISBN' class='Biblio'>
390
342
  [1]&#160;
391
343
  <i>Chemicals for analytical laboratory use</i>
344
+ . ISBN.
392
345
  </p>
393
346
  <p id='ISSN' class='Biblio'>
394
347
  [2]&#160;
395
348
  <i>Instruments for analytical laboratory use</i>
349
+ . ISSN.
396
350
  </p>
397
351
  <div class='Note'>
398
352
  <p>
@@ -409,37 +363,41 @@ RSpec.describe IsoDoc do
409
363
  <p id='ISO3696' class='Biblio'>
410
364
  [3]&#160; ISO 3696,
411
365
  <i>Water for analytical laboratory use</i>
366
+ .
412
367
  </p>
413
368
  <p id='ref10' class='Biblio'>
414
369
  [10]&#160;
415
370
  <span style='font-variant:small-caps;'>Standard No I.C.C 167</span>
416
- .
371
+ .
417
372
  <i>
418
- Determination of the protein content in cereal and cereal products
373
+ Determination of the protein content in cereal and cereal products
419
374
  for food and animal feeding stuffs according to the Dumas combustion
420
375
  method
421
376
  </i>
422
377
  (see
423
378
  <a href='http://www.icc.or.at'>http://www.icc.or.at</a>
424
- )
379
+ )
425
380
  </p>
426
381
  <p id='ref11' class='Biblio'>
427
382
  [4]&#160; IETF RFC 10,
428
383
  <i>Internet Calendaring and Scheduling Core Object Specification (iCalendar)</i>
384
+ .
429
385
  </p>
430
386
  <p id='ref12' class='Biblio'>
431
387
  Citn&#160; IETF RFC 20, CitationWorks. 2019.
432
388
  <i>How to cite a reference</i>
433
- .
389
+ . [IETF RFC 20]
434
390
  </p>
435
- <p id='ref10b' class='Biblio'>
391
+ <p id='ref10b' class='Biblio'>
436
392
  [5]&#160; IETF RFC 20,
437
393
  <i>Internet Calendaring and Scheduling Core Object Specification (iCalendar)</i>
394
+ .
438
395
  </p>
439
396
  <p id='ref10c' class='Biblio'>
440
- [6]&#160;
441
- <i>Internet Calendaring and Scheduling Core Object Specification (iCalendar)</i>
442
- </p>
397
+ [6]&#160;
398
+ <i>Internet Calendaring and Scheduling Core Object Specification (iCalendar)</i>
399
+ .
400
+ </p>
443
401
  </div>
444
402
  <aside id='fn:1' class='footnote'>
445
403
  <p>Under preparation. (Stage at the time of publication ISO/DIS 16634)</p>
@@ -702,11 +660,7 @@ RSpec.describe IsoDoc do
702
660
  </contributor>
703
661
  </bibitem>
704
662
  <bibitem id='ISO16634' type='standard'>
705
- <title language='x' format='text/plain'>
706
- Cereals, pulses, milled cereal products, xxxx, oilseeds and animal
707
- feeding stuffs
708
- </title>
709
- <title language='en' format='text/plain'>Cereals, pulses, milled cereal products, oilseeds and animal feeding stuffs</title>
663
+ <formattedref language='en' format='text/plain'><em>Cereals, pulses, milled cereal products, oilseeds and animal feeding stuffs</em></formattedref>
710
664
  <docidentifier type='ISO'>ISO 16634:-- (all parts)</docidentifier>
711
665
  <date type='published'>
712
666
  <on>--</on>
@@ -880,16 +834,16 @@ RSpec.describe IsoDoc do
880
834
  <references id='_normative_references' obligation='informative' normative='false' displayorder='1'>
881
835
  <title depth='1'>Bibliography</title>
882
836
  <bibitem id='ref1' type='standard'>
883
- <title format='text/plain'>Cereals or cereal products</title>
837
+ <formattedref><em>Cereals or cereal products</em>.</formattedref>
884
838
  <docidentifier type='metanorma-ordinal'>[1]</docidentifier>
885
839
  <docidentifier type='IEC'>IEC 217</docidentifier>
886
840
  </bibitem>
887
841
  <bibitem id='ref2' type='standard'>
888
- <title format='text/plain'>Cereals or cereal products</title>
842
+ <formattedref><em>Cereals or cereal products</em>.</formattedref>
889
843
  <docidentifier type='metanorma'>[3]</docidentifier>
890
844
  </bibitem>
891
845
  <bibitem id='ref3' type='standard'>
892
- <title format='text/plain'>Cereals or cereal products</title>
846
+ <formattedref><em>Cereals or cereal products</em>.</formattedref>
893
847
  <docidentifier type='metanorma-ordinal'>[4]</docidentifier>
894
848
  <docidentifier>ABC</docidentifier>
895
849
  </bibitem>
@@ -902,4 +856,100 @@ RSpec.describe IsoDoc do
902
856
  ).at("//xmlns:bibliography").to_xml))
903
857
  .to be_equivalent_to xmlpp(presxml)
904
858
  end
859
+
860
+ it "enforces consistent references numbering with hidden items: metanorma identifiers" do
861
+ input = <<~INPUT
862
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
863
+ <bibdata>
864
+ <language>en</language>
865
+ </bibdata>
866
+ <bibliography><references id="_normative_references" obligation="informative" normative="false"><title>Bibliography</title>
867
+ <bibitem id="ref1" type="standard">
868
+ <title format="text/plain">Cereals or cereal products</title>
869
+ <docidentifier type="metanorma">[1]</docidentifier>
870
+ </bibitem>
871
+ <bibitem id="ref2" type="standard" hidden="true">
872
+ <title format="text/plain">Cereals or cereal products</title>
873
+ <docidentifier type="metanorma">[2]</docidentifier>
874
+ </bibitem>
875
+ <bibitem id="ref3" type="standard">
876
+ <title format="text/plain">Cereals or cereal products</title>
877
+ <docidentifier type="metanorma">[3]</docidentifier>
878
+ </bibitem>
879
+ </references></bibliography></iso-standard>
880
+ INPUT
881
+ presxml = <<~PRESXML
882
+ <bibliography>
883
+ <references id='_normative_references' obligation='informative' normative='false' displayorder='1'>
884
+ <title depth='1'>Bibliography</title>
885
+ <bibitem id='ref1' type='standard'>
886
+ <formattedref><em>Cereals or cereal products</em>.</formattedref>
887
+ <docidentifier type='metanorma'>[1]</docidentifier>
888
+ </bibitem>
889
+ <bibitem id='ref2' type='standard' hidden='true'>
890
+ <formattedref><em>Cereals or cereal products</em>.</formattedref>
891
+ <docidentifier type='metanorma'>[2]</docidentifier>
892
+ </bibitem>
893
+ <bibitem id='ref3' type='standard'>
894
+ <formattedref><em>Cereals or cereal products</em>.</formattedref>
895
+ <docidentifier type='metanorma'>[3]</docidentifier>
896
+ </bibitem>
897
+ </references>
898
+ </bibliography>
899
+ PRESXML
900
+ expect(xmlpp(Nokogiri::XML(
901
+ IsoDoc::PresentationXMLConvert.new({})
902
+ .convert("test", input, true),
903
+ ).at("//xmlns:bibliography").to_xml))
904
+ .to be_equivalent_to xmlpp(presxml)
905
+ end
906
+
907
+ it "enforces consistent references numbering with hidden items: metanorma-ordinal identifiers" do
908
+ input = <<~INPUT
909
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
910
+ <bibdata>
911
+ <language>en</language>
912
+ </bibdata>
913
+ <bibliography><references id="_normative_references" obligation="informative" normative="false"><title>Bibliography</title>
914
+ <bibitem id="ref1" type="standard">
915
+ <title format="text/plain">Cereals or cereal products</title>
916
+ <docidentifier>ABC</docidentifier>
917
+ </bibitem>
918
+ <bibitem id="ref2" type="standard" hidden="true">
919
+ <title format="text/plain">Cereals or cereal products</title>
920
+ <docidentifier>ABD</docidentifier>
921
+ </bibitem>
922
+ <bibitem id="ref3" type="standard">
923
+ <title format="text/plain">Cereals or cereal products</title>
924
+ <docidentifier>ABE</docidentifier>
925
+ </bibitem>
926
+ </references></bibliography></iso-standard>
927
+ INPUT
928
+ presxml = <<~PRESXML
929
+ <bibliography>
930
+ <references id='_normative_references' obligation='informative' normative='false' displayorder='1'>
931
+ <title depth='1'>Bibliography</title>
932
+ <bibitem id='ref1' type='standard'>
933
+ <formattedref><em>Cereals or cereal products</em>.</formattedref>
934
+ <docidentifier type='metanorma-ordinal'>[1]</docidentifier>
935
+ <docidentifier>ABC</docidentifier>
936
+ </bibitem>
937
+ <bibitem id='ref2' type='standard' hidden='true'>
938
+ <formattedref><em>Cereals or cereal products</em>.</formattedref>
939
+ <docidentifier>ABD</docidentifier>
940
+ </bibitem>
941
+ <bibitem id='ref3' type='standard'>
942
+ <formattedref><em>Cereals or cereal products</em>.</formattedref>
943
+ <docidentifier type='metanorma-ordinal'>[2]</docidentifier>
944
+ <docidentifier>ABE</docidentifier>
945
+ </bibitem>
946
+ </references>
947
+ </bibliography>
948
+ PRESXML
949
+ expect(xmlpp(Nokogiri::XML(
950
+ IsoDoc::PresentationXMLConvert.new({})
951
+ .convert("test", input, true),
952
+ ).at("//xmlns:bibliography").to_xml))
953
+ .to be_equivalent_to xmlpp(presxml)
954
+ end
905
955
  end
@@ -45,7 +45,6 @@ RSpec.describe IsoDoc do
45
45
  </div>
46
46
  <p class='zzSTDTitle1'/>
47
47
  <div id='L' class='Admonition'>
48
- <p class='AdmonitionTitle' style='text-align:center;'>CAUTION</p>
49
48
  <p>admonition</p>
50
49
  </div>
51
50
  <div id='M'>
@@ -105,7 +104,6 @@ RSpec.describe IsoDoc do
105
104
  <div class='WordSection3'>
106
105
  <p class='zzSTDTitle1'/>
107
106
  <div id='L' class='Admonition'>
108
- <p class='AdmonitionTitle' style='text-align:center;'>CAUTION</p>
109
107
  <p>admonition</p>
110
108
  </div>
111
109
  <div id='M'>
@@ -201,7 +199,9 @@ RSpec.describe IsoDoc do
201
199
  </acknowledgements>
202
200
  </preface><sections>
203
201
  <note id="NN1"><p>Initial note</p></note>
204
- <admonition id="NN2" type="warning"><p>Initial admonition</p></admonition>
202
+ <admonition id="NN2" type="warning">
203
+ <name>WARNING</name>
204
+ <p>Initial admonition</p></admonition>
205
205
  <clause id="D" obligation="normative" type="scope">
206
206
  <title>Scope</title>
207
207
  <p id="E">Text</p>
@@ -316,6 +316,7 @@ RSpec.describe IsoDoc do
316
316
  <p>Initial note</p>
317
317
  </note>
318
318
  <admonition id='NN2' type='warning'>
319
+ <name>WARNING</name>
319
320
  <p>Initial admonition</p>
320
321
  </admonition>
321
322
  <clause id='D' obligation='normative' type='scope' displayorder='7'>
@@ -2048,7 +2049,6 @@ RSpec.describe IsoDoc do
2048
2049
  <strong>Glossary</strong>
2049
2050
  </title>
2050
2051
  <terms id='PP1' obligation='normative'>
2051
- <title>A.</title>
2052
2052
  <term id='term-glossary'>
2053
2053
  <name>A.1.</name>
2054
2054
  <preferred><strong>Glossary</strong></preferred>
@@ -344,4 +344,35 @@ RSpec.describe IsoDoc do
344
344
  a.increment({})
345
345
  expect(a.print).to eq "Bb"
346
346
  end
347
+
348
+ it "returns initial unincremented value" do
349
+ input = <<~INPUT
350
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
351
+ <preface>
352
+ <foreword id="fwd">
353
+ <note id="A" unnumbered="true"/>
354
+ <note id="B" unnumbered="false"/>
355
+ <note id="C" unnumbered="true"/>
356
+ </foreword>
357
+ </preface>
358
+ </iso-standard>
359
+ INPUT
360
+ output = <<~OUTPUT
361
+ <foreword id='fwd' displayorder='1'>
362
+ <note id='A' unnumbered='true'>
363
+ <name>NOTE </name>
364
+ </note>
365
+ <note id='B' unnumbered='false'>
366
+ <name>NOTE </name>
367
+ </note>
368
+ <note id='C' unnumbered='true'>
369
+ <name>NOTE </name>
370
+ </note>
371
+ </foreword>
372
+ OUTPUT
373
+ expect(xmlpp(Nokogiri::XML(IsoDoc::PresentationXMLConvert.new({})
374
+ .convert("test", input, true))
375
+ .at("//xmlns:foreword").to_xml))
376
+ .to be_equivalent_to xmlpp(output)
377
+ end
347
378
  end