asciidoctor-diagram 2.1.2 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.adoc +12 -0
- data/docs/antora.yml +1 -1
- data/docs/modules/ROOT/pages/index.adoc +1 -1
- data/docs/modules/ROOT/partials/advanced.adoc +49 -6
- data/docs/modules/ROOT/partials/create_diagram.adoc +45 -43
- data/docs/modules/ROOT/partials/uris.adoc +3 -2
- data/lib/asciidoctor-diagram.rb +1 -0
- data/lib/asciidoctor-diagram/a2s.rb +1 -0
- data/lib/asciidoctor-diagram/a2s/extension.rb +4 -0
- data/lib/asciidoctor-diagram/barcode.rb +11 -0
- data/lib/asciidoctor-diagram/barcode/converter.rb +157 -0
- data/lib/asciidoctor-diagram/barcode/dependencies.rb +10 -0
- data/lib/asciidoctor-diagram/barcode/extension.rb +47 -0
- data/lib/asciidoctor-diagram/barcode/svg_outputter.rb +12 -0
- data/lib/asciidoctor-diagram/blockdiag.rb +1 -0
- data/lib/asciidoctor-diagram/blockdiag/extension.rb +5 -0
- data/lib/asciidoctor-diagram/bpmn.rb +1 -0
- data/lib/asciidoctor-diagram/bpmn/extension.rb +4 -0
- data/lib/asciidoctor-diagram/bytefield.rb +1 -0
- data/lib/asciidoctor-diagram/bytefield/extension.rb +4 -0
- data/lib/asciidoctor-diagram/diagram_processor.rb +52 -4
- data/lib/asciidoctor-diagram/diagram_source.rb +16 -0
- data/lib/asciidoctor-diagram/diagrams.rb +1 -0
- data/lib/asciidoctor-diagram/diagrams/extension.rb +4 -0
- data/lib/asciidoctor-diagram/ditaa.rb +1 -0
- data/lib/asciidoctor-diagram/ditaa/extension.rb +4 -0
- data/lib/asciidoctor-diagram/dpic.rb +1 -0
- data/lib/asciidoctor-diagram/dpic/extension.rb +4 -0
- data/lib/asciidoctor-diagram/erd.rb +1 -0
- data/lib/asciidoctor-diagram/erd/extension.rb +4 -0
- data/lib/asciidoctor-diagram/gnuplot.rb +1 -0
- data/lib/asciidoctor-diagram/gnuplot/extension.rb +4 -0
- data/lib/asciidoctor-diagram/graphviz.rb +1 -0
- data/lib/asciidoctor-diagram/graphviz/extension.rb +4 -0
- data/lib/asciidoctor-diagram/lilypond.rb +1 -0
- data/lib/asciidoctor-diagram/lilypond/extension.rb +4 -0
- data/lib/asciidoctor-diagram/meme.rb +1 -0
- data/lib/asciidoctor-diagram/meme/extension.rb +14 -16
- data/lib/asciidoctor-diagram/mermaid.rb +1 -0
- data/lib/asciidoctor-diagram/mermaid/extension.rb +4 -0
- data/lib/asciidoctor-diagram/msc.rb +1 -0
- data/lib/asciidoctor-diagram/msc/extension.rb +4 -0
- data/lib/asciidoctor-diagram/nomnoml.rb +1 -0
- data/lib/asciidoctor-diagram/nomnoml/extension.rb +4 -0
- data/lib/asciidoctor-diagram/pikchr.rb +1 -0
- data/lib/asciidoctor-diagram/pikchr/extension.rb +4 -0
- data/lib/asciidoctor-diagram/plantuml.rb +1 -0
- data/lib/asciidoctor-diagram/plantuml/extension.rb +8 -0
- data/lib/asciidoctor-diagram/salt.rb +1 -0
- data/lib/asciidoctor-diagram/shaape.rb +1 -0
- data/lib/asciidoctor-diagram/shaape/extension.rb +4 -0
- data/lib/asciidoctor-diagram/smcat.rb +1 -0
- data/lib/asciidoctor-diagram/smcat/extension.rb +4 -0
- data/lib/asciidoctor-diagram/svgbob.rb +1 -0
- data/lib/asciidoctor-diagram/svgbob/extension.rb +4 -0
- data/lib/asciidoctor-diagram/symbolator.rb +1 -0
- data/lib/asciidoctor-diagram/symbolator/extension.rb +4 -0
- data/lib/asciidoctor-diagram/syntrax.rb +1 -0
- data/lib/asciidoctor-diagram/syntrax/converter.rb +1 -1
- data/lib/asciidoctor-diagram/syntrax/extension.rb +4 -0
- data/lib/asciidoctor-diagram/tikz.rb +1 -0
- data/lib/asciidoctor-diagram/tikz/extension.rb +4 -0
- data/lib/asciidoctor-diagram/umlet.rb +1 -0
- data/lib/asciidoctor-diagram/umlet/extension.rb +4 -0
- data/lib/asciidoctor-diagram/vega.rb +2 -0
- data/lib/asciidoctor-diagram/vega/extension.rb +4 -0
- data/lib/asciidoctor-diagram/version.rb +1 -1
- data/lib/asciidoctor-diagram/wavedrom.rb +1 -0
- data/lib/asciidoctor-diagram/wavedrom/extension.rb +4 -0
- data/spec/a2s_spec.rb +4 -0
- data/spec/barcode_spec.rb +176 -0
- data/spec/blockdiag_spec.rb +4 -0
- data/spec/bpmn_spec.rb +4 -0
- data/spec/bytefield_spec.rb +4 -0
- data/spec/diagrams_spec.rb +4 -0
- data/spec/ditaa_spec.rb +4 -0
- data/spec/dpic_spec.rb +4 -0
- data/spec/erd_spec.rb +4 -0
- data/spec/gnuplot_spec.rb +4 -0
- data/spec/graphviz_spec.rb +4 -0
- data/spec/lilypond_spec.rb +4 -0
- data/spec/mermaid_spec.rb +4 -0
- data/spec/msc_spec.rb +4 -0
- data/spec/nomnoml_spec.rb +4 -0
- data/spec/pikchr_spec.rb +4 -0
- data/spec/plantuml_spec.rb +30 -1
- data/spec/shaape_spec.rb +4 -0
- data/spec/shared_examples.rb +161 -0
- data/spec/smcat_spec.rb +4 -0
- data/spec/svgbob_spec.rb +4 -0
- data/spec/symbolator_spec.rb +4 -0
- data/spec/syntrax_spec.rb +4 -0
- data/spec/test_helper.rb +3 -1
- data/spec/tikz_spec.rb +4 -0
- data/spec/umlet_spec.rb +3 -0
- data/spec/vega_spec.rb +5 -0
- data/spec/wavedrom_spec.rb +4 -0
- metadata +10 -3
data/spec/blockdiag_spec.rb
CHANGED
@@ -7,6 +7,10 @@ blockdiag {
|
|
7
7
|
}
|
8
8
|
eos
|
9
9
|
|
10
|
+
describe Asciidoctor::Diagram::BlockDiagInlineMacroProcessor do
|
11
|
+
include_examples "inline_macro", :blockdiag, BLOCKDIAG_CODE, [:png, :svg, :pdf]
|
12
|
+
end
|
13
|
+
|
10
14
|
describe Asciidoctor::Diagram::BlockDiagBlockMacroProcessor do
|
11
15
|
include_examples "block_macro", :blockdiag, BLOCKDIAG_CODE, [:png, :svg, :pdf]
|
12
16
|
end
|
data/spec/bpmn_spec.rb
CHANGED
@@ -47,6 +47,10 @@ BPNM_CODE = <<EOF
|
|
47
47
|
</bpmn:definitions>
|
48
48
|
EOF
|
49
49
|
|
50
|
+
describe Asciidoctor::Diagram::BpmnInlineMacroProcessor do
|
51
|
+
include_examples "inline_macro", :bpmn, BPNM_CODE, [:png, :svg, :pdf]
|
52
|
+
end
|
53
|
+
|
50
54
|
describe Asciidoctor::Diagram::BpmnBlockMacroProcessor do
|
51
55
|
include_examples "block_macro", :bpmn, BPNM_CODE, [:png, :svg, :pdf]
|
52
56
|
end
|
data/spec/bytefield_spec.rb
CHANGED
@@ -83,6 +83,10 @@ BYTEFIELD_CODE = <<-eos
|
|
83
83
|
(draw-bottom)
|
84
84
|
eos
|
85
85
|
|
86
|
+
describe Asciidoctor::Diagram::BytefieldInlineMacroProcessor do
|
87
|
+
include_examples "inline_macro", :bytefield, BYTEFIELD_CODE, [:svg]
|
88
|
+
end
|
89
|
+
|
86
90
|
describe Asciidoctor::Diagram::BytefieldBlockMacroProcessor do
|
87
91
|
include_examples "block_macro", :bytefield, BYTEFIELD_CODE, [:svg]
|
88
92
|
end
|
data/spec/diagrams_spec.rb
CHANGED
@@ -14,6 +14,10 @@ with Diagram("Grouped Workers", show=False, direction="TB"):
|
|
14
14
|
EC2("worker5")] >> RDS("events")
|
15
15
|
eos
|
16
16
|
|
17
|
+
describe Asciidoctor::Diagram::DiagramsInlineMacroProcessor do
|
18
|
+
include_examples "inline_macro", :diagrams, DIAGRAMS_CODE, [:png, :svg]
|
19
|
+
end
|
20
|
+
|
17
21
|
describe Asciidoctor::Diagram::DiagramsBlockMacroProcessor do
|
18
22
|
include_examples "block_macro", :diagrams, DIAGRAMS_CODE, [:png, :svg]
|
19
23
|
end
|
data/spec/ditaa_spec.rb
CHANGED
@@ -12,6 +12,10 @@ DITAA_CODE = <<-eos
|
|
12
12
|
+-------------------------+
|
13
13
|
eos
|
14
14
|
|
15
|
+
describe Asciidoctor::Diagram::DitaaInlineMacroProcessor do
|
16
|
+
include_examples "inline_macro", :ditaa, DITAA_CODE, [:png, :svg]
|
17
|
+
end
|
18
|
+
|
15
19
|
describe Asciidoctor::Diagram::DitaaBlockMacroProcessor do
|
16
20
|
include_examples "block_macro", :ditaa, DITAA_CODE, [:png, :svg]
|
17
21
|
end
|
data/spec/dpic_spec.rb
CHANGED
@@ -10,6 +10,10 @@ G: box "$G(s)$"
|
|
10
10
|
"$-\;$" below rjust
|
11
11
|
eos
|
12
12
|
|
13
|
+
describe Asciidoctor::Diagram::DpicInlineMacroProcessor, :broken_on_windows do
|
14
|
+
include_examples "inline_macro", :dpic, DPIC_CODE, [:svg]
|
15
|
+
end
|
16
|
+
|
13
17
|
describe Asciidoctor::Diagram::DpicBlockMacroProcessor, :broken_on_windows do
|
14
18
|
include_examples "block_macro", :dpic, DPIC_CODE, [:svg]
|
15
19
|
end
|
data/spec/erd_spec.rb
CHANGED
@@ -83,6 +83,10 @@ play 1--* play_player
|
|
83
83
|
player 1--* play_player
|
84
84
|
eos
|
85
85
|
|
86
|
+
describe Asciidoctor::Diagram::ErdInlineMacroProcessor, :broken_on_windows do
|
87
|
+
include_examples "inline_macro", :erd, ERD_CODE, [:png, :svg]
|
88
|
+
end
|
89
|
+
|
86
90
|
describe Asciidoctor::Diagram::ErdBlockMacroProcessor, :broken_on_windows do
|
87
91
|
include_examples "block_macro", :erd, ERD_CODE, [:png, :svg]
|
88
92
|
end
|
data/spec/gnuplot_spec.rb
CHANGED
@@ -4,6 +4,10 @@ GNUPLOT_CODE = <<-eos
|
|
4
4
|
plot [0:5][0:20] x**2 title 'O(n^2)'
|
5
5
|
eos
|
6
6
|
|
7
|
+
describe Asciidoctor::Diagram::GnuplotInlineMacroProcessor do
|
8
|
+
include_examples "inline_macro", :gnuplot, GNUPLOT_CODE, [:png, :svg, :gif]
|
9
|
+
end
|
10
|
+
|
7
11
|
describe Asciidoctor::Diagram::GnuplotBlockMacroProcessor do
|
8
12
|
include_examples "block_macro", :gnuplot, GNUPLOT_CODE, [:png, :svg, :gif, :txt]
|
9
13
|
end
|
data/spec/graphviz_spec.rb
CHANGED
@@ -11,6 +11,10 @@ digraph foo {
|
|
11
11
|
}
|
12
12
|
eos
|
13
13
|
|
14
|
+
describe Asciidoctor::Diagram::GraphvizInlineMacroProcessor do
|
15
|
+
include_examples "inline_macro", :graphviz, DOT_CODE, [:png, :svg]
|
16
|
+
end
|
17
|
+
|
14
18
|
describe Asciidoctor::Diagram::GraphvizBlockMacroProcessor do
|
15
19
|
include_examples "block_macro", :graphviz, DOT_CODE, [:png, :svg]
|
16
20
|
end
|
data/spec/lilypond_spec.rb
CHANGED
@@ -4,6 +4,10 @@ LILYPOND_CODE = <<-eos
|
|
4
4
|
\\relative c' { f d f a d f e d cis a cis e a g f e }
|
5
5
|
eos
|
6
6
|
|
7
|
+
describe Asciidoctor::Diagram::LilypondInlineMacroProcessor do
|
8
|
+
include_examples "inline_macro", :lilypond, LILYPOND_CODE, [:png]
|
9
|
+
end
|
10
|
+
|
7
11
|
describe Asciidoctor::Diagram::LilypondBlockMacroProcessor do
|
8
12
|
include_examples "block_macro", :lilypond, LILYPOND_CODE, [:png]
|
9
13
|
end
|
data/spec/mermaid_spec.rb
CHANGED
@@ -8,6 +8,10 @@ graph LR
|
|
8
8
|
C --> D
|
9
9
|
eos
|
10
10
|
|
11
|
+
describe Asciidoctor::Diagram::MermaidInlineMacroProcessor do
|
12
|
+
include_examples "inline_macro", :mermaid, MERMAID_CODE, [:png, :svg]
|
13
|
+
end
|
14
|
+
|
11
15
|
describe Asciidoctor::Diagram::MermaidBlockMacroProcessor do
|
12
16
|
include_examples "block_macro", :mermaid, MERMAID_CODE, [:png, :svg]
|
13
17
|
|
data/spec/msc_spec.rb
CHANGED
@@ -24,6 +24,10 @@ msc {
|
|
24
24
|
}
|
25
25
|
eos
|
26
26
|
|
27
|
+
describe Asciidoctor::Diagram::MscInlineMacroProcessor do
|
28
|
+
include_examples "inline_macro", :msc, MSC_CODE, [:png, :svg]
|
29
|
+
end
|
30
|
+
|
27
31
|
describe Asciidoctor::Diagram::MscBlockMacroProcessor do
|
28
32
|
include_examples "block_macro", :msc, MSC_CODE, [:png, :svg]
|
29
33
|
end
|
data/spec/nomnoml_spec.rb
CHANGED
@@ -23,6 +23,10 @@ NOMNOML_CODE = <<-eos
|
|
23
23
|
[<actor>Sailor] - [<usecase>shiver me;timbers]
|
24
24
|
eos
|
25
25
|
|
26
|
+
describe Asciidoctor::Diagram::NomnomlInlineMacroProcessor do
|
27
|
+
include_examples "inline_macro", :nomnoml, NOMNOML_CODE, [:svg]
|
28
|
+
end
|
29
|
+
|
26
30
|
describe Asciidoctor::Diagram::NomnomlBlockMacroProcessor do
|
27
31
|
include_examples "block_macro", :nomnoml, NOMNOML_CODE, [:svg]
|
28
32
|
end
|
data/spec/pikchr_spec.rb
CHANGED
@@ -42,6 +42,10 @@ arrow dashed from last circle.w to 5/8<last circle.w,2nd last box> chop
|
|
42
42
|
box invis wid 2*boxwid "ndtable:" with .e at Start.w
|
43
43
|
eos
|
44
44
|
|
45
|
+
describe Asciidoctor::Diagram::PikchrInlineMacroProcessor, :broken_on_windows do
|
46
|
+
include_examples "inline_macro", :pikchr, PIKCHR_CODE, [:svg]
|
47
|
+
end
|
48
|
+
|
45
49
|
describe Asciidoctor::Diagram::PikchrBlockMacroProcessor, :broken_on_windows do
|
46
50
|
include_examples "block_macro", :pikchr, PIKCHR_CODE, [:svg]
|
47
51
|
end
|
data/spec/plantuml_spec.rb
CHANGED
@@ -7,6 +7,10 @@ User --> (Use the application) : Label
|
|
7
7
|
:Main Admin: ---> (Use the application) : Another label
|
8
8
|
eos
|
9
9
|
|
10
|
+
describe Asciidoctor::Diagram::PlantUmlInlineMacroProcessor do
|
11
|
+
include_examples "inline_macro", :plantuml, PLANTUML_CODE, [:png, :svg]
|
12
|
+
end
|
13
|
+
|
10
14
|
describe Asciidoctor::Diagram::PlantUmlBlockMacroProcessor do
|
11
15
|
include_examples "block_macro", :plantuml, PLANTUML_CODE, [:png, :svg, :txt]
|
12
16
|
|
@@ -190,6 +194,29 @@ Doc Writer <doc@example.com>
|
|
190
194
|
expect(b.attributes['height']).to_not be_nil
|
191
195
|
end
|
192
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
|
+
|
193
220
|
it 'should use plantuml configuration when specified as a document attribute' do
|
194
221
|
doc = <<-eos
|
195
222
|
= Hello, PlantUML!
|
@@ -650,7 +677,9 @@ Container(spa, "SPA", "angular", "The main interface that the customer interacts
|
|
650
677
|
Container(api, "API", "java", "Handles all business logic", "java")
|
651
678
|
ContainerDb(db, "Database", "Microsoft SQL", "Holds product, order and invoice information", "msql_server")
|
652
679
|
|
653
|
-
|
680
|
+
!$protocol ?= "https"
|
681
|
+
|
682
|
+
Rel(user, spa, "Uses", $protocol)
|
654
683
|
Rel(spa, api, "Uses", "https")
|
655
684
|
Rel_R(api, db, "Reads/Writes")
|
656
685
|
@enduml
|
data/spec/shaape_spec.rb
CHANGED
@@ -7,6 +7,10 @@ SHAAPE_CODE = <<-eos
|
|
7
7
|
\/
|
8
8
|
eos
|
9
9
|
|
10
|
+
describe Asciidoctor::Diagram::ShaapeInlineMacroProcessor, :broken_on_osx, :broken_on_github, :broken_on_windows do
|
11
|
+
include_examples "inline_macro", :shaape, SHAAPE_CODE, [:png, :svg]
|
12
|
+
end
|
13
|
+
|
10
14
|
describe Asciidoctor::Diagram::ShaapeBlockMacroProcessor, :broken_on_osx, :broken_on_github, :broken_on_windows do
|
11
15
|
include_examples "block_macro", :shaape, SHAAPE_CODE, [:png, :svg]
|
12
16
|
end
|
data/spec/shared_examples.rb
CHANGED
@@ -195,6 +195,167 @@ Doc Writer <doc@example.com>
|
|
195
195
|
end
|
196
196
|
end
|
197
197
|
|
198
|
+
RSpec.shared_examples "inline_macro" do |name, code, formats|
|
199
|
+
formats.each do |format|
|
200
|
+
it "#{name} should generate image tags when format is set to '#{format}'" do
|
201
|
+
File.write("#{name}.txt", code)
|
202
|
+
|
203
|
+
doc = <<-eos
|
204
|
+
= Hello, #{name}!
|
205
|
+
Doc Writer <doc@example.com>
|
206
|
+
|
207
|
+
== First Section
|
208
|
+
|
209
|
+
#{name}:#{name}.txt[#{format}]
|
210
|
+
eos
|
211
|
+
|
212
|
+
d = load_asciidoc doc
|
213
|
+
expect(d).to_not be_nil
|
214
|
+
|
215
|
+
b = d.find { |bl| bl.context == :paragraph }
|
216
|
+
expect(b).to_not be_nil
|
217
|
+
|
218
|
+
output = b.convert
|
219
|
+
img_match = /<img[^>]*>/.match(output)
|
220
|
+
expect(img_match).to_not be_nil
|
221
|
+
img = img_match.to_s
|
222
|
+
|
223
|
+
src_match = /src="([^"]*)"/.match(img)
|
224
|
+
expect(src_match).to_not be_nil
|
225
|
+
src = src_match[1]
|
226
|
+
|
227
|
+
expect(src).to_not be_nil
|
228
|
+
expect(src).to match(/\.#{format}$/)
|
229
|
+
expect(File.exist?(src)).to be true
|
230
|
+
|
231
|
+
unless format == :pdf
|
232
|
+
expect(/width="([^"]*)"/.match(img)).to_not be_nil
|
233
|
+
expect(/height="([^"]*)"/.match(img)).to_not be_nil
|
234
|
+
end
|
235
|
+
end
|
236
|
+
end
|
237
|
+
|
238
|
+
it 'should support substitutions in the target attribute' do
|
239
|
+
File.write("#{name}.txt", code)
|
240
|
+
|
241
|
+
doc = <<-eos
|
242
|
+
= Hello, #{name}!
|
243
|
+
Doc Writer <doc@example.com>
|
244
|
+
:file: #{name}
|
245
|
+
|
246
|
+
== First Section
|
247
|
+
|
248
|
+
#{name}:{file}.txt[subs=attributes+]
|
249
|
+
eos
|
250
|
+
|
251
|
+
d = load_asciidoc doc, :attributes => {'backend' => 'html5'}
|
252
|
+
expect(d).to_not be_nil
|
253
|
+
|
254
|
+
b = d.find { |bl| bl.context == :paragraph }
|
255
|
+
expect(b).to_not be_nil
|
256
|
+
|
257
|
+
output = b.convert
|
258
|
+
img_match = /<img[^>]*>/.match(output)
|
259
|
+
expect(img_match).to_not be_nil
|
260
|
+
img = img_match.to_s
|
261
|
+
|
262
|
+
src_match = /src="([^"]*)"/.match(img)
|
263
|
+
expect(src_match).to_not be_nil
|
264
|
+
src = src_match[1]
|
265
|
+
|
266
|
+
expect(src).to_not be_nil
|
267
|
+
expect(src).to match(/\.#{formats[0]}$/)
|
268
|
+
expect(File.exist?(src)).to be true
|
269
|
+
end
|
270
|
+
|
271
|
+
it 'should support substitutions in the format attribute' do
|
272
|
+
File.write("#{name}.txt", code)
|
273
|
+
|
274
|
+
doc = <<-eos
|
275
|
+
= Hello, #{name}!
|
276
|
+
Doc Writer <doc@example.com>
|
277
|
+
:file: #{name}
|
278
|
+
:outputformat: #{formats[0]}
|
279
|
+
|
280
|
+
== First Section
|
281
|
+
|
282
|
+
#{name}:{file}.txt[format="{outputformat}", subs=attributes+]
|
283
|
+
eos
|
284
|
+
|
285
|
+
d = load_asciidoc doc, :attributes => {'backend' => 'html5'}
|
286
|
+
expect(d).to_not be_nil
|
287
|
+
|
288
|
+
b = d.find { |bl| bl.context == :paragraph }
|
289
|
+
expect(b).to_not be_nil
|
290
|
+
|
291
|
+
output = b.convert
|
292
|
+
img_match = /<img[^>]*>/.match(output)
|
293
|
+
expect(img_match).to_not be_nil
|
294
|
+
img = img_match.to_s
|
295
|
+
|
296
|
+
src_match = /src="([^"]*)"/.match(img)
|
297
|
+
expect(src_match).to_not be_nil
|
298
|
+
src = src_match[1]
|
299
|
+
|
300
|
+
expect(src).to_not be_nil
|
301
|
+
expect(src).to match(/\.#{formats[0]}$/)
|
302
|
+
expect(File.exist?(src)).to be true
|
303
|
+
|
304
|
+
unless formats[0] == :pdf
|
305
|
+
expect(/width="([^"]*)"/.match(img)).to_not be_nil
|
306
|
+
expect(/height="([^"]*)"/.match(img)).to_not be_nil
|
307
|
+
end
|
308
|
+
end
|
309
|
+
|
310
|
+
it 'should respect target attribute in inline macros' do
|
311
|
+
File.write("#{name}.txt", code)
|
312
|
+
|
313
|
+
doc = <<-eos
|
314
|
+
= Hello, #{name}!
|
315
|
+
Doc Writer <doc@example.com>
|
316
|
+
|
317
|
+
== First Section
|
318
|
+
|
319
|
+
#{name}:#{name}.txt[target="foobar"]
|
320
|
+
#{name}:#{name}.txt[target="foobaz"]
|
321
|
+
eos
|
322
|
+
|
323
|
+
d = load_asciidoc doc
|
324
|
+
|
325
|
+
b = d.find { |bl| bl.context == :paragraph }
|
326
|
+
expect(b).to_not be_nil
|
327
|
+
b.convert
|
328
|
+
|
329
|
+
expect(File.exist?("foobar.#{formats[0]}")).to be true
|
330
|
+
expect(File.exist?("foobaz.#{formats[0]}")).to be true
|
331
|
+
expect(File.exist?("#{name}.#{formats[0]}")).to be false
|
332
|
+
end
|
333
|
+
|
334
|
+
it 'should respect target attribute values with relative paths in inline macros' do
|
335
|
+
File.write("#{name}.txt", code)
|
336
|
+
|
337
|
+
doc = <<-eos
|
338
|
+
= Hello, #{name}!
|
339
|
+
Doc Writer <doc@example.com>
|
340
|
+
|
341
|
+
== First Section
|
342
|
+
|
343
|
+
#{name}:#{name}.txt[target="test/foobar"]
|
344
|
+
#{name}:#{name}.txt[target="test2/foobaz"]
|
345
|
+
eos
|
346
|
+
|
347
|
+
d = load_asciidoc doc
|
348
|
+
|
349
|
+
b = d.find { |bl| bl.context == :paragraph }
|
350
|
+
expect(b).to_not be_nil
|
351
|
+
b.convert
|
352
|
+
|
353
|
+
expect(File.exist?("test/foobar.#{formats[0]}")).to be true
|
354
|
+
expect(File.exist?("test2/foobaz.#{formats[0]}")).to be true
|
355
|
+
expect(File.exist?("#{name}.#{formats[0]}")).to be false
|
356
|
+
end
|
357
|
+
end
|
358
|
+
|
198
359
|
RSpec.shared_examples "block" do |name, code, formats|
|
199
360
|
formats.each do |format|
|
200
361
|
if format == :txt
|
data/spec/smcat_spec.rb
CHANGED
@@ -17,6 +17,10 @@ testing => "on backlog" : test not ok;
|
|
17
17
|
testing => final : test ok;
|
18
18
|
eos
|
19
19
|
|
20
|
+
describe Asciidoctor::Diagram::SmcatInlineMacroProcessor do
|
21
|
+
include_examples "inline_macro", :smcat, SMCAT_CODE, [:svg]
|
22
|
+
end
|
23
|
+
|
20
24
|
describe Asciidoctor::Diagram::SmcatBlockMacroProcessor do
|
21
25
|
include_examples "block_macro", :smcat, SMCAT_CODE, [:svg]
|
22
26
|
end
|
data/spec/svgbob_spec.rb
CHANGED
@@ -20,6 +20,10 @@ SVGBOB_CODE = <<-eos
|
|
20
20
|
'---------------------------------------'
|
21
21
|
eos
|
22
22
|
|
23
|
+
describe Asciidoctor::Diagram::SvgBobInlineMacroProcessor do
|
24
|
+
include_examples "inline_macro", :svgbob, SVGBOB_CODE, [:svg]
|
25
|
+
end
|
26
|
+
|
23
27
|
describe Asciidoctor::Diagram::SvgBobBlockMacroProcessor do
|
24
28
|
include_examples "block_macro", :svgbob, SVGBOB_CODE, [:svg]
|
25
29
|
end
|
data/spec/symbolator_spec.rb
CHANGED
@@ -14,6 +14,10 @@ package demo is
|
|
14
14
|
end package;
|
15
15
|
eos
|
16
16
|
|
17
|
+
describe Asciidoctor::Diagram::SymbolatorInlineMacroProcessor, :broken_on_windows do
|
18
|
+
include_examples "inline_macro", :symbolator, SYMBOLATOR_CODE, [:png, :svg, :pdf]
|
19
|
+
end
|
20
|
+
|
17
21
|
describe Asciidoctor::Diagram::SymbolatorBlockMacroProcessor, :broken_on_windows do
|
18
22
|
include_examples "block_macro", :symbolator, SYMBOLATOR_CODE, [:png, :svg, :pdf]
|
19
23
|
end
|
data/spec/syntrax_spec.rb
CHANGED
@@ -9,6 +9,10 @@ indentstack(10,
|
|
9
9
|
)
|
10
10
|
eos
|
11
11
|
|
12
|
+
describe Asciidoctor::Diagram::SyntraxInlineMacroProcessor, :broken_on_windows do
|
13
|
+
include_examples "inline_macro", :syntrax, SYNTRAX_CODE, [:png, :svg]
|
14
|
+
end
|
15
|
+
|
12
16
|
describe Asciidoctor::Diagram::SyntraxBlockMacroProcessor, :broken_on_windows do
|
13
17
|
include_examples "block_macro", :syntrax, SYNTRAX_CODE, [:png, :svg]
|
14
18
|
end
|