asciidoctor-diagram 2.2.11 → 2.2.12.next1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.adoc +7 -0
  3. data/lib/asciidoctor-diagram/plantuml/converter.rb +1 -0
  4. data/lib/asciidoctor-diagram/structurizr/renderers.rb +5 -0
  5. data/lib/asciidoctor-diagram/version.rb +1 -1
  6. metadata +5 -132
  7. data/Rakefile +0 -9
  8. data/docs/antora.yml +0 -5
  9. data/docs/modules/ROOT/images/a2s.svg +0 -44
  10. data/docs/modules/ROOT/images/actdiag.png +0 -0
  11. data/docs/modules/ROOT/images/asciidoctor-diagram-classes.png +0 -0
  12. data/docs/modules/ROOT/images/asciidoctor-diagram-process.png +0 -0
  13. data/docs/modules/ROOT/images/barcode.png +0 -0
  14. data/docs/modules/ROOT/images/barcode2.png +0 -0
  15. data/docs/modules/ROOT/images/blockdiag.png +0 -0
  16. data/docs/modules/ROOT/images/d2.png +0 -0
  17. data/docs/modules/ROOT/images/lilypond.png +0 -0
  18. data/docs/modules/ROOT/images/penrose.png +0 -0
  19. data/docs/modules/ROOT/nav.adoc +0 -41
  20. data/docs/modules/ROOT/pages/blocks.adoc +0 -140
  21. data/docs/modules/ROOT/pages/diagram_types/a2s.adoc +0 -47
  22. data/docs/modules/ROOT/pages/diagram_types/actdiag.adoc +0 -46
  23. data/docs/modules/ROOT/pages/diagram_types/barcode.adoc +0 -72
  24. data/docs/modules/ROOT/pages/diagram_types/blockdiag.adoc +0 -38
  25. data/docs/modules/ROOT/pages/diagram_types/bpmn.adoc +0 -21
  26. data/docs/modules/ROOT/pages/diagram_types/bytefield.adoc +0 -16
  27. data/docs/modules/ROOT/pages/diagram_types/d2.adoc +0 -43
  28. data/docs/modules/ROOT/pages/diagram_types/dbml.adoc +0 -16
  29. data/docs/modules/ROOT/pages/diagram_types/diagrams.adoc +0 -20
  30. data/docs/modules/ROOT/pages/diagram_types/ditaa.adoc +0 -31
  31. data/docs/modules/ROOT/pages/diagram_types/dpic.adoc +0 -16
  32. data/docs/modules/ROOT/pages/diagram_types/erd.adoc +0 -17
  33. data/docs/modules/ROOT/pages/diagram_types/gnuplot.adoc +0 -27
  34. data/docs/modules/ROOT/pages/diagram_types/graphviz.adoc +0 -21
  35. data/docs/modules/ROOT/pages/diagram_types/lilypond.adoc +0 -27
  36. data/docs/modules/ROOT/pages/diagram_types/meme.adoc +0 -34
  37. data/docs/modules/ROOT/pages/diagram_types/mermaid.adoc +0 -28
  38. data/docs/modules/ROOT/pages/diagram_types/msc.adoc +0 -23
  39. data/docs/modules/ROOT/pages/diagram_types/nomnoml.adoc +0 -16
  40. data/docs/modules/ROOT/pages/diagram_types/nwdiag.adoc +0 -22
  41. data/docs/modules/ROOT/pages/diagram_types/penrose.adoc +0 -50
  42. data/docs/modules/ROOT/pages/diagram_types/pikchr.adoc +0 -16
  43. data/docs/modules/ROOT/pages/diagram_types/plantuml.adoc +0 -24
  44. data/docs/modules/ROOT/pages/diagram_types/seqdiag.adoc +0 -18
  45. data/docs/modules/ROOT/pages/diagram_types/shaape.adoc +0 -18
  46. data/docs/modules/ROOT/pages/diagram_types/smcat.adoc +0 -18
  47. data/docs/modules/ROOT/pages/diagram_types/structurizr.adoc +0 -29
  48. data/docs/modules/ROOT/pages/diagram_types/svgbob.adoc +0 -21
  49. data/docs/modules/ROOT/pages/diagram_types/symbolator.adoc +0 -19
  50. data/docs/modules/ROOT/pages/diagram_types/syntrax.adoc +0 -28
  51. data/docs/modules/ROOT/pages/diagram_types/tikz.adoc +0 -21
  52. data/docs/modules/ROOT/pages/diagram_types/umlet.adoc +0 -19
  53. data/docs/modules/ROOT/pages/diagram_types/vega.adoc +0 -28
  54. data/docs/modules/ROOT/pages/diagram_types/wavedrom.adoc +0 -17
  55. data/docs/modules/ROOT/pages/enabling.adoc +0 -25
  56. data/docs/modules/ROOT/pages/generate.adoc +0 -15
  57. data/docs/modules/ROOT/pages/index.adoc +0 -12
  58. data/docs/modules/ROOT/pages/installation.adoc +0 -32
  59. data/docs/modules/ROOT/pages/output.adoc +0 -19
  60. data/docs/modules/ROOT/partials/shared-attrs.adoc +0 -12
  61. data/docs/modules/ROOT/partials/uris.adoc +0 -48
  62. data/examples/Gemfile +0 -3
  63. data/examples/README.adoc +0 -18
  64. data/examples/design.adoc +0 -78
  65. data/examples/features.adoc +0 -189
  66. data/spec/a2s_spec.rb +0 -33
  67. data/spec/barcode_spec.rb +0 -176
  68. data/spec/blockdiag_spec.rb +0 -20
  69. data/spec/bpmn_spec.rb +0 -60
  70. data/spec/bytefield_spec.rb +0 -96
  71. data/spec/d2_spec.rb +0 -87
  72. data/spec/dbml_spec.rb +0 -32
  73. data/spec/diagrams_spec.rb +0 -27
  74. data/spec/ditaa_spec.rb +0 -191
  75. data/spec/dpic_spec.rb +0 -23
  76. data/spec/erd_spec.rb +0 -96
  77. data/spec/gnuplot_spec.rb +0 -229
  78. data/spec/graphviz_py_spec.rb +0 -33
  79. data/spec/graphviz_spec.rb +0 -24
  80. data/spec/lilypond_spec.rb +0 -17
  81. data/spec/man.jpg +0 -0
  82. data/spec/meme_spec.rb +0 -67
  83. data/spec/mermaid_spec.rb +0 -161
  84. data/spec/msc_spec.rb +0 -37
  85. data/spec/nomnoml_spec.rb +0 -36
  86. data/spec/pikchr_spec.rb +0 -73
  87. data/spec/plantuml_spec.rb +0 -800
  88. data/spec/shaape_spec.rb +0 -20
  89. data/spec/shared_examples.rb +0 -766
  90. data/spec/smcat_spec.rb +0 -30
  91. data/spec/structurizr_spec.rb +0 -41
  92. data/spec/svgbob_spec.rb +0 -33
  93. data/spec/symbolator_spec.rb +0 -27
  94. data/spec/syntrax_spec.rb +0 -22
  95. data/spec/test_helper_methods.rb +0 -118
  96. data/spec/tikz_spec.rb +0 -181
  97. data/spec/umlet_spec.rb +0 -32
  98. data/spec/vega_spec.rb +0 -133
  99. data/spec/wavedrom_spec.rb +0 -21
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
@@ -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
@@ -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
@@ -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
data/spec/mermaid_spec.rb DELETED
@@ -1,161 +0,0 @@
1
- require_relative 'test_helper_methods'
2
-
3
- MERMAID_CODE = <<-eos
4
- graph LR
5
- A[Square Rect] -- Link text --> B((Circle))
6
- A --> C(Round Rect)
7
- B --> D{Rhombus}
8
- C --> D
9
- eos
10
-
11
- describe Asciidoctor::Diagram::MermaidInlineMacroProcessor do
12
- include_examples "inline_macro", :mermaid, MERMAID_CODE, [:png, :svg]
13
- end
14
-
15
- describe Asciidoctor::Diagram::MermaidBlockMacroProcessor do
16
- include_examples "block_macro", :mermaid, MERMAID_CODE, [:png, :svg]
17
-
18
- it "should respect the sequenceConfig attribute" do
19
- seq_diag = <<-eos
20
- sequenceDiagram
21
- Alice->>John: Hello John, how are you?
22
- John-->>Alice: Great!
23
- eos
24
-
25
- seq_config = <<-eos
26
- {
27
- "diagramMarginX": 0,
28
- "diagramMarginY": 0,
29
- "actorMargin": 0,
30
- "boxMargin": 0,
31
- "boxTextMargin": 0,
32
- "noteMargin": 0,
33
- "messageMargin": 0
34
- }
35
- eos
36
- File.write('seqconfig.txt', seq_config)
37
-
38
- File.write('mermaid.txt', seq_diag)
39
-
40
- doc = <<-eos
41
- = Hello, Mermaid!
42
- Doc Writer <doc@example.com>
43
-
44
- == First Section
45
-
46
- mermaid::mermaid.txt[target="with_config", sequenceConfig="seqconfig.txt"]
47
- mermaid::mermaid.txt[target="without_config"]
48
- eos
49
-
50
- load_asciidoc doc
51
- expect(File.exist?('with_config.png')).to be true
52
- expect(File.exist?('without_config.png')).to be true
53
- expect(File.size('with_config.png')).to_not be File.size('without_config.png')
54
- end
55
-
56
- it "should respect the width attribute" do
57
- seq_diag = <<-eos
58
- sequenceDiagram
59
- Alice->>Bob: Hello Bob, how are you?
60
- Bob->>Claire: Hello Claire, how are you?
61
- Claire->>Doug: Hello Doug, how are you?
62
- eos
63
-
64
- File.write('mermaid.txt', seq_diag)
65
-
66
- doc = <<-eos
67
- = Hello, Mermaid!
68
- Doc Writer <doc@example.com>
69
-
70
- == First Section
71
-
72
- mermaid::mermaid.txt[target="with_width", width="700"]
73
- mermaid::mermaid.txt[target="without_width"]
74
- eos
75
-
76
- load_asciidoc doc
77
- expect(File.exist?('with_width.png')).to be true
78
- expect(File.exist?('without_width.png')).to be true
79
- expect(File.size('with_width.png')).to_not be File.size('without_width.png')
80
- end
81
-
82
- it "should respect the theme attribute" do
83
- seq_diag = <<-eos
84
- sequenceDiagram
85
- Alice->>Bob: Hello Bob, how are you?
86
- Bob->>Claire: Hello Claire, how are you?
87
- Claire->>Doug: Hello Doug, how are you?
88
- eos
89
-
90
- File.write('mermaid.txt', seq_diag)
91
-
92
- doc = <<-eos
93
- = Hello, Mermaid!
94
- Doc Writer <doc@example.com>
95
-
96
- == First Section
97
-
98
- mermaid::mermaid.txt[target="default", format="svg"]
99
- mermaid::mermaid.txt[target="dark", format="svg", theme="dark"]
100
- eos
101
-
102
- load_asciidoc doc
103
- expect(File.exist?('default.svg')).to be true
104
- expect(File.exist?('dark.svg')).to be true
105
- expect(File.read('default.svg')).to_not be File.read('dark.svg')
106
- end
107
-
108
- it "should respect the puppeteerConfig attribute" do
109
- seq_diag = <<-eos
110
- sequenceDiagram
111
- Alice->>John: Hello John, how are you?
112
- John-->>Alice: Great!
113
- eos
114
-
115
- pptr_config = <<-eos
116
- {
117
- "args": ["--no-sandbox"]
118
- }
119
- eos
120
- File.write('pptrconfig.txt', pptr_config)
121
-
122
- File.write('mermaid.txt', seq_diag)
123
-
124
- doc = <<-eos
125
- = Hello, Mermaid!
126
- Doc Writer <doc@example.com>
127
-
128
- == First Section
129
-
130
- mermaid::mermaid.txt[target="with_config", puppeteerConfig="pptrconfig.txt"]
131
- mermaid::mermaid.txt[target="without_config"]
132
- eos
133
-
134
- load_asciidoc doc
135
- expect(File.exist?('with_config.png')).to be true
136
- expect(File.exist?('without_config.png')).to be true
137
- expect(File.size('with_config.png')).to be File.size('without_config.png')
138
- end
139
- end
140
-
141
- describe Asciidoctor::Diagram::MermaidBlockProcessor do
142
- include_examples "block", :mermaid, MERMAID_CODE, [:png, :svg]
143
-
144
- it "should report unsupported scaling factors" do
145
- doc = <<-eos
146
- = Hello, Mermaid!
147
- Doc Writer <doc@example.com>
148
-
149
- == First Section
150
-
151
- [mermaid, scale=1.5]
152
- ----
153
- sequenceDiagram
154
- Alice->>John: Hello John, how are you?
155
- John-->>Alice: Great!
156
- ----
157
- eos
158
-
159
- expect { load_asciidoc doc }.to raise_error(/support.*scale/i)
160
- end
161
- end
data/spec/msc_spec.rb DELETED
@@ -1,37 +0,0 @@
1
- require_relative 'test_helper_methods'
2
-
3
- MSC_CODE = <<-eos
4
- # MSC for some fictional process
5
- msc {
6
- hscale = "2";
7
-
8
- a,b,c;
9
-
10
- a->b [ label = "ab()" ] ;
11
- b->c [ label = "bc(TRUE)"];
12
- c=>c [ label = "process(1)" ];
13
- c=>c [ label = "process(2)" ];
14
- ...;
15
- c=>c [ label = "process(n)" ];
16
- c=>c [ label = "process(END)" ];
17
- a<<=c [ label = "callback()"];
18
- --- [ label = "If more to run", ID="*" ];
19
- a->a [ label = "next()"];
20
- a->c [ label = "ac1()\nac2()"];
21
- b<-c [ label = "cb(TRUE)"];
22
- b->b [ label = "stalled(...)"];
23
- a<-b [ label = "ab() = FALSE"];
24
- }
25
- eos
26
-
27
- describe Asciidoctor::Diagram::MscInlineMacroProcessor, :broken_on_windows do
28
- include_examples "inline_macro", :msc, MSC_CODE, [:png, :svg]
29
- end
30
-
31
- describe Asciidoctor::Diagram::MscBlockMacroProcessor, :broken_on_windows do
32
- include_examples "block_macro", :msc, MSC_CODE, [:png, :svg]
33
- end
34
-
35
- describe Asciidoctor::Diagram::MscBlockProcessor, :broken_on_windows do
36
- include_examples "block", :msc, MSC_CODE, [:png, :svg]
37
- end