asciidoctor-diagram 2.0.2 → 2.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.adoc +25 -0
- data/README.adoc +13 -4
- data/lib/asciidoctor-diagram.rb +3 -0
- data/lib/asciidoctor-diagram/a2s/converter.rb +10 -6
- data/lib/asciidoctor-diagram/blockdiag/converter.rb +1 -1
- data/lib/asciidoctor-diagram/bpmn/converter.rb +3 -3
- data/lib/asciidoctor-diagram/diagram_converter.rb +5 -1
- data/lib/asciidoctor-diagram/diagram_processor.rb +64 -38
- data/lib/asciidoctor-diagram/diagram_source.rb +64 -17
- data/lib/asciidoctor-diagram/ditaa/converter.rb +6 -2
- data/lib/asciidoctor-diagram/dpic.rb +7 -0
- data/lib/asciidoctor-diagram/dpic/converter.rb +30 -0
- data/lib/asciidoctor-diagram/dpic/extension.rb +14 -0
- data/lib/asciidoctor-diagram/gnuplot/converter.rb +8 -8
- data/lib/asciidoctor-diagram/graphviz/converter.rb +2 -2
- data/lib/asciidoctor-diagram/http/converter.rb +25 -5
- data/lib/asciidoctor-diagram/http/server.rb +10 -5
- data/lib/asciidoctor-diagram/lilypond/converter.rb +2 -2
- data/lib/asciidoctor-diagram/meme/converter.rb +7 -7
- data/lib/asciidoctor-diagram/mermaid/converter.rb +16 -15
- data/lib/asciidoctor-diagram/msc/converter.rb +2 -2
- data/lib/asciidoctor-diagram/pikchr.rb +7 -0
- data/lib/asciidoctor-diagram/pikchr/converter.rb +26 -0
- data/lib/asciidoctor-diagram/pikchr/extension.rb +14 -0
- data/lib/asciidoctor-diagram/plantuml/converter.rb +3 -3
- data/lib/asciidoctor-diagram/smcat/converter.rb +3 -3
- data/lib/asciidoctor-diagram/svgbob/converter.rb +2 -2
- data/lib/asciidoctor-diagram/symbolator.rb +7 -0
- data/lib/asciidoctor-diagram/symbolator/converter.rb +23 -0
- data/lib/asciidoctor-diagram/symbolator/extension.rb +14 -0
- data/lib/asciidoctor-diagram/syntrax/converter.rb +9 -6
- data/lib/asciidoctor-diagram/util/cli_generator.rb +18 -0
- data/lib/asciidoctor-diagram/util/gif.rb +2 -2
- data/lib/asciidoctor-diagram/util/pdf.rb +2 -2
- data/lib/asciidoctor-diagram/util/png.rb +2 -2
- data/lib/asciidoctor-diagram/util/svg.rb +46 -19
- data/lib/asciidoctor-diagram/vega/converter.rb +2 -2
- data/lib/asciidoctor-diagram/version.rb +1 -1
- data/spec/a2s_spec.rb +2 -140
- data/spec/blockdiag_spec.rb +2 -200
- data/spec/bpmn_spec.rb +52 -92
- data/spec/bytefield_spec.rb +2 -140
- data/spec/ditaa_spec.rb +5 -143
- data/spec/dpic_spec.rb +19 -0
- data/spec/erd_spec.rb +2 -199
- data/spec/gnuplot_spec.rb +2 -255
- data/spec/graphviz_spec.rb +6 -145
- data/spec/lilypond_spec.rb +2 -140
- data/spec/mermaid_spec.rb +2 -199
- data/spec/msc_spec.rb +2 -199
- data/spec/nomnoml_spec.rb +4 -142
- data/spec/pikchr_spec.rb +51 -0
- data/spec/plantuml_spec.rb +6 -578
- data/spec/shaape_spec.rb +9 -221
- data/spec/shared_examples.rb +552 -0
- data/spec/smcat_spec.rb +2 -140
- data/spec/svgbob_spec.rb +2 -140
- data/spec/symbolator_spec.rb +23 -0
- data/spec/syntrax_spec.rb +5 -215
- data/spec/test_helper.rb +1 -22
- data/spec/tikz_spec.rb +4 -24
- data/spec/umlet_spec.rb +2 -58
- data/spec/vega_spec.rb +4 -117
- data/spec/wavedrom_spec.rb +2 -199
- metadata +20 -6
- data/spec/bpmn-example.xml +0 -44
data/spec/smcat_spec.rb
CHANGED
@@ -18,147 +18,9 @@ testing => final : test ok;
|
|
18
18
|
eos
|
19
19
|
|
20
20
|
describe Asciidoctor::Diagram::SmcatBlockMacroProcessor, :broken_on_windows do
|
21
|
-
|
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
|
21
|
+
include_examples "block_macro", :smcat, code, [:svg]
|
49
22
|
end
|
50
23
|
|
51
24
|
describe Asciidoctor::Diagram::SmcatBlockProcessor, :broken_on_windows do
|
52
|
-
|
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
|
25
|
+
include_examples "block", :smcat, code, [:svg]
|
164
26
|
end
|
data/spec/svgbob_spec.rb
CHANGED
@@ -21,147 +21,9 @@ code = <<-eos
|
|
21
21
|
eos
|
22
22
|
|
23
23
|
describe Asciidoctor::Diagram::SvgBobBlockMacroProcessor, :broken_on_travis, :broken_on_windows do
|
24
|
-
|
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
|
24
|
+
include_examples "block_macro", :svgbob, code, [:svg]
|
52
25
|
end
|
53
26
|
|
54
27
|
describe Asciidoctor::Diagram::SvgBobBlockProcessor, :broken_on_travis, :broken_on_windows do
|
55
|
-
|
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
|
28
|
+
include_examples "block", :svgbob, code, [:svg]
|
167
29
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require_relative 'test_helper'
|
2
|
+
|
3
|
+
code = <<-eos
|
4
|
+
library ieee;
|
5
|
+
use ieee.std_logic_1164.all;
|
6
|
+
|
7
|
+
package demo is
|
8
|
+
component demo_device is
|
9
|
+
generic (
|
10
|
+
SIZE : positive;
|
11
|
+
RESET_ACTIVE_LEVEL : std_ulogic := '1'
|
12
|
+
);
|
13
|
+
end component;
|
14
|
+
end package;
|
15
|
+
eos
|
16
|
+
|
17
|
+
describe Asciidoctor::Diagram::SymbolatorBlockMacroProcessor, :broken_on_windows do
|
18
|
+
include_examples "block_macro", :symbolator, code, [:png, :svg, :pdf]
|
19
|
+
end
|
20
|
+
|
21
|
+
describe Asciidoctor::Diagram::SymbolatorBlockProcessor, :broken_on_windows do
|
22
|
+
include_examples "block", :symbolator, code, [:png, :svg, :pdf]
|
23
|
+
end
|
data/spec/syntrax_spec.rb
CHANGED
@@ -1,228 +1,18 @@
|
|
1
1
|
require_relative 'test_helper'
|
2
2
|
|
3
|
-
|
4
|
-
it "should generate PNG images when format is set to 'png'" do
|
5
|
-
code = <<-eos
|
3
|
+
code = <<-eos
|
6
4
|
indentstack(10,
|
7
5
|
line(opt('-'), choice('0', line('1-9', loop(None, '0-9'))),
|
8
6
|
opt('.', loop('0-9', None))),
|
9
7
|
|
10
8
|
line(opt(choice('e', 'E'), choice(None, '+', '-'), loop('0-9', None)))
|
11
9
|
)
|
12
|
-
|
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
|
10
|
+
eos
|
27
11
|
|
28
|
-
|
29
|
-
|
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
|
12
|
+
describe Asciidoctor::Diagram::SyntraxBlockMacroProcessor, :broken_on_appveyor do
|
13
|
+
include_examples "block_macro", :syntrax, code, [:png, :svg]
|
41
14
|
end
|
42
15
|
|
43
16
|
describe Asciidoctor::Diagram::SyntraxBlockProcessor, :broken_on_appveyor do
|
44
|
-
|
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
|
17
|
+
include_examples "block", :syntrax, code, [:png, :svg]
|
228
18
|
end
|