metanorma-standoc 1.11.3 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (150) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +3 -31
  3. data/.gitignore +23 -0
  4. data/Gemfile +0 -1
  5. data/lib/asciidoctor/standoc/base.rb +2 -145
  6. data/lib/asciidoctor/standoc/blocks.rb +2 -238
  7. data/lib/asciidoctor/standoc/blocks_notes.rb +2 -100
  8. data/lib/asciidoctor/standoc/cleanup.rb +2 -208
  9. data/lib/asciidoctor/standoc/cleanup_amend.rb +2 -53
  10. data/lib/asciidoctor/standoc/cleanup_block.rb +2 -172
  11. data/lib/asciidoctor/standoc/cleanup_boilerplate.rb +2 -212
  12. data/lib/asciidoctor/standoc/cleanup_footnotes.rb +2 -108
  13. data/lib/asciidoctor/standoc/cleanup_image.rb +2 -69
  14. data/lib/asciidoctor/standoc/cleanup_inline.rb +2 -189
  15. data/lib/asciidoctor/standoc/cleanup_maths.rb +2 -221
  16. data/lib/asciidoctor/standoc/cleanup_ref.rb +2 -169
  17. data/lib/asciidoctor/standoc/cleanup_ref_dl.rb +2 -103
  18. data/lib/asciidoctor/standoc/cleanup_reqt.rb +2 -110
  19. data/lib/asciidoctor/standoc/cleanup_section.rb +2 -184
  20. data/lib/asciidoctor/standoc/cleanup_section_names.rb +2 -91
  21. data/lib/asciidoctor/standoc/cleanup_symbols.rb +2 -47
  22. data/lib/asciidoctor/standoc/cleanup_table.rb +2 -67
  23. data/lib/asciidoctor/standoc/cleanup_terms.rb +2 -139
  24. data/lib/asciidoctor/standoc/cleanup_terms_designations.rb +2 -192
  25. data/lib/asciidoctor/standoc/cleanup_text.rb +2 -95
  26. data/lib/asciidoctor/standoc/cleanup_toc.rb +3 -0
  27. data/lib/asciidoctor/standoc/cleanup_xref.rb +2 -106
  28. data/lib/asciidoctor/standoc/converter.rb +2 -123
  29. data/lib/asciidoctor/standoc/datamodel/attributes_table_preprocessor.rb +2 -56
  30. data/lib/asciidoctor/standoc/datamodel/diagram_preprocessor.rb +2 -102
  31. data/lib/asciidoctor/standoc/datamodel/plantuml_renderer.rb +3 -404
  32. data/lib/asciidoctor/standoc/deprecated.rb +5 -0
  33. data/lib/asciidoctor/standoc/front.rb +2 -219
  34. data/lib/asciidoctor/standoc/front_contributor.rb +2 -191
  35. data/lib/asciidoctor/standoc/inline.rb +2 -231
  36. data/lib/asciidoctor/standoc/lists.rb +2 -119
  37. data/lib/asciidoctor/standoc/macros.rb +2 -203
  38. data/lib/asciidoctor/standoc/macros_form.rb +2 -62
  39. data/lib/asciidoctor/standoc/macros_note.rb +2 -44
  40. data/lib/asciidoctor/standoc/macros_plantuml.rb +2 -112
  41. data/lib/asciidoctor/standoc/macros_terms.rb +2 -180
  42. data/lib/asciidoctor/standoc/ref.rb +2 -251
  43. data/lib/asciidoctor/standoc/ref_sect.rb +2 -153
  44. data/lib/asciidoctor/standoc/ref_utility.rb +2 -0
  45. data/lib/asciidoctor/standoc/render.rb +2 -116
  46. data/lib/asciidoctor/standoc/reqt.rb +2 -89
  47. data/lib/asciidoctor/standoc/section.rb +2 -194
  48. data/lib/asciidoctor/standoc/table.rb +2 -84
  49. data/lib/asciidoctor/standoc/term_lookup_cleanup.rb +2 -178
  50. data/lib/asciidoctor/standoc/terms.rb +2 -153
  51. data/lib/asciidoctor/standoc/utils.rb +2 -100
  52. data/lib/asciidoctor/standoc/validate.rb +2 -157
  53. data/lib/asciidoctor/standoc/validate_section.rb +2 -54
  54. data/lib/isodoc/html/htmlstyle.css +44 -29
  55. data/lib/isodoc/html/htmlstyle.scss +17 -12
  56. data/lib/metanorma/standoc/base.rb +163 -0
  57. data/lib/{asciidoctor → metanorma}/standoc/basicdoc.rng +0 -0
  58. data/lib/{asciidoctor → metanorma}/standoc/biblio.rng +2 -2
  59. data/lib/metanorma/standoc/blocks.rb +239 -0
  60. data/lib/metanorma/standoc/blocks_notes.rb +101 -0
  61. data/lib/metanorma/standoc/cleanup.rb +157 -0
  62. data/lib/metanorma/standoc/cleanup_amend.rb +54 -0
  63. data/lib/metanorma/standoc/cleanup_block.rb +173 -0
  64. data/lib/metanorma/standoc/cleanup_boilerplate.rb +213 -0
  65. data/lib/metanorma/standoc/cleanup_footnotes.rb +109 -0
  66. data/lib/metanorma/standoc/cleanup_image.rb +70 -0
  67. data/lib/metanorma/standoc/cleanup_inline.rb +190 -0
  68. data/lib/metanorma/standoc/cleanup_maths.rb +222 -0
  69. data/lib/metanorma/standoc/cleanup_ref.rb +170 -0
  70. data/lib/metanorma/standoc/cleanup_ref_dl.rb +104 -0
  71. data/lib/metanorma/standoc/cleanup_reqt.rb +111 -0
  72. data/lib/metanorma/standoc/cleanup_section.rb +212 -0
  73. data/lib/metanorma/standoc/cleanup_section_names.rb +92 -0
  74. data/lib/metanorma/standoc/cleanup_symbols.rb +48 -0
  75. data/lib/metanorma/standoc/cleanup_table.rb +68 -0
  76. data/lib/metanorma/standoc/cleanup_terms.rb +140 -0
  77. data/lib/metanorma/standoc/cleanup_terms_designations.rb +199 -0
  78. data/lib/metanorma/standoc/cleanup_text.rb +74 -0
  79. data/lib/metanorma/standoc/cleanup_toc.rb +98 -0
  80. data/lib/metanorma/standoc/cleanup_xref.rb +107 -0
  81. data/lib/metanorma/standoc/converter.rb +126 -0
  82. data/lib/metanorma/standoc/datamodel/attributes_table_preprocessor.rb +57 -0
  83. data/lib/metanorma/standoc/datamodel/diagram_preprocessor.rb +103 -0
  84. data/lib/metanorma/standoc/datamodel/plantuml_renderer.rb +409 -0
  85. data/lib/metanorma/standoc/front.rb +224 -0
  86. data/lib/metanorma/standoc/front_contributor.rb +192 -0
  87. data/lib/metanorma/standoc/inline.rb +232 -0
  88. data/lib/{asciidoctor → metanorma}/standoc/isodoc.rng +104 -3
  89. data/lib/metanorma/standoc/lists.rb +120 -0
  90. data/lib/metanorma/standoc/macros.rb +205 -0
  91. data/lib/metanorma/standoc/macros_embed.rb +72 -0
  92. data/lib/metanorma/standoc/macros_form.rb +63 -0
  93. data/lib/metanorma/standoc/macros_note.rb +45 -0
  94. data/lib/metanorma/standoc/macros_plantuml.rb +113 -0
  95. data/lib/metanorma/standoc/macros_terms.rb +194 -0
  96. data/lib/metanorma/standoc/ref.rb +243 -0
  97. data/lib/metanorma/standoc/ref_sect.rb +153 -0
  98. data/lib/{asciidoctor/standoc/ref_date_id.rb → metanorma/standoc/ref_utility.rb} +43 -5
  99. data/lib/metanorma/standoc/render.rb +115 -0
  100. data/lib/metanorma/standoc/reqt.rb +90 -0
  101. data/lib/{asciidoctor → metanorma}/standoc/reqt.rng +0 -0
  102. data/lib/metanorma/standoc/section.rb +209 -0
  103. data/lib/metanorma/standoc/table.rb +85 -0
  104. data/lib/metanorma/standoc/term_lookup_cleanup.rb +179 -0
  105. data/lib/metanorma/standoc/terms.rb +160 -0
  106. data/lib/metanorma/standoc/utils.rb +101 -0
  107. data/lib/metanorma/standoc/validate.rb +158 -0
  108. data/lib/metanorma/standoc/validate_section.rb +55 -0
  109. data/lib/metanorma/standoc/version.rb +1 -1
  110. data/lib/{asciidoctor → metanorma}/standoc/views/datamodel/model_representation.adoc.erb +0 -0
  111. data/lib/{asciidoctor → metanorma}/standoc/views/datamodel/plantuml_representation.adoc.erb +0 -0
  112. data/lib/metanorma-standoc.rb +1 -1
  113. data/metanorma-standoc.gemspec +1 -1
  114. data/spec/assets/a1.adoc +8 -0
  115. data/spec/assets/a2.adoc +8 -0
  116. data/spec/assets/a3.adoc +9 -0
  117. data/spec/assets/a4.adoc +4 -0
  118. data/spec/{asciidoctor → metanorma}/base_spec.rb +499 -407
  119. data/spec/{asciidoctor → metanorma}/blank_spec.rb +1 -1
  120. data/spec/{asciidoctor → metanorma}/blocks_spec.rb +1 -1
  121. data/spec/{asciidoctor → metanorma}/cleanup_blocks_spec.rb +1 -1
  122. data/spec/{asciidoctor → metanorma}/cleanup_sections_spec.rb +1 -1
  123. data/spec/{asciidoctor → metanorma}/cleanup_spec.rb +5 -5
  124. data/spec/{asciidoctor → metanorma}/cleanup_terms_spec.rb +227 -119
  125. data/spec/{asciidoctor → metanorma}/datamodel/attributes_table_preprocessor_spec.rb +1 -1
  126. data/spec/{asciidoctor → metanorma}/datamodel/diagram_preprocessor_spec.rb +1 -1
  127. data/spec/{asciidoctor → metanorma}/inline_spec.rb +170 -1
  128. data/spec/{asciidoctor → metanorma}/isobib_cache_spec.rb +1 -1
  129. data/spec/{asciidoctor → metanorma}/lists_spec.rb +1 -1
  130. data/spec/{asciidoctor → metanorma}/macros_json2text_spec.rb +0 -0
  131. data/spec/{asciidoctor → metanorma}/macros_plantuml_spec.rb +3 -3
  132. data/spec/{asciidoctor → metanorma}/macros_spec.rb +97 -6
  133. data/spec/{asciidoctor → metanorma}/macros_yaml2text_spec.rb +0 -0
  134. data/spec/metanorma/refs_dl_spec.rb +863 -0
  135. data/spec/{asciidoctor → metanorma}/refs_spec.rb +522 -15
  136. data/spec/{asciidoctor → metanorma}/section_spec.rb +59 -1
  137. data/spec/{asciidoctor → metanorma}/table_spec.rb +1 -1
  138. data/spec/{asciidoctor → metanorma}/validate_spec.rb +2 -2
  139. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +46 -46
  140. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec1.yml +12 -12
  141. data/spec/vcr_cassettes/hide_refs.yml +599 -0
  142. data/spec/vcr_cassettes/isobib_get_123.yml +12 -12
  143. data/spec/vcr_cassettes/isobib_get_123_1.yml +24 -24
  144. data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +35 -35
  145. data/spec/vcr_cassettes/isobib_get_123_2001.yml +13 -13
  146. data/spec/vcr_cassettes/isobib_get_124.yml +10 -10
  147. data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +18 -18
  148. data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +46 -46
  149. metadata +88 -32
  150. data/spec/asciidoctor/refs_dl_spec.rb +0 -864
@@ -1,7 +1,7 @@
1
1
  require "spec_helper"
2
2
  require "fileutils"
3
3
 
4
- RSpec.describe Asciidoctor::Standoc do
4
+ RSpec.describe Metanorma::Standoc do
5
5
  it "has a version number" do
6
6
  expect(Metanorma::Standoc::VERSION).not_to be nil
7
7
  end
@@ -26,7 +26,7 @@ RSpec.describe Asciidoctor::Standoc do
26
26
  <stage>published</stage>
27
27
  </status>
28
28
  <copyright>
29
- <from>2021</from>
29
+ <from>#{Time.now.year}</from>
30
30
  </copyright>
31
31
  <ext>
32
32
  <doctype>article</doctype>
@@ -222,267 +222,284 @@ RSpec.describe Asciidoctor::Standoc do
222
222
  :isbn: ISBN-13
223
223
  :isbn10: ISBN-10
224
224
  :classification: a:b, c
225
+ :toclevels: 2
226
+ :doctoclevels: 3
227
+ :htmltoclevels: 4
225
228
  INPUT
226
229
  output = <<~OUTPUT
227
- <?xml version="1.0" encoding="UTF-8"?>
228
- <standard-document xmlns="https://www.metanorma.org/ns/standoc" type="semantic" version="#{Metanorma::Standoc::VERSION}">
229
- <bibdata type="standard">
230
- <title language="en" format="text/plain">Main Title — Title</title>
231
- <docidentifier>1000-1</docidentifier>
232
- <docidentifier type='ISBN'>ISBN-13</docidentifier>
233
- <docidentifier type='ISBN10'>ISBN-10</docidentifier>
234
- <docnumber>1000</docnumber>
235
- <date type="published">
236
- <on>1000-01-01</on>
237
- </date>
238
- <date type="accessed">
239
- <on>1001-01-01</on>
240
- </date>
241
- <date type="created">
242
- <on>1002-01-01</on>
243
- </date>
244
- <date type="implemented">
245
- <on>1003-01-01</on>
246
- </date>
247
- <date type="obsoleted">
248
- <on>1004-01-01</on>
249
- </date>
250
- <date type="confirmed">
251
- <on>1005-01-01</on>
252
- </date>
253
- <date type="updated">
254
- <on>1006-01-01</on>
255
- </date>
256
- <date type="issued">
257
- <on>1007-01-01</on>
258
- </date>
259
- <date type="circulated">
260
- <on>1008-01-01</on>
261
- </date>
262
- <date type="unchanged">
263
- <on>1009-01-01</on>
264
- </date>
265
- <date type='vote-started'>
266
- <on>1011-01-01</on>
267
- </date>
268
- <date type='vote-ended'>
269
- <on>1012-01-01</on>
270
- </date>
271
- <date type="Fred">
272
- <on>1010-01-01</on>
273
- </date>
274
- <date type="Jack">
275
- <on>1010-01-01</on>
276
- </date>
277
- <contributor>
278
- <role type="author"/>
279
- <organization>
280
- <name>Hanna Barbera</name>
281
- </organization>
282
- </contributor>
283
- <contributor>
284
- <role type="author"/>
285
- <organization>
286
- <name>Cartoon Network</name>
287
- </organization>
288
- </contributor>
289
- <contributor>
290
- <role type="author"/>
291
- <organization>
292
- <name>Ribose, Inc.</name>
293
- </organization>
294
- </contributor>
295
- <contributor>
296
- <role type="author"/>
297
- <person>
298
- <name>
299
- <completename>Fred Flintstone</completename>
300
- </name>
230
+ <?xml version="1.0" encoding="UTF-8"?>
231
+ <standard-document xmlns="https://www.metanorma.org/ns/standoc" type="semantic" version="#{Metanorma::Standoc::VERSION}">
232
+ <bibdata type="standard">
233
+ <title language="en" format="text/plain">Main Title — Title</title>
234
+ <docidentifier>1000-1</docidentifier>
235
+ <docidentifier type='ISBN'>ISBN-13</docidentifier>
236
+ <docidentifier type='ISBN10'>ISBN-10</docidentifier>
237
+ <docnumber>1000</docnumber>
238
+ <date type="published">
239
+ <on>1000-01-01</on>
240
+ </date>
241
+ <date type="accessed">
242
+ <on>1001-01-01</on>
243
+ </date>
244
+ <date type="created">
245
+ <on>1002-01-01</on>
246
+ </date>
247
+ <date type="implemented">
248
+ <on>1003-01-01</on>
249
+ </date>
250
+ <date type="obsoleted">
251
+ <on>1004-01-01</on>
252
+ </date>
253
+ <date type="confirmed">
254
+ <on>1005-01-01</on>
255
+ </date>
256
+ <date type="updated">
257
+ <on>1006-01-01</on>
258
+ </date>
259
+ <date type="issued">
260
+ <on>1007-01-01</on>
261
+ </date>
262
+ <date type="circulated">
263
+ <on>1008-01-01</on>
264
+ </date>
265
+ <date type="unchanged">
266
+ <on>1009-01-01</on>
267
+ </date>
268
+ <date type='vote-started'>
269
+ <on>1011-01-01</on>
270
+ </date>
271
+ <date type='vote-ended'>
272
+ <on>1012-01-01</on>
273
+ </date>
274
+ <date type="Fred">
275
+ <on>1010-01-01</on>
276
+ </date>
277
+ <date type="Jack">
278
+ <on>1010-01-01</on>
279
+ </date>
280
+ <contributor>
281
+ <role type="author"/>
282
+ <organization>
283
+ <name>Hanna Barbera</name>
284
+ </organization>
285
+ </contributor>
286
+ <contributor>
287
+ <role type="author"/>
288
+ <organization>
289
+ <name>Cartoon Network</name>
290
+ </organization>
291
+ </contributor>
292
+ <contributor>
293
+ <role type="author"/>
294
+ <organization>
295
+ <name>Ribose, Inc.</name>
296
+ </organization>
297
+ </contributor>
298
+ <contributor>
299
+ <role type="author"/>
300
+ <person>
301
+ <name>
302
+ <completename>Fred Flintstone</completename>
303
+ </name>
304
+ <affiliation>
305
+ <organization>
306
+ <name>Slate Rock and Gravel Company</name>
307
+ <abbreviation>SRG</abbreviation>
308
+ <subdivision>Hermeneutics Unit</subdivision>
309
+ <subdivision>Exegetical Subunit</subdivision>
310
+ <address>
311
+ <formattedAddress>
312
+ 6 Rubble Way, Bedrock
313
+ </formattedAddress>
314
+ </address>
315
+ </organization>
316
+ </affiliation>
317
+ <phone>123</phone>
318
+ <phone type='fax'>456</phone>
319
+ <uri>http://slate.example.com</uri>
320
+ </person>
321
+ </contributor>
322
+ <contributor>
323
+ <role type="editor"/>
324
+ <person>
325
+ <name>
326
+ <forename>Barney</forename>
327
+ <initial>B. X.</initial>
328
+ <surname>Rubble</surname>
329
+ </name>
301
330
  <affiliation>
302
- <organization>
303
- <name>Slate Rock and Gravel Company</name>
304
- <abbreviation>SRG</abbreviation>
305
- <subdivision>Hermeneutics Unit</subdivision>
306
- <subdivision>Exegetical Subunit</subdivision>
307
- <address>
308
- <formattedAddress>
309
- 6 Rubble Way, Bedrock
310
- </formattedAddress>
311
- </address>
312
- </organization>
313
- </affiliation>
314
- <phone>123</phone>
315
- <phone type='fax'>456</phone>
316
- <uri>http://slate.example.com</uri>
317
- </person>
318
- </contributor>
319
- <contributor>
320
- <role type="editor"/>
321
- <person>
322
- <name>
323
- <forename>Barney</forename>
324
- <initial>B. X.</initial>
325
- <surname>Rubble</surname>
326
- </name>
327
- <affiliation>
328
- <organization>
329
- <name>Rockhead and Quarry Cave Construction Company</name>
330
- <abbreviation>RQCCC</abbreviation>
331
- <subdivision>Hermeneutics Unit</subdivision>
332
- <subdivision>Exegetical Subunit</subdivision>
333
- <address>
334
- <formattedAddress>6A Rubble Way, <br/>Bedrock</formattedAddress>
335
- </address>
336
- </organization>
337
- </affiliation>
338
- <phone>789</phone>
339
- <phone type='fax'>012</phone>
340
- <email>barney@rockhead.example.com</email>
341
- </person>
342
- </contributor>
343
- <contributor>
344
- <role type="publisher"/>
345
- <organization>
346
- <name>Hanna Barbera</name>
347
- <address>
348
- <formattedAddress>
349
- 1 Infinity Loop
350
- <br/>
351
- California
352
- </formattedAddress>
353
- </address>
354
- <phone>3333333</phone>
355
- <phone type='fax'>4444444</phone>
356
- <email>x@example.com</email>
357
- <uri>http://www.example.com</uri>
358
- </organization>
359
- </contributor>
360
- <contributor>
361
- <role type="publisher"/>
362
- <organization>
363
- <name>Cartoon Network</name>
364
- <address>
365
- <formattedAddress>
366
- 1 Infinity Loop
367
- <br/>
368
- California
369
- </formattedAddress>
370
- </address>
371
- <phone>3333333</phone>
372
- <phone type='fax'>4444444</phone>
373
- <email>x@example.com</email>
374
- <uri>http://www.example.com</uri>
375
- </organization>
376
- </contributor>
377
- <contributor>
378
- <role type="publisher"/>
379
- <organization>
380
- <name>Ribose, Inc.</name>
381
- <address>
382
- <formattedAddress>
383
- 1 Infinity Loop
384
- <br/>
385
- California
386
- </formattedAddress>
387
- </address>
388
- <phone>3333333</phone>
389
- <phone type='fax'>4444444</phone>
390
- <email>x@example.com</email>
391
- <uri>http://www.example.com</uri>
392
- </organization>
393
- </contributor>
394
- <edition>2</edition>
395
- <version>
396
- <revision-date>2000-01-01</revision-date>
397
- <draft>3.4</draft>
398
- </version>
399
- <language>en</language>
400
- <script>Latn</script>
401
- <status>
402
- <stage>10</stage>
403
- <substage>20</substage>
404
- <iteration>3</iteration>
405
- </status>
406
- <copyright>
407
- <from>2001</from>
408
- <owner>
409
- <organization>
410
- <name>Ribose, Inc.</name>
411
- <address>
412
- <formattedAddress>
413
- 1 Infinity Loop
414
- <br/>
415
- California
416
- </formattedAddress>
417
- </address>
418
- <phone>3333333</phone>
419
- <phone type='fax'>4444444</phone>
420
- <email>x@example.com</email>
421
- <uri>http://www.example.com</uri>
422
- </organization>
423
- </owner>
424
- </copyright>
425
- <copyright>
426
- <from>2001</from>
427
- <owner>
428
- <organization>
429
- <name>Hanna Barbera</name>
430
- <address>
431
- <formattedAddress>
432
- 1 Infinity Loop
433
- <br/>
434
- California
435
- </formattedAddress>
436
- </address>
437
- <phone>3333333</phone>
438
- <phone type='fax'>4444444</phone>
439
- <email>x@example.com</email>
440
- <uri>http://www.example.com</uri>
441
- </organization>
442
- </owner>
443
- </copyright>
444
- <relation type="partOf">
445
- <bibitem>
446
- <title>--</title>
447
- <docidentifier>ABC</docidentifier>
448
- </bibitem>
449
- </relation>
450
- <relation type="translatedFrom">
451
- <bibitem>
452
- <title>GHI</title>
453
- <docidentifier>DEF</docidentifier>
454
- </bibitem>
455
- </relation>
456
- <relation type="translatedFrom">
457
- <bibitem>
458
- <title>PQR</title>
459
- <docidentifier>JKL MNO</docidentifier>
460
- </bibitem>
461
- </relation>
462
- <classification type='a'>b</classification>
463
- <classification type='default'>c</classification>
464
- <keyword>a</keyword>
465
- <keyword>b</keyword>
466
- <keyword>c</keyword>
467
- <ext>
468
- <doctype>article</doctype>
469
- <editorialgroup>
470
- <technical-committee number="1" type="A">TC</technical-committee>
471
- <technical-committee number="11" type="A1">TC1</technical-committee>
472
- </editorialgroup>
473
- <ics>
474
- <code>1</code>
475
- </ics>
476
- <ics>
477
- <code>2</code>
478
- </ics>
479
- <ics>
480
- <code>3</code>
481
- </ics>
482
- </ext>
483
- </bibdata>
484
- <sections/>
485
- </standard-document>
331
+ <organization>
332
+ <name>Rockhead and Quarry Cave Construction Company</name>
333
+ <abbreviation>RQCCC</abbreviation>
334
+ <subdivision>Hermeneutics Unit</subdivision>
335
+ <subdivision>Exegetical Subunit</subdivision>
336
+ <address>
337
+ <formattedAddress>6A Rubble Way, <br/>Bedrock</formattedAddress>
338
+ </address>
339
+ </organization>
340
+ </affiliation>
341
+ <phone>789</phone>
342
+ <phone type='fax'>012</phone>
343
+ <email>barney@rockhead.example.com</email>
344
+ </person>
345
+ </contributor>
346
+ <contributor>
347
+ <role type="publisher"/>
348
+ <organization>
349
+ <name>Hanna Barbera</name>
350
+ <address>
351
+ <formattedAddress>
352
+ 1 Infinity Loop
353
+ <br/>
354
+ California
355
+ </formattedAddress>
356
+ </address>
357
+ <phone>3333333</phone>
358
+ <phone type='fax'>4444444</phone>
359
+ <email>x@example.com</email>
360
+ <uri>http://www.example.com</uri>
361
+ </organization>
362
+ </contributor>
363
+ <contributor>
364
+ <role type="publisher"/>
365
+ <organization>
366
+ <name>Cartoon Network</name>
367
+ <address>
368
+ <formattedAddress>
369
+ 1 Infinity Loop
370
+ <br/>
371
+ California
372
+ </formattedAddress>
373
+ </address>
374
+ <phone>3333333</phone>
375
+ <phone type='fax'>4444444</phone>
376
+ <email>x@example.com</email>
377
+ <uri>http://www.example.com</uri>
378
+ </organization>
379
+ </contributor>
380
+ <contributor>
381
+ <role type="publisher"/>
382
+ <organization>
383
+ <name>Ribose, Inc.</name>
384
+ <address>
385
+ <formattedAddress>
386
+ 1 Infinity Loop
387
+ <br/>
388
+ California
389
+ </formattedAddress>
390
+ </address>
391
+ <phone>3333333</phone>
392
+ <phone type='fax'>4444444</phone>
393
+ <email>x@example.com</email>
394
+ <uri>http://www.example.com</uri>
395
+ </organization>
396
+ </contributor>
397
+ <edition>2</edition>
398
+ <version>
399
+ <revision-date>2000-01-01</revision-date>
400
+ <draft>3.4</draft>
401
+ </version>
402
+ <language>en</language>
403
+ <script>Latn</script>
404
+ <status>
405
+ <stage>10</stage>
406
+ <substage>20</substage>
407
+ <iteration>3</iteration>
408
+ </status>
409
+ <copyright>
410
+ <from>2001</from>
411
+ <owner>
412
+ <organization>
413
+ <name>Ribose, Inc.</name>
414
+ <address>
415
+ <formattedAddress>
416
+ 1 Infinity Loop
417
+ <br/>
418
+ California
419
+ </formattedAddress>
420
+ </address>
421
+ <phone>3333333</phone>
422
+ <phone type='fax'>4444444</phone>
423
+ <email>x@example.com</email>
424
+ <uri>http://www.example.com</uri>
425
+ </organization>
426
+ </owner>
427
+ </copyright>
428
+ <copyright>
429
+ <from>2001</from>
430
+ <owner>
431
+ <organization>
432
+ <name>Hanna Barbera</name>
433
+ <address>
434
+ <formattedAddress>
435
+ 1 Infinity Loop
436
+ <br/>
437
+ California
438
+ </formattedAddress>
439
+ </address>
440
+ <phone>3333333</phone>
441
+ <phone type='fax'>4444444</phone>
442
+ <email>x@example.com</email>
443
+ <uri>http://www.example.com</uri>
444
+ </organization>
445
+ </owner>
446
+ </copyright>
447
+ <relation type="partOf">
448
+ <bibitem>
449
+ <title>--</title>
450
+ <docidentifier>ABC</docidentifier>
451
+ </bibitem>
452
+ </relation>
453
+ <relation type="translatedFrom">
454
+ <bibitem>
455
+ <title>GHI</title>
456
+ <docidentifier>DEF</docidentifier>
457
+ </bibitem>
458
+ </relation>
459
+ <relation type="translatedFrom">
460
+ <bibitem>
461
+ <title>PQR</title>
462
+ <docidentifier>JKL MNO</docidentifier>
463
+ </bibitem>
464
+ </relation>
465
+ <classification type='a'>b</classification>
466
+ <classification type='default'>c</classification>
467
+ <keyword>a</keyword>
468
+ <keyword>b</keyword>
469
+ <keyword>c</keyword>
470
+ <ext>
471
+ <doctype>article</doctype>
472
+ <editorialgroup>
473
+ <technical-committee number="1" type="A">TC</technical-committee>
474
+ <technical-committee number="11" type="A1">TC1</technical-committee>
475
+ </editorialgroup>
476
+ <ics>
477
+ <code>1</code>
478
+ </ics>
479
+ <ics>
480
+ <code>2</code>
481
+ </ics>
482
+ <ics>
483
+ <code>3</code>
484
+ </ics>
485
+ </ext>
486
+ </bibdata>
487
+ <misc-container>
488
+ <presentation-metadata>
489
+ <name>TOC Heading Levels</name>
490
+ <value>2</value>
491
+ </presentation-metadata>
492
+ <presentation-metadata>
493
+ <name>TOC Heading Levels</name>
494
+ <value>2</value>
495
+ </presentation-metadata>
496
+ <presentation-metadata>
497
+ <name>TOC Heading Levels</name>
498
+ <value>2</value>
499
+ </presentation-metadata>
500
+ </misc-container>
501
+ <sections/>
502
+ </standard-document>
486
503
  OUTPUT
487
504
  expect(xmlpp(Asciidoctor.convert(input, *OPTIONS)))
488
505
  .to be_equivalent_to xmlpp(output)
@@ -527,6 +544,10 @@ RSpec.describe Asciidoctor::Standoc do
527
544
  :city_2: Sèvres CEDEX
528
545
  :country_2: France
529
546
  :postcode_2: F-92312
547
+ :semantic-metadata-hello-world: A, B, "C, D"
548
+ :semantic-metadata-hello: what-not
549
+ :presentation-metadata-hello: Hello?
550
+ :presentation-metadata-Manifold: "hello, world","yes"
530
551
 
531
552
  [abstract]
532
553
  == Abstract
@@ -538,147 +559,170 @@ RSpec.describe Asciidoctor::Standoc do
538
559
  == Clause 1
539
560
  INPUT
540
561
  output = <<~OUTPUT
541
- <?xml version="1.0" encoding="UTF-8"?>
542
- <standard-document xmlns="https://www.metanorma.org/ns/standoc" type="semantic" version="#{Metanorma::Standoc::VERSION}">
543
- <bibdata type="standard">
544
- <title language="en" format="text/plain">Document title</title>
545
- <title language="eo" format="text/plain">Dokumenttitolo</title>
546
- <uri>A</uri>
547
- <uri type="xml">B</uri>
548
- <uri type="html">C</uri>
549
- <uri type="pdf">D</uri>
550
- <uri type="doc">E</uri>
551
- <uri type="relaton">F</uri>
552
- <docidentifier>1000-1-1</docidentifier>
553
- <docnumber>1000</docnumber>
554
- <date type='published'>
555
- <on>1000-01</on>
556
- </date>
557
- <contributor>
558
- <role type="author"/>
559
- <organization>
560
- <name>IEC</name>
561
- </organization>
562
- </contributor>
563
- <contributor>
564
- <role type="author"/>
565
- <organization>
566
- <name>IETF</name>
567
- </organization>
568
- </contributor>
569
- <contributor>
570
- <role type="author"/>
571
- <organization>
572
- <name>ISO</name>
573
- </organization>
574
- </contributor>
575
- <contributor>
576
- <role type='author'/>
577
- <person>
578
- <name>
579
- <completename>Fred Flintstone</completename>
580
- </name>
581
- <affiliation>
582
- <organization>
583
- <name>Slate Rock and Gravel Company</name>
584
- <address>
585
- <street>1 Infinity Loop</street>
586
- <city>Cupertino</city>
587
- <state>CA</state>
588
- <country>USA</country>
589
- <postcode>95014</postcode>
590
- </address>
591
- </organization>
592
- </affiliation>
593
- </person>
594
- </contributor>
595
- <contributor>
596
- <role type='author'/>
597
- <person>
598
- <name>
599
- <completename>Barney Rubble</completename>
600
- </name>
601
- <affiliation>
602
- <organization>
603
- <name>Slate Rock and Gravel Company</name>
604
- <address>
605
- <street>Pavillon de Breteuil</street>
606
- <city>S&#232;vres CEDEX</city>
607
- <country>France</country>
608
- <postcode>F-92312</postcode>
609
- </address>
610
- </organization>
611
- </affiliation>
612
- </person>
613
- </contributor>
614
- <contributor>
615
- <role type="publisher"/>
616
- <organization>
617
- <name>IEC</name>
618
- </organization>
619
- </contributor>
620
- <contributor>
621
- <role type="publisher"/>
622
- <organization>
623
- <name>IETF</name>
624
- </organization>
625
- </contributor>
626
- <contributor>
627
- <role type="publisher"/>
628
- <organization>
629
- <name>ISO</name>
630
- </organization>
631
- </contributor>
632
- <version>
633
- <revision-date>2000-01</revision-date>
634
- </version>
635
- <language>el</language>
636
- <script>Grek</script>
637
- <abstract><p>This is the abstract of the document</p>
638
- <p>This is the second paragraph of the abstract of the document.</p></abstract>
639
- <status><stage>published</stage></status>
640
- <copyright>
641
- <from>#{Date.today.year}</from>
642
- <owner>
643
- <organization>
644
- <name>IEC</name>
645
- </organization>
646
- </owner>
647
- </copyright>
648
- <copyright>
649
- <from>#{Date.today.year}</from>
650
- <owner>
651
- <organization>
652
- <name>IETF</name>
653
- </organization>
654
- </owner>
655
- </copyright>
656
- <copyright>
657
- <from>#{Date.today.year}</from>
658
- <owner>
659
- <organization>
660
- <name>ISO</name>
661
- </organization>
662
- </owner>
663
- </copyright>
664
- <ext>
665
- <doctype>this-is-a-doctype</doctype>
666
- <subdoctype>This is a DocSubType</subdoctype>
667
- </ext>
668
- </bibdata>
669
- <preface>
670
- <abstract id='_'>
671
- <title>Abstract</title>
672
- <p id='_'>This is the abstract of the document</p>
673
- <p id='_'>This is the second paragraph of the abstract of the document.</p>
674
- </abstract>
675
- </preface>
676
- <sections>
677
- <clause id='_' language='en' inline-header='false' obligation='normative'>
678
- <title>Clause 1</title>
679
- </clause>
680
- </sections>
681
- </standard-document>
562
+ <?xml version="1.0" encoding="UTF-8"?>
563
+ <standard-document xmlns="https://www.metanorma.org/ns/standoc" type="semantic" version="#{Metanorma::Standoc::VERSION}">
564
+ <bibdata type="standard">
565
+ <title language="en" format="text/plain">Document title</title>
566
+ <title language="eo" format="text/plain">Dokumenttitolo</title>
567
+ <uri>A</uri>
568
+ <uri type="xml">B</uri>
569
+ <uri type="html">C</uri>
570
+ <uri type="pdf">D</uri>
571
+ <uri type="doc">E</uri>
572
+ <uri type="relaton">F</uri>
573
+ <docidentifier>1000-1-1</docidentifier>
574
+ <docnumber>1000</docnumber>
575
+ <date type='published'>
576
+ <on>1000-01</on>
577
+ </date>
578
+ <contributor>
579
+ <role type="author"/>
580
+ <organization>
581
+ <name>IEC</name>
582
+ </organization>
583
+ </contributor>
584
+ <contributor>
585
+ <role type="author"/>
586
+ <organization>
587
+ <name>IETF</name>
588
+ </organization>
589
+ </contributor>
590
+ <contributor>
591
+ <role type="author"/>
592
+ <organization>
593
+ <name>ISO</name>
594
+ </organization>
595
+ </contributor>
596
+ <contributor>
597
+ <role type='author'/>
598
+ <person>
599
+ <name>
600
+ <completename>Fred Flintstone</completename>
601
+ </name>
602
+ <affiliation>
603
+ <organization>
604
+ <name>Slate Rock and Gravel Company</name>
605
+ <address>
606
+ <street>1 Infinity Loop</street>
607
+ <city>Cupertino</city>
608
+ <state>CA</state>
609
+ <country>USA</country>
610
+ <postcode>95014</postcode>
611
+ </address>
612
+ </organization>
613
+ </affiliation>
614
+ </person>
615
+ </contributor>
616
+ <contributor>
617
+ <role type='author'/>
618
+ <person>
619
+ <name>
620
+ <completename>Barney Rubble</completename>
621
+ </name>
622
+ <affiliation>
623
+ <organization>
624
+ <name>Slate Rock and Gravel Company</name>
625
+ <address>
626
+ <street>Pavillon de Breteuil</street>
627
+ <city>S&#232;vres CEDEX</city>
628
+ <country>France</country>
629
+ <postcode>F-92312</postcode>
630
+ </address>
631
+ </organization>
632
+ </affiliation>
633
+ </person>
634
+ </contributor>
635
+ <contributor>
636
+ <role type="publisher"/>
637
+ <organization>
638
+ <name>IEC</name>
639
+ </organization>
640
+ </contributor>
641
+ <contributor>
642
+ <role type="publisher"/>
643
+ <organization>
644
+ <name>IETF</name>
645
+ </organization>
646
+ </contributor>
647
+ <contributor>
648
+ <role type="publisher"/>
649
+ <organization>
650
+ <name>ISO</name>
651
+ </organization>
652
+ </contributor>
653
+ <version>
654
+ <revision-date>2000-01</revision-date>
655
+ </version>
656
+ <language>el</language>
657
+ <script>Grek</script>
658
+ <abstract><p>This is the abstract of the document</p>
659
+ <p>This is the second paragraph of the abstract of the document.</p></abstract>
660
+ <status><stage>published</stage></status>
661
+ <copyright>
662
+ <from>#{Date.today.year}</from>
663
+ <owner>
664
+ <organization>
665
+ <name>IEC</name>
666
+ </organization>
667
+ </owner>
668
+ </copyright>
669
+ <copyright>
670
+ <from>#{Date.today.year}</from>
671
+ <owner>
672
+ <organization>
673
+ <name>IETF</name>
674
+ </organization>
675
+ </owner>
676
+ </copyright>
677
+ <copyright>
678
+ <from>#{Date.today.year}</from>
679
+ <owner>
680
+ <organization>
681
+ <name>ISO</name>
682
+ </organization>
683
+ </owner>
684
+ </copyright>
685
+ <ext>
686
+ <doctype>this-is-a-doctype</doctype>
687
+ <subdoctype>This is a DocSubType</subdoctype>
688
+ </ext>
689
+ </bibdata>
690
+ <misc-container>
691
+ <semantic-metadata>
692
+ <hello-world>A</hello-world>
693
+ </semantic-metadata>
694
+ <semantic-metadata>
695
+ <hello-world>B</hello-world>
696
+ </semantic-metadata>
697
+ <semantic-metadata>
698
+ <hello-world>C, D</hello-world>
699
+ </semantic-metadata>
700
+ <semantic-metadata>
701
+ <hello>what-not</hello>
702
+ </semantic-metadata>
703
+ <presentation-metadata>
704
+ <hello>Hello?</hello>
705
+ </presentation-metadata>
706
+ <presentation-metadata>
707
+ <manifold>hello, world</manifold>
708
+ </presentation-metadata>
709
+ <presentation-metadata>
710
+ <manifold>yes</manifold>
711
+ </presentation-metadata>
712
+ </misc-container>
713
+ <preface>
714
+ <abstract id='_'>
715
+ <title>Abstract</title>
716
+ <p id='_'>This is the abstract of the document</p>
717
+ <p id='_'>This is the second paragraph of the abstract of the document.</p>
718
+ </abstract>
719
+ </preface>
720
+ <sections>
721
+ <clause id='_' language='en' inline-header='false' obligation='normative'>
722
+ <title>Clause 1</title>
723
+ </clause>
724
+ </sections>
725
+ </standard-document>
682
726
  OUTPUT
683
727
  expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
684
728
  .to be_equivalent_to xmlpp(output)
@@ -742,7 +786,7 @@ RSpec.describe Asciidoctor::Standoc do
742
786
  <stage>published</stage>
743
787
  </status>
744
788
  <copyright>
745
- <from>2021</from>
789
+ <from>#{Time.now.year}</from>
746
790
  </copyright>
747
791
  <ext>
748
792
  <doctype>article</doctype>
@@ -849,6 +893,47 @@ RSpec.describe Asciidoctor::Standoc do
849
893
  .to be_equivalent_to xmlpp(output)
850
894
  end
851
895
 
896
+ it "processes document relations by description" do
897
+ mock_relaton_relation_descriptions
898
+ input = <<~INPUT
899
+ = Document title
900
+ Author
901
+ :docfile: test.adoc
902
+ :nodoc:
903
+ :novalid:
904
+ :normatively-cited-in: ABC
905
+
906
+ INPUT
907
+ output = <<~OUTPUT
908
+ <standard-document xmlns="https://www.metanorma.org/ns/standoc" type="semantic" version="#{Metanorma::Standoc::VERSION}">
909
+ <bibdata type='standard'>
910
+ <title language='en' format='text/plain'>Document title</title>
911
+ <language>en</language>
912
+ <script>Latn</script>
913
+ <status>
914
+ <stage>published</stage>
915
+ </status>
916
+ <copyright>
917
+ <from>#{Time.now.year}</from>
918
+ </copyright>
919
+ <relation type='isCitedIn'>
920
+ <description>normatively cited in</description>
921
+ <bibitem>
922
+ <title>--</title>
923
+ <docidentifier>ABC</docidentifier>
924
+ </bibitem>
925
+ </relation>
926
+ <ext>
927
+ <doctype>article</doctype>
928
+ </ext>
929
+ </bibdata>
930
+ <sections> </sections>
931
+ </standard-document>
932
+ OUTPUT
933
+ expect(xmlpp(Asciidoctor.convert(input, *OPTIONS)))
934
+ .to be_equivalent_to xmlpp(output)
935
+ end
936
+
852
937
  it "reads scripts into blank HTML document" do
853
938
  FileUtils.rm_f "test.html"
854
939
  Asciidoctor.convert(<<~"INPUT", *OPTIONS)
@@ -959,21 +1044,21 @@ QU1FOiB0ZXN0Cgo=
959
1044
 
960
1045
  it "process mn2pdf attributes" do
961
1046
  node = Nokogiri::XML("<fake/>").at("fake")
962
- node[Asciidoctor::Standoc::Base::FONTS_MANIFEST] =
1047
+ node[Metanorma::Standoc::Base::FONTS_MANIFEST] =
963
1048
  "passed/as/font/manifest/to/mn2pdf.jar"
964
1049
 
965
- options = Asciidoctor::Standoc::Converter
1050
+ options = Metanorma::Standoc::Converter
966
1051
  .new(:standoc, header_footer: true)
967
1052
  .doc_extract_attributes(node)
968
1053
 
969
1054
  expect(options.dig(:mn2pdf, :font_manifest))
970
- .to eq(node[Asciidoctor::Standoc::Base::FONTS_MANIFEST])
1055
+ .to eq(node[Metanorma::Standoc::Base::FONTS_MANIFEST])
971
1056
  end
972
1057
 
973
1058
  private
974
1059
 
975
1060
  def mock_org_abbrevs
976
- allow_any_instance_of(::Asciidoctor::Standoc::Front)
1061
+ allow_any_instance_of(::Metanorma::Standoc::Front)
977
1062
  .to receive(:org_abbrev).and_return(
978
1063
  { "International Standards Organization" => "ISO",
979
1064
  "International Electrotechnical Commission" => "IEC" },
@@ -981,9 +1066,16 @@ QU1FOiB0ZXN0Cgo=
981
1066
  end
982
1067
 
983
1068
  def mock_default_publisher
984
- allow_any_instance_of(::Asciidoctor::Standoc::Front)
1069
+ allow_any_instance_of(::Metanorma::Standoc::Front)
985
1070
  .to receive(:default_publisher).and_return(
986
1071
  "International Standards Organization",
987
1072
  )
988
1073
  end
1074
+
1075
+ def mock_relaton_relation_descriptions
1076
+ allow_any_instance_of(::Metanorma::Standoc::Front)
1077
+ .to receive(:relaton_relation_descriptions).and_return(
1078
+ "normatively-cited-in" => "isCitedIn",
1079
+ )
1080
+ end
989
1081
  end