metanorma-standoc 1.11.1 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (146) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +3 -31
  3. data/.gitignore +23 -0
  4. data/Gemfile +2 -0
  5. data/lib/asciidoctor/standoc/base.rb +2 -241
  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 -207
  9. data/lib/asciidoctor/standoc/cleanup_amend.rb +2 -53
  10. data/lib/asciidoctor/standoc/cleanup_block.rb +2 -173
  11. data/lib/asciidoctor/standoc/cleanup_boilerplate.rb +2 -204
  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 -179
  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 -93
  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 -113
  24. data/lib/asciidoctor/standoc/cleanup_terms_designations.rb +2 -161
  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 -229
  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 -225
  43. data/lib/asciidoctor/standoc/ref_sect.rb +2 -143
  44. data/lib/asciidoctor/standoc/ref_utility.rb +2 -0
  45. data/lib/asciidoctor/standoc/render.rb +3 -0
  46. data/lib/asciidoctor/standoc/reqt.rb +2 -89
  47. data/lib/asciidoctor/standoc/section.rb +2 -190
  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 -116
  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 +20 -11
  55. data/lib/isodoc/html/htmlstyle.scss +11 -11
  56. data/lib/metanorma/standoc/base.rb +149 -0
  57. data/lib/{asciidoctor → metanorma}/standoc/basicdoc.rng +0 -0
  58. data/lib/{asciidoctor → metanorma}/standoc/biblio.rng +0 -0
  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 +146 -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 +96 -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 +124 -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 +90 -18
  89. data/lib/metanorma/standoc/lists.rb +120 -0
  90. data/lib/metanorma/standoc/macros.rb +204 -0
  91. data/lib/metanorma/standoc/macros_form.rb +63 -0
  92. data/lib/metanorma/standoc/macros_note.rb +45 -0
  93. data/lib/metanorma/standoc/macros_plantuml.rb +113 -0
  94. data/lib/metanorma/standoc/macros_terms.rb +181 -0
  95. data/lib/metanorma/standoc/ref.rb +243 -0
  96. data/lib/metanorma/standoc/ref_sect.rb +153 -0
  97. data/lib/metanorma/standoc/ref_utility.rb +129 -0
  98. data/lib/metanorma/standoc/render.rb +115 -0
  99. data/lib/metanorma/standoc/reqt.rb +90 -0
  100. data/lib/{asciidoctor → metanorma}/standoc/reqt.rng +0 -0
  101. data/lib/metanorma/standoc/section.rb +209 -0
  102. data/lib/metanorma/standoc/table.rb +85 -0
  103. data/lib/metanorma/standoc/term_lookup_cleanup.rb +179 -0
  104. data/lib/metanorma/standoc/terms.rb +160 -0
  105. data/lib/metanorma/standoc/utils.rb +101 -0
  106. data/lib/metanorma/standoc/validate.rb +158 -0
  107. data/lib/metanorma/standoc/validate_section.rb +55 -0
  108. data/lib/metanorma/standoc/version.rb +1 -1
  109. data/lib/{asciidoctor → metanorma}/standoc/views/datamodel/model_representation.adoc.erb +0 -0
  110. data/lib/{asciidoctor → metanorma}/standoc/views/datamodel/plantuml_representation.adoc.erb +0 -0
  111. data/lib/metanorma-standoc.rb +1 -1
  112. data/metanorma-standoc.gemspec +4 -4
  113. data/spec/{asciidoctor → metanorma}/base_spec.rb +73 -8
  114. data/spec/{asciidoctor → metanorma}/blank_spec.rb +1 -1
  115. data/spec/{asciidoctor → metanorma}/blocks_spec.rb +49 -20
  116. data/spec/{asciidoctor → metanorma}/cleanup_blocks_spec.rb +25 -1
  117. data/spec/{asciidoctor → metanorma}/cleanup_sections_spec.rb +2 -2
  118. data/spec/{asciidoctor → metanorma}/cleanup_spec.rb +9 -9
  119. data/spec/{asciidoctor → metanorma}/cleanup_terms_spec.rb +528 -91
  120. data/spec/{asciidoctor → metanorma}/datamodel/attributes_table_preprocessor_spec.rb +22 -22
  121. data/spec/{asciidoctor → metanorma}/datamodel/diagram_preprocessor_spec.rb +17 -17
  122. data/spec/{asciidoctor → metanorma}/inline_spec.rb +175 -6
  123. data/spec/{asciidoctor → metanorma}/isobib_cache_spec.rb +5 -9
  124. data/spec/{asciidoctor → metanorma}/lists_spec.rb +1 -1
  125. data/spec/{asciidoctor → metanorma}/macros_json2text_spec.rb +0 -0
  126. data/spec/{asciidoctor → metanorma}/macros_plantuml_spec.rb +3 -3
  127. data/spec/{asciidoctor → metanorma}/macros_spec.rb +8 -8
  128. data/spec/{asciidoctor → metanorma}/macros_yaml2text_spec.rb +0 -0
  129. data/spec/metanorma/refs_dl_spec.rb +863 -0
  130. data/spec/{asciidoctor → metanorma}/refs_spec.rb +1277 -687
  131. data/spec/{asciidoctor → metanorma}/section_spec.rb +90 -3
  132. data/spec/{asciidoctor → metanorma}/table_spec.rb +1 -1
  133. data/spec/{asciidoctor → metanorma}/validate_spec.rb +2 -2
  134. data/spec/spec_helper.rb +0 -1
  135. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +179 -179
  136. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec1.yml +12 -12
  137. data/spec/vcr_cassettes/isobib_get_123.yml +13 -13
  138. data/spec/vcr_cassettes/isobib_get_123_1.yml +98 -98
  139. data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +111 -111
  140. data/spec/vcr_cassettes/isobib_get_123_2001.yml +13 -13
  141. data/spec/vcr_cassettes/isobib_get_124.yml +14 -14
  142. data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +14 -14
  143. data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +46 -46
  144. metadata +89 -38
  145. data/lib/asciidoctor/standoc/ref_date_id.rb +0 -62
  146. data/spec/asciidoctor/refs_dl_spec.rb +0 -864
@@ -1,20 +1,20 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'spec_helper'
3
+ require "spec_helper"
4
4
 
5
- RSpec.describe Asciidoctor::Standoc::Datamodel::AttributesTablePreprocessor do
6
- describe '#process' do
7
- context 'when simple models without relations' do
5
+ RSpec.describe Metanorma::Standoc::Datamodel::AttributesTablePreprocessor do
6
+ describe "#process" do
7
+ context "when simple models without relations" do
8
8
  let(:datamodel_file) do
9
- examples_path('datamodel/address_class_profile.adoc')
9
+ examples_path("datamodel/address_class_profile.adoc")
10
10
  end
11
11
  let(:result_file) do
12
- examples_path('datamodel/address_class_profile.xml')
12
+ examples_path("datamodel/address_class_profile.xml")
13
13
  end
14
14
  let(:output) do
15
15
  [
16
16
  BLANK_HDR,
17
- File.read(fixtures_path('macros_datamodel/address_class_profile.xml'))
17
+ File.read(fixtures_path("macros_datamodel/address_class_profile.xml")),
18
18
  ]
19
19
  .join
20
20
  end
@@ -27,7 +27,7 @@ RSpec.describe Asciidoctor::Standoc::Datamodel::AttributesTablePreprocessor do
27
27
  end
28
28
  end
29
29
 
30
- it 'correctly renders input' do
30
+ it "correctly renders input" do
31
31
  Asciidoctor.convert_file(datamodel_file,
32
32
  backend: :standoc,
33
33
  safe: :safe,
@@ -37,18 +37,18 @@ RSpec.describe Asciidoctor::Standoc::Datamodel::AttributesTablePreprocessor do
37
37
  end
38
38
  end
39
39
 
40
- context 'when complex relations' do
40
+ context "when complex relations" do
41
41
  let(:datamodel_file) do
42
- examples_path('datamodel/address_component_profile.adoc')
42
+ examples_path("datamodel/address_component_profile.adoc")
43
43
  end
44
44
  let(:result_file) do
45
- examples_path('datamodel/address_component_profile.xml')
45
+ examples_path("datamodel/address_component_profile.xml")
46
46
  end
47
47
  let(:output) do
48
- path = fixtures_path('macros_datamodel/address_component_profile.xml')
48
+ path = fixtures_path("macros_datamodel/address_component_profile.xml")
49
49
  [
50
50
  BLANK_HDR,
51
- File.read(path)
51
+ File.read(path),
52
52
  ]
53
53
  .join("\n")
54
54
  end
@@ -56,14 +56,14 @@ RSpec.describe Asciidoctor::Standoc::Datamodel::AttributesTablePreprocessor do
56
56
  after do
57
57
  %w[doc html xml err].each do |extention|
58
58
  path = examples_path(
59
- "datamodel/address_component_profile.#{extention}"
59
+ "datamodel/address_component_profile.#{extention}",
60
60
  )
61
61
  FileUtils.rm_f(path)
62
62
  FileUtils.rm_f("address_component_profile.#{extention}")
63
63
  end
64
64
  end
65
65
 
66
- it 'correctly renders input' do
66
+ it "correctly renders input" do
67
67
  Asciidoctor.convert_file(datamodel_file,
68
68
  backend: :standoc,
69
69
  safe: :safe,
@@ -73,32 +73,32 @@ RSpec.describe Asciidoctor::Standoc::Datamodel::AttributesTablePreprocessor do
73
73
  end
74
74
  end
75
75
 
76
- context 'when missing definition' do
76
+ context "when missing definition" do
77
77
  let(:datamodel_file) do
78
- examples_path('datamodel/blank_definition_profile.adoc')
78
+ examples_path("datamodel/blank_definition_profile.adoc")
79
79
  end
80
80
  let(:result_file) do
81
- examples_path('datamodel/blank_definition_profile.xml')
81
+ examples_path("datamodel/blank_definition_profile.xml")
82
82
  end
83
83
  let(:output) do
84
- path = fixtures_path('macros_datamodel/blank_definition_profile.xml')
84
+ path = fixtures_path("macros_datamodel/blank_definition_profile.xml")
85
85
  [
86
86
  BLANK_HDR,
87
- File.read(path)
87
+ File.read(path),
88
88
  ].join("\n")
89
89
  end
90
90
 
91
91
  after do
92
92
  %w[doc html xml err].each do |extention|
93
93
  path = examples_path(
94
- "datamodel/blank_definition_profile.#{extention}"
94
+ "datamodel/blank_definition_profile.#{extention}",
95
95
  )
96
96
  FileUtils.rm_f(path)
97
97
  FileUtils.rm_f("blank_definition_profile.#{extention}")
98
98
  end
99
99
  end
100
100
 
101
- it 'correctly renders input' do
101
+ it "correctly renders input" do
102
102
  Asciidoctor.convert_file(datamodel_file,
103
103
  backend: :standoc,
104
104
  safe: :safe,
@@ -1,22 +1,22 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'spec_helper'
3
+ require "spec_helper"
4
4
 
5
- RSpec.describe Asciidoctor::Standoc::Datamodel::DiagramPreprocessor do
6
- describe '#process' do
7
- context 'when simple models without relations' do
5
+ RSpec.describe Metanorma::Standoc::Datamodel::DiagramPreprocessor do
6
+ describe "#process" do
7
+ context "when simple models without relations" do
8
8
  let(:datamodel_file) do
9
- examples_path('datamodel/common_models_diagram.adoc')
9
+ examples_path("datamodel/common_models_diagram.adoc")
10
10
  end
11
11
  let(:result_file) do
12
- examples_path('datamodel/common_models_diagram.xml')
12
+ examples_path("datamodel/common_models_diagram.xml")
13
13
  end
14
14
  let(:output) do
15
15
  [
16
16
  BLANK_HDR,
17
17
  File.read(
18
- fixtures_path('macros_datamodel/common_models_diagram.xml')
19
- )
18
+ fixtures_path("macros_datamodel/common_models_diagram.xml"),
19
+ ),
20
20
  ].join
21
21
  end
22
22
 
@@ -26,10 +26,10 @@ RSpec.describe Asciidoctor::Standoc::Datamodel::DiagramPreprocessor do
26
26
  FileUtils.rm_f(path)
27
27
  FileUtils.rm_f("common_models_diagram.#{extention}")
28
28
  end
29
- FileUtils.rm_rf('common_models_diagram_htmlimages')
29
+ FileUtils.rm_rf("common_models_diagram_htmlimages")
30
30
  end
31
31
 
32
- it 'correctly renders input' do
32
+ it "correctly renders input" do
33
33
  Asciidoctor.convert_file(datamodel_file,
34
34
  backend: :standoc,
35
35
  safe: :safe,
@@ -39,13 +39,13 @@ RSpec.describe Asciidoctor::Standoc::Datamodel::DiagramPreprocessor do
39
39
  end
40
40
  end
41
41
 
42
- context 'when complex relations' do
43
- let(:datamodel_file) { examples_path('datamodel/top_down_diagram.adoc') }
44
- let(:result_file) { examples_path('datamodel/top_down_diagram.xml') }
42
+ context "when complex relations" do
43
+ let(:datamodel_file) { examples_path("datamodel/top_down_diagram.adoc") }
44
+ let(:result_file) { examples_path("datamodel/top_down_diagram.xml") }
45
45
  let(:output) do
46
46
  [
47
47
  BLANK_HDR,
48
- File.read(fixtures_path('macros_datamodel/top_down_diagram.xml'))
48
+ File.read(fixtures_path("macros_datamodel/top_down_diagram.xml")),
49
49
  ].join("\n")
50
50
  end
51
51
 
@@ -55,11 +55,11 @@ RSpec.describe Asciidoctor::Standoc::Datamodel::DiagramPreprocessor do
55
55
  FileUtils.rm_f(path)
56
56
  FileUtils.rm_f("top_down_diagram.#{extention}")
57
57
  end
58
- FileUtils.rm_rf(examples_path('datamodel/plantuml'))
59
- FileUtils.rm_rf('top_down_diagram_htmlimages')
58
+ FileUtils.rm_rf(examples_path("datamodel/plantuml"))
59
+ FileUtils.rm_rf("top_down_diagram_htmlimages")
60
60
  end
61
61
 
62
- it 'correctly renders input' do
62
+ it "correctly renders input" do
63
63
  Asciidoctor.convert_file(datamodel_file,
64
64
  backend: :standoc,
65
65
  safe: :safe,
@@ -1,6 +1,6 @@
1
1
  require "spec_helper"
2
2
 
3
- RSpec.describe Asciidoctor::Standoc do
3
+ RSpec.describe Metanorma::Standoc do
4
4
  it "handles spacing around markup" do
5
5
  input = <<~INPUT
6
6
  #{ASCIIDOC_BLANK_HDR}
@@ -294,9 +294,9 @@ RSpec.describe Asciidoctor::Standoc do
294
294
  http://example.com[Link]
295
295
  http://example.com[Link,title="tip"]
296
296
  link:++https://asciidoctor.org/now_this__link_works.html++[]
297
- http://example.com[Link,updatetype=true]
297
+ http://example.com[Link,update-type=true]
298
298
  link:../example[updatetype=true]
299
- link:../example[Link,updatetype=true]
299
+ link:../example[Link,update-type=true]
300
300
  INPUT
301
301
  output = <<~OUTPUT
302
302
  #{BLANK_HDR}
@@ -306,9 +306,9 @@ RSpec.describe Asciidoctor::Standoc do
306
306
  <link target="http://example.com">Link</link>
307
307
  <link target="http://example.com" alt="tip">Link</link>
308
308
  <link target='https://asciidoctor.org/now_this__link_works.html'/>
309
- <link target="http://example.com" updatetype="true">Link</link>
310
- <link target="../example" updatetype="true"/>
311
- <link target="../example" updatetype="true">Link</link></p>
309
+ <link target="http://example.com" update-type="true">Link</link>
310
+ <link target="../example" update-type="true"/>
311
+ <link target="../example" update-type="true">Link</link></p>
312
312
  </p>
313
313
  </sections>
314
314
  </standard-document>
@@ -389,6 +389,61 @@ RSpec.describe Asciidoctor::Standoc do
389
389
  .to be_equivalent_to(output)
390
390
  end
391
391
 
392
+ it "processes formatting within crossreferences" do
393
+ input = <<~INPUT
394
+ #{ASCIIDOC_BLANK_HDR}
395
+ [[reference]]
396
+ == Section
397
+
398
+ <<reference,_reference_>>
399
+ <<reference,_**reference**_>>
400
+ <<reference,_A_ stem:[x^2]>>
401
+ <<reference,_A_ footnote:[_B_]>>
402
+ INPUT
403
+ output = <<~OUTPUT
404
+ #{BLANK_HDR}
405
+ <sections>
406
+ <clause id="reference" inline-header="false" obligation="normative">
407
+ <title>Section</title>
408
+ <p id="_"><xref target="reference"><em>reference</em></xref>
409
+ <xref target="reference"><em><strong>reference</strong></em></xref>
410
+ <xref target="reference"><em>A</em> <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msup><mrow><mi>x</mi></mrow><mrow><mn>2</mn></mrow></msup></math></stem></xref>
411
+ <xref target="reference"><em>A</em><fn reference="1"><p id="_"><em>B</em></p></fn></xref></p>
412
+ </clause>
413
+ </sections>
414
+ </standard-document>
415
+ OUTPUT
416
+ expect((strip_guid(Asciidoctor.convert(input, *OPTIONS))))
417
+ .to be_equivalent_to(output)
418
+ end
419
+
420
+ it "processes formatting within crossreferences to non-existent anchor" do
421
+ input = <<~INPUT
422
+ #{ASCIIDOC_BLANK_HDR}
423
+ == Section
424
+
425
+ <<reference,_reference_>>
426
+ <<reference,_**reference**_>>
427
+ <<reference,_A_ stem:[x^2]>>
428
+ <<reference,_A_ footnote:[_B_]>>
429
+ INPUT
430
+ output = <<~OUTPUT
431
+ #{BLANK_HDR}
432
+ <sections>
433
+ <clause id="_" inline-header="false" obligation="normative">
434
+ <title>Section</title>
435
+ <p id="_"><xref target="reference"><em>reference</em></xref>
436
+ <xref target="reference"><em><strong>reference</strong></em></xref>
437
+ <xref target="reference"><em>A</em> <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msup><mrow><mi>x</mi></mrow><mrow><mn>2</mn></mrow></msup></math></stem></xref>
438
+ <xref target="reference"><em>A</em><fn reference="1"><p id="_"><em>B</em></p></fn></xref></p>
439
+ </clause>
440
+ </sections>
441
+ </standard-document>
442
+ OUTPUT
443
+ expect((strip_guid(Asciidoctor.convert(input, *OPTIONS))))
444
+ .to be_equivalent_to(output)
445
+ end
446
+
392
447
  it "processes bibliographic anchors" do
393
448
  input = <<~INPUT
394
449
  #{ASCIIDOC_BLANK_HDR}
@@ -423,6 +478,120 @@ RSpec.describe Asciidoctor::Standoc do
423
478
  .to be_equivalent_to(output)
424
479
  end
425
480
 
481
+ it "processes formatting within bibliographic references" do
482
+ input = <<~INPUT
483
+ #{ASCIIDOC_BLANK_HDR}
484
+ == Section
485
+
486
+ <<reference,_reference_>>
487
+ <<reference,_**reference**_>>
488
+ <<reference,_A_ stem:[x^2]>>
489
+ <<reference,_A_ footnote:[_B_]>>
490
+ <<reference,clause=3.4.2, ISO 9000:2005 footnote:[Superseded by ISO 9000:2015.]>>
491
+
492
+ [bibliography]
493
+ == Normative References
494
+
495
+ * [[[reference,ABC]]] Reference
496
+ INPUT
497
+ output = <<~OUTPUT
498
+ #{BLANK_HDR}
499
+ <sections><clause id="_" inline-header="false" obligation="normative">
500
+ <title>Section</title>
501
+ <p id="_"><eref type="inline" bibitemid="reference" citeas="ABC"><em>reference</em></eref>
502
+ <eref type="inline" bibitemid="reference" citeas="ABC"><em><strong>reference</strong></em></eref>
503
+ <eref type="inline" bibitemid="reference" citeas="ABC"><em>A</em> <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msup><mrow><mi>x</mi></mrow><mrow><mn>2</mn></mrow></msup></math></stem></eref>
504
+ <eref type="inline" bibitemid="reference" citeas="ABC"><em>A</em><fn reference="1"><p id="_"><em>B</em></p></fn></eref>
505
+ <eref type="inline" bibitemid="reference" citeas="ABC"><localityStack><locality type="clause"><referenceFrom>3.4.2</referenceFrom></locality></localityStack>ISO 9000:2005<fn reference="2"><p id="_">Superseded by ISO 9000:2015.</p></fn></eref></p>
506
+ </clause>
507
+ </sections><bibliography><references id="_" normative="true" obligation="informative">
508
+ <title>Normative references</title><p id="_">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>
509
+ <bibitem id="reference">
510
+ <formattedref format="application/x-isodoc+xml">Reference</formattedref>
511
+ <docidentifier>ABC</docidentifier>
512
+ </bibitem>
513
+ </references></bibliography>
514
+ </standard-document>
515
+ OUTPUT
516
+ expect((strip_guid(Asciidoctor.convert(input, *OPTIONS))))
517
+ .to be_equivalent_to(output)
518
+ end
519
+
520
+ it "processes formatting within term sources" do
521
+ input = <<~INPUT
522
+ #{ASCIIDOC_BLANK_HDR}
523
+ == Terms and Definitions
524
+
525
+ === Term1
526
+
527
+ [.source]
528
+ <<reference,_reference_>>
529
+
530
+ [.source]
531
+ <<reference,_**reference**_>>
532
+
533
+ [.source]
534
+ <<reference,_A_ stem:[x^2]>>
535
+
536
+ [.source]
537
+ <<reference,_A_ footnote:[_B_]>>
538
+
539
+ [.source]
540
+ <<reference,clause=3.4.2, ISO 9000:2005 footnote:[Superseded by ISO 9000:2015.]>>
541
+
542
+ [bibliography]
543
+ == Normative References
544
+
545
+ * [[[reference,ABC]]] Reference
546
+ INPUT
547
+ output = <<~OUTPUT
548
+ #{BLANK_HDR}
549
+ <sections><terms id="_" obligation="normative">
550
+ <title>Terms and definitions</title><p id="_">For the purposes of this document,
551
+ the following terms and definitions apply.</p>
552
+
553
+ <term id="term-term1"><preferred><expression><name>Term1</name></expression><termsource status="identical" type="authoritative">
554
+ <origin bibitemid="reference" type="inline" citeas="ABC">
555
+ <em>reference</em>
556
+ </origin>
557
+ </termsource><termsource status="identical" type="authoritative">
558
+ <origin bibitemid="reference" type="inline" citeas="ABC">
559
+ <em>
560
+ <strong>reference</strong>
561
+ </em>
562
+ </origin>
563
+ </termsource><termsource status="identical" type="authoritative">
564
+ <origin bibitemid="reference" type="inline" citeas="ABC"><em>A</em> <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msup><mrow><mi>x</mi></mrow><mrow><mn>2</mn></mrow></msup></math></stem></origin>
565
+ </termsource><termsource status="identical" type="authoritative">
566
+ <origin bibitemid="reference" type="inline" citeas="ABC"><em>A</em><fn reference="1">
567
+ <p id="_">
568
+ <em>B</em>
569
+ </p>
570
+ </fn></origin>
571
+ </termsource><termsource status="identical" type="authoritative">
572
+ <origin bibitemid="reference" type="inline" citeas="ABC"><localityStack><locality type="clause"><referenceFrom>3.4.2</referenceFrom></locality></localityStack>ISO 9000:2005<fn reference="2">
573
+ <p id="_">Superseded by ISO 9000:2015.</p>
574
+ </fn></origin>
575
+ </termsource></preferred>
576
+
577
+
578
+
579
+ </term>
580
+ </terms>
581
+ </sections><bibliography><references id="_" normative="true" obligation="informative">
582
+ <title>Normative references</title><p id="_">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>
583
+ <bibitem id="reference">
584
+ <formattedref format="application/x-isodoc+xml">Reference</formattedref>
585
+ <docidentifier>ABC</docidentifier>
586
+
587
+ </bibitem>
588
+ </references></bibliography>
589
+ </standard-document>
590
+ OUTPUT
591
+ expect((strip_guid(Asciidoctor.convert(input, *OPTIONS))))
592
+ .to be_equivalent_to(output)
593
+ end
594
+
426
595
  it "processes footnotes" do
427
596
  input = <<~INPUT
428
597
  #{ASCIIDOC_BLANK_HDR}
@@ -266,7 +266,7 @@ ISO_123_DATED = <<~XML.freeze
266
266
  </bibdata>
267
267
  XML
268
268
 
269
- RSpec.describe Asciidoctor::Standoc do
269
+ RSpec.describe Metanorma::Standoc do
270
270
  it "does not activate biblio caches if isobib disabled" do
271
271
  FileUtils.rm_rf File.expand_path("~/.relaton-bib.pstore1")
272
272
  FileUtils.mv(File.expand_path("~/.relaton/cache"),
@@ -716,29 +716,25 @@ RSpec.describe Asciidoctor::Standoc do
716
716
 
717
717
  def mock_isobib_get_123
718
718
  expect(RelatonIso::IsoBibliography).to receive(:get)
719
- .with("ISO 123", "2001",
720
- { lang: "en", title: "<em>Standard</em>", usrlbl: nil })
719
+ .with("ISO 123", "2001", anything)
721
720
  .and_return(RelatonIsoBib::XMLParser.from_xml(ISO_123_DATED))
722
721
  end
723
722
 
724
723
  def mock_isobib_get_123_undated
725
724
  expect(RelatonIso::IsoBibliography).to receive(:get)
726
- .with("ISO 123", nil,
727
- { lang: "en", title: "<em>Standard</em>", usrlbl: nil })
725
+ .with("ISO 123", nil, anything)
728
726
  .and_return(RelatonIsoBib::XMLParser.from_xml(ISO_123_UNDATED))
729
727
  end
730
728
 
731
729
  def mock_isobib_get_124
732
730
  expect(RelatonIso::IsoBibliography).to receive(:get)
733
- .with("ISO 124", "2014",
734
- { lang: "en", title: "<em>Standard</em>", usrlbl: nil })
731
+ .with("ISO 124", "2014", anything)
735
732
  .and_return(RelatonIsoBib::XMLParser.from_xml(ISO_124_DATED))
736
733
  end
737
734
 
738
735
  def mock_ietfbib_get_123
739
736
  expect(RelatonIetf::IetfBibliography).to receive(:get)
740
- .with("RFC 123", nil,
741
- { lang: "en", title: "<em>Standard</em>", usrlbl: nil })
737
+ .with("RFC 123", nil, anything)
742
738
  .and_return(RelatonIsoBib::XMLParser.from_xml(IETF_123_SHORT))
743
739
  end
744
740
  end
@@ -1,6 +1,6 @@
1
1
  require "spec_helper"
2
2
 
3
- RSpec.describe Asciidoctor::Standoc do
3
+ RSpec.describe Metanorma::Standoc do
4
4
  it "processes simple lists" do
5
5
  output = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
6
6
  #{ASCIIDOC_BLANK_HDR}
@@ -1,6 +1,6 @@
1
1
  require "spec_helper"
2
2
 
3
- RSpec.describe Asciidoctor::Standoc do
3
+ RSpec.describe Metanorma::Standoc do
4
4
  it "processes the PlantUML macro" do
5
5
  input = <<~INPUT
6
6
  #{ASCIIDOC_BLANK_HDR}
@@ -383,14 +383,14 @@ RSpec.describe Asciidoctor::Standoc do
383
383
  private
384
384
 
385
385
  def mock_plantuml_disabled
386
- expect(Asciidoctor::Standoc::PlantUMLBlockMacroBackend)
386
+ expect(Metanorma::Standoc::PlantUMLBlockMacroBackend)
387
387
  .to receive(:plantuml_installed?) do
388
388
  raise "PlantUML not installed"
389
389
  end
390
390
  end
391
391
 
392
392
  def mock_localdir_unwritable
393
- expect(Asciidoctor::Standoc::Utils).to receive(:localdir) do
393
+ expect(Metanorma::Standoc::Utils).to receive(:localdir) do
394
394
  "/"
395
395
  end.exactly(2).times
396
396
  end
@@ -1,7 +1,7 @@
1
1
  require "spec_helper"
2
2
 
3
- RSpec.describe Asciidoctor::Standoc do
4
- it "processes the Asciidoctor::Standoc inline macros" do
3
+ RSpec.describe Metanorma::Standoc do
4
+ it "processes the Metanorma::Standoc inline macros" do
5
5
  input = <<~INPUT
6
6
  #{ASCIIDOC_BLANK_HDR}
7
7
  preferred:[term0]
@@ -55,7 +55,7 @@ RSpec.describe Asciidoctor::Standoc do
55
55
  .to be_equivalent_to xmlpp(output)
56
56
  end
57
57
 
58
- it "processes the Asciidoctor::Standoc index macros" do
58
+ it "processes the Metanorma::Standoc index macros" do
59
59
  input = <<~INPUT
60
60
  #{ASCIIDOC_BLANK_HDR}
61
61
  index:also[]
@@ -127,7 +127,7 @@ RSpec.describe Asciidoctor::Standoc do
127
127
  .to be_equivalent_to xmlpp(output)
128
128
  end
129
129
 
130
- it "processes the Asciidoctor::Standoc variant macros" do
130
+ it "processes the Metanorma::Standoc variant macros" do
131
131
  input = <<~INPUT
132
132
  #{ASCIIDOC_BLANK_HDR}
133
133
  == lang:en[English] lang:fr-Latn[Français]
@@ -163,7 +163,7 @@ RSpec.describe Asciidoctor::Standoc do
163
163
  .to be_equivalent_to xmlpp(output)
164
164
  end
165
165
 
166
- it "processes the Asciidoctor::Standoc concept and related macros" do
166
+ it "processes the Metanorma::Standoc concept and related macros" do
167
167
  input = <<~INPUT
168
168
  #{ASCIIDOC_BLANK_HDR}
169
169
 
@@ -332,7 +332,7 @@ RSpec.describe Asciidoctor::Standoc do
332
332
  .to be_equivalent_to xmlpp(output)
333
333
  end
334
334
 
335
- it "processes the Asciidoctor::Standoc concept macros for acronyms" do
335
+ it "processes the Metanorma::Standoc concept macros for acronyms" do
336
336
  input = <<~INPUT
337
337
  #{ASCIIDOC_BLANK_HDR}
338
338
 
@@ -1562,7 +1562,7 @@ RSpec.describe Asciidoctor::Standoc do
1562
1562
  <tt>missing</tt>
1563
1563
  </strong>
1564
1564
  </related>
1565
- <definition><verbaldefinition>
1565
+ <definition><verbal-definition>
1566
1566
  <p id='_'>paragraph</p>
1567
1567
  <p id='_'>
1568
1568
  <concept>
@@ -1620,7 +1620,7 @@ RSpec.describe Asciidoctor::Standoc do
1620
1620
  </concept>
1621
1621
  is a term
1622
1622
  </p>
1623
- </verbaldefinition></definition>
1623
+ </verbal-definition></definition>
1624
1624
  </term>
1625
1625
  </terms>
1626
1626
  </sections>