asciidoctor-diagram 1.5.18 → 1.5.19
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.adoc +18 -0
- data/README.adoc +34 -5
- data/lib/asciidoctor-diagram.rb +3 -0
- data/lib/asciidoctor-diagram/ditaa/extension.rb +1 -1
- data/lib/asciidoctor-diagram/gnuplot.rb +7 -0
- data/lib/asciidoctor-diagram/gnuplot/extension.rb +70 -0
- data/lib/asciidoctor-diagram/lilypond.rb +7 -0
- data/lib/asciidoctor-diagram/lilypond/extension.rb +61 -0
- data/lib/asciidoctor-diagram/smcat.rb +7 -0
- data/lib/asciidoctor-diagram/smcat/extension.rb +50 -0
- data/lib/asciidoctor-diagram/tikz/extension.rb +2 -2
- data/lib/asciidoctor-diagram/version.rb +1 -1
- data/lib/asciidoctor-diagram/wavedrom/extension.rb +20 -12
- data/lib/ditaamini-0.12.jar +0 -0
- data/spec/gnuplot_spec.rb +478 -0
- data/spec/lilypond_spec.rb +151 -0
- data/spec/smcat_spec.rb +164 -0
- data/spec/test_helper.rb +3 -0
- metadata +18 -6
- data/lib/ditaamini-0.11.jar +0 -0
@@ -0,0 +1,151 @@
|
|
1
|
+
require_relative 'test_helper'
|
2
|
+
|
3
|
+
code = <<-eos
|
4
|
+
\\relative c' { f d f a d f e d cis a cis e a g f e }
|
5
|
+
eos
|
6
|
+
|
7
|
+
describe Asciidoctor::Diagram::LilypondBlockMacroProcessor, :broken_on_windows do
|
8
|
+
it "should generate PNG images when format is set to 'png'" do
|
9
|
+
File.write('lilypond.txt', code)
|
10
|
+
|
11
|
+
doc = <<-eos
|
12
|
+
= Hello, Lilypond!
|
13
|
+
Doc Writer <doc@example.com>
|
14
|
+
|
15
|
+
== First Section
|
16
|
+
|
17
|
+
lilypond::lilypond.txt[format="png"]
|
18
|
+
eos
|
19
|
+
|
20
|
+
d = load_asciidoc doc
|
21
|
+
expect(d).to_not be_nil
|
22
|
+
|
23
|
+
b = d.find { |bl| bl.context == :image }
|
24
|
+
expect(b).to_not be_nil
|
25
|
+
|
26
|
+
expect(b.content_model).to eq :empty
|
27
|
+
|
28
|
+
target = b.attributes['target']
|
29
|
+
expect(target).to_not be_nil
|
30
|
+
expect(target).to match(/\.png/)
|
31
|
+
expect(File.exist?(target)).to be true
|
32
|
+
|
33
|
+
expect(b.attributes['width']).to_not be_nil
|
34
|
+
expect(b.attributes['height']).to_not be_nil
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
describe Asciidoctor::Diagram::LilypondBlockProcessor, :broken_on_windows do
|
39
|
+
it "should generate PNG images when format is set to 'png'" do
|
40
|
+
doc = <<-eos
|
41
|
+
= Hello, Lilypond!
|
42
|
+
Doc Writer <doc@example.com>
|
43
|
+
|
44
|
+
== First Section
|
45
|
+
|
46
|
+
[lilypond, format="png"]
|
47
|
+
----
|
48
|
+
#{code}
|
49
|
+
----
|
50
|
+
eos
|
51
|
+
|
52
|
+
d = load_asciidoc doc
|
53
|
+
expect(d).to_not be_nil
|
54
|
+
|
55
|
+
b = d.find { |bl| bl.context == :image }
|
56
|
+
expect(b).to_not be_nil
|
57
|
+
|
58
|
+
expect(b.content_model).to eq :empty
|
59
|
+
|
60
|
+
target = b.attributes['target']
|
61
|
+
expect(target).to_not be_nil
|
62
|
+
expect(target).to match(/\.png/)
|
63
|
+
expect(File.exist?(target)).to be true
|
64
|
+
|
65
|
+
expect(b.attributes['width']).to_not be_nil
|
66
|
+
expect(b.attributes['height']).to_not be_nil
|
67
|
+
end
|
68
|
+
|
69
|
+
it "should raise an error when when format is set to an invalid value" do
|
70
|
+
doc = <<-eos
|
71
|
+
= Hello, Lilypond!
|
72
|
+
Doc Writer <doc@example.com>
|
73
|
+
|
74
|
+
== First Section
|
75
|
+
|
76
|
+
[lilypond, format="foobar"]
|
77
|
+
----
|
78
|
+
----
|
79
|
+
eos
|
80
|
+
|
81
|
+
expect { load_asciidoc doc }.to raise_error(/support.*format/i)
|
82
|
+
end
|
83
|
+
|
84
|
+
it "should not regenerate images when source has not changed" do
|
85
|
+
File.write('lilypond.txt', code)
|
86
|
+
|
87
|
+
doc = <<-eos
|
88
|
+
= Hello, Lilypond!
|
89
|
+
Doc Writer <doc@example.com>
|
90
|
+
|
91
|
+
== First Section
|
92
|
+
|
93
|
+
lilypond::lilypond.txt
|
94
|
+
|
95
|
+
[lilypond, format="png"]
|
96
|
+
----
|
97
|
+
#{code}
|
98
|
+
----
|
99
|
+
eos
|
100
|
+
|
101
|
+
d = load_asciidoc doc
|
102
|
+
b = d.find { |bl| bl.context == :image }
|
103
|
+
expect(b).to_not be_nil
|
104
|
+
target = b.attributes['target']
|
105
|
+
mtime1 = File.mtime(target)
|
106
|
+
|
107
|
+
sleep 1
|
108
|
+
|
109
|
+
d = load_asciidoc doc
|
110
|
+
|
111
|
+
mtime2 = File.mtime(target)
|
112
|
+
|
113
|
+
expect(mtime2).to eq mtime1
|
114
|
+
end
|
115
|
+
|
116
|
+
it "should handle two block macros with the same source" do
|
117
|
+
File.write('lilypond.txt', code)
|
118
|
+
|
119
|
+
doc = <<-eos
|
120
|
+
= Hello, Lilypond!
|
121
|
+
Doc Writer <doc@example.com>
|
122
|
+
|
123
|
+
== First Section
|
124
|
+
|
125
|
+
lilypond::lilypond.txt[]
|
126
|
+
lilypond::lilypond.txt[]
|
127
|
+
eos
|
128
|
+
|
129
|
+
load_asciidoc doc
|
130
|
+
expect(File.exist?('lilypond.png')).to be true
|
131
|
+
end
|
132
|
+
|
133
|
+
it "should respect target attribute in block macros" do
|
134
|
+
File.write('lilypond.txt', code)
|
135
|
+
|
136
|
+
doc = <<-eos
|
137
|
+
= Hello, Lilypond!
|
138
|
+
Doc Writer <doc@example.com>
|
139
|
+
|
140
|
+
== First Section
|
141
|
+
|
142
|
+
lilypond::lilypond.txt["foobar"]
|
143
|
+
lilypond::lilypond.txt["foobaz"]
|
144
|
+
eos
|
145
|
+
|
146
|
+
load_asciidoc doc
|
147
|
+
expect(File.exist?('foobar.png')).to be true
|
148
|
+
expect(File.exist?('foobaz.png')).to be true
|
149
|
+
expect(File.exist?('lilypond.png')).to be false
|
150
|
+
end
|
151
|
+
end
|
data/spec/smcat_spec.rb
ADDED
@@ -0,0 +1,164 @@
|
|
1
|
+
require_relative 'test_helper'
|
2
|
+
|
3
|
+
code = <<-eos
|
4
|
+
initial,
|
5
|
+
doing: entry/ write unit test
|
6
|
+
do/ write code
|
7
|
+
exit/ ...,
|
8
|
+
# smcat recognizes initial
|
9
|
+
# and final states by name
|
10
|
+
# and renders them appropriately
|
11
|
+
final;
|
12
|
+
|
13
|
+
initial => "on backlog" : item adds most value;
|
14
|
+
"on backlog" => doing : working on it;
|
15
|
+
doing => testing : built & unit tested;
|
16
|
+
testing => "on backlog" : test not ok;
|
17
|
+
testing => final : test ok;
|
18
|
+
eos
|
19
|
+
|
20
|
+
describe Asciidoctor::Diagram::SmcatBlockMacroProcessor, :broken_on_windows do
|
21
|
+
it "should generate SVG images when format is set to 'svg'" do
|
22
|
+
File.write('smcat.txt', code)
|
23
|
+
|
24
|
+
doc = <<-eos
|
25
|
+
= Hello, Smcat!
|
26
|
+
Doc Writer <doc@example.com>
|
27
|
+
|
28
|
+
== First Section
|
29
|
+
|
30
|
+
smcat::smcat.txt[format="svg"]
|
31
|
+
eos
|
32
|
+
|
33
|
+
d = load_asciidoc doc
|
34
|
+
expect(d).to_not be_nil
|
35
|
+
|
36
|
+
b = d.find { |bl| bl.context == :image }
|
37
|
+
expect(b).to_not be_nil
|
38
|
+
|
39
|
+
expect(b.content_model).to eq :empty
|
40
|
+
|
41
|
+
target = b.attributes['target']
|
42
|
+
expect(target).to_not be_nil
|
43
|
+
expect(target).to match(/\.svg/)
|
44
|
+
expect(File.exist?(target)).to be true
|
45
|
+
|
46
|
+
expect(b.attributes['width']).to_not be_nil
|
47
|
+
expect(b.attributes['height']).to_not be_nil
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
describe Asciidoctor::Diagram::SmcatBlockProcessor, :broken_on_windows do
|
52
|
+
it "should generate SVG images when format is set to 'svg'" do
|
53
|
+
doc = <<-eos
|
54
|
+
= Hello, Smcat!
|
55
|
+
Doc Writer <doc@example.com>
|
56
|
+
|
57
|
+
== First Section
|
58
|
+
|
59
|
+
[smcat, format="svg"]
|
60
|
+
----
|
61
|
+
#{code}
|
62
|
+
----
|
63
|
+
eos
|
64
|
+
|
65
|
+
d = load_asciidoc doc
|
66
|
+
expect(d).to_not be_nil
|
67
|
+
|
68
|
+
b = d.find { |bl| bl.context == :image }
|
69
|
+
expect(b).to_not be_nil
|
70
|
+
|
71
|
+
expect(b.content_model).to eq :empty
|
72
|
+
|
73
|
+
target = b.attributes['target']
|
74
|
+
expect(target).to_not be_nil
|
75
|
+
expect(target).to match(/\.svg/)
|
76
|
+
expect(File.exist?(target)).to be true
|
77
|
+
|
78
|
+
expect(b.attributes['width']).to_not be_nil
|
79
|
+
expect(b.attributes['height']).to_not be_nil
|
80
|
+
end
|
81
|
+
|
82
|
+
it "should raise an error when when format is set to an invalid value" do
|
83
|
+
doc = <<-eos
|
84
|
+
= Hello, Smcat!
|
85
|
+
Doc Writer <doc@example.com>
|
86
|
+
|
87
|
+
== First Section
|
88
|
+
|
89
|
+
[smcat, format="foobar"]
|
90
|
+
----
|
91
|
+
----
|
92
|
+
eos
|
93
|
+
|
94
|
+
expect { load_asciidoc doc }.to raise_error(/support.*format/i)
|
95
|
+
end
|
96
|
+
|
97
|
+
it "should not regenerate images when source has not changed" do
|
98
|
+
File.write('smcat.txt', code)
|
99
|
+
|
100
|
+
doc = <<-eos
|
101
|
+
= Hello, Smcat!
|
102
|
+
Doc Writer <doc@example.com>
|
103
|
+
|
104
|
+
== First Section
|
105
|
+
|
106
|
+
smcat::smcat.txt
|
107
|
+
|
108
|
+
[smcat, format="svg"]
|
109
|
+
----
|
110
|
+
#{code}
|
111
|
+
----
|
112
|
+
eos
|
113
|
+
|
114
|
+
d = load_asciidoc doc
|
115
|
+
b = d.find { |bl| bl.context == :image }
|
116
|
+
expect(b).to_not be_nil
|
117
|
+
target = b.attributes['target']
|
118
|
+
mtime1 = File.mtime(target)
|
119
|
+
|
120
|
+
sleep 1
|
121
|
+
|
122
|
+
d = load_asciidoc doc
|
123
|
+
|
124
|
+
mtime2 = File.mtime(target)
|
125
|
+
|
126
|
+
expect(mtime2).to eq mtime1
|
127
|
+
end
|
128
|
+
|
129
|
+
it "should handle two block macros with the same source" do
|
130
|
+
File.write('smcat.txt', code)
|
131
|
+
|
132
|
+
doc = <<-eos
|
133
|
+
= Hello, Smcat!
|
134
|
+
Doc Writer <doc@example.com>
|
135
|
+
|
136
|
+
== First Section
|
137
|
+
|
138
|
+
smcat::smcat.txt[]
|
139
|
+
smcat::smcat.txt[]
|
140
|
+
eos
|
141
|
+
|
142
|
+
load_asciidoc doc
|
143
|
+
expect(File.exist?('smcat.svg')).to be true
|
144
|
+
end
|
145
|
+
|
146
|
+
it "should respect target attribute in block macros" do
|
147
|
+
File.write('smcat.txt', code)
|
148
|
+
|
149
|
+
doc = <<-eos
|
150
|
+
= Hello, Smcat!
|
151
|
+
Doc Writer <doc@example.com>
|
152
|
+
|
153
|
+
== First Section
|
154
|
+
|
155
|
+
smcat::smcat.txt["foobar"]
|
156
|
+
smcat::smcat.txt["foobaz"]
|
157
|
+
eos
|
158
|
+
|
159
|
+
load_asciidoc doc
|
160
|
+
expect(File.exist?('foobar.svg')).to be true
|
161
|
+
expect(File.exist?('foobaz.svg')).to be true
|
162
|
+
expect(File.exist?('smcat.svg')).to be false
|
163
|
+
end
|
164
|
+
end
|
data/spec/test_helper.rb
CHANGED
@@ -10,13 +10,16 @@ require_relative '../lib/asciidoctor-diagram/a2s/extension'
|
|
10
10
|
require_relative '../lib/asciidoctor-diagram/blockdiag/extension'
|
11
11
|
require_relative '../lib/asciidoctor-diagram/ditaa/extension'
|
12
12
|
require_relative '../lib/asciidoctor-diagram/erd/extension'
|
13
|
+
require_relative '../lib/asciidoctor-diagram/gnuplot/extension'
|
13
14
|
require_relative '../lib/asciidoctor-diagram/graphviz/extension'
|
15
|
+
require_relative '../lib/asciidoctor-diagram/lilypond/extension'
|
14
16
|
require_relative '../lib/asciidoctor-diagram/meme/extension'
|
15
17
|
require_relative '../lib/asciidoctor-diagram/mermaid/extension'
|
16
18
|
require_relative '../lib/asciidoctor-diagram/msc/extension'
|
17
19
|
require_relative '../lib/asciidoctor-diagram/nomnoml/extension'
|
18
20
|
require_relative '../lib/asciidoctor-diagram/plantuml/extension'
|
19
21
|
require_relative '../lib/asciidoctor-diagram/shaape/extension'
|
22
|
+
require_relative '../lib/asciidoctor-diagram/smcat/extension'
|
20
23
|
require_relative '../lib/asciidoctor-diagram/svgbob/extension'
|
21
24
|
require_relative '../lib/asciidoctor-diagram/syntrax/extension'
|
22
25
|
require_relative '../lib/asciidoctor-diagram/tikz/extension'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: asciidoctor-diagram
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.19
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pepijn Van Eeckhoudt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-10-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -58,7 +58,7 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 1.5.
|
61
|
+
version: 1.5.7
|
62
62
|
- - "<"
|
63
63
|
- !ruby/object:Gem::Version
|
64
64
|
version: 3.x
|
@@ -68,7 +68,7 @@ dependencies:
|
|
68
68
|
requirements:
|
69
69
|
- - ">="
|
70
70
|
- !ruby/object:Gem::Version
|
71
|
-
version: 1.5.
|
71
|
+
version: 1.5.7
|
72
72
|
- - "<"
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: 3.x
|
@@ -100,8 +100,12 @@ files:
|
|
100
100
|
- lib/asciidoctor-diagram/erd.rb
|
101
101
|
- lib/asciidoctor-diagram/erd/extension.rb
|
102
102
|
- lib/asciidoctor-diagram/extensions.rb
|
103
|
+
- lib/asciidoctor-diagram/gnuplot.rb
|
104
|
+
- lib/asciidoctor-diagram/gnuplot/extension.rb
|
103
105
|
- lib/asciidoctor-diagram/graphviz.rb
|
104
106
|
- lib/asciidoctor-diagram/graphviz/extension.rb
|
107
|
+
- lib/asciidoctor-diagram/lilypond.rb
|
108
|
+
- lib/asciidoctor-diagram/lilypond/extension.rb
|
105
109
|
- lib/asciidoctor-diagram/meme.rb
|
106
110
|
- lib/asciidoctor-diagram/meme/extension.rb
|
107
111
|
- lib/asciidoctor-diagram/mermaid.rb
|
@@ -115,6 +119,8 @@ files:
|
|
115
119
|
- lib/asciidoctor-diagram/salt.rb
|
116
120
|
- lib/asciidoctor-diagram/shaape.rb
|
117
121
|
- lib/asciidoctor-diagram/shaape/extension.rb
|
122
|
+
- lib/asciidoctor-diagram/smcat.rb
|
123
|
+
- lib/asciidoctor-diagram/smcat/extension.rb
|
118
124
|
- lib/asciidoctor-diagram/svgbob.rb
|
119
125
|
- lib/asciidoctor-diagram/svgbob/extension.rb
|
120
126
|
- lib/asciidoctor-diagram/syntrax.rb
|
@@ -142,7 +148,7 @@ files:
|
|
142
148
|
- lib/asciidoctor-diagram/wavedrom/extension.rb
|
143
149
|
- lib/batik-all-1.10.jar
|
144
150
|
- lib/ditaa-1.3.13.jar
|
145
|
-
- lib/ditaamini-0.
|
151
|
+
- lib/ditaamini-0.12.jar
|
146
152
|
- lib/jlatexmath-minimal-1.0.5.jar
|
147
153
|
- lib/plantuml-1.3.13.jar
|
148
154
|
- lib/plantuml.jar
|
@@ -151,7 +157,9 @@ files:
|
|
151
157
|
- spec/blockdiag_spec.rb
|
152
158
|
- spec/ditaa_spec.rb
|
153
159
|
- spec/erd_spec.rb
|
160
|
+
- spec/gnuplot_spec.rb
|
154
161
|
- spec/graphviz_spec.rb
|
162
|
+
- spec/lilypond_spec.rb
|
155
163
|
- spec/man.jpg
|
156
164
|
- spec/meme_spec.rb
|
157
165
|
- spec/mermaid_spec.rb
|
@@ -159,6 +167,7 @@ files:
|
|
159
167
|
- spec/nomnoml_spec.rb
|
160
168
|
- spec/plantuml_spec.rb
|
161
169
|
- spec/shaape_spec.rb
|
170
|
+
- spec/smcat_spec.rb
|
162
171
|
- spec/svgbob_spec.rb
|
163
172
|
- spec/syntrax_spec.rb
|
164
173
|
- spec/test_helper.rb
|
@@ -186,7 +195,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
186
195
|
version: '0'
|
187
196
|
requirements: []
|
188
197
|
rubyforge_project:
|
189
|
-
rubygems_version: 2.
|
198
|
+
rubygems_version: 2.5.1
|
190
199
|
signing_key:
|
191
200
|
specification_version: 4
|
192
201
|
summary: An extension for asciidoctor that adds support for UML diagram generation
|
@@ -196,7 +205,9 @@ test_files:
|
|
196
205
|
- spec/blockdiag_spec.rb
|
197
206
|
- spec/ditaa_spec.rb
|
198
207
|
- spec/erd_spec.rb
|
208
|
+
- spec/gnuplot_spec.rb
|
199
209
|
- spec/graphviz_spec.rb
|
210
|
+
- spec/lilypond_spec.rb
|
200
211
|
- spec/man.jpg
|
201
212
|
- spec/meme_spec.rb
|
202
213
|
- spec/mermaid_spec.rb
|
@@ -204,6 +215,7 @@ test_files:
|
|
204
215
|
- spec/nomnoml_spec.rb
|
205
216
|
- spec/plantuml_spec.rb
|
206
217
|
- spec/shaape_spec.rb
|
218
|
+
- spec/smcat_spec.rb
|
207
219
|
- spec/svgbob_spec.rb
|
208
220
|
- spec/syntrax_spec.rb
|
209
221
|
- spec/test_helper.rb
|
data/lib/ditaamini-0.11.jar
DELETED
Binary file
|