asciidoctor-diagram 1.5.5 → 1.5.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  require_relative 'test_helper'
2
2
 
3
- describe Asciidoctor::Diagram::ShaapeBlockMacroProcessor, :broken_on_osx do
3
+ describe Asciidoctor::Diagram::ShaapeBlockMacroProcessor, :broken_on_osx, :broken_on_appveyor do
4
4
  it "should generate PNG images when format is set to 'png'" do
5
5
  code = <<-eos
6
6
  +--------+ +-------------+
@@ -40,7 +40,7 @@ shaape::shaape.txt[format="png"]
40
40
  end
41
41
  end
42
42
 
43
- describe Asciidoctor::Diagram::ShaapeBlockProcessor, :broken_on_osx do
43
+ describe Asciidoctor::Diagram::ShaapeBlockProcessor, :broken_on_osx, :broken_on_appveyor do
44
44
  it "should generate PNG images when format is set to 'png'" do
45
45
  doc = <<-eos
46
46
  = Hello, Shaape!
@@ -0,0 +1,167 @@
1
+ require_relative 'test_helper'
2
+
3
+ code = <<-eos
4
+ .--. .---. .---. .---. .---. .---. .---.
5
+ | | OS API '---' '---' '---' '---' '---' '---'
6
+ v | | | | | | |
7
+ .-. .-. .-. | v v | v | v
8
+ .-->'-' '-' '-' | .------------. | .-----------. | .-----.
9
+ | \\ | / | | Filesystem | | | Scheduler | | | MMU |
10
+ | v . v | '------------' | '-----------' | '-----'
11
+ '_______/ \\_____| | | | |
12
+ \\ / v | | v
13
+ | ____ .----. | | .---------.
14
+ '--> /___/ | IO |<----' | | Network |
15
+ '----' | '---------'
16
+ | | |
17
+ v v v
18
+ .---------------------------------------.
19
+ | HAL |
20
+ '---------------------------------------'
21
+ eos
22
+
23
+ describe Asciidoctor::Diagram::SvgBobBlockMacroProcessor, :broken_on_travis, :broken_on_windows do
24
+ it "should generate SVG images when format is set to 'svg'" do
25
+ File.write('svgbob.txt', code)
26
+
27
+ doc = <<-eos
28
+ = Hello, SvgBob!
29
+ Doc Writer <doc@example.com>
30
+
31
+ == First Section
32
+
33
+ svgbob::svgbob.txt[format="svg"]
34
+ eos
35
+
36
+ d = load_asciidoc doc
37
+ expect(d).to_not be_nil
38
+
39
+ b = d.find { |bl| bl.context == :image }
40
+ expect(b).to_not be_nil
41
+
42
+ expect(b.content_model).to eq :empty
43
+
44
+ target = b.attributes['target']
45
+ expect(target).to_not be_nil
46
+ expect(target).to match(/\.svg/)
47
+ expect(File.exist?(target)).to be true
48
+
49
+ expect(b.attributes['width']).to_not be_nil
50
+ expect(b.attributes['height']).to_not be_nil
51
+ end
52
+ end
53
+
54
+ describe Asciidoctor::Diagram::SvgBobBlockProcessor, :broken_on_travis, :broken_on_windows do
55
+ it "should generate SVG images when format is set to 'svg'" do
56
+ doc = <<-eos
57
+ = Hello, SvgBob!
58
+ Doc Writer <doc@example.com>
59
+
60
+ == First Section
61
+
62
+ [svgbob, format="svg"]
63
+ ----
64
+ #{code}
65
+ ----
66
+ eos
67
+
68
+ d = load_asciidoc doc
69
+ expect(d).to_not be_nil
70
+
71
+ b = d.find { |bl| bl.context == :image }
72
+ expect(b).to_not be_nil
73
+
74
+ expect(b.content_model).to eq :empty
75
+
76
+ target = b.attributes['target']
77
+ expect(target).to_not be_nil
78
+ expect(target).to match(/\.svg/)
79
+ expect(File.exist?(target)).to be true
80
+
81
+ expect(b.attributes['width']).to_not be_nil
82
+ expect(b.attributes['height']).to_not be_nil
83
+ end
84
+
85
+ it "should raise an error when when format is set to an invalid value" do
86
+ doc = <<-eos
87
+ = Hello, SvgBob!
88
+ Doc Writer <doc@example.com>
89
+
90
+ == First Section
91
+
92
+ [svgbob, format="foobar"]
93
+ ----
94
+ ----
95
+ eos
96
+
97
+ expect { load_asciidoc doc }.to raise_error(/support.*format/i)
98
+ end
99
+
100
+ it "should not regenerate images when source has not changed" do
101
+ File.write('svgbob.txt', code)
102
+
103
+ doc = <<-eos
104
+ = Hello, SvgBob!
105
+ Doc Writer <doc@example.com>
106
+
107
+ == First Section
108
+
109
+ svgbob::svgbob.txt
110
+
111
+ [svgbob]
112
+ ----
113
+ #{code}
114
+ ----
115
+ eos
116
+
117
+ d = load_asciidoc doc
118
+ b = d.find { |bl| bl.context == :image }
119
+ expect(b).to_not be_nil
120
+ target = b.attributes['target']
121
+ mtime1 = File.mtime(target)
122
+
123
+ sleep 1
124
+
125
+ d = load_asciidoc doc
126
+
127
+ mtime2 = File.mtime(target)
128
+
129
+ expect(mtime2).to eq mtime1
130
+ end
131
+
132
+ it "should handle two block macros with the same source" do
133
+ File.write('svgbob.txt', code)
134
+
135
+ doc = <<-eos
136
+ = Hello, SvgBob!
137
+ Doc Writer <doc@example.com>
138
+
139
+ == First Section
140
+
141
+ svgbob::svgbob.txt[]
142
+ svgbob::svgbob.txt[]
143
+ eos
144
+
145
+ load_asciidoc doc
146
+ expect(File.exist?('svgbob.svg')).to be true
147
+ end
148
+
149
+ it "should respect target attribute in block macros" do
150
+ File.write('svgbob.txt', code)
151
+
152
+ doc = <<-eos
153
+ = Hello, SvgBob!
154
+ Doc Writer <doc@example.com>
155
+
156
+ == First Section
157
+
158
+ svgbob::svgbob.txt["foobar"]
159
+ svgbob::svgbob.txt["foobaz"]
160
+ eos
161
+
162
+ load_asciidoc doc
163
+ expect(File.exist?('foobar.svg')).to be true
164
+ expect(File.exist?('foobaz.svg')).to be true
165
+ expect(File.exist?('svgbob.svg')).to be false
166
+ end
167
+ end
@@ -0,0 +1,228 @@
1
+ require_relative 'test_helper'
2
+
3
+ describe Asciidoctor::Diagram::SyntraxBlockMacroProcessor, :broken_on_appveyor do
4
+ it "should generate PNG images when format is set to 'png'" do
5
+ code = <<-eos
6
+ indentstack(10,
7
+ line(opt('-'), choice('0', line('1-9', loop(None, '0-9'))),
8
+ opt('.', loop('0-9', None))),
9
+
10
+ line(opt(choice('e', 'E'), choice(None, '+', '-'), loop('0-9', None)))
11
+ )
12
+ eos
13
+
14
+ File.write('syntrax.txt', code)
15
+
16
+ doc = <<-eos
17
+ = Hello, Syntrax!
18
+ Doc Writer <doc@example.com>
19
+
20
+ == First Section
21
+
22
+ syntrax::syntrax.txt[format="png"]
23
+ eos
24
+
25
+ d = load_asciidoc doc
26
+ expect(d).to_not be_nil
27
+
28
+ b = d.find { |bl| bl.context == :image }
29
+ expect(b).to_not be_nil
30
+
31
+ expect(b.content_model).to eq :empty
32
+
33
+ target = b.attributes['target']
34
+ expect(target).to_not be_nil
35
+ expect(target).to match(/\.png$/)
36
+ expect(File.exist?(target)).to be true
37
+
38
+ expect(b.attributes['width']).to_not be_nil
39
+ expect(b.attributes['height']).to_not be_nil
40
+ end
41
+ end
42
+
43
+ describe Asciidoctor::Diagram::SyntraxBlockProcessor, :broken_on_appveyor do
44
+ it "should generate PNG images when format is set to 'png'" do
45
+ doc = <<-eos
46
+ = Hello, Syntrax!
47
+ Doc Writer <doc@example.com>
48
+
49
+ == First Section
50
+
51
+ [syntrax, format="png"]
52
+ ----
53
+ indentstack(10,
54
+ line(opt('-'), choice('0', line('1-9', loop(None, '0-9'))),
55
+ opt('.', loop('0-9', None))),
56
+
57
+ line(opt(choice('e', 'E'), choice(None, '+', '-'), loop('0-9', None)))
58
+ )
59
+ ----
60
+ eos
61
+
62
+ d = load_asciidoc doc
63
+ expect(d).to_not be_nil
64
+
65
+ b = d.find { |bl| bl.context == :image }
66
+ expect(b).to_not be_nil
67
+
68
+ expect(b.content_model).to eq :empty
69
+
70
+ target = b.attributes['target']
71
+ expect(target).to_not be_nil
72
+ expect(target).to match(/\.png$/)
73
+ expect(File.exist?(target)).to be true
74
+
75
+ expect(b.attributes['width']).to_not be_nil
76
+ expect(b.attributes['height']).to_not be_nil
77
+ end
78
+
79
+ it "should generate SVG images when format is set to 'svg'" do
80
+ doc = <<-eos
81
+ = Hello, Syntrax!
82
+ Doc Writer <doc@example.com>
83
+
84
+ == First Section
85
+
86
+ [syntrax, format="svg"]
87
+ ----
88
+ indentstack(10,
89
+ line(opt('-'), choice('0', line('1-9', loop(None, '0-9'))),
90
+ opt('.', loop('0-9', None))),
91
+
92
+ line(opt(choice('e', 'E'), choice(None, '+', '-'), loop('0-9', None)))
93
+ )
94
+ ----
95
+ eos
96
+
97
+ d = load_asciidoc doc
98
+ expect(d).to_not be_nil
99
+
100
+ b = d.find { |bl| bl.context == :image }
101
+ expect(b).to_not be_nil
102
+
103
+ expect(b.content_model).to eq :empty
104
+
105
+ target = b.attributes['target']
106
+ expect(target).to_not be_nil
107
+ expect(target).to match(/\.svg/)
108
+ expect(File.exist?(target)).to be true
109
+
110
+ expect(b.attributes['width']).to_not be_nil
111
+ expect(b.attributes['height']).to_not be_nil
112
+ end
113
+
114
+ it "should raise an error when when format is set to an invalid value" do
115
+ doc = <<-eos
116
+ = Hello, Syntrax!
117
+ Doc Writer <doc@example.com>
118
+
119
+ == First Section
120
+
121
+ [syntrax, format="foobar"]
122
+ ----
123
+ ----
124
+ eos
125
+
126
+ expect { load_asciidoc doc }.to raise_error(/support.*format/i)
127
+ end
128
+
129
+ it "should not regenerate images when source has not changed" do
130
+ code = <<-eos
131
+ indentstack(10,
132
+ line(opt('-'), choice('0', line('1-9', loop(None, '0-9'))),
133
+ opt('.', loop('0-9', None))),
134
+
135
+ line(opt(choice('e', 'E'), choice(None, '+', '-'), loop('0-9', None)))
136
+ )
137
+ eos
138
+
139
+ File.write('syntrax.txt', code)
140
+
141
+ doc = <<-eos
142
+ = Hello, Syntrax!
143
+ Doc Writer <doc@example.com>
144
+
145
+ == First Section
146
+
147
+ syntrax::syntrax.txt
148
+
149
+ [syntrax, format="png"]
150
+ ----
151
+ indentstack(10,
152
+ line(opt('-'), choice('0', line('1-9', loop(None, '0-9'))),
153
+ opt('.', loop('0-9', None))),
154
+
155
+ line(opt(choice('e', 'E'), choice(None, '+', '-'), loop('0-9', None)))
156
+ )
157
+ ----
158
+ eos
159
+
160
+ d = load_asciidoc doc
161
+ b = d.find { |bl| bl.context == :image }
162
+ expect(b).to_not be_nil
163
+ target = b.attributes['target']
164
+ mtime1 = File.mtime(target)
165
+
166
+ sleep 1
167
+
168
+ d = load_asciidoc doc
169
+
170
+ mtime2 = File.mtime(target)
171
+
172
+ expect(mtime2).to eq mtime1
173
+ end
174
+
175
+ it "should handle two block macros with the same source" do
176
+ code = <<-eos
177
+ indentstack(10,
178
+ line(opt('-'), choice('0', line('1-9', loop(None, '0-9'))),
179
+ opt('.', loop('0-9', None))),
180
+
181
+ line(opt(choice('e', 'E'), choice(None, '+', '-'), loop('0-9', None)))
182
+ )
183
+ eos
184
+
185
+ File.write('syntrax.txt', code)
186
+
187
+ doc = <<-eos
188
+ = Hello, Syntrax!
189
+ Doc Writer <doc@example.com>
190
+
191
+ == First Section
192
+
193
+ syntrax::syntrax.txt[]
194
+ syntrax::syntrax.txt[]
195
+ eos
196
+
197
+ load_asciidoc doc
198
+ expect(File.exist?('syntrax.png')).to be true
199
+ end
200
+
201
+ it "should respect target attribute in block macros" do
202
+ code = <<-eos
203
+ indentstack(10,
204
+ line(opt('-'), choice('0', line('1-9', loop(None, '0-9'))),
205
+ opt('.', loop('0-9', None))),
206
+
207
+ line(opt(choice('e', 'E'), choice(None, '+', '-'), loop('0-9', None)))
208
+ )
209
+ eos
210
+
211
+ File.write('syntrax.txt', code)
212
+
213
+ doc = <<-eos
214
+ = Hello, Syntrax!
215
+ Doc Writer <doc@example.com>
216
+
217
+ == First Section
218
+
219
+ syntrax::syntrax.txt["foobar"]
220
+ syntrax::syntrax.txt["foobaz"]
221
+ eos
222
+
223
+ load_asciidoc doc
224
+ expect(File.exist?('foobar.png')).to be true
225
+ expect(File.exist?('foobaz.png')).to be true
226
+ expect(File.exist?('syntrax.png')).to be false
227
+ end
228
+ end
@@ -12,8 +12,11 @@ require_relative '../lib/asciidoctor-diagram/erd/extension'
12
12
  require_relative '../lib/asciidoctor-diagram/graphviz/extension'
13
13
  require_relative '../lib/asciidoctor-diagram/meme/extension'
14
14
  require_relative '../lib/asciidoctor-diagram/mermaid/extension'
15
+ require_relative '../lib/asciidoctor-diagram/msc/extension'
15
16
  require_relative '../lib/asciidoctor-diagram/plantuml/extension'
16
17
  require_relative '../lib/asciidoctor-diagram/shaape/extension'
18
+ require_relative '../lib/asciidoctor-diagram/svgbob/extension'
19
+ require_relative '../lib/asciidoctor-diagram/syntrax/extension'
17
20
  require_relative '../lib/asciidoctor-diagram/umlet/extension'
18
21
  require_relative '../lib/asciidoctor-diagram/wavedrom/extension'
19
22
 
@@ -83,6 +86,10 @@ RSpec.configure do |c|
83
86
  c.filter_run_excluding :broken_on_travis => true
84
87
  end
85
88
 
89
+ if ENV['APPVEYOR']
90
+ c.filter_run_excluding :broken_on_appveyor => true
91
+ end
92
+
86
93
  TEST_DIR = File.expand_path('testing')
87
94
 
88
95
  c.before(:suite) do
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.5
4
+ version: 1.5.6
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: 2017-07-13 00:00:00.000000000 Z
11
+ date: 2017-11-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -98,11 +98,17 @@ files:
98
98
  - lib/asciidoctor-diagram/meme/extension.rb
99
99
  - lib/asciidoctor-diagram/mermaid.rb
100
100
  - lib/asciidoctor-diagram/mermaid/extension.rb
101
+ - lib/asciidoctor-diagram/msc.rb
102
+ - lib/asciidoctor-diagram/msc/extension.rb
101
103
  - lib/asciidoctor-diagram/plantuml.rb
102
104
  - lib/asciidoctor-diagram/plantuml/extension.rb
103
105
  - lib/asciidoctor-diagram/salt.rb
104
106
  - lib/asciidoctor-diagram/shaape.rb
105
107
  - lib/asciidoctor-diagram/shaape/extension.rb
108
+ - lib/asciidoctor-diagram/svgbob.rb
109
+ - lib/asciidoctor-diagram/svgbob/extension.rb
110
+ - lib/asciidoctor-diagram/syntrax.rb
111
+ - lib/asciidoctor-diagram/syntrax/extension.rb
106
112
  - lib/asciidoctor-diagram/umlet.rb
107
113
  - lib/asciidoctor-diagram/umlet/extension.rb
108
114
  - lib/asciidoctor-diagram/util/binaryio.rb
@@ -134,8 +140,11 @@ files:
134
140
  - spec/man.jpg
135
141
  - spec/meme_spec.rb
136
142
  - spec/mermaid_spec.rb
143
+ - spec/msc_spec.rb
137
144
  - spec/plantuml_spec.rb
138
145
  - spec/shaape_spec.rb
146
+ - spec/svgbob_spec.rb
147
+ - spec/syntrax_spec.rb
139
148
  - spec/test_helper.rb
140
149
  - spec/umlet_spec.rb
141
150
  - spec/wavedrom_spec.rb
@@ -172,8 +181,11 @@ test_files:
172
181
  - spec/man.jpg
173
182
  - spec/meme_spec.rb
174
183
  - spec/mermaid_spec.rb
184
+ - spec/msc_spec.rb
175
185
  - spec/plantuml_spec.rb
176
186
  - spec/shaape_spec.rb
187
+ - spec/svgbob_spec.rb
188
+ - spec/syntrax_spec.rb
177
189
  - spec/test_helper.rb
178
190
  - spec/umlet_spec.rb
179
191
  - spec/wavedrom_spec.rb