asciidoctor-diagram 2.2.10 → 2.2.12.next1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.adoc +13 -0
- data/lib/asciidoctor-diagram/diagram_source.rb +2 -2
- 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 +5 -132
- 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/ditaa_spec.rb
DELETED
@@ -1,191 +0,0 @@
|
|
1
|
-
require_relative 'test_helper_methods'
|
2
|
-
|
3
|
-
DITAA_CODE = <<-eos
|
4
|
-
+--------+ +-------+ +-------+
|
5
|
-
| | --+ ditaa +--> | |
|
6
|
-
| Text | +-------+ |diagram|
|
7
|
-
|Document| |!magic!| | |
|
8
|
-
| {d}| | | | |
|
9
|
-
+---+----+ +-------+ +-------+
|
10
|
-
: ^
|
11
|
-
| Lots of work |
|
12
|
-
+-------------------------+
|
13
|
-
eos
|
14
|
-
|
15
|
-
describe Asciidoctor::Diagram::DitaaInlineMacroProcessor do
|
16
|
-
include_examples "inline_macro", :ditaa, DITAA_CODE, [:png, :svg]
|
17
|
-
end
|
18
|
-
|
19
|
-
describe Asciidoctor::Diagram::DitaaBlockMacroProcessor do
|
20
|
-
include_examples "block_macro", :ditaa, DITAA_CODE, [:png, :svg, :txt]
|
21
|
-
end
|
22
|
-
|
23
|
-
describe Asciidoctor::Diagram::DitaaBlockProcessor do
|
24
|
-
include_examples "block", :ditaa, DITAA_CODE, [:png, :svg, :txt]
|
25
|
-
|
26
|
-
it "should support ditaa options as attributes" do
|
27
|
-
doc = <<-eos
|
28
|
-
:ditaa-option-antialias: false
|
29
|
-
:ditaa-option-round-corners: true
|
30
|
-
= Hello, PlantUML!
|
31
|
-
Doc Writer <doc@example.com>
|
32
|
-
|
33
|
-
== First Section
|
34
|
-
|
35
|
-
[ditaa, shadows=false, separation=false, round-corners=false, scale=2.3]
|
36
|
-
----
|
37
|
-
+--------+ +-------+ +-------+
|
38
|
-
| | --+ ditaa +--> | |
|
39
|
-
| Text | +-------+ |diagram|
|
40
|
-
|Document| |!magic!| | |
|
41
|
-
| {d}| | | | |
|
42
|
-
+---+----+ +-------+ +-------+
|
43
|
-
: ^
|
44
|
-
| Lots of work |
|
45
|
-
+-------------------------+
|
46
|
-
----
|
47
|
-
eos
|
48
|
-
|
49
|
-
d = load_asciidoc doc
|
50
|
-
expect(d).to_not be_nil
|
51
|
-
|
52
|
-
b = d.find { |bl| bl.context == :image }
|
53
|
-
expect(b).to_not be_nil
|
54
|
-
target = b.attributes['target']
|
55
|
-
expect(target).to match(/\.png$/)
|
56
|
-
expect(File.exist?(target)).to be true
|
57
|
-
end
|
58
|
-
|
59
|
-
it "should regenerate images when options change" do
|
60
|
-
doc = <<-eos
|
61
|
-
= Hello, PlantUML!
|
62
|
-
Doc Writer <doc@example.com>
|
63
|
-
|
64
|
-
== First Section
|
65
|
-
|
66
|
-
[ditaa, test, png, {opts}]
|
67
|
-
----
|
68
|
-
+--------+ +-------+ +-------+
|
69
|
-
| | --+ ditaa +--> | |
|
70
|
-
| Text | +-------+ |diagram|
|
71
|
-
|Document| |!magic!| | |
|
72
|
-
| {d}| | | | |
|
73
|
-
+---+----+ +-------+ +-------+
|
74
|
-
: ^
|
75
|
-
| Lots of work |
|
76
|
-
+-------------------------+
|
77
|
-
----
|
78
|
-
eos
|
79
|
-
|
80
|
-
d = load_asciidoc(doc.sub('{opts}', 'shadow=false'))
|
81
|
-
b = d.find { |bl| bl.context == :image }
|
82
|
-
target = b.attributes['target']
|
83
|
-
mtime1 = File.mtime(target)
|
84
|
-
|
85
|
-
sleep 1
|
86
|
-
|
87
|
-
d = load_asciidoc(doc.sub('{opts}', 'round-corners=true'))
|
88
|
-
|
89
|
-
mtime2 = File.mtime(target)
|
90
|
-
|
91
|
-
expect(mtime2).to be > mtime1
|
92
|
-
end
|
93
|
-
|
94
|
-
it "should support UTF-8 characters" do
|
95
|
-
doc = <<-eos
|
96
|
-
= Test
|
97
|
-
|
98
|
-
[ditaa]
|
99
|
-
----
|
100
|
-
/-----\\
|
101
|
-
|\u00AB \u2026 \u00BB|
|
102
|
-
\\-----/
|
103
|
-
----
|
104
|
-
eos
|
105
|
-
|
106
|
-
d = load_asciidoc doc
|
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
|
-
expect(b.content_model).to eq :empty
|
113
|
-
|
114
|
-
target = b.attributes['target']
|
115
|
-
expect(target).to_not be_nil
|
116
|
-
expect(target).to match(/\.png$/)
|
117
|
-
expect(File.exist?(target)).to be true
|
118
|
-
|
119
|
-
expect(b.attributes['width']).to_not be_nil
|
120
|
-
expect(b.attributes['height']).to_not be_nil
|
121
|
-
end
|
122
|
-
|
123
|
-
it "should report syntax errors" do
|
124
|
-
doc = <<-eos
|
125
|
-
= Hello, Ditaa!
|
126
|
-
Doc Writer <doc@example.com>
|
127
|
-
|
128
|
-
== First Section
|
129
|
-
|
130
|
-
[ditaa,format="svg"]
|
131
|
-
----
|
132
|
-
This should cause a bug.
|
133
|
-
|
134
|
-
// TODO:
|
135
|
-
// - don't make bugs
|
136
|
-
// - oops I wrote a comment here
|
137
|
-
|
138
|
-
+--------+ +-------+ +-------+
|
139
|
-
| | --+ ditaa +--> | |
|
140
|
-
| Text | +-------+ |diagram|
|
141
|
-
|Document| |!magic!| | |
|
142
|
-
| {d}| | | | |
|
143
|
-
+---+----+ +-------+ +-------+
|
144
|
-
: ^
|
145
|
-
| Lots of work |
|
146
|
-
+-------------------------+
|
147
|
-
----
|
148
|
-
eos
|
149
|
-
|
150
|
-
expect {
|
151
|
-
load_asciidoc doc
|
152
|
-
}.to raise_error(/Ambiguous input/i)
|
153
|
-
end
|
154
|
-
|
155
|
-
it "should support custom bullet characters" do
|
156
|
-
doc = <<-eos
|
157
|
-
= Hello, Ditaa!
|
158
|
-
Doc Writer <doc@example.com>
|
159
|
-
|
160
|
-
== First Section
|
161
|
-
|
162
|
-
[ditaa,format="svg",bullet-characters=x]
|
163
|
-
----
|
164
|
-
+-----------------+
|
165
|
-
| o Things to do |
|
166
|
-
| cGRE |
|
167
|
-
| x Cut the grass |
|
168
|
-
| x Buy jam |
|
169
|
-
| x Fix car |
|
170
|
-
| x Make website |
|
171
|
-
+-----------------+
|
172
|
-
----
|
173
|
-
eos
|
174
|
-
|
175
|
-
d = load_asciidoc doc
|
176
|
-
expect(d).to_not be_nil
|
177
|
-
|
178
|
-
b = d.find { |bl| bl.context == :image }
|
179
|
-
expect(b).to_not be_nil
|
180
|
-
|
181
|
-
expect(b.content_model).to eq :empty
|
182
|
-
|
183
|
-
target = b.attributes['target']
|
184
|
-
expect(target).to_not be_nil
|
185
|
-
expect(target).to match(/\.svg$/)
|
186
|
-
expect(File.exist?(target)).to be true
|
187
|
-
|
188
|
-
expect(b.attributes['width']).to_not be_nil
|
189
|
-
expect(b.attributes['height']).to_not be_nil
|
190
|
-
end
|
191
|
-
end
|
data/spec/dpic_spec.rb
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
require_relative 'test_helper_methods'
|
2
|
-
|
3
|
-
DPIC_CODE = <<-eos
|
4
|
-
arrow "$u$" above
|
5
|
-
S: circle rad 10/72.27 # 10 pt
|
6
|
-
line right 0.35
|
7
|
-
G: box "$G(s)$"
|
8
|
-
arrow "$y$" above
|
9
|
-
line -> down G.ht from last arrow then left last arrow.c.x-S.x then to S.s
|
10
|
-
"$-\;$" below rjust
|
11
|
-
eos
|
12
|
-
|
13
|
-
describe Asciidoctor::Diagram::DpicInlineMacroProcessor, :broken_on_windows do
|
14
|
-
include_examples "inline_macro", :dpic, DPIC_CODE, [:svg]
|
15
|
-
end
|
16
|
-
|
17
|
-
describe Asciidoctor::Diagram::DpicBlockMacroProcessor, :broken_on_windows do
|
18
|
-
include_examples "block_macro", :dpic, DPIC_CODE, [:svg]
|
19
|
-
end
|
20
|
-
|
21
|
-
describe Asciidoctor::Diagram::DpicBlockProcessor, :broken_on_windows do
|
22
|
-
include_examples "block", :dpic, DPIC_CODE, [:svg]
|
23
|
-
end
|
data/spec/erd_spec.rb
DELETED
@@ -1,96 +0,0 @@
|
|
1
|
-
require_relative 'test_helper_methods'
|
2
|
-
|
3
|
-
ERD_CODE = <<-eos
|
4
|
-
title {label: "nfldb Entity-Relationship diagram (condensed)", size: "20"}
|
5
|
-
|
6
|
-
# Entities
|
7
|
-
|
8
|
-
[player] {bgcolor: "#d0e0d0"}
|
9
|
-
*player_id {label: "varchar, not null"}
|
10
|
-
full_name {label: "varchar, null"}
|
11
|
-
team {label: "varchar, not null"}
|
12
|
-
position {label: "player_pos, not null"}
|
13
|
-
status {label: "player_status, not null"}
|
14
|
-
|
15
|
-
[team] {bgcolor: "#d0e0d0"}
|
16
|
-
*team_id {label: "varchar, not null"}
|
17
|
-
city {label: "varchar, not null"}
|
18
|
-
name {label: "varchar, not null"}
|
19
|
-
|
20
|
-
[game] {bgcolor: "#ececfc"}
|
21
|
-
*gsis_id {label: "gameid, not null"}
|
22
|
-
start_time {label: "utctime, not null"}
|
23
|
-
week {label: "usmallint, not null"}
|
24
|
-
season_year {label: "usmallint, not null"}
|
25
|
-
season_type {label: "season_phase, not null"}
|
26
|
-
finished {label: "boolean, not null"}
|
27
|
-
home_team {label: "varchar, not null"}
|
28
|
-
home_score {label: "usmallint, not null"}
|
29
|
-
away_team {label: "varchar, not null"}
|
30
|
-
away_score {label: "usmallint, not null"}
|
31
|
-
|
32
|
-
[drive] {bgcolor: "#ececfc"}
|
33
|
-
*+gsis_id {label: "gameid, not null"}
|
34
|
-
*drive_id {label: "usmallint, not null"}
|
35
|
-
start_field {label: "field_pos, null"}
|
36
|
-
start_time {label: "game_time, not null"}
|
37
|
-
end_field {label: "field_pos, null"}
|
38
|
-
end_time {label: "game_time, not null"}
|
39
|
-
pos_team {label: "varchar, not null"}
|
40
|
-
pos_time {label: "pos_period, null"}
|
41
|
-
|
42
|
-
[play] {bgcolor: "#ececfc"}
|
43
|
-
*+gsis_id {label: "gameid, not null"}
|
44
|
-
*+drive_id {label: "usmallint, not null"}
|
45
|
-
*play_id {label: "usmallint, not null"}
|
46
|
-
time {label: "game_time, not null"}
|
47
|
-
pos_team {label: "varchar, not null"}
|
48
|
-
yardline {label: "field_pos, null"}
|
49
|
-
down {label: "smallint, null"}
|
50
|
-
yards_to_go {label: "smallint, null"}
|
51
|
-
|
52
|
-
[play_player] {bgcolor: "#ececfc"}
|
53
|
-
*+gsis_id {label: "gameid, not null"}
|
54
|
-
*+drive_id {label: "usmallint, not null"}
|
55
|
-
*+play_id {label: "usmallint, not null"}
|
56
|
-
*+player_id {label: "varchar, not null"}
|
57
|
-
team {label: "varchar, not null"}
|
58
|
-
|
59
|
-
[meta] {bgcolor: "#fcecec"}
|
60
|
-
version {label: "smallint, null"}
|
61
|
-
season_type {label: "season_phase, null"}
|
62
|
-
season_year {label: "usmallint, null"}
|
63
|
-
week {label: "usmallint, null"}
|
64
|
-
|
65
|
-
# Relationships
|
66
|
-
|
67
|
-
player *--1 team
|
68
|
-
game *--1 team {label: "home"}
|
69
|
-
game *--1 team {label: "away"}
|
70
|
-
drive *--1 team
|
71
|
-
play *--1 team
|
72
|
-
play_player *--1 team
|
73
|
-
|
74
|
-
game 1--* drive
|
75
|
-
game 1--* play
|
76
|
-
game 1--* play_player
|
77
|
-
|
78
|
-
drive 1--* play
|
79
|
-
drive 1--* play_player
|
80
|
-
|
81
|
-
play 1--* play_player
|
82
|
-
|
83
|
-
player 1--* play_player
|
84
|
-
eos
|
85
|
-
|
86
|
-
describe Asciidoctor::Diagram::ErdInlineMacroProcessor, :broken_on_windows do
|
87
|
-
include_examples "inline_macro", :erd, ERD_CODE, [:png, :svg]
|
88
|
-
end
|
89
|
-
|
90
|
-
describe Asciidoctor::Diagram::ErdBlockMacroProcessor, :broken_on_windows do
|
91
|
-
include_examples "block_macro", :erd, ERD_CODE, [:png, :svg]
|
92
|
-
end
|
93
|
-
|
94
|
-
describe Asciidoctor::Diagram::ErdBlockProcessor, :broken_on_windows do
|
95
|
-
include_examples "block", :erd, ERD_CODE, [:png, :svg]
|
96
|
-
end
|
data/spec/gnuplot_spec.rb
DELETED
@@ -1,229 +0,0 @@
|
|
1
|
-
require_relative 'test_helper_methods'
|
2
|
-
|
3
|
-
GNUPLOT_CODE = <<-eos
|
4
|
-
plot [0:5][0:20] x**2 title 'O(n^2)'
|
5
|
-
eos
|
6
|
-
|
7
|
-
describe Asciidoctor::Diagram::GnuplotInlineMacroProcessor do
|
8
|
-
include_examples "inline_macro", :gnuplot, GNUPLOT_CODE, [:png, :svg, :gif]
|
9
|
-
end
|
10
|
-
|
11
|
-
describe Asciidoctor::Diagram::GnuplotBlockMacroProcessor do
|
12
|
-
include_examples "block_macro", :gnuplot, GNUPLOT_CODE, [:png, :svg, :gif, :txt]
|
13
|
-
end
|
14
|
-
|
15
|
-
describe Asciidoctor::Diagram::GnuplotBlockProcessor do
|
16
|
-
include_examples "block", :gnuplot, GNUPLOT_CODE, [:png, :svg, :gif, :txt]
|
17
|
-
|
18
|
-
it "should generate images with user defined size" do
|
19
|
-
doc = <<-eos
|
20
|
-
= Hello, Gnuplot!
|
21
|
-
Doc Writer <doc@example.com>
|
22
|
-
|
23
|
-
== First Section
|
24
|
-
|
25
|
-
[gnuplot, format="png",width="800", height="600"]
|
26
|
-
----
|
27
|
-
#{GNUPLOT_CODE}
|
28
|
-
----
|
29
|
-
eos
|
30
|
-
|
31
|
-
d = load_asciidoc doc
|
32
|
-
expect(d).to_not be_nil
|
33
|
-
|
34
|
-
b = d.find { |bl| bl.context == :image }
|
35
|
-
expect(b).to_not be_nil
|
36
|
-
|
37
|
-
expect(b.content_model).to eq :empty
|
38
|
-
|
39
|
-
target = b.attributes['target']
|
40
|
-
expect(target).to_not be_nil
|
41
|
-
expect(target).to match(/\.png$/)
|
42
|
-
expect(File.exist?(target)).to be true
|
43
|
-
|
44
|
-
expect(b.attributes['width']).to_not be_nil
|
45
|
-
expect(b.attributes['height']).to_not be_nil
|
46
|
-
end
|
47
|
-
|
48
|
-
it "should generate nocrop/notrasparent images" do
|
49
|
-
doc = <<-eos
|
50
|
-
= Hello, Gnuplot!
|
51
|
-
Doc Writer <doc@example.com>
|
52
|
-
|
53
|
-
== First Section
|
54
|
-
|
55
|
-
[gnuplot, format="png", crop=false, transparent=false]
|
56
|
-
----
|
57
|
-
#{GNUPLOT_CODE}
|
58
|
-
----
|
59
|
-
eos
|
60
|
-
|
61
|
-
d = load_asciidoc doc
|
62
|
-
expect(d).to_not be_nil
|
63
|
-
|
64
|
-
b = d.find { |bl| bl.context == :image }
|
65
|
-
expect(b).to_not be_nil
|
66
|
-
|
67
|
-
expect(b.content_model).to eq :empty
|
68
|
-
|
69
|
-
target = b.attributes['target']
|
70
|
-
expect(target).to_not be_nil
|
71
|
-
expect(target).to match(/\.png$/)
|
72
|
-
expect(File.exist?(target)).to be true
|
73
|
-
|
74
|
-
expect(b.attributes['width']).to_not be_nil
|
75
|
-
expect(b.attributes['height']).to_not be_nil
|
76
|
-
end
|
77
|
-
|
78
|
-
it "should generate crop/trasparent images" do
|
79
|
-
doc = <<-eos
|
80
|
-
= Hello, Gnuplot!
|
81
|
-
Doc Writer <doc@example.com>
|
82
|
-
|
83
|
-
== First Section
|
84
|
-
|
85
|
-
[gnuplot, format="png", crop=true, transparent=true]
|
86
|
-
----
|
87
|
-
#{GNUPLOT_CODE}
|
88
|
-
----
|
89
|
-
eos
|
90
|
-
|
91
|
-
d = load_asciidoc doc
|
92
|
-
expect(d).to_not be_nil
|
93
|
-
|
94
|
-
b = d.find { |bl| bl.context == :image }
|
95
|
-
expect(b).to_not be_nil
|
96
|
-
|
97
|
-
expect(b.content_model).to eq :empty
|
98
|
-
|
99
|
-
target = b.attributes['target']
|
100
|
-
expect(target).to_not be_nil
|
101
|
-
expect(target).to match(/\.png$/)
|
102
|
-
expect(File.exist?(target)).to be true
|
103
|
-
|
104
|
-
expect(b.attributes['width']).to_not be_nil
|
105
|
-
expect(b.attributes['height']).to_not be_nil
|
106
|
-
end
|
107
|
-
|
108
|
-
it "should generate image with font name" do
|
109
|
-
doc = <<-eos
|
110
|
-
= Hello, Gnuplot!
|
111
|
-
Doc Writer <doc@example.com>
|
112
|
-
|
113
|
-
== First Section
|
114
|
-
|
115
|
-
[gnuplot, format="png", font="Arial"]
|
116
|
-
----
|
117
|
-
#{GNUPLOT_CODE}
|
118
|
-
----
|
119
|
-
eos
|
120
|
-
|
121
|
-
d = load_asciidoc doc
|
122
|
-
expect(d).to_not be_nil
|
123
|
-
|
124
|
-
b = d.find { |bl| bl.context == :image }
|
125
|
-
expect(b).to_not be_nil
|
126
|
-
|
127
|
-
expect(b.content_model).to eq :empty
|
128
|
-
|
129
|
-
target = b.attributes['target']
|
130
|
-
expect(target).to_not be_nil
|
131
|
-
expect(target).to match(/\.png$/)
|
132
|
-
expect(File.exist?(target)).to be true
|
133
|
-
|
134
|
-
expect(b.attributes['width']).to_not be_nil
|
135
|
-
expect(b.attributes['height']).to_not be_nil
|
136
|
-
end
|
137
|
-
|
138
|
-
it "should generate image with font name and size" do
|
139
|
-
doc = <<-eos
|
140
|
-
= Hello, Gnuplot!
|
141
|
-
Doc Writer <doc@example.com>
|
142
|
-
|
143
|
-
== First Section
|
144
|
-
|
145
|
-
[gnuplot, format="png", font="Arial,11"]
|
146
|
-
----
|
147
|
-
#{GNUPLOT_CODE}
|
148
|
-
----
|
149
|
-
eos
|
150
|
-
|
151
|
-
d = load_asciidoc doc
|
152
|
-
expect(d).to_not be_nil
|
153
|
-
|
154
|
-
b = d.find { |bl| bl.context == :image }
|
155
|
-
expect(b).to_not be_nil
|
156
|
-
|
157
|
-
expect(b.content_model).to eq :empty
|
158
|
-
|
159
|
-
target = b.attributes['target']
|
160
|
-
expect(target).to_not be_nil
|
161
|
-
expect(target).to match(/\.png$/)
|
162
|
-
expect(File.exist?(target)).to be true
|
163
|
-
|
164
|
-
expect(b.attributes['width']).to_not be_nil
|
165
|
-
expect(b.attributes['height']).to_not be_nil
|
166
|
-
end
|
167
|
-
|
168
|
-
it "should generate image with font name and scale" do
|
169
|
-
doc = <<-eos
|
170
|
-
= Hello, Gnuplot!
|
171
|
-
Doc Writer <doc@example.com>
|
172
|
-
|
173
|
-
== First Section
|
174
|
-
|
175
|
-
[gnuplot, format="png", font="Arial", scale="0.5"]
|
176
|
-
----
|
177
|
-
#{GNUPLOT_CODE}
|
178
|
-
----
|
179
|
-
eos
|
180
|
-
|
181
|
-
d = load_asciidoc doc
|
182
|
-
expect(d).to_not be_nil
|
183
|
-
|
184
|
-
b = d.find { |bl| bl.context == :image }
|
185
|
-
expect(b).to_not be_nil
|
186
|
-
|
187
|
-
expect(b.content_model).to eq :empty
|
188
|
-
|
189
|
-
target = b.attributes['target']
|
190
|
-
expect(target).to_not be_nil
|
191
|
-
expect(target).to match(/\.png$/)
|
192
|
-
expect(File.exist?(target)).to be true
|
193
|
-
|
194
|
-
expect(b.attributes['width']).to_not be_nil
|
195
|
-
expect(b.attributes['height']).to_not be_nil
|
196
|
-
end
|
197
|
-
|
198
|
-
it %(should generate image with font background="red") do
|
199
|
-
doc = <<-eos
|
200
|
-
= Hello, Gnuplot!
|
201
|
-
Doc Writer <doc@example.com>
|
202
|
-
|
203
|
-
== First Section
|
204
|
-
|
205
|
-
[gnuplot, format="png", background="red"]
|
206
|
-
----
|
207
|
-
#{GNUPLOT_CODE}
|
208
|
-
----
|
209
|
-
eos
|
210
|
-
|
211
|
-
d = load_asciidoc doc
|
212
|
-
expect(d).to_not be_nil
|
213
|
-
|
214
|
-
b = d.find { |bl| bl.context == :image }
|
215
|
-
expect(b).to_not be_nil
|
216
|
-
|
217
|
-
expect(b.content_model).to eq :empty
|
218
|
-
|
219
|
-
target = b.attributes['target']
|
220
|
-
expect(target).to_not be_nil
|
221
|
-
expect(target).to match(/\.png$/)
|
222
|
-
expect(File.exist?(target)).to be true
|
223
|
-
|
224
|
-
expect(b.attributes['width']).to_not be_nil
|
225
|
-
expect(b.attributes['height']).to_not be_nil
|
226
|
-
end
|
227
|
-
|
228
|
-
|
229
|
-
end
|
data/spec/graphviz_py_spec.rb
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
require_relative 'test_helper_methods'
|
2
|
-
|
3
|
-
GRAPHVIZ_PY_CODE = <<-eos
|
4
|
-
graph python_graph {
|
5
|
-
{{
|
6
|
-
import math
|
7
|
-
|
8
|
-
value = 0.5
|
9
|
-
sin = math.sin(value)
|
10
|
-
cos = math.cos(value)
|
11
|
-
}}
|
12
|
-
|
13
|
-
A [label="{{= value }}"];
|
14
|
-
B [label="{{= sin }}"];
|
15
|
-
C [label="{{= cos }}"];
|
16
|
-
|
17
|
-
A -- B [headlabel="sin"];
|
18
|
-
A -- C [headlabel="cos"];
|
19
|
-
|
20
|
-
}
|
21
|
-
eos
|
22
|
-
|
23
|
-
describe Asciidoctor::Diagram::GraphvizPyInlineMacroProcessor, :broken_on_github do
|
24
|
-
include_examples "inline_macro", :graphviz_py, GRAPHVIZ_PY_CODE, [:png, :svg]
|
25
|
-
end
|
26
|
-
|
27
|
-
describe Asciidoctor::Diagram::GraphvizPyBlockMacroProcessor, :broken_on_github do
|
28
|
-
include_examples "block_macro", :graphviz_py, GRAPHVIZ_PY_CODE, [:png, :svg]
|
29
|
-
end
|
30
|
-
|
31
|
-
describe Asciidoctor::Diagram::GraphvizPyBlockProcessor, :broken_on_github do
|
32
|
-
include_examples "block", :graphviz_py, GRAPHVIZ_PY_CODE, [:png, :svg]
|
33
|
-
end
|
data/spec/graphviz_spec.rb
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
require_relative 'test_helper_methods'
|
2
|
-
|
3
|
-
DOT_CODE = <<-eos
|
4
|
-
digraph foo {
|
5
|
-
node [style=rounded]
|
6
|
-
node1 [shape=box]
|
7
|
-
node2 [fillcolor=yellow, style="rounded,filled", shape=diamond]
|
8
|
-
node3 [shape=record, label=" a b c"]
|
9
|
-
|
10
|
-
node1 -> node2 -> node3
|
11
|
-
}
|
12
|
-
eos
|
13
|
-
|
14
|
-
describe Asciidoctor::Diagram::GraphvizInlineMacroProcessor do
|
15
|
-
include_examples "inline_macro", :graphviz, DOT_CODE, [:png, :svg]
|
16
|
-
end
|
17
|
-
|
18
|
-
describe Asciidoctor::Diagram::GraphvizBlockMacroProcessor do
|
19
|
-
include_examples "block_macro", :graphviz, DOT_CODE, [:png, :svg]
|
20
|
-
end
|
21
|
-
|
22
|
-
describe Asciidoctor::Diagram::GraphvizBlockProcessor do
|
23
|
-
include_examples "block", :graphviz, DOT_CODE, [:png, :svg]
|
24
|
-
end
|
data/spec/lilypond_spec.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
require_relative 'test_helper_methods'
|
2
|
-
|
3
|
-
LILYPOND_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::LilypondInlineMacroProcessor, :broken_on_windows do
|
8
|
-
include_examples "inline_macro", :lilypond, LILYPOND_CODE, [:png]
|
9
|
-
end
|
10
|
-
|
11
|
-
describe Asciidoctor::Diagram::LilypondBlockMacroProcessor, :broken_on_windows do
|
12
|
-
include_examples "block_macro", :lilypond, LILYPOND_CODE, [:png]
|
13
|
-
end
|
14
|
-
|
15
|
-
describe Asciidoctor::Diagram::LilypondBlockProcessor, :broken_on_windows do
|
16
|
-
include_examples "block", :lilypond, LILYPOND_CODE, [:png]
|
17
|
-
end
|
data/spec/man.jpg
DELETED
Binary file
|
data/spec/meme_spec.rb
DELETED
@@ -1,67 +0,0 @@
|
|
1
|
-
require_relative 'test_helper_methods'
|
2
|
-
|
3
|
-
describe Asciidoctor::Diagram::MemeBlockMacroProcessor do
|
4
|
-
it "should generate PNG images when format is set to 'png'" do
|
5
|
-
FileUtils.cp(
|
6
|
-
File.expand_path('man.jpg', File.dirname(__FILE__)),
|
7
|
-
File.expand_path('man.jpg', Dir.getwd)
|
8
|
-
)
|
9
|
-
|
10
|
-
doc = <<-eos
|
11
|
-
= Hello, PlantUML!
|
12
|
-
Doc Writer <doc@example.com>
|
13
|
-
|
14
|
-
== First Section
|
15
|
-
|
16
|
-
meme::man.jpg[I don't always // write unit tests, but when I do // they generate memes, format=png, options=noupcase]
|
17
|
-
eos
|
18
|
-
|
19
|
-
d = load_asciidoc doc
|
20
|
-
expect(d).to_not be_nil
|
21
|
-
|
22
|
-
b = d.find { |bl| bl.context == :image }
|
23
|
-
expect(b).to_not be_nil
|
24
|
-
|
25
|
-
expect(b.content_model).to eq :empty
|
26
|
-
|
27
|
-
target = b.attributes['target']
|
28
|
-
expect(target).to_not be_nil
|
29
|
-
expect(target).to match(/\.png$/)
|
30
|
-
expect(File.exist?(target)).to be true
|
31
|
-
|
32
|
-
expect(b.attributes['width']).to_not be_nil
|
33
|
-
expect(b.attributes['height']).to_not be_nil
|
34
|
-
end
|
35
|
-
|
36
|
-
it "should generate GIF images when format is set to 'gif'" do
|
37
|
-
FileUtils.cp(
|
38
|
-
File.expand_path('man.jpg', File.dirname(__FILE__)),
|
39
|
-
File.expand_path('man.jpg', Dir.getwd)
|
40
|
-
)
|
41
|
-
|
42
|
-
doc = <<-eos
|
43
|
-
= Hello, PlantUML!
|
44
|
-
Doc Writer <doc@example.com>
|
45
|
-
|
46
|
-
== First Section
|
47
|
-
|
48
|
-
meme::man.jpg[I don't always // write unit tests, but when I do // they generate memes, format=gif, options=noupcase]
|
49
|
-
eos
|
50
|
-
|
51
|
-
d = load_asciidoc doc
|
52
|
-
expect(d).to_not be_nil
|
53
|
-
|
54
|
-
b = d.find { |bl| bl.context == :image }
|
55
|
-
expect(b).to_not be_nil
|
56
|
-
|
57
|
-
expect(b.content_model).to eq :empty
|
58
|
-
|
59
|
-
target = b.attributes['target']
|
60
|
-
expect(target).to_not be_nil
|
61
|
-
expect(target).to match(/\.gif/)
|
62
|
-
expect(File.exist?(target)).to be true
|
63
|
-
|
64
|
-
expect(b.attributes['width']).to_not be_nil
|
65
|
-
expect(b.attributes['height']).to_not be_nil
|
66
|
-
end
|
67
|
-
end
|