metanorma-standoc 1.10.0 → 1.10.3.1

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 (46) hide show
  1. checksums.yaml +4 -4
  2. data/lib/asciidoctor/standoc/base.rb +0 -1
  3. data/lib/asciidoctor/standoc/blocks.rb +1 -1
  4. data/lib/asciidoctor/standoc/cleanup.rb +62 -2
  5. data/lib/asciidoctor/standoc/cleanup_block.rb +0 -1
  6. data/lib/asciidoctor/standoc/cleanup_boilerplate.rb +2 -2
  7. data/lib/asciidoctor/standoc/cleanup_footnotes.rb +0 -1
  8. data/lib/asciidoctor/standoc/cleanup_maths.rb +0 -1
  9. data/lib/asciidoctor/standoc/cleanup_section.rb +0 -1
  10. data/lib/asciidoctor/standoc/converter.rb +3 -0
  11. data/lib/asciidoctor/standoc/datamodel/diagram_preprocessor.rb +22 -21
  12. data/lib/asciidoctor/standoc/front.rb +0 -1
  13. data/lib/asciidoctor/standoc/front_contributor.rb +0 -1
  14. data/lib/asciidoctor/standoc/isodoc.rng +44 -7
  15. data/lib/asciidoctor/standoc/macros.rb +25 -5
  16. data/lib/asciidoctor/standoc/macros_plantuml.rb +3 -3
  17. data/lib/asciidoctor/standoc/macros_terms.rb +34 -7
  18. data/lib/asciidoctor/standoc/ref.rb +60 -56
  19. data/lib/asciidoctor/standoc/section.rb +19 -12
  20. data/lib/asciidoctor/standoc/term_lookup_cleanup.rb +59 -18
  21. data/lib/asciidoctor/standoc/utils.rb +0 -1
  22. data/lib/asciidoctor/standoc/validate.rb +4 -3
  23. data/lib/isodoc/html/html_titlepage.html +81 -0
  24. data/lib/isodoc/html/htmlstyle.css +983 -0
  25. data/lib/isodoc/html/htmlstyle.scss +714 -0
  26. data/lib/isodoc/html/scripts.html +71 -0
  27. data/lib/metanorma/standoc/processor.rb +16 -7
  28. data/lib/metanorma/standoc/version.rb +1 -1
  29. data/metanorma-standoc.gemspec +1 -1
  30. data/spec/asciidoctor/blocks_spec.rb +2 -2
  31. data/spec/asciidoctor/cleanup_sections_spec.rb +899 -864
  32. data/spec/asciidoctor/cleanup_spec.rb +64 -14
  33. data/spec/asciidoctor/macros_json2text_spec.rb +1 -1
  34. data/spec/asciidoctor/macros_plantuml_spec.rb +165 -104
  35. data/spec/asciidoctor/macros_spec.rb +396 -75
  36. data/spec/asciidoctor/validate_spec.rb +12 -2
  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 +12 -12
  40. data/spec/vcr_cassettes/isobib_get_123_1.yml +23 -23
  41. data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +34 -34
  42. data/spec/vcr_cassettes/isobib_get_123_2001.yml +13 -13
  43. data/spec/vcr_cassettes/isobib_get_124.yml +12 -12
  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>
@@ -1931,11 +1981,11 @@ RSpec.describe Asciidoctor::Standoc do
1931
1981
  <definitions id='L' obligation="normative">
1932
1982
  <title>Symbols and abbreviated terms</title>
1933
1983
  <dl id='_'>
1934
- <dt>m</dt>
1984
+ <dt id="symbol-m">m</dt>
1935
1985
  <dd>
1936
1986
  <p id='_'>Definition 7</p>
1937
1987
  </dd>
1938
- <dt>
1988
+ <dt id="symbol-_-n-">
1939
1989
  <stem type='MathML'>
1940
1990
  <math xmlns='http://www.w3.org/1998/Math/MathML'>
1941
1991
  <mi>n</mi>
@@ -1945,23 +1995,23 @@ RSpec.describe Asciidoctor::Standoc do
1945
1995
  <dd>
1946
1996
  <p id='_'>Definition 6</p>
1947
1997
  </dd>
1948
- <dt>x</dt>
1998
+ <dt id="symbol-x">x</dt>
1949
1999
  <dd>
1950
2000
  <p id='_'>Definition 5</p>
1951
2001
  </dd>
1952
- <dt>x_m_</dt>
2002
+ <dt id='symbol-x_m_'>x_m_</dt>
1953
2003
  <dd>
1954
2004
  <p id='_'>Definition 4</p>
1955
2005
  </dd>
1956
- <dt>x_1_</dt>
2006
+ <dt id='symbol-x_1_'>x_1_</dt>
1957
2007
  <dd>
1958
2008
  <p id='_'>Definition 3</p>
1959
2009
  </dd>
1960
- <dt>Xa</dt>
2010
+ <dt id='symbol-xa'>Xa</dt>
1961
2011
  <dd>
1962
2012
  <p id='_'>Definition 2</p>
1963
2013
  </dd>
1964
- <dt>α</dt>
2014
+ <dt id='symbol-&#945;'>α</dt>
1965
2015
  <dd>
1966
2016
  <p id='_'>Definition 1</p>
1967
2017
  </dd>
@@ -1993,11 +2043,11 @@ RSpec.describe Asciidoctor::Standoc do
1993
2043
  <definitions id='L' obligation="normative">
1994
2044
  <title>Symbols and abbreviated terms</title>
1995
2045
  <dl id='_'>
1996
- <dt>x</dt>
2046
+ <dt id='symbol-x'>x</dt>
1997
2047
  <dd>
1998
2048
  <p id='_'>Definition 5</p>
1999
2049
  </dd>
2000
- <dt><stem type='MathML'>
2050
+ <dt id='symbol-_-xm-'><stem type='MathML'>
2001
2051
  <math xmlns='http://www.w3.org/1998/Math/MathML'>
2002
2052
  <msub>
2003
2053
  <mrow>
@@ -2012,7 +2062,7 @@ RSpec.describe Asciidoctor::Standoc do
2012
2062
  <dd>
2013
2063
  <p id='_'>Definition 4</p>
2014
2064
  </dd>
2015
- <dt><stem type='MathML'>
2065
+ <dt id='symbol-_-x1-'><stem type='MathML'>
2016
2066
  <math xmlns='http://www.w3.org/1998/Math/MathML'>
2017
2067
  <msub>
2018
2068
  <mrow>
@@ -2027,11 +2077,11 @@ RSpec.describe Asciidoctor::Standoc do
2027
2077
  <dd>
2028
2078
  <p id='_'>Definition 3</p>
2029
2079
  </dd>
2030
- <dt>xa</dt>
2080
+ <dt id='symbol-xa'>xa</dt>
2031
2081
  <dd>
2032
2082
  <p id='_'>Definition 2</p>
2033
2083
  </dd>
2034
- <dt>
2084
+ <dt id='symbol-_-&#945;-'>
2035
2085
  <stem type='MathML'>
2036
2086
  <math xmlns='http://www.w3.org/1998/Math/MathML'>
2037
2087
  <mi>α</mi>
@@ -1,6 +1,6 @@
1
1
  require "spec_helper"
2
2
 
3
- RSpec.describe 'Json2Text macros' do
3
+ RSpec.describe "Json2Text macros" do
4
4
  it_behaves_like "structured data 2 text preprocessor" do
5
5
  let(:extention) { "json" }
6
6
  def transform_to_type(data)
@@ -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