metanorma-standoc 1.6.1 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +66 -0
  3. data/README.adoc +1 -3
  4. data/lib/asciidoctor/standoc/base.rb +8 -16
  5. data/lib/asciidoctor/standoc/basicdoc.rng +50 -3
  6. data/lib/asciidoctor/standoc/cleanup.rb +52 -4
  7. data/lib/asciidoctor/standoc/cleanup_block.rb +41 -4
  8. data/lib/asciidoctor/standoc/cleanup_boilerplate.rb +47 -20
  9. data/lib/asciidoctor/standoc/cleanup_footnotes.rb +14 -0
  10. data/lib/asciidoctor/standoc/cleanup_inline.rb +9 -3
  11. data/lib/asciidoctor/standoc/cleanup_ref.rb +17 -24
  12. data/lib/asciidoctor/standoc/cleanup_terms.rb +4 -6
  13. data/lib/asciidoctor/standoc/converter.rb +71 -1
  14. data/lib/asciidoctor/standoc/front.rb +6 -0
  15. data/lib/asciidoctor/standoc/front_contributor.rb +8 -4
  16. data/lib/asciidoctor/standoc/inline.rb +6 -5
  17. data/lib/asciidoctor/standoc/isodoc.rng +36 -43
  18. data/lib/asciidoctor/standoc/lists.rb +4 -2
  19. data/lib/asciidoctor/standoc/macros.rb +55 -59
  20. data/lib/asciidoctor/standoc/macros_terms.rb +82 -0
  21. data/lib/asciidoctor/standoc/ref.rb +19 -25
  22. data/lib/asciidoctor/standoc/ref_sect.rb +4 -3
  23. data/lib/asciidoctor/standoc/section.rb +21 -20
  24. data/lib/asciidoctor/standoc/table.rb +12 -0
  25. data/lib/asciidoctor/standoc/term_lookup_cleanup.rb +86 -0
  26. data/lib/asciidoctor/standoc/utils.rb +2 -0
  27. data/lib/metanorma/standoc/version.rb +1 -1
  28. data/metanorma-standoc.gemspec +5 -3
  29. data/spec/asciidoctor-standoc/base_spec.rb +14 -4
  30. data/spec/asciidoctor-standoc/blocks_spec.rb +14 -9
  31. data/spec/asciidoctor-standoc/cleanup_sections_spec.rb +1519 -0
  32. data/spec/asciidoctor-standoc/cleanup_spec.rb +416 -1554
  33. data/spec/asciidoctor-standoc/converter_spec.rb +8 -0
  34. data/spec/asciidoctor-standoc/inline_spec.rb +2 -5
  35. data/spec/asciidoctor-standoc/isobib_cache_spec.rb +16 -9
  36. data/spec/asciidoctor-standoc/lists_spec.rb +10 -1
  37. data/spec/asciidoctor-standoc/macros_lutaml_spec.rb +80 -0
  38. data/spec/asciidoctor-standoc/macros_plantuml_spec.rb +307 -0
  39. data/spec/asciidoctor-standoc/macros_spec.rb +408 -169
  40. data/spec/asciidoctor-standoc/refs_dl_spec.rb +6 -6
  41. data/spec/asciidoctor-standoc/refs_spec.rb +112 -65
  42. data/spec/asciidoctor-standoc/section_spec.rb +17 -12
  43. data/spec/asciidoctor-standoc/table_spec.rb +86 -0
  44. data/spec/asciidoctor-standoc/validate_spec.rb +26 -0
  45. data/spec/fixtures/diagram_definitions.lutaml +22 -0
  46. data/spec/fixtures/test.exp +121 -0
  47. data/spec/spec_helper.rb +33 -0
  48. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +59 -243
  49. data/spec/vcr_cassettes/isobib_get_123.yml +12 -12
  50. data/spec/vcr_cassettes/isobib_get_123_1.yml +27 -119
  51. data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +35 -35
  52. data/spec/vcr_cassettes/isobib_get_123_2001.yml +14 -60
  53. data/spec/vcr_cassettes/isobib_get_124.yml +11 -57
  54. data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +8 -8
  55. data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +281 -157
  56. metadata +45 -11
  57. data/.github/workflows/macos.yml +0 -41
  58. data/.github/workflows/ubuntu.yml +0 -45
  59. data/.github/workflows/windows.yml +0 -43
@@ -0,0 +1,8 @@
1
+ require "spec_helper"
2
+
3
+ RSpec.describe Asciidoctor::Standoc do
4
+ it "flavor_name is standoc" do
5
+ converter = Asciidoctor::Standoc::Converter.new(nil, backend: :standoc)
6
+ expect(converter.flavor_name).to eql(:standoc)
7
+ end
8
+ end
@@ -418,14 +418,11 @@ OUTPUT
418
418
  it "processes index terms" do
419
419
  expect((strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to (<<~"OUTPUT")
420
420
  #{ASCIIDOC_BLANK_HDR}
421
- ((See)) Index ((_term_)) and(((A, B, C))).
421
+ ((See)) Index ((_term_)) and(((A~B~, stem:[alpha], &#x2c80;))).
422
422
  INPUT
423
423
  #{BLANK_HDR}
424
424
  <sections>
425
- <p id='_'>
426
- See
427
- <index primary='See'/> Index <em>term</em> <index primary='term'/> and<index primary='A' secondary='B' tertiary='C'/>.
428
- </p>
425
+ <p id="_">See<index><primary>See</primary></index> Index <em>term</em><index><primary><em>term</em></primary></index> and<index><primary>A<sub>B</sub></primary><secondary><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>α</mi></math></stem></secondary><tertiary>Ⲁ</tertiary></index>.</p>
429
426
  </sections>
430
427
  </standard-document>
431
428
  OUTPUT
@@ -55,7 +55,7 @@ EOS
55
55
  <docidentifier type='URN'>urn:iso:std:iso:124:stage-90.93:ed-7:en</docidentifier>
56
56
  <docnumber>124</docnumber>
57
57
  <date type="published">
58
- <on>2014</on>
58
+ <on>2014-03</on>
59
59
  </date>
60
60
  <contributor>
61
61
  <role type="publisher"/>
@@ -214,7 +214,7 @@ EOS
214
214
  <docidentifier type='URN'>urn:iso:std:iso:123:stage-90.93:ed-3:en</docidentifier>
215
215
  <docnumber>123</docnumber>
216
216
  <date type="published">
217
- <on>2001</on>
217
+ <on>2001-05</on>
218
218
  </date>
219
219
  <contributor>
220
220
  <role type="publisher"/>
@@ -227,6 +227,13 @@ EOS
227
227
  <edition>3</edition>
228
228
  <language>en</language>
229
229
  <script>Latn</script>
230
+ <abstract format='text/plain' language='en' script='Latn'>
231
+ This International Standard specifies procedures for sampling natural rubber
232
+ latex concentrate and for sampling syntheticrubber latices and artificial
233
+ latices. It is also suitable for sampling rubber latex contained in drums,
234
+ tank cars ortanks. The procedures may also be used for sampling plastics
235
+ dispersions.
236
+ </abstract>
230
237
  <status>
231
238
  <stage>90</stage>
232
239
  <substage>93</substage>
@@ -326,7 +333,7 @@ EOS
326
333
  FileUtils.rm_rf File.expand_path("~/.iev/cache")
327
334
 
328
335
  # mock_isobib_get_123
329
- VCR.use_cassette "isobib_get_123_2001", :re_record_interval => 25200 do
336
+ VCR.use_cassette "isobib_get_123_2001" do
330
337
  Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)
331
338
  #{FLUSH_CACHE_ISOBIB_BLANK_HDR}
332
339
  [bibliography]
@@ -407,7 +414,7 @@ EOS
407
414
  it "activates global cache" do
408
415
  FileUtils.mv File.expand_path("~/.relaton/cache"), File.expand_path("~/.relaton-bib.pstore1"), force: true
409
416
  FileUtils.rm_rf "relaton/cache"
410
- VCR.use_cassette "isobib_get_123_2001", :re_record_interval => 25200 do
417
+ VCR.use_cassette "isobib_get_123_2001" do
411
418
  Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)
412
419
  #{CACHED_ISOBIB_BLANK_HDR}
413
420
  [bibliography]
@@ -527,7 +534,7 @@ EOS
527
534
  #)
528
535
 
529
536
  # mock_isobib_get_124
530
- VCR.use_cassette "isobib_get_124", :re_record_interval => 25200 do
537
+ VCR.use_cassette "isobib_get_124" do
531
538
  Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)
532
539
  #{CACHED_ISOBIB_BLANK_HDR}
533
540
  [bibliography]
@@ -566,7 +573,7 @@ EOS
566
573
  #)
567
574
 
568
575
  # mock_isobib_get_123_undated
569
- VCR.use_cassette "isobib_get_123", :re_record_interval => 25200 do
576
+ VCR.use_cassette "isobib_get_123" do
570
577
  Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)
571
578
  #{CACHED_ISOBIB_BLANK_HDR}
572
579
  [bibliography]
@@ -587,7 +594,7 @@ EOS
587
594
  end
588
595
 
589
596
  it "does not expire stale dated references" do
590
- VCR.use_cassette "isobib_get_123_2001", :re_record_interval => 25200 do
597
+ VCR.use_cassette "isobib_get_123_2001" do
591
598
  FileUtils.rm_rf File.expand_path("~/.relaton-bib.pstore1")
592
599
  FileUtils.mv File.expand_path("~/.relaton/cache"), File.expand_path("~/.relaton-bib.pstore1"), force: true
593
600
 
@@ -621,8 +628,8 @@ EOS
621
628
  end
622
629
 
623
630
  it "prioritises local over global cache values" do
624
- VCR.use_cassette "isobib_get_123_2001", :re_record_interval => 25200 do
625
- VCR.use_cassette "isobib_get_124", :re_record_interval => 25200 do
631
+ VCR.use_cassette "isobib_get_123_2001" do
632
+ VCR.use_cassette "isobib_get_124" do
626
633
  FileUtils.rm_rf File.expand_path("~/.relaton-bib.pstore1")
627
634
  FileUtils.mv File.expand_path("~/.relaton/cache"), File.expand_path("~/.relaton-bib.pstore1"), force: true
628
635
  FileUtils.rm_rf "relaton/cache"
@@ -111,6 +111,9 @@ RSpec.describe Asciidoctor::Standoc do
111
111
  +
112
112
  Note 3.
113
113
 
114
+ [%key]
115
+ a:: b
116
+
114
117
  INPUT
115
118
  expect(xmlpp(strip_guid(output))).to be_equivalent_to xmlpp(<<~"OUTPUT")
116
119
  #{BLANK_HDR}
@@ -174,7 +177,13 @@ RSpec.describe Asciidoctor::Standoc do
174
177
  </li>
175
178
  </ol>
176
179
  </li>
177
- </ol></sections>
180
+ </ol><dl id='_' key='true'>
181
+ <dt>a</dt>
182
+ <dd>
183
+ <p id='_'>b</p>
184
+ </dd>
185
+ </dl>
186
+ </sections>
178
187
  </standard-document>
179
188
  OUTPUT
180
189
  end
@@ -0,0 +1,80 @@
1
+ require "spec_helper"
2
+
3
+ RSpec.describe 'Lutaml macros' do
4
+ let(:example_file) { fixtures_path("test.exp") }
5
+
6
+ context "Array of hashes" do
7
+ let(:input) do
8
+ <<~TEXT
9
+ = Document title
10
+ Author
11
+ :docfile: test.adoc
12
+ :nodoc:
13
+ :novalid:
14
+ :no-isobib:
15
+ :imagesdir: spec/assets
16
+
17
+ [lutaml,#{example_file},my_context]
18
+ ----
19
+
20
+ {% for schema in my_context.schemas %}
21
+ == {{schema.id}}
22
+
23
+ {% for entity in schema.entities %}
24
+ === {{entity.id}}
25
+ supertypes -> {{entity.supertypes.id}}
26
+ explicit -> {{entity.explicit.first.id}}
27
+
28
+ {% endfor %}
29
+
30
+ {% endfor %}
31
+ ----
32
+ TEXT
33
+ end
34
+ let(:output) do
35
+ <<~TEXT
36
+ #{BLANK_METANORMA_HDR}
37
+ <sections>
38
+ <clause id="_" inline-header="false" obligation="normative"><title>annotated_3d_model_data_quality_criteria_schema</title>
39
+ <clause id="_" inline-header="false" obligation="normative">
40
+ <title>a3m_data_quality_criteria_representation</title>
41
+ <p id="_">supertypes →
42
+ explicit → </p>
43
+ </clause>
44
+ <clause id="_" inline-header="false" obligation="normative">
45
+ <title>a3m_data_quality_criterion</title>
46
+ <p id="_">supertypes →
47
+ explicit → </p>
48
+ </clause>
49
+ <clause id="_" inline-header="false" obligation="normative">
50
+ <title>a3m_data_quality_criterion_specific_applied_value</title>
51
+ <p id="_">supertypes →
52
+ explicit → </p>
53
+ </clause>
54
+ <clause id="_" inline-header="false" obligation="normative">
55
+ <title>a3m_data_quality_target_accuracy_association</title>
56
+ <p id="_">supertypes →
57
+ explicit → </p>
58
+ </clause>
59
+ <clause id="_" inline-header="false" obligation="normative">
60
+ <title>a3m_detailed_report_request</title>
61
+ <p id="_">supertypes →
62
+ explicit → </p>
63
+ </clause>
64
+ <clause id="_" inline-header="false" obligation="normative">
65
+ <title>a3m_summary_report_request_with_representative_value</title>
66
+ <p id="_">supertypes →
67
+ explicit → </p>
68
+ </clause></clause>
69
+ </sections>
70
+ </standard-document>
71
+ </body></html>
72
+ TEXT
73
+ end
74
+
75
+ it "correctly renders input" do
76
+ expect(xml_string_conent(metanorma_process(input)))
77
+ .to(be_equivalent_to(output))
78
+ end
79
+ end
80
+ end
@@ -0,0 +1,307 @@
1
+ require "spec_helper"
2
+
3
+ RSpec.describe Asciidoctor::Standoc do
4
+ it "processes the PlantUML macro" do
5
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)).gsub(%r{plantuml/plantuml[^./]+\.}, "plantuml/_."))).to be_equivalent_to xmlpp(<<~"OUTPUT")
6
+ #{ASCIIDOC_BLANK_HDR}
7
+
8
+ [plantuml]
9
+ ....
10
+ @startuml
11
+ Alice -> Bob: Authentication Request
12
+ Bob --> Alice: Authentication Response
13
+
14
+ Alice -> Bob: Another authentication Request
15
+ Alice <-- Bob: another authentication Response
16
+ @enduml
17
+ ....
18
+
19
+ [plantuml]
20
+ ....
21
+ Alice -> Bob: Authentication Request
22
+ Bob --> Alice: Authentication Response
23
+
24
+ Alice -> Bob: Another authentication Request
25
+ Alice <-- Bob: another authentication Response
26
+ ....
27
+
28
+ [plantuml]
29
+ ....
30
+ @startuml filename
31
+ Alice -> Bob: Authentication Request
32
+ Bob --> Alice: Authentication Response
33
+
34
+ Alice -> Bob: Another authentication Request
35
+ Alice <-- Bob: another authentication Response
36
+ @enduml
37
+ ....
38
+ INPUT
39
+ #{BLANK_HDR}
40
+ <sections><figure id="_">
41
+ <image src="plantuml/_.png" id="_" mimetype="image/png" height="auto" width="auto"/>
42
+ </figure>
43
+ <figure id="_">
44
+ <image src="plantuml/_.png" id="_" mimetype="image/png" height="auto" width="auto"/>
45
+ </figure>
46
+ <figure id="_">
47
+ <image src="plantuml/filename.png" id="_" mimetype="image/png" height="auto" width="auto"/>
48
+ </figure>
49
+ </sections>
50
+
51
+ </standard-document>
52
+ OUTPUT
53
+ end
54
+
55
+ it "processes the PlantUML macro with imagesdir" do
56
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)).gsub(%r{spec/assets/[^./]+\.}, "spec/assets/_."))).to be_equivalent_to xmlpp(<<~"OUTPUT")
57
+ = Document title
58
+ Author
59
+ :docfile: test.adoc
60
+ :nodoc:
61
+ :novalid:
62
+ :no-isobib:
63
+ :imagesdir: spec/assets
64
+
65
+ [plantuml]
66
+ ....
67
+ @startuml
68
+ Alice -> Bob: Authentication Request
69
+ Bob --> Alice: Authentication Response
70
+
71
+ Alice -> Bob: Another authentication Request
72
+ Alice <-- Bob: another authentication Response
73
+ @enduml
74
+ ....
75
+ INPUT
76
+ #{BLANK_HDR}
77
+ <sections>
78
+ <figure id="_">
79
+ <image src="spec/assets/_.png" id="_" mimetype="image/png" height="auto" width="auto"/>
80
+ </figure>
81
+ </sections>
82
+ </standard-document>
83
+ OUTPUT
84
+ end
85
+
86
+ context 'when lutaml_diagram' do
87
+ let(:input) do
88
+ <<~"OUTPUT"
89
+ = Document title
90
+ Author
91
+ :docfile: test.adoc
92
+ :nodoc:
93
+ :novalid:
94
+ :no-isobib:
95
+ :imagesdir: spec/assets
96
+
97
+ [lutaml_diagram]
98
+ ....
99
+ diagram MyView {
100
+ fontname "Arial"
101
+ title "my diagram"
102
+ class Foo {}
103
+ }
104
+ ....
105
+ OUTPUT
106
+ end
107
+ let(:output) do
108
+ <<~"OUTPUT"
109
+ #{BLANK_HDR}
110
+ <sections>
111
+ <figure id="_">
112
+ <image src="spec/assets/_.png" id="_" mimetype="image/png" height="auto" width="auto"/>
113
+ </figure>
114
+ </sections>
115
+ </standard-document>
116
+ OUTPUT
117
+ end
118
+
119
+ it "processes the lutaml_diagram" do
120
+ expect(
121
+ xmlpp(
122
+ strip_guid(Asciidoctor.convert(input, backend: :standoc, header_footer: true))
123
+ .gsub(%r{".+spec\/assets\/lutaml\/[^.\/]+\.}, %q("spec/assets/_.))))
124
+ .to(be_equivalent_to xmlpp(output))
125
+ end
126
+ end
127
+
128
+ context 'when lutaml_uml_attributes_table' do
129
+ let(:example_file) { fixtures_path("diagram_definitions.lutaml") }
130
+ let(:input) do
131
+ <<~"OUTPUT"
132
+ = Document title
133
+ Author
134
+ :docfile: test.adoc
135
+ :nodoc:
136
+ :novalid:
137
+ :no-isobib:
138
+ :imagesdir: spec/assets
139
+
140
+ [lutaml_uml_attributes_table,#{example_file},AttributeProfile]
141
+ OUTPUT
142
+ end
143
+ let(:output) do
144
+ <<~"OUTPUT"
145
+ #{BLANK_HDR}
146
+ <sections>
147
+ <clause id='_' inline-header='false' obligation='normative'>
148
+ <title>AttributeProfile</title>
149
+ <table id='_'>
150
+ <name>AttributeProfile attributes</name>
151
+ <thead>
152
+ <tr>
153
+ <th valign='top' align='left'>Name</th>
154
+ <th valign='top' align='left'>Definition</th>
155
+ <th valign='top' align='left'>Mandatory/ Optional/ Conditional</th>
156
+ <th valign='top' align='left'>Max Occur</th>
157
+ <th valign='top' align='left'>Data Type</th>
158
+ </tr>
159
+ </thead>
160
+ <tbody>
161
+ <tr>
162
+ <td valign='top' align='left'>addressClassProfile</td>
163
+ <td valign='top' align='left'>TODO: enum ‘s definition</td>
164
+ <td valign='top' align='left'>O</td>
165
+ <td valign='top' align='left'>1</td>
166
+ <td valign='top' align='left'>
167
+ <tt>CharacterString</tt>
168
+ </td>
169
+ </tr>
170
+ <tr>
171
+ <td valign='top' align='left'>imlicistAttributeProfile</td>
172
+ <td valign='top' align='left'>this is attribute definition with multiply lines</td>
173
+ <td valign='top' align='left'>O</td>
174
+ <td valign='top' align='left'>1</td>
175
+ <td valign='top' align='left'>
176
+ <tt>CharacterString</tt>
177
+ </td>
178
+ </tr>
179
+ </tbody>
180
+ </table>
181
+ </clause>
182
+ </sections>
183
+ </standard-document>
184
+ OUTPUT
185
+ end
186
+
187
+ it "processes the lutaml_uml_attributes_table macro" do
188
+ expect(
189
+ xmlpp(
190
+ strip_guid(Asciidoctor.convert(input, backend: :standoc, header_footer: true))))
191
+ .to(be_equivalent_to(xmlpp(output)))
192
+ end
193
+ end
194
+
195
+ it "processes the PlantUML macro with PlantUML disabled" do
196
+ mock_plantuml_disabled
197
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true) }.to output(%r{PlantUML not installed}).to_stderr
198
+ #{ASCIIDOC_BLANK_HDR}
199
+
200
+ [plantuml]
201
+ ....
202
+ @startuml
203
+ Alice -> Bob: Authentication Request
204
+ Bob --> Alice: Authentication Response
205
+
206
+ Alice -> Bob: Another authentication Request
207
+ Alice <-- Bob: another authentication Response
208
+ @enduml
209
+ ....
210
+ INPUT
211
+
212
+ mock_plantuml_disabled
213
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
214
+ #{ASCIIDOC_BLANK_HDR}
215
+
216
+ [plantuml]
217
+ ....
218
+ @startuml
219
+ Alice -> Bob: Authentication Request
220
+ Bob --> Alice: Authentication Response
221
+
222
+ Alice -> Bob: Another authentication Request
223
+ Alice <-- Bob: another authentication Response
224
+ @enduml
225
+ ....
226
+ INPUT
227
+ #{BLANK_HDR}
228
+ <sections>
229
+ <sourcecode id="_" lang="plantuml">@startuml
230
+ Alice -&gt; Bob: Authentication Request
231
+ Bob --&gt; Alice: Authentication Response
232
+
233
+ Alice -&gt; Bob: Another authentication Request
234
+ Alice &lt;-- Bob: another authentication Response
235
+ @enduml</sourcecode>
236
+ </sections>
237
+ </standard-document>
238
+ OUTPUT
239
+ end
240
+
241
+ it "processes the PlantUML macro with localdir unwritable" do
242
+ mock_localdir_unwritable
243
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true) }.to output(%r{not writable for PlantUML}).to_stderr
244
+ #{ASCIIDOC_BLANK_HDR}
245
+
246
+ [plantuml]
247
+ ....
248
+ @startuml
249
+ Alice -> Bob: Authentication Request
250
+ Bob --> Alice: Authentication Response
251
+
252
+ Alice -> Bob: Another authentication Request
253
+ Alice <-- Bob: another authentication Response
254
+ @enduml
255
+ ....
256
+ INPUT
257
+
258
+ mock_localdir_unwritable
259
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
260
+ #{ASCIIDOC_BLANK_HDR}
261
+
262
+ [plantuml]
263
+ ....
264
+ @startuml
265
+ Alice -> Bob: Authentication Request
266
+ Bob --> Alice: Authentication Response
267
+
268
+ Alice -> Bob: Another authentication Request
269
+ Alice <-- Bob: another authentication Response
270
+ @enduml
271
+ ....
272
+ INPUT
273
+ #{BLANK_HDR}
274
+ <sections>
275
+ <sourcecode id="_" lang="plantuml">@startuml
276
+ Alice -&gt; Bob: Authentication Request
277
+ Bob --&gt; Alice: Authentication Response
278
+
279
+ Alice -&gt; Bob: Another authentication Request
280
+ Alice &lt;-- Bob: another authentication Response
281
+ @enduml</sourcecode>
282
+ </sections>
283
+ </standard-document>
284
+ OUTPUT
285
+ end
286
+
287
+ private
288
+
289
+ def mock_plantuml_disabled
290
+ expect(Asciidoctor::Standoc::PlantUMLBlockMacroBackend).to receive(:plantuml_installed?) do
291
+ raise "PlantUML not installed"
292
+ false
293
+ end
294
+ end
295
+
296
+ def mock_localdir_unwritable
297
+ expect(Asciidoctor::Standoc::Utils).to receive(:localdir) do
298
+ "/"
299
+ end.exactly(2).times
300
+ end
301
+
302
+ def mock_localdir_unwritable
303
+ expect(File).to receive(:writable?) do
304
+ false
305
+ end
306
+ end
307
+ end