metanorma-standoc 1.10.2 → 1.10.4.1

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/lib/asciidoctor/standoc/base.rb +13 -5
  3. data/lib/asciidoctor/standoc/blocks.rb +35 -31
  4. data/lib/asciidoctor/standoc/cleanup.rb +61 -0
  5. data/lib/asciidoctor/standoc/cleanup_block.rb +6 -3
  6. data/lib/asciidoctor/standoc/cleanup_reqt.rb +59 -14
  7. data/lib/asciidoctor/standoc/converter.rb +4 -0
  8. data/lib/asciidoctor/standoc/datamodel/diagram_preprocessor.rb +22 -21
  9. data/lib/asciidoctor/standoc/isodoc.rng +12 -0
  10. data/lib/asciidoctor/standoc/lists.rb +9 -6
  11. data/lib/asciidoctor/standoc/macros.rb +18 -0
  12. data/lib/asciidoctor/standoc/ref.rb +60 -56
  13. data/lib/asciidoctor/standoc/reqt.rb +39 -27
  14. data/lib/asciidoctor/standoc/reqt.rng +15 -4
  15. data/lib/asciidoctor/standoc/validate_section.rb +2 -1
  16. data/lib/isodoc/base.standard.xsl +6003 -0
  17. data/lib/isodoc/pdf_convert.rb +20 -0
  18. data/lib/metanorma-standoc.rb +1 -0
  19. data/lib/metanorma/standoc/processor.rb +5 -1
  20. data/lib/metanorma/standoc/version.rb +1 -1
  21. data/metanorma-standoc.gemspec +1 -1
  22. data/spec/asciidoctor/base_spec.rb +6 -0
  23. data/spec/asciidoctor/blocks_spec.rb +45 -25
  24. data/spec/asciidoctor/cleanup_sections_spec.rb +899 -864
  25. data/spec/asciidoctor/cleanup_spec.rb +136 -2
  26. data/spec/asciidoctor/macros_plantuml_spec.rb +165 -104
  27. data/spec/asciidoctor/macros_spec.rb +208 -0
  28. data/spec/asciidoctor/validate_spec.rb +4 -0
  29. data/spec/examples/datamodel/address_class_profile.adoc +1 -0
  30. data/spec/examples/datamodel/address_component_profile.adoc +1 -0
  31. data/spec/examples/datamodel/blank_definition_profile.adoc +1 -0
  32. data/spec/examples/datamodel/common_models_diagram.adoc +2 -1
  33. data/spec/examples/datamodel/top_down_diagram.adoc +2 -1
  34. data/spec/fixtures/datamodel_description_sections_tree.xml +327 -0
  35. data/spec/fixtures/test.xmi +9250 -0
  36. data/spec/metanorma/processor_spec.rb +50 -50
  37. data/spec/support/shared_examples/structured_data_2_text_preprocessor.rb +34 -34
  38. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +50 -50
  39. data/spec/vcr_cassettes/isobib_get_123.yml +11 -11
  40. data/spec/vcr_cassettes/isobib_get_123_1.yml +23 -23
  41. data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +35 -35
  42. data/spec/vcr_cassettes/isobib_get_123_2001.yml +12 -12
  43. data/spec/vcr_cassettes/isobib_get_124.yml +11 -11
  44. data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +14 -14
  45. data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +46 -46
  46. metadata +8 -4
@@ -316,6 +316,56 @@ RSpec.describe Asciidoctor::Standoc do
316
316
  .to be_equivalent_to xmlpp(output)
317
317
  end
318
318
 
319
+ it "ignores tags when applying smartquotes" do
320
+ input = <<~INPUT
321
+ #{ASCIIDOC_BLANK_HDR}
322
+
323
+ "((ppt))",
324
+
325
+ "((ppm))", "((ppt))"
326
+
327
+ "((ppm))"&#xa0;
328
+
329
+ ....
330
+ ((ppm))",
331
+ ....
332
+ INPUT
333
+ output = <<~OUTPUT
334
+ #{BLANK_HDR}
335
+ <sections>
336
+ <p id='_'>
337
+ &#8220;ppt&#8221;,
338
+ <index>
339
+ <primary>ppt</primary>
340
+ </index>
341
+ </p>
342
+ <p id='_'>
343
+ &#8220;ppm&#8221;,
344
+ <index>
345
+ <primary>ppm</primary>
346
+ </index>
347
+ &#8220;ppt&#8221;
348
+ <index>
349
+ <primary>ppt</primary>
350
+ </index>
351
+ </p>
352
+ <p id='_'>
353
+ &#8220;ppm
354
+ <index>
355
+ <primary>ppm</primary>
356
+ </index>
357
+ &#8220;&#160;
358
+ </p>
359
+ <figure id='_'>
360
+ <pre id='_'>((ppm))",</pre>
361
+ </figure>
362
+ </sections>
363
+ </standard-document>
364
+ OUTPUT
365
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
366
+ .to be_equivalent_to xmlpp(output)
367
+ end
368
+
319
369
  it "removes empty text elements" do
320
370
  input = <<~INPUT
321
371
  #{ASCIIDOC_BLANK_HDR}
@@ -486,7 +536,7 @@ RSpec.describe Asciidoctor::Standoc do
486
536
  output = <<~OUTPUT
487
537
  #{BLANK_HDR}
488
538
  <sections><formula id="_">
489
- <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>r</mi><mo>=</mo><mn>1</mn><mi>%</mi><mi>r</mi><mo>=</mo><mn>1</mn><mi>%</mi></math></stem>
539
+ <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>r</mi><mo>=</mo><mn>1</mn><mo>%</mo><mi>r</mi><mo>=</mo><mn>1</mn><mo>%</mo></math></stem>
490
540
  <note id="_">
491
541
  <p id="_">That formula does not do much</p>
492
542
  </note></formula>
@@ -517,7 +567,7 @@ RSpec.describe Asciidoctor::Standoc do
517
567
  output = <<~OUTPUT
518
568
  #{BLANK_HDR}
519
569
  <sections><formula id="_">
520
- <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>r</mi><mo>=</mo><mn>1</mn><mi>%</mi><mi>r</mi><mo>=</mo><mn>1</mn><mi>%</mi></math></stem></formula>
570
+ <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>r</mi><mo>=</mo><mn>1</mn><mo>%</mo><mi>r</mi><mo>=</mo><mn>1</mn><mo>%</mo></math></stem></formula>
521
571
  <note id="_">
522
572
  <p id="_">That formula does not do much</p>
523
573
  </note>
@@ -2050,6 +2100,90 @@ RSpec.describe Asciidoctor::Standoc do
2050
2100
  .to be_equivalent_to xmlpp(output)
2051
2101
  end
2052
2102
 
2103
+ it "moves metadata deflist to correct location" do
2104
+ input = <<~INPUT
2105
+ #{ASCIIDOC_BLANK_HDR}
2106
+
2107
+ == Clause
2108
+
2109
+ [.requirement,subsequence="A",inherit="/ss/584/2015/level/1 &amp; /ss/584/2015/level/2"]
2110
+ ====
2111
+ [%metadata]
2112
+ model:: ogc
2113
+ type:: class
2114
+ label:: http://www.opengis.net/spec/waterml/2.0/req/xsd-xml-rules[*req/core*]
2115
+ subject:: Encoding of logical models
2116
+ inherit:: urn:iso:dis:iso:19156:clause:7.2.2
2117
+ inherit:: urn:iso:dis:iso:19156:clause:8
2118
+ inherit:: http://www.opengis.net/doc/IS/GML/3.2/clause/2.4
2119
+ inherit:: O&M Abstract model, OGC 10-004r3, clause D.3.4
2120
+ inherit:: http://www.opengis.net/spec/SWE/2.0/req/core/core-concepts-used
2121
+ inherit:: <<ref2>>
2122
+ inherit:: <<ref3>>
2123
+ classification:: priority:P0
2124
+ classification:: domain:Hydrology,Groundwater
2125
+ classification:: control-class:Technical
2126
+ obligation:: recommendation,requirement
2127
+
2128
+ I recommend this
2129
+ ====
2130
+ INPUT
2131
+ output = <<~OUTPUT
2132
+ #{BLANK_HDR}
2133
+ <sections>
2134
+ <clause id='_' inline-header='false' obligation='normative'>
2135
+ <title>Clause</title>
2136
+ <requirement id='_' subsequence='A'>
2137
+ <label>
2138
+ <link target='http://www.opengis.net/spec/waterml/2.0/req/xsd-xml-rules'>
2139
+ <strong>req/core</strong>
2140
+ </link>
2141
+ </label>
2142
+ <subject>Encoding of logical models</subject>
2143
+ <inherit>/ss/584/2015/level/1 &amp; /ss/584/2015/level/2</inherit>
2144
+ <inherit>urn:iso:dis:iso:19156:clause:7.2.2</inherit>
2145
+ <inherit>urn:iso:dis:iso:19156:clause:8</inherit>
2146
+ <inherit>
2147
+ <link target='http://www.opengis.net/doc/IS/GML/3.2/clause/2.4'/>
2148
+ </inherit>
2149
+ <inherit>O&amp;M Abstract model, OGC 10-004r3, clause D.3.4</inherit>
2150
+ <inherit>
2151
+ <link target='http://www.opengis.net/spec/SWE/2.0/req/core/core-concepts-used'/>
2152
+ </inherit>
2153
+ <inherit>
2154
+ <xref target='ref2'/>
2155
+ </inherit>
2156
+ <inherit>
2157
+ <xref target='ref3'/>
2158
+ </inherit>
2159
+ <classification>
2160
+ <tag>control-class</tag>
2161
+ <value>Technical</value>
2162
+ </classification>
2163
+ <classification>
2164
+ <tag>domain</tag>
2165
+ <value>Groundwater</value>
2166
+ </classification>
2167
+ <classification>
2168
+ <tag>domain</tag>
2169
+ <value>Hydrology</value>
2170
+ </classification>
2171
+ <classification>
2172
+ <tag>priority</tag>
2173
+ <value>P0</value>
2174
+ </classification>
2175
+ <description>
2176
+ <p id='_'>I recommend this</p>
2177
+ </description>
2178
+ </requirement>
2179
+ </clause>
2180
+ </sections>
2181
+ </standard-document>
2182
+ OUTPUT
2183
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
2184
+ .to be_equivalent_to xmlpp(output)
2185
+ end
2186
+
2053
2187
  it "moves inherit macros to correct location" do
2054
2188
  input = <<~INPUT
2055
2189
  #{ASCIIDOC_BLANK_HDR}
@@ -2,7 +2,7 @@ require "spec_helper"
2
2
 
3
3
  RSpec.describe Asciidoctor::Standoc do
4
4
  it "processes the PlantUML macro" do
5
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)).gsub(%r{plantuml/plantuml[^./]+\.}, "plantuml/_."))).to be_equivalent_to xmlpp(<<~"OUTPUT")
5
+ input = <<~INPUT
6
6
  #{ASCIIDOC_BLANK_HDR}
7
7
 
8
8
  [plantuml]
@@ -36,24 +36,27 @@ RSpec.describe Asciidoctor::Standoc do
36
36
  @enduml
37
37
  ....
38
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>
39
+ output = <<~OUTPUT
40
+ #{BLANK_HDR}
41
+ <sections><figure id="_">
42
+ <image src="plantuml/_.png" id="_" mimetype="image/png" height="auto" width="auto"/>
43
+ </figure>
44
+ <figure id="_">
45
+ <image src="plantuml/_.png" id="_" mimetype="image/png" height="auto" width="auto"/>
46
+ </figure>
47
+ <figure id="_">
48
+ <image src="plantuml/filename.png" id="_" mimetype="image/png" height="auto" width="auto"/>
49
+ </figure>
50
+ </sections>
51
+ </standard-document>
52
52
  OUTPUT
53
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))
54
+ .gsub(%r{plantuml/plantuml[^./]+\.}, "plantuml/_.")))
55
+ .to be_equivalent_to xmlpp(output)
53
56
  end
54
57
 
55
58
  it "processes the PlantUML macro with imagesdir" do
56
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)).gsub(%r{spec/assets/[^./]+\.}, "spec/assets/_."))).to be_equivalent_to xmlpp(<<~"OUTPUT")
59
+ input = <<~INPUT
57
60
  = Document title
58
61
  Author
59
62
  :docfile: test.adoc
@@ -72,18 +75,22 @@ RSpec.describe Asciidoctor::Standoc do
72
75
  Alice <-- Bob: another authentication Response
73
76
  @enduml
74
77
  ....
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
78
+ INPUT
79
+ output = <<~OUTPUT
80
+ #{BLANK_HDR}
81
+ <sections>
82
+ <figure id="_">
83
+ <image src="spec/assets/_.png" id="_" mimetype="image/png" height="auto" width="auto"/>
84
+ </figure>
85
+ </sections>
86
+ </standard-document>
87
+ OUTPUT
88
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))
89
+ .gsub(%r{spec/assets/[^./]+\.}, "spec/assets/_.")))
90
+ .to be_equivalent_to xmlpp(output)
91
+ end
85
92
 
86
- context 'when lutaml_diagram' do
93
+ context "when lutaml_diagram" do
87
94
  let(:input) do
88
95
  <<~"OUTPUT"
89
96
  = Document title
@@ -106,13 +113,13 @@ OUTPUT
106
113
  end
107
114
  let(:output) do
108
115
  <<~"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
+ #{BLANK_HDR}
117
+ <sections>
118
+ <figure id="_">
119
+ <image src="spec/assets/_.png" id="_" mimetype="image/png" height="auto" width="auto"/>
120
+ </figure>
121
+ </sections>
122
+ </standard-document>
116
123
  OUTPUT
117
124
  end
118
125
 
@@ -120,12 +127,54 @@ OUTPUT
120
127
  expect(
121
128
  xmlpp(
122
129
  strip_guid(Asciidoctor.convert(input, *OPTIONS))
123
- .gsub(%r{".+spec\/assets\/lutaml\/[^.\/]+\.}, %q("spec/assets/_.))))
124
- .to(be_equivalent_to xmlpp(output))
130
+ .gsub(%r{".+spec/assets/lutaml/[^./]+\.},
131
+ '"spec/assets/_.'),
132
+ ),
133
+ )
134
+ .to(be_equivalent_to(xmlpp(output)))
135
+ end
136
+
137
+ context "when inline macro, path supplied as the second arg" do
138
+ let(:example_file) { fixtures_path('diagram_definitions.lutaml') }
139
+ let(:input) do
140
+ <<~TEXT
141
+ = Document title
142
+ Author
143
+ :docfile: test.adoc
144
+ :nodoc:
145
+ :novalid:
146
+ :no-isobib:
147
+ :imagesdir: spec/assets
148
+
149
+ lutaml_diagram::#{example_file}[]
150
+
151
+ TEXT
152
+ end
153
+ let(:output) do
154
+ <<~TEXT
155
+ #{BLANK_HDR}
156
+ <sections>
157
+ <figure id="_">
158
+ <image src="spec/assets/_.png" id="_" mimetype="image/png" height="auto" width="auto"/>
159
+ </figure>
160
+ </sections>
161
+ </standard-document>
162
+ TEXT
163
+ end
164
+
165
+ it "correctly renders input" do
166
+ expect(
167
+ xmlpp(
168
+ strip_guid(Asciidoctor.convert(input, *OPTIONS))
169
+ .gsub(%r{".+spec/assets/lutaml/[^./]+\.},
170
+ '"spec/assets/_.'),
171
+ ),
172
+ ).to(be_equivalent_to(xmlpp(output)))
173
+ end
125
174
  end
126
175
  end
127
176
 
128
- context 'when lutaml_uml_attributes_table' do
177
+ context "when lutaml_uml_attributes_table" do
129
178
  let(:example_file) { fixtures_path("diagram_definitions.lutaml") }
130
179
  let(:input) do
131
180
  <<~"OUTPUT"
@@ -142,59 +191,61 @@ OUTPUT
142
191
  end
143
192
  let(:output) do
144
193
  <<~"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>
194
+ #{BLANK_HDR}
195
+ <sections>
196
+ <clause id='_' inline-header='false' obligation='normative'>
197
+ <title>AttributeProfile</title>
198
+ <table id='_'>
199
+ <name>AttributeProfile attributes</name>
200
+ <thead>
201
+ <tr>
202
+ <th valign='top' align='left'>Name</th>
203
+ <th valign='top' align='left'>Definition</th>
204
+ <th valign='top' align='left'>Mandatory/ Optional/ Conditional</th>
205
+ <th valign='top' align='left'>Max Occur</th>
206
+ <th valign='top' align='left'>Data Type</th>
207
+ </tr>
208
+ </thead>
209
+ <tbody>
210
+ <tr>
211
+ <td valign='top' align='left'>addressClassProfile</td>
212
+ <td valign='top' align='left'></td>
213
+ <td valign='top' align='left'>O</td>
214
+ <td valign='top' align='left'>1</td>
215
+ <td valign='top' align='left'>
216
+ <tt>CharacterString</tt>
217
+ </td>
218
+ </tr>
219
+ <tr>
220
+ <td valign='top' align='left'>imlicistAttributeProfile</td>
221
+ <td valign='top' align='left'>this is attribute definition with multiply lines</td>
222
+ <td valign='top' align='left'>O</td>
223
+ <td valign='top' align='left'>1</td>
224
+ <td valign='top' align='left'>
225
+ <tt>CharacterString</tt>
226
+ </td>
227
+ </tr>
228
+ </tbody>
229
+ </table>
230
+ </clause>
231
+ </sections>
232
+ </standard-document>
184
233
  OUTPUT
185
234
  end
186
235
 
187
236
  it "processes the lutaml_uml_attributes_table macro" do
188
237
  expect(
189
238
  xmlpp(
190
- strip_guid(Asciidoctor.convert(input, *OPTIONS))))
239
+ strip_guid(Asciidoctor.convert(input, *OPTIONS)),
240
+ ),
241
+ )
191
242
  .to(be_equivalent_to(xmlpp(output)))
192
243
  end
193
244
  end
194
245
 
195
246
  it "processes the PlantUML macro with PlantUML disabled" do
196
247
  mock_plantuml_disabled
197
- expect { Asciidoctor.convert(<<~"INPUT", *OPTIONS) }.to output(%r{PlantUML not installed}).to_stderr
248
+ input = <<~INPUT
198
249
  #{ASCIIDOC_BLANK_HDR}
199
250
 
200
251
  [plantuml]
@@ -208,9 +259,11 @@ OUTPUT
208
259
  @enduml
209
260
  ....
210
261
  INPUT
262
+ expect { Asciidoctor.convert(input, *OPTIONS) }
263
+ .to output(%r{PlantUML not installed}).to_stderr
211
264
 
212
265
  mock_plantuml_disabled
213
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
266
+ input = <<~INPUT
214
267
  #{ASCIIDOC_BLANK_HDR}
215
268
 
216
269
  [plantuml]
@@ -224,23 +277,26 @@ OUTPUT
224
277
  @enduml
225
278
  ....
226
279
  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>
280
+ output = <<~OUTPUT
281
+ #{BLANK_HDR}
282
+ <sections>
283
+ <sourcecode id="_" lang="plantuml">@startuml
284
+ Alice -&gt; Bob: Authentication Request
285
+ Bob --&gt; Alice: Authentication Response
286
+
287
+ Alice -&gt; Bob: Another authentication Request
288
+ Alice &lt;-- Bob: another authentication Response
289
+ @enduml</sourcecode>
290
+ </sections>
291
+ </standard-document>
238
292
  OUTPUT
293
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
294
+ .to be_equivalent_to xmlpp(output)
239
295
  end
240
296
 
241
297
  it "processes the PlantUML macro with localdir unwritable" do
242
298
  mock_localdir_unwritable
243
- expect { Asciidoctor.convert(<<~"INPUT", *OPTIONS) }.to output(%r{not writable for PlantUML}).to_stderr
299
+ input = <<~INPUT
244
300
  #{ASCIIDOC_BLANK_HDR}
245
301
 
246
302
  [plantuml]
@@ -254,9 +310,11 @@ Alice &lt;-- Bob: another authentication Response
254
310
  @enduml
255
311
  ....
256
312
  INPUT
313
+ expect { Asciidoctor.convert(input, *OPTIONS) }
314
+ .to output(%r{not writable for PlantUML}).to_stderr
257
315
 
258
316
  mock_localdir_unwritable
259
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
317
+ input = <<~INPUT
260
318
  #{ASCIIDOC_BLANK_HDR}
261
319
 
262
320
  [plantuml]
@@ -270,26 +328,29 @@ Alice &lt;-- Bob: another authentication Response
270
328
  @enduml
271
329
  ....
272
330
  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>
331
+ output = <<~OUTPUT
332
+ #{BLANK_HDR}
333
+ <sections>
334
+ <sourcecode id="_" lang="plantuml">@startuml
335
+ Alice -&gt; Bob: Authentication Request
336
+ Bob --&gt; Alice: Authentication Response
337
+
338
+ Alice -&gt; Bob: Another authentication Request
339
+ Alice &lt;-- Bob: another authentication Response
340
+ @enduml</sourcecode>
341
+ </sections>
342
+ </standard-document>
284
343
  OUTPUT
344
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
345
+ .to be_equivalent_to xmlpp(output)
285
346
  end
286
347
 
287
348
  private
288
349
 
289
350
  def mock_plantuml_disabled
290
- expect(Asciidoctor::Standoc::PlantUMLBlockMacroBackend).to receive(:plantuml_installed?) do
351
+ expect(Asciidoctor::Standoc::PlantUMLBlockMacroBackend)
352
+ .to receive(:plantuml_installed?) do
291
353
  raise "PlantUML not installed"
292
- false
293
354
  end
294
355
  end
295
356