asciidoctor-diagram 2.2.11 → 2.2.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.adoc +7 -0
- data/lib/asciidoctor-diagram/plantuml/converter.rb +1 -0
- data/lib/asciidoctor-diagram/structurizr/renderers.rb +5 -0
- data/lib/asciidoctor-diagram/version.rb +1 -1
- metadata +3 -130
- data/Rakefile +0 -9
- data/docs/antora.yml +0 -5
- data/docs/modules/ROOT/images/a2s.svg +0 -44
- data/docs/modules/ROOT/images/actdiag.png +0 -0
- data/docs/modules/ROOT/images/asciidoctor-diagram-classes.png +0 -0
- data/docs/modules/ROOT/images/asciidoctor-diagram-process.png +0 -0
- data/docs/modules/ROOT/images/barcode.png +0 -0
- data/docs/modules/ROOT/images/barcode2.png +0 -0
- data/docs/modules/ROOT/images/blockdiag.png +0 -0
- data/docs/modules/ROOT/images/d2.png +0 -0
- data/docs/modules/ROOT/images/lilypond.png +0 -0
- data/docs/modules/ROOT/images/penrose.png +0 -0
- data/docs/modules/ROOT/nav.adoc +0 -41
- data/docs/modules/ROOT/pages/blocks.adoc +0 -140
- data/docs/modules/ROOT/pages/diagram_types/a2s.adoc +0 -47
- data/docs/modules/ROOT/pages/diagram_types/actdiag.adoc +0 -46
- data/docs/modules/ROOT/pages/diagram_types/barcode.adoc +0 -72
- data/docs/modules/ROOT/pages/diagram_types/blockdiag.adoc +0 -38
- data/docs/modules/ROOT/pages/diagram_types/bpmn.adoc +0 -21
- data/docs/modules/ROOT/pages/diagram_types/bytefield.adoc +0 -16
- data/docs/modules/ROOT/pages/diagram_types/d2.adoc +0 -43
- data/docs/modules/ROOT/pages/diagram_types/dbml.adoc +0 -16
- data/docs/modules/ROOT/pages/diagram_types/diagrams.adoc +0 -20
- data/docs/modules/ROOT/pages/diagram_types/ditaa.adoc +0 -31
- data/docs/modules/ROOT/pages/diagram_types/dpic.adoc +0 -16
- data/docs/modules/ROOT/pages/diagram_types/erd.adoc +0 -17
- data/docs/modules/ROOT/pages/diagram_types/gnuplot.adoc +0 -27
- data/docs/modules/ROOT/pages/diagram_types/graphviz.adoc +0 -21
- data/docs/modules/ROOT/pages/diagram_types/lilypond.adoc +0 -27
- data/docs/modules/ROOT/pages/diagram_types/meme.adoc +0 -34
- data/docs/modules/ROOT/pages/diagram_types/mermaid.adoc +0 -28
- data/docs/modules/ROOT/pages/diagram_types/msc.adoc +0 -23
- data/docs/modules/ROOT/pages/diagram_types/nomnoml.adoc +0 -16
- data/docs/modules/ROOT/pages/diagram_types/nwdiag.adoc +0 -22
- data/docs/modules/ROOT/pages/diagram_types/penrose.adoc +0 -50
- data/docs/modules/ROOT/pages/diagram_types/pikchr.adoc +0 -16
- data/docs/modules/ROOT/pages/diagram_types/plantuml.adoc +0 -24
- data/docs/modules/ROOT/pages/diagram_types/seqdiag.adoc +0 -18
- data/docs/modules/ROOT/pages/diagram_types/shaape.adoc +0 -18
- data/docs/modules/ROOT/pages/diagram_types/smcat.adoc +0 -18
- data/docs/modules/ROOT/pages/diagram_types/structurizr.adoc +0 -29
- data/docs/modules/ROOT/pages/diagram_types/svgbob.adoc +0 -21
- data/docs/modules/ROOT/pages/diagram_types/symbolator.adoc +0 -19
- data/docs/modules/ROOT/pages/diagram_types/syntrax.adoc +0 -28
- data/docs/modules/ROOT/pages/diagram_types/tikz.adoc +0 -21
- data/docs/modules/ROOT/pages/diagram_types/umlet.adoc +0 -19
- data/docs/modules/ROOT/pages/diagram_types/vega.adoc +0 -28
- data/docs/modules/ROOT/pages/diagram_types/wavedrom.adoc +0 -17
- data/docs/modules/ROOT/pages/enabling.adoc +0 -25
- data/docs/modules/ROOT/pages/generate.adoc +0 -15
- data/docs/modules/ROOT/pages/index.adoc +0 -12
- data/docs/modules/ROOT/pages/installation.adoc +0 -32
- data/docs/modules/ROOT/pages/output.adoc +0 -19
- data/docs/modules/ROOT/partials/shared-attrs.adoc +0 -12
- data/docs/modules/ROOT/partials/uris.adoc +0 -48
- data/examples/Gemfile +0 -3
- data/examples/README.adoc +0 -18
- data/examples/design.adoc +0 -78
- data/examples/features.adoc +0 -189
- data/spec/a2s_spec.rb +0 -33
- data/spec/barcode_spec.rb +0 -176
- data/spec/blockdiag_spec.rb +0 -20
- data/spec/bpmn_spec.rb +0 -60
- data/spec/bytefield_spec.rb +0 -96
- data/spec/d2_spec.rb +0 -87
- data/spec/dbml_spec.rb +0 -32
- data/spec/diagrams_spec.rb +0 -27
- data/spec/ditaa_spec.rb +0 -191
- data/spec/dpic_spec.rb +0 -23
- data/spec/erd_spec.rb +0 -96
- data/spec/gnuplot_spec.rb +0 -229
- data/spec/graphviz_py_spec.rb +0 -33
- data/spec/graphviz_spec.rb +0 -24
- data/spec/lilypond_spec.rb +0 -17
- data/spec/man.jpg +0 -0
- data/spec/meme_spec.rb +0 -67
- data/spec/mermaid_spec.rb +0 -161
- data/spec/msc_spec.rb +0 -37
- data/spec/nomnoml_spec.rb +0 -36
- data/spec/pikchr_spec.rb +0 -73
- data/spec/plantuml_spec.rb +0 -800
- data/spec/shaape_spec.rb +0 -20
- data/spec/shared_examples.rb +0 -766
- data/spec/smcat_spec.rb +0 -30
- data/spec/structurizr_spec.rb +0 -41
- data/spec/svgbob_spec.rb +0 -33
- data/spec/symbolator_spec.rb +0 -27
- data/spec/syntrax_spec.rb +0 -22
- data/spec/test_helper_methods.rb +0 -118
- data/spec/tikz_spec.rb +0 -181
- data/spec/umlet_spec.rb +0 -32
- data/spec/vega_spec.rb +0 -133
- data/spec/wavedrom_spec.rb +0 -21
data/spec/plantuml_spec.rb
DELETED
@@ -1,800 +0,0 @@
|
|
1
|
-
require_relative 'test_helper_methods'
|
2
|
-
|
3
|
-
PLANTUML_CODE = <<-eos
|
4
|
-
User -> (Start)
|
5
|
-
User --> (Use the application) : Label
|
6
|
-
|
7
|
-
:Main Admin: ---> (Use the application) : Another label
|
8
|
-
eos
|
9
|
-
|
10
|
-
describe Asciidoctor::Diagram::PlantUmlInlineMacroProcessor do
|
11
|
-
include_examples "inline_macro", :plantuml, PLANTUML_CODE, [:png, :svg]
|
12
|
-
end
|
13
|
-
|
14
|
-
describe Asciidoctor::Diagram::PlantUmlBlockMacroProcessor do
|
15
|
-
include_examples "block_macro", :plantuml, PLANTUML_CODE, [:png, :svg, :txt]
|
16
|
-
|
17
|
-
it 'should support substitutions in diagram code' do
|
18
|
-
code = <<-eos
|
19
|
-
class {parent-class}
|
20
|
-
class {child-class}
|
21
|
-
{parent-class} <|-- {child-class}
|
22
|
-
eos
|
23
|
-
|
24
|
-
File.write('plantuml.txt', code)
|
25
|
-
|
26
|
-
doc = <<-eos
|
27
|
-
= Hello, PlantUML!
|
28
|
-
Doc Writer <doc@example.com>
|
29
|
-
:parent-class: ParentClass
|
30
|
-
:child-class: ChildClass
|
31
|
-
|
32
|
-
== First Section
|
33
|
-
|
34
|
-
plantuml::plantuml.txt[format="svg", subs=attributes+]
|
35
|
-
eos
|
36
|
-
|
37
|
-
d = load_asciidoc doc, :attributes => {'backend' => 'html5'}
|
38
|
-
expect(d).to_not be_nil
|
39
|
-
|
40
|
-
b = d.find { |bl| bl.context == :image }
|
41
|
-
expect(b).to_not be_nil
|
42
|
-
|
43
|
-
target = b.attributes['target']
|
44
|
-
expect(File.exist?(target)).to be true
|
45
|
-
|
46
|
-
content = File.read(target, :encoding => Encoding::UTF_8)
|
47
|
-
expect(content).to include('ParentClass')
|
48
|
-
expect(content).to include('ChildClass')
|
49
|
-
end
|
50
|
-
|
51
|
-
it 'should support substitutions in the target attribute' do
|
52
|
-
code = <<-eos
|
53
|
-
class {parent-class}
|
54
|
-
class {child-class}
|
55
|
-
{parent-class} <|-- {child-class}
|
56
|
-
eos
|
57
|
-
|
58
|
-
File.write('plantuml.txt', code)
|
59
|
-
|
60
|
-
doc = <<-eos
|
61
|
-
= Hello, PlantUML!
|
62
|
-
Doc Writer <doc@example.com>
|
63
|
-
:file: plantuml
|
64
|
-
:parent-class: ParentClass
|
65
|
-
:child-class: ChildClass
|
66
|
-
|
67
|
-
== First Section
|
68
|
-
|
69
|
-
plantuml::{file}.txt[format="svg", subs=attributes+]
|
70
|
-
eos
|
71
|
-
|
72
|
-
d = load_asciidoc doc, :attributes => {'backend' => 'html5'}
|
73
|
-
expect(d).to_not be_nil
|
74
|
-
|
75
|
-
b = d.find { |bl| bl.context == :image }
|
76
|
-
expect(b).to_not be_nil
|
77
|
-
|
78
|
-
target = b.attributes['target']
|
79
|
-
expect(File.exist?(target)).to be true
|
80
|
-
|
81
|
-
content = File.read(target, :encoding => Encoding::UTF_8)
|
82
|
-
expect(content).to include('ParentClass')
|
83
|
-
expect(content).to include('ChildClass')
|
84
|
-
end
|
85
|
-
|
86
|
-
it 'should support substitutions in the format attribute' do
|
87
|
-
code = <<-eos
|
88
|
-
class Parent
|
89
|
-
class Child
|
90
|
-
Parent <|-- Child
|
91
|
-
eos
|
92
|
-
|
93
|
-
File.write('plantuml.txt', code)
|
94
|
-
|
95
|
-
doc = <<-eos
|
96
|
-
= Hello, PlantUML!
|
97
|
-
Doc Writer <doc@example.com>
|
98
|
-
:file: plantuml
|
99
|
-
:plantumlformat: png
|
100
|
-
|
101
|
-
== First Section
|
102
|
-
|
103
|
-
plantuml::{file}.txt[format="{plantumlformat}", subs=attributes+]
|
104
|
-
eos
|
105
|
-
|
106
|
-
d = load_asciidoc doc, :attributes => {'backend' => 'html5'}
|
107
|
-
expect(d).to_not be_nil
|
108
|
-
|
109
|
-
b = d.find { |bl| bl.context == :image }
|
110
|
-
expect(b).to_not be_nil
|
111
|
-
|
112
|
-
target = b.attributes['target']
|
113
|
-
expect(target).to match(/\.png$/)
|
114
|
-
expect(File.exist?(target)).to be true
|
115
|
-
|
116
|
-
expect(b.attributes['width']).to_not be_nil
|
117
|
-
expect(b.attributes['height']).to_not be_nil
|
118
|
-
end
|
119
|
-
|
120
|
-
it 'should resolve !include directives with relative paths' do
|
121
|
-
included = <<-eos
|
122
|
-
interface List
|
123
|
-
List : int size()
|
124
|
-
List : void clear()
|
125
|
-
eos
|
126
|
-
|
127
|
-
code = <<-eos
|
128
|
-
!include list.iuml
|
129
|
-
List <|.. ArrayList
|
130
|
-
eos
|
131
|
-
|
132
|
-
Dir.mkdir('dir')
|
133
|
-
File.write('dir/list.iuml', included)
|
134
|
-
File.write('dir/plantuml.txt', code)
|
135
|
-
|
136
|
-
doc = <<-eos
|
137
|
-
= Hello, PlantUML!
|
138
|
-
Doc Writer <doc@example.com>
|
139
|
-
:parent-class: ParentClass
|
140
|
-
:child-class: ChildClass
|
141
|
-
|
142
|
-
== First Section
|
143
|
-
|
144
|
-
plantuml::dir/plantuml.txt[format="svg", subs=attributes+]
|
145
|
-
eos
|
146
|
-
|
147
|
-
d = load_asciidoc doc, :attributes => {'backend' => 'html5'}
|
148
|
-
|
149
|
-
expect(d).to_not be_nil
|
150
|
-
|
151
|
-
b = d.find { |bl| bl.context == :image }
|
152
|
-
expect(b).to_not be_nil
|
153
|
-
|
154
|
-
target = b.attributes['target']
|
155
|
-
expect(File.exist?(target)).to be true
|
156
|
-
|
157
|
-
content = File.read(target, :encoding => Encoding::UTF_8)
|
158
|
-
expect(content).to_not include('!include')
|
159
|
-
end
|
160
|
-
end
|
161
|
-
|
162
|
-
describe Asciidoctor::Diagram::PlantUmlBlockProcessor do
|
163
|
-
include_examples "block", :plantuml, PLANTUML_CODE, [:png, :svg, :txt]
|
164
|
-
|
165
|
-
it "should work with plantuml.com" do
|
166
|
-
doc = <<-eos
|
167
|
-
= Hello, kroki!
|
168
|
-
:diagram-server-url: http://plantuml.com/plantuml
|
169
|
-
:diagram-server-type: plantuml
|
170
|
-
Doc Writer <doc@example.com>
|
171
|
-
|
172
|
-
== First Section
|
173
|
-
|
174
|
-
[plantuml, format=svg]
|
175
|
-
----
|
176
|
-
#{PLANTUML_CODE}
|
177
|
-
----
|
178
|
-
eos
|
179
|
-
|
180
|
-
d = load_asciidoc doc
|
181
|
-
expect(d).to_not be_nil
|
182
|
-
|
183
|
-
b = d.find { |bl| bl.context == :image }
|
184
|
-
expect(b).to_not be_nil
|
185
|
-
|
186
|
-
expect(b.content_model).to eq :empty
|
187
|
-
|
188
|
-
target = b.attributes['target']
|
189
|
-
expect(target).to_not be_nil
|
190
|
-
expect(target).to match(/\.svg$/)
|
191
|
-
expect(File.exist?(target)).to be true
|
192
|
-
|
193
|
-
expect(b.attributes['width']).to_not be_nil
|
194
|
-
expect(b.attributes['height']).to_not be_nil
|
195
|
-
end
|
196
|
-
|
197
|
-
it "should handle syntax errors gracefully" do
|
198
|
-
doc = <<-eos
|
199
|
-
[plantuml]
|
200
|
-
----
|
201
|
-
@startuml
|
202
|
-
xxx
|
203
|
-
@enduml
|
204
|
-
----
|
205
|
-
eos
|
206
|
-
|
207
|
-
options = {}
|
208
|
-
options[:attributes] = {}
|
209
|
-
options[:attributes]['diagram-on-error'] = 'log'
|
210
|
-
|
211
|
-
d = load_asciidoc doc, options
|
212
|
-
expect(d).to_not be_nil
|
213
|
-
|
214
|
-
b = d.find { |bl| bl.context == :listing }
|
215
|
-
expect(b).to_not be_nil
|
216
|
-
|
217
|
-
expect(b.source).to include 'Failed to generate image'
|
218
|
-
end
|
219
|
-
|
220
|
-
it 'should use plantuml configuration when specified as a document attribute' do
|
221
|
-
doc = <<-eos
|
222
|
-
= Hello, PlantUML!
|
223
|
-
Doc Writer <doc@example.com>
|
224
|
-
:plantuml-config: test.config
|
225
|
-
:plantuml-format: svg
|
226
|
-
|
227
|
-
== First Section
|
228
|
-
|
229
|
-
[plantuml]
|
230
|
-
----
|
231
|
-
actor Foo1
|
232
|
-
boundary Foo2
|
233
|
-
Foo1 -> Foo2 : To boundary
|
234
|
-
----
|
235
|
-
eos
|
236
|
-
|
237
|
-
config = <<-eos
|
238
|
-
skinparam ArrowColor #DEADBE
|
239
|
-
eos
|
240
|
-
|
241
|
-
File.open('test.config', 'w') do |f|
|
242
|
-
f.write config
|
243
|
-
end
|
244
|
-
|
245
|
-
d = load_asciidoc doc
|
246
|
-
b = d.find { |bl| bl.context == :image }
|
247
|
-
|
248
|
-
target = b.attributes['target']
|
249
|
-
expect(target).to_not be_nil
|
250
|
-
expect(File.exist?(target)).to be true
|
251
|
-
|
252
|
-
svg = File.read(target, :encoding => Encoding::UTF_8)
|
253
|
-
expect(svg).to match(/<[^<]+ fill=["']#DEADBE["']/)
|
254
|
-
end
|
255
|
-
|
256
|
-
it 'should use plantuml theme when specified as a document attribute' do
|
257
|
-
doc = <<-eos
|
258
|
-
= Hello, PlantUML!
|
259
|
-
Doc Writer <doc@example.com>
|
260
|
-
:plantuml-format: svg
|
261
|
-
:plantuml-theme: spacelab
|
262
|
-
|
263
|
-
== First Section
|
264
|
-
|
265
|
-
[plantuml]
|
266
|
-
----
|
267
|
-
actor Foo1
|
268
|
-
boundary Foo2
|
269
|
-
Foo1 -> Foo2 : To boundary
|
270
|
-
----
|
271
|
-
eos
|
272
|
-
|
273
|
-
d = load_asciidoc doc
|
274
|
-
b = d.find { |bl| bl.context == :image }
|
275
|
-
|
276
|
-
target = b.attributes['target']
|
277
|
-
expect(target).to_not be_nil
|
278
|
-
expect(File.exist?(target)).to be true
|
279
|
-
|
280
|
-
svg = File.read(target, :encoding => Encoding::UTF_8)
|
281
|
-
expect(svg).to match(/<[^<]+ stop-color=["']#7C9AB9["']/)
|
282
|
-
end
|
283
|
-
|
284
|
-
it 'should use plantuml include dir when specified as a document attribute' do
|
285
|
-
doc = <<-eos
|
286
|
-
= Hello, PlantUML!
|
287
|
-
Doc Writer <doc@example.com>
|
288
|
-
:plantuml-includedir: include
|
289
|
-
:plantuml-format: svg
|
290
|
-
|
291
|
-
== First Section
|
292
|
-
|
293
|
-
[plantuml]
|
294
|
-
----
|
295
|
-
!include common.puml
|
296
|
-
actor Foo1
|
297
|
-
boundary Foo2
|
298
|
-
Foo1 -> Foo2 : To boundary
|
299
|
-
----
|
300
|
-
eos
|
301
|
-
|
302
|
-
includefile = <<-eos
|
303
|
-
skinparam ArrowColor #DEADBE
|
304
|
-
eos
|
305
|
-
Dir.mkdir('include')
|
306
|
-
File.open('include/common.puml', 'w') do |f|
|
307
|
-
f.write includefile
|
308
|
-
end
|
309
|
-
|
310
|
-
d = load_asciidoc doc
|
311
|
-
b = d.find { |bl| bl.context == :image }
|
312
|
-
|
313
|
-
target = b.attributes['target']
|
314
|
-
expect(target).to_not be_nil
|
315
|
-
expect(File.exist?(target)).to be true
|
316
|
-
|
317
|
-
svg = File.read(target, :encoding => Encoding::UTF_8)
|
318
|
-
expect(svg).to match(/<[^<]+ fill=["']#DEADBE["']/)
|
319
|
-
end
|
320
|
-
|
321
|
-
it 'should support salt diagrams using salt block type' do
|
322
|
-
doc = <<-eos
|
323
|
-
= Hello, PlantUML!
|
324
|
-
Doc Writer <doc@example.com>
|
325
|
-
|
326
|
-
== First Section
|
327
|
-
|
328
|
-
[salt, format="png"]
|
329
|
-
----
|
330
|
-
{
|
331
|
-
Just plain text
|
332
|
-
[This is my button]
|
333
|
-
() Unchecked radio
|
334
|
-
(X) Checked radio
|
335
|
-
[] Unchecked box
|
336
|
-
[X] Checked box
|
337
|
-
"Enter text here "
|
338
|
-
^This is a droplist^
|
339
|
-
}
|
340
|
-
----
|
341
|
-
eos
|
342
|
-
|
343
|
-
d = load_asciidoc doc, :attributes => {'backend' => 'docbook5'}
|
344
|
-
expect(d).to_not be_nil
|
345
|
-
|
346
|
-
b = d.find { |bl| bl.context == :image }
|
347
|
-
expect(b).to_not be_nil
|
348
|
-
|
349
|
-
target = b.attributes['target']
|
350
|
-
expect(File.exist?(target)).to be true
|
351
|
-
|
352
|
-
expect(b.attributes['width']).to be_nil
|
353
|
-
expect(b.attributes['height']).to be_nil
|
354
|
-
end
|
355
|
-
|
356
|
-
it 'should support salt diagrams using plantuml block type' do
|
357
|
-
doc = <<-eos
|
358
|
-
= Hello, PlantUML!
|
359
|
-
Doc Writer <doc@example.com>
|
360
|
-
|
361
|
-
== First Section
|
362
|
-
|
363
|
-
[plantuml, format="png"]
|
364
|
-
----
|
365
|
-
salt
|
366
|
-
{
|
367
|
-
Just plain text
|
368
|
-
[This is my button]
|
369
|
-
() Unchecked radio
|
370
|
-
(X) Checked radio
|
371
|
-
[] Unchecked box
|
372
|
-
[X] Checked box
|
373
|
-
"Enter text here "
|
374
|
-
^This is a droplist^
|
375
|
-
}
|
376
|
-
----
|
377
|
-
eos
|
378
|
-
|
379
|
-
d = load_asciidoc doc, :attributes => {'backend' => 'docbook5'}
|
380
|
-
expect(d).to_not be_nil
|
381
|
-
|
382
|
-
b = d.find { |bl| bl.context == :image }
|
383
|
-
expect(b).to_not be_nil
|
384
|
-
|
385
|
-
target = b.attributes['target']
|
386
|
-
expect(File.exist?(target)).to be true
|
387
|
-
|
388
|
-
expect(b.attributes['width']).to be_nil
|
389
|
-
expect(b.attributes['height']).to be_nil
|
390
|
-
end
|
391
|
-
|
392
|
-
it 'should support salt diagrams containing tree widgets' do
|
393
|
-
doc = <<-eos
|
394
|
-
= Hello, PlantUML!
|
395
|
-
Doc Writer <doc@example.com>
|
396
|
-
|
397
|
-
== First Section
|
398
|
-
|
399
|
-
[plantuml, format="png"]
|
400
|
-
----
|
401
|
-
salt
|
402
|
-
{
|
403
|
-
{T
|
404
|
-
+A
|
405
|
-
++a
|
406
|
-
}
|
407
|
-
}
|
408
|
-
----
|
409
|
-
eos
|
410
|
-
|
411
|
-
d = load_asciidoc doc, :attributes => {'backend' => 'docbook5'}
|
412
|
-
expect(d).to_not be_nil
|
413
|
-
|
414
|
-
b = d.find { |bl| bl.context == :image }
|
415
|
-
expect(b).to_not be_nil
|
416
|
-
|
417
|
-
target = b.attributes['target']
|
418
|
-
expect(File.exist?(target)).to be true
|
419
|
-
|
420
|
-
expect(b.attributes['width']).to be_nil
|
421
|
-
expect(b.attributes['height']).to be_nil
|
422
|
-
end
|
423
|
-
|
424
|
-
it 'should support ditaa diagrams' do
|
425
|
-
doc = <<-eos
|
426
|
-
= Hello, PlantUML!
|
427
|
-
Doc Writer <doc@example.com>
|
428
|
-
|
429
|
-
== First Section
|
430
|
-
|
431
|
-
[plantuml, format="png"]
|
432
|
-
----
|
433
|
-
@startditaa -E
|
434
|
-
+---------+
|
435
|
-
| example |
|
436
|
-
+---------+
|
437
|
-
@endditaa
|
438
|
-
----
|
439
|
-
eos
|
440
|
-
|
441
|
-
d = load_asciidoc doc, :attributes => {'backend' => 'docbook5'}
|
442
|
-
expect(d).to_not be_nil
|
443
|
-
|
444
|
-
b = d.find { |bl| bl.context == :image }
|
445
|
-
expect(b).to_not be_nil
|
446
|
-
|
447
|
-
target = b.attributes['target']
|
448
|
-
expect(File.exist?(target)).to be true
|
449
|
-
|
450
|
-
expect(b.attributes['width']).to be_nil
|
451
|
-
expect(b.attributes['height']).to be_nil
|
452
|
-
end
|
453
|
-
|
454
|
-
it 'should handle embedded creole images correctly' do
|
455
|
-
creole_doc = <<-eos
|
456
|
-
= Hello, PlantUML!
|
457
|
-
Doc Writer <doc@example.com>
|
458
|
-
|
459
|
-
== First Section
|
460
|
-
|
461
|
-
[plantuml, format="png"]
|
462
|
-
----
|
463
|
-
:* You can change <color:red>text color</color>
|
464
|
-
* You can change <back:cadetblue>background color</back>
|
465
|
-
* You can change <size:18>size</size>
|
466
|
-
* You use <u>legacy</u> <b>HTML <i>tag</i></b>
|
467
|
-
* You use <u:red>color</u> <s:green>in HTML</s> <w:#0000FF>tag</w>
|
468
|
-
* Use image : <img:sourceforge.jpg>
|
469
|
-
* Use image : <img:http://www.foo.bar/sourceforge.jpg>
|
470
|
-
* Use image : <img:file:///sourceforge.jpg>
|
471
|
-
|
472
|
-
;
|
473
|
-
----
|
474
|
-
eos
|
475
|
-
|
476
|
-
load_asciidoc creole_doc, :attributes => {'backend' => 'html5'}
|
477
|
-
|
478
|
-
# No real way to assert this since PlantUML doesn't produce an error on file not found
|
479
|
-
end
|
480
|
-
|
481
|
-
it 'should resolve !include directives with relative paths' do
|
482
|
-
included = <<-eos
|
483
|
-
interface List
|
484
|
-
List : int size()
|
485
|
-
List : void clear()
|
486
|
-
eos
|
487
|
-
|
488
|
-
sub = <<-eos
|
489
|
-
@startuml
|
490
|
-
A -> A : stuff1
|
491
|
-
!startsub BASIC
|
492
|
-
B -> B : stuff2
|
493
|
-
!endsub
|
494
|
-
C -> C : stuff3
|
495
|
-
!startsub BASIC
|
496
|
-
D -> D : stuff4
|
497
|
-
!endsub
|
498
|
-
@enduml
|
499
|
-
eos
|
500
|
-
|
501
|
-
Dir.mkdir('dir')
|
502
|
-
File.write('dir/List.iuml', included)
|
503
|
-
File.write('dir/Sub.iuml', sub)
|
504
|
-
|
505
|
-
creole_doc = <<-eos
|
506
|
-
= Hello, PlantUML!
|
507
|
-
Doc Writer <doc@example.com>
|
508
|
-
|
509
|
-
== First Section
|
510
|
-
|
511
|
-
[plantuml, format="svg"]
|
512
|
-
----
|
513
|
-
!include dir/List.iuml
|
514
|
-
!includesub dir/Sub.iuml!BASIC
|
515
|
-
List <|.. ArrayList
|
516
|
-
----
|
517
|
-
eos
|
518
|
-
|
519
|
-
d = load_asciidoc creole_doc, :attributes => {'backend' => 'html5'}
|
520
|
-
|
521
|
-
expect(d).to_not be_nil
|
522
|
-
|
523
|
-
b = d.find { |bl| bl.context == :image }
|
524
|
-
expect(b).to_not be_nil
|
525
|
-
|
526
|
-
target = b.attributes['target']
|
527
|
-
expect(File.exist?(target)).to be true
|
528
|
-
|
529
|
-
content = File.read(target, :encoding => Encoding::UTF_8)
|
530
|
-
expect(content).to_not include('!include')
|
531
|
-
expect(content).to_not include('!includesub')
|
532
|
-
end
|
533
|
-
|
534
|
-
it 'should not resolve stdlib !include directives' do
|
535
|
-
doc = <<-eos
|
536
|
-
= Hello, PlantUML!
|
537
|
-
Doc Writer <doc@example.com>
|
538
|
-
|
539
|
-
== First Section
|
540
|
-
|
541
|
-
[plantuml, format="svg"]
|
542
|
-
----
|
543
|
-
@startuml
|
544
|
-
!include <tupadr3/common>
|
545
|
-
!include <tupadr3/font-awesome/server>
|
546
|
-
!include <tupadr3/font-awesome/database>
|
547
|
-
|
548
|
-
title Styling example
|
549
|
-
|
550
|
-
FA_SERVER(web1,web1) #Green
|
551
|
-
FA_SERVER(web2,web2) #Yellow
|
552
|
-
FA_SERVER(web3,web3) #Blue
|
553
|
-
FA_SERVER(web4,web4) #YellowGreen
|
554
|
-
|
555
|
-
FA_DATABASE(db1,LIVE,database,white) #RoyalBlue
|
556
|
-
FA_DATABASE(db2,SPARE,database) #Red
|
557
|
-
|
558
|
-
db1 <--> db2
|
559
|
-
|
560
|
-
web1 <--> db1
|
561
|
-
web2 <--> db1
|
562
|
-
web3 <--> db1
|
563
|
-
web4 <--> db1
|
564
|
-
@enduml
|
565
|
-
----
|
566
|
-
eos
|
567
|
-
|
568
|
-
d = load_asciidoc doc, :attributes => {'backend' => 'html5'}
|
569
|
-
|
570
|
-
expect(d).to_not be_nil
|
571
|
-
|
572
|
-
b = d.find { |bl| bl.context == :image }
|
573
|
-
expect(b).to_not be_nil
|
574
|
-
|
575
|
-
target = b.attributes['target']
|
576
|
-
expect(File.exist?(target)).to be true
|
577
|
-
|
578
|
-
content = File.read(target, :encoding => Encoding::UTF_8)
|
579
|
-
expect(content).to_not include('!include')
|
580
|
-
end
|
581
|
-
|
582
|
-
it 'should support substitutions' do
|
583
|
-
doc = <<-eos
|
584
|
-
= Hello, PlantUML!
|
585
|
-
:parent-class: ParentClass
|
586
|
-
:child-class: ChildClass
|
587
|
-
|
588
|
-
[plantuml,class-inheritence,svg,subs=attributes+]
|
589
|
-
....
|
590
|
-
class {parent-class}
|
591
|
-
class {child-class}
|
592
|
-
{parent-class} <|-- {child-class}
|
593
|
-
....
|
594
|
-
eos
|
595
|
-
|
596
|
-
d = load_asciidoc doc, :attributes => {'backend' => 'html5'}
|
597
|
-
expect(d).to_not be_nil
|
598
|
-
|
599
|
-
b = d.find { |bl| bl.context == :image }
|
600
|
-
expect(b).to_not be_nil
|
601
|
-
|
602
|
-
target = b.attributes['target']
|
603
|
-
expect(File.exist?(target)).to be true
|
604
|
-
|
605
|
-
content = File.read(target, :encoding => Encoding::UTF_8)
|
606
|
-
expect(content).to include('ParentClass')
|
607
|
-
expect(content).to include('ChildClass')
|
608
|
-
end
|
609
|
-
|
610
|
-
it "should generate PNG images for jlatexmath blocks when format is set to 'png'" do
|
611
|
-
doc = <<-eos
|
612
|
-
= Hello, PlantUML!
|
613
|
-
Doc Writer <doc@example.com>
|
614
|
-
|
615
|
-
== First Section
|
616
|
-
|
617
|
-
[plantuml,format="png"]
|
618
|
-
----
|
619
|
-
@startlatex
|
620
|
-
e^{i\\pi} + 1 = 0
|
621
|
-
@endlatex
|
622
|
-
----
|
623
|
-
eos
|
624
|
-
|
625
|
-
d = load_asciidoc doc
|
626
|
-
expect(d).to_not be_nil
|
627
|
-
|
628
|
-
b = d.find { |bl| bl.context == :image }
|
629
|
-
expect(b).to_not be_nil
|
630
|
-
|
631
|
-
expect(b.content_model).to eq :empty
|
632
|
-
|
633
|
-
target = b.attributes['target']
|
634
|
-
expect(target).to_not be_nil
|
635
|
-
expect(target).to match(/\.png$/)
|
636
|
-
expect(File.exist?(target)).to be true
|
637
|
-
|
638
|
-
expect(b.attributes['width']).to_not be_nil
|
639
|
-
expect(b.attributes['height']).to_not be_nil
|
640
|
-
end
|
641
|
-
|
642
|
-
it "should generate SVG images for jlatexmath blocks when format is set to 'svg'" do
|
643
|
-
doc = <<-eos
|
644
|
-
= Hello, PlantUML!
|
645
|
-
Doc Writer <doc@example.com>
|
646
|
-
|
647
|
-
== First Section
|
648
|
-
|
649
|
-
[plantuml,format="svg"]
|
650
|
-
----
|
651
|
-
@startlatex
|
652
|
-
e^{i\\pi} + 1 = 0
|
653
|
-
@endlatex
|
654
|
-
----
|
655
|
-
eos
|
656
|
-
|
657
|
-
d = load_asciidoc doc
|
658
|
-
expect(d).to_not be_nil
|
659
|
-
|
660
|
-
b = d.find { |bl| bl.context == :image }
|
661
|
-
expect(b).to_not be_nil
|
662
|
-
|
663
|
-
expect(b.content_model).to eq :empty
|
664
|
-
|
665
|
-
target = b.attributes['target']
|
666
|
-
expect(target).to_not be_nil
|
667
|
-
expect(target).to match(/\.svg$/)
|
668
|
-
expect(File.exist?(target)).to be true
|
669
|
-
end
|
670
|
-
|
671
|
-
it "should generate PNG images for diagrams with latex tags when format is set to 'png'" do
|
672
|
-
doc = <<-eos
|
673
|
-
= Hello, PlantUML!
|
674
|
-
Doc Writer <doc@example.com>
|
675
|
-
|
676
|
-
== First Section
|
677
|
-
|
678
|
-
[plantuml,format="png"]
|
679
|
-
----
|
680
|
-
:<latex>P(y|\\mathbf{x}) \\mbox{ or } f(\\mathbf{x})+\\epsilon</latex>;
|
681
|
-
----
|
682
|
-
eos
|
683
|
-
|
684
|
-
d = load_asciidoc doc
|
685
|
-
expect(d).to_not be_nil
|
686
|
-
|
687
|
-
b = d.find { |bl| bl.context == :image }
|
688
|
-
expect(b).to_not be_nil
|
689
|
-
|
690
|
-
expect(b.content_model).to eq :empty
|
691
|
-
|
692
|
-
target = b.attributes['target']
|
693
|
-
expect(target).to_not be_nil
|
694
|
-
expect(target).to match(/\.png$/)
|
695
|
-
expect(File.exist?(target)).to be true
|
696
|
-
|
697
|
-
expect(b.attributes['width']).to_not be_nil
|
698
|
-
expect(b.attributes['height']).to_not be_nil
|
699
|
-
end
|
700
|
-
|
701
|
-
it "should generate SVG images for diagrams with latex tags when format is set to 'svg'" do
|
702
|
-
doc = <<-eos
|
703
|
-
= Hello, PlantUML!
|
704
|
-
Doc Writer <doc@example.com>
|
705
|
-
|
706
|
-
== First Section
|
707
|
-
|
708
|
-
[plantuml,format="svg"]
|
709
|
-
----
|
710
|
-
:<latex>P(y|\\mathbf{x}) \\mbox{ or } f(\\mathbf{x})+\\epsilon</latex>;
|
711
|
-
----
|
712
|
-
eos
|
713
|
-
|
714
|
-
d = load_asciidoc doc
|
715
|
-
expect(d).to_not be_nil
|
716
|
-
|
717
|
-
b = d.find { |bl| bl.context == :image }
|
718
|
-
expect(b).to_not be_nil
|
719
|
-
|
720
|
-
expect(b.content_model).to eq :empty
|
721
|
-
|
722
|
-
target = b.attributes['target']
|
723
|
-
expect(target).to_not be_nil
|
724
|
-
expect(target).to match(/\.svg$/)
|
725
|
-
expect(File.exist?(target)).to be true
|
726
|
-
|
727
|
-
expect(b.attributes['width']).to_not be_nil
|
728
|
-
expect(b.attributes['height']).to_not be_nil
|
729
|
-
end
|
730
|
-
|
731
|
-
it "should report syntax errors" do
|
732
|
-
doc = <<-eos
|
733
|
-
= Hello, PlantUML!
|
734
|
-
Doc Writer <doc@example.com>
|
735
|
-
|
736
|
-
== First Section
|
737
|
-
|
738
|
-
[plantuml,format="svg"]
|
739
|
-
----
|
740
|
-
Bob; Alice; foo
|
741
|
-
----
|
742
|
-
eos
|
743
|
-
|
744
|
-
expect {
|
745
|
-
load_asciidoc doc
|
746
|
-
}.to raise_error(/syntax error/i)
|
747
|
-
end
|
748
|
-
|
749
|
-
it "should support complex preprocessor usage" do
|
750
|
-
doc = <<-eos
|
751
|
-
= Hello, PlantUML!
|
752
|
-
Doc Writer <doc@example.com>
|
753
|
-
|
754
|
-
== First Section
|
755
|
-
|
756
|
-
[plantuml,format="png"]
|
757
|
-
----
|
758
|
-
@startuml
|
759
|
-
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml
|
760
|
-
|
761
|
-
!define DEVICONS https://raw.githubusercontent.com/tupadr3/plantuml-icon-font-sprites/master/devicons
|
762
|
-
!define FONTAWESOME https://raw.githubusercontent.com/tupadr3/plantuml-icon-font-sprites/master/font-awesome-5
|
763
|
-
!include DEVICONS/angular.puml
|
764
|
-
!include DEVICONS/java.puml
|
765
|
-
!include DEVICONS/msql_server.puml
|
766
|
-
!include FONTAWESOME/users.puml
|
767
|
-
|
768
|
-
LAYOUT_WITH_LEGEND()
|
769
|
-
|
770
|
-
Person(user, "Customer", "People that need products", "users")
|
771
|
-
Container(spa, "SPA", "angular", "The main interface that the customer interacts with", "angular")
|
772
|
-
Container(api, "API", "java", "Handles all business logic", "java")
|
773
|
-
ContainerDb(db, "Database", "Microsoft SQL", "Holds product, order and invoice information", "msql_server")
|
774
|
-
|
775
|
-
!$protocol ?= "https"
|
776
|
-
|
777
|
-
Rel(user, spa, "Uses", $protocol)
|
778
|
-
Rel(spa, api, "Uses", "https")
|
779
|
-
Rel_R(api, db, "Reads/Writes")
|
780
|
-
@enduml
|
781
|
-
----
|
782
|
-
eos
|
783
|
-
|
784
|
-
d = load_asciidoc doc
|
785
|
-
expect(d).to_not be_nil
|
786
|
-
|
787
|
-
b = d.find { |bl| bl.context == :image }
|
788
|
-
expect(b).to_not be_nil
|
789
|
-
|
790
|
-
expect(b.content_model).to eq :empty
|
791
|
-
|
792
|
-
target = b.attributes['target']
|
793
|
-
expect(target).to_not be_nil
|
794
|
-
expect(target).to match(/\.png$/)
|
795
|
-
expect(File.exist?(target)).to be true
|
796
|
-
|
797
|
-
expect(b.attributes['width']).to_not be_nil
|
798
|
-
expect(b.attributes['height']).to_not be_nil
|
799
|
-
end
|
800
|
-
end
|