asciidoctor-diagram 1.5.7 → 1.5.8
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.
- checksums.yaml +4 -4
- data/CHANGELOG.adoc +13 -0
- data/README.adoc +12 -8
- data/lib/asciidoctor-diagram/ditaa/extension.rb +14 -7
- data/lib/asciidoctor-diagram/meme/extension.rb +1 -1
- data/lib/asciidoctor-diagram/mermaid/extension.rb +86 -16
- data/lib/asciidoctor-diagram/plantuml/extension.rb +1 -1
- data/lib/asciidoctor-diagram/svgbob/extension.rb +0 -2
- data/lib/asciidoctor-diagram/util/cli.rb +6 -2
- data/lib/asciidoctor-diagram/util/cli_generator.rb +20 -7
- data/lib/asciidoctor-diagram/util/java.rb +1 -1
- data/lib/asciidoctor-diagram/util/java_socket.rb +2 -2
- data/lib/asciidoctor-diagram/util/platform.rb +1 -1
- data/lib/asciidoctor-diagram/version.rb +1 -1
- data/lib/asciidoctor-diagram/wavedrom/extension.rb +1 -1
- data/lib/ditaa-1.3.13.jar +0 -0
- data/lib/ditaamini-0.11.jar +0 -0
- data/lib/jlatexmath-minimal-1.0.5.jar +0 -0
- data/lib/plantuml-1.3.13.jar +0 -0
- data/lib/plantuml.jar +0 -0
- data/lib/{server-1.3.12.jar → server-1.3.13.jar} +0 -0
- data/spec/ditaa_spec.rb +38 -0
- data/spec/mermaid_spec.rb +29 -2
- data/spec/plantuml_spec.rb +4 -4
- metadata +7 -7
- data/lib/ditaa-1.3.12.jar +0 -0
- data/lib/ditaamini-0.10.jar +0 -0
- data/lib/jlatexmath-minimal-1.0.3.jar +0 -0
- data/lib/plantuml-1.3.12.jar +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ccff08a5e14979fee3b741ce234474feb2a795d
|
4
|
+
data.tar.gz: 0e61b1ad07479b28caa76797becf7ae54e2d4fb3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d2f65dc8a689996d4a42d86343559538b383d4fd115d98828c585cb7cb8927ce8a4e1ed8b5b39d8b7bccc81b1ec32be70250b91f464c7f56c2d33734229b2543
|
7
|
+
data.tar.gz: 6e37fdc49db2cf843e2a3c4652e292908072b914341a53875faf2463ec0027f49148cc0e3dcc2f872e5bf5203c02c0d23394731dab4fabaea20a738eb667311d
|
data/CHANGELOG.adoc
CHANGED
@@ -1,5 +1,18 @@
|
|
1
1
|
= Asciidoctor-diagram Changelog
|
2
2
|
|
3
|
+
== 1.5.8
|
4
|
+
|
5
|
+
Enhancements::
|
6
|
+
|
7
|
+
* Issue #163: Add support for Mermaid.CLI
|
8
|
+
* Update PlantUML to revision 2018.1
|
9
|
+
* Add initial SVG support for Ditaa
|
10
|
+
|
11
|
+
Bug Fixes::
|
12
|
+
|
13
|
+
* Issue #159: Resolve classloading issue in JRuby (@robertpanzer)
|
14
|
+
* Issue #177: Resolve unused variable warning in svgbob integratin
|
15
|
+
|
3
16
|
== 1.5.7
|
4
17
|
|
5
18
|
Enhancements::
|
data/README.adoc
CHANGED
@@ -18,12 +18,12 @@ ifndef::env-site[:status:]
|
|
18
18
|
:uri-asciidoctor-extensions: http://asciidoctor.org/docs/user-manual/#extension-points
|
19
19
|
:uri-blockdiag: http://blockdiag.com
|
20
20
|
:uri-ditaa: http://ditaa.sourceforge.net/
|
21
|
-
:uri-dot:
|
21
|
+
:uri-dot: https://graphviz.gitlab.io/_pages/doc/info/lang.html
|
22
22
|
:uri-erd: https://github.com/BurntSushi/erd
|
23
|
-
:uri-graphviz:
|
23
|
+
:uri-graphviz: https://graphviz.gitlab.io
|
24
24
|
:uri-imagemagick: http://www.imagemagick.org
|
25
25
|
:uri-java: http://java.sun.com
|
26
|
-
:uri-mermaid:
|
26
|
+
:uri-mermaid: https://github.com/mermaidjs/mermaid.cli
|
27
27
|
:uri-mscgen: http://www.mcternan.me.uk/mscgen/
|
28
28
|
:uri-nwdiag: http://blockdiag.com/en/nwdiag/index.html
|
29
29
|
:uri-packetdiag: http://blockdiag.com/en/nwdiag/index.html
|
@@ -82,7 +82,7 @@ by first adding the following entry to your project's [.path]_Gemfile_.
|
|
82
82
|
.Gemfile
|
83
83
|
[source,ruby]
|
84
84
|
----
|
85
|
-
gem 'asciidoctor-diagram', '~> 1.
|
85
|
+
gem 'asciidoctor-diagram', '~> 1.5.7'
|
86
86
|
----
|
87
87
|
|
88
88
|
Then execute `bundle` in the CLI.
|
@@ -112,11 +112,11 @@ The following diagram types and output formats are available:
|
|
112
112
|
|Diagram Type |gif |pdf |png |svg |txt
|
113
113
|
|{uri-actdiag}[actdiag] | |{check}|{check}|{check}|
|
114
114
|
|{uri-blockdiag}[blockdiag] | |{check}|{check}|{check}|
|
115
|
-
|{uri-ditaa}[ditaa] | | |{check}|
|
115
|
+
|{uri-ditaa}[ditaa] | | |{check}|{check}|
|
116
116
|
|{uri-erd}[erd] | | |{check}|{check}|
|
117
117
|
|{uri-dot}[graphviz] | |{check}|{check}|{check}|
|
118
118
|
|<<meme,meme>> |{check}| |{check}| |
|
119
|
-
|{uri-mermaid}[mermaid] | |
|
119
|
+
|{uri-mermaid}[mermaid] | |{check}|{check}|{check}|
|
120
120
|
|{uri-mscgen}[msc] | | |{check}|{check}|
|
121
121
|
|{uri-nwdiag}[nwdiag] | |{check}|{check}|{check}|
|
122
122
|
|{uri-packetdiag}[packetdiag]| |{check}|{check}|{check}|
|
@@ -288,7 +288,7 @@ The following table lists the tools that are required for each diagram type, the
|
|
288
288
|
|erd |{uri-erd}[Erd] |`erd`
|
289
289
|
|graphviz |{uri-graphviz}[GraphViz] |`dot` or `graphvizdot`
|
290
290
|
|meme |{uri-imagemagick}[ImageMagick] |`convert` and `identify`
|
291
|
-
|mermaid |{uri-mermaid}[Mermaid]
|
291
|
+
|mermaid |{uri-mermaid}[Mermaid.cli] |`mermaid`
|
292
292
|
|msc |{uri-mscgen}[Mscgen] |`mscgen`
|
293
293
|
|nwdiag |{uri-nwdiag}[NwDiag] |`nwdiag`
|
294
294
|
|packetdiag |{uri-nwdiag}[NwDiag] |`packetdiag`
|
@@ -397,10 +397,14 @@ The attribute name at the block level should be prefixed with the name of the di
|
|
397
397
|
[cols=">,<,<",options="header"]
|
398
398
|
|===
|
399
399
|
|Name |Default value |Description
|
400
|
+
|background |FFFFFF |The background colour of the image. The format should be a six-digit hexadecimal number (as in HTML, FF0000 for red). Pass an eight-digit hex to define transparency.
|
400
401
|
|css |unspecified |Path to a CSS file to pass to mermaid.
|
402
|
+
|config |unspecified |Path to a JSON config file to pass to mermaid.
|
401
403
|
|ganttconfig |unspecified |Path to a gantt config file to pass to mermaid.
|
402
404
|
|sequenceconfig|unspecified |Path to a sequence config file to pass to mermaid.
|
403
|
-
|
|
405
|
+
|theme |unspecified |Theme of the chart, could be default, forest, dark or neutral.
|
406
|
+
|width |unspecified |Width of the page.
|
407
|
+
|height |unspecified |Height of the page.
|
404
408
|
|===
|
405
409
|
|
406
410
|
==== Msc
|
@@ -20,18 +20,22 @@ module Asciidoctor
|
|
20
20
|
'transparent' => lambda { |o, v| o << '--transparent' if v == 'true'}
|
21
21
|
}
|
22
22
|
|
23
|
-
JARS = ['ditaa-1.3.
|
23
|
+
JARS = ['ditaa-1.3.13.jar', 'ditaamini-0.11.jar'].map do |jar|
|
24
24
|
File.expand_path File.join('../..', jar), File.dirname(__FILE__)
|
25
25
|
end
|
26
26
|
Java.classpath.concat JARS
|
27
27
|
|
28
28
|
def self.included(mod)
|
29
29
|
mod.register_format(:png, :image) do |parent, source|
|
30
|
-
ditaa(parent, source)
|
30
|
+
ditaa(parent, source, 'image/png')
|
31
|
+
end
|
32
|
+
|
33
|
+
mod.register_format(:svg, :image) do |parent, source|
|
34
|
+
ditaa(parent, source, 'image/svg+xml')
|
31
35
|
end
|
32
36
|
end
|
33
37
|
|
34
|
-
def ditaa(parent, source)
|
38
|
+
def ditaa(parent, source, mime_type)
|
35
39
|
Java.load
|
36
40
|
|
37
41
|
global_attributes = parent.document.attributes
|
@@ -43,14 +47,17 @@ module Asciidoctor
|
|
43
47
|
OPTIONS[key].call(options, value)
|
44
48
|
end
|
45
49
|
|
46
|
-
|
50
|
+
options_string = options.join(' ')
|
51
|
+
|
52
|
+
headers = {
|
53
|
+
'Accept' => mime_type,
|
54
|
+
'X-Options' => options_string
|
55
|
+
}
|
47
56
|
|
48
57
|
response = Java.send_request(
|
49
58
|
:url => '/ditaa',
|
50
59
|
:body => source.to_s,
|
51
|
-
:headers =>
|
52
|
-
'X-Options' => options
|
53
|
-
}
|
60
|
+
:headers => headers
|
54
61
|
)
|
55
62
|
|
56
63
|
unless response[:code] == 200
|
@@ -37,7 +37,7 @@ module Asciidoctor
|
|
37
37
|
options = source.attr('options', '', inherit_prefix).split(',')
|
38
38
|
noupcase = options.include?('noupcase')
|
39
39
|
|
40
|
-
dimensions = Cli.run(identify, '-format', '%w %h', bg_img).match(/(?<w>\d+) (?<h>\d+)/)
|
40
|
+
dimensions = Cli.run(identify, '-format', '%w %h', bg_img)[:out].match(/(?<w>\d+) (?<h>\d+)/)
|
41
41
|
bg_width = dimensions['w'].to_i
|
42
42
|
bg_height = dimensions['h'].to_i
|
43
43
|
label_width = bg_width
|
@@ -21,27 +21,97 @@ module Asciidoctor
|
|
21
21
|
|
22
22
|
def mermaid(parent_block, source, format)
|
23
23
|
inherit_prefix = name
|
24
|
-
|
25
|
-
|
26
|
-
# Mermaid >= 6.0.0 requires PhantomJS 2.1; older version required 1.9
|
27
|
-
phantomjs = which(parent_block, 'phantomjs', :alt_attrs => [config['mermaid>=6'] ? 'phantomjs_2' : 'phantomjs_19'])
|
24
|
+
|
25
|
+
options = {}
|
28
26
|
|
29
27
|
css = source.attr('css', nil, inherit_prefix)
|
30
28
|
if css
|
31
|
-
css = parent_block.normalize_system_path(css, source.base_dir)
|
29
|
+
options[:css] = parent_block.normalize_system_path(css, source.base_dir)
|
32
30
|
end
|
33
31
|
|
34
32
|
gantt_config = source.attr('ganttConfig', nil, inherit_prefix) || source.attr('ganttconfig', nil, inherit_prefix)
|
35
33
|
if gantt_config
|
36
|
-
|
34
|
+
options[:gantt] = parent_block.normalize_system_path(gantt_config, source.base_dir)
|
37
35
|
end
|
38
36
|
|
39
37
|
seq_config = source.attr('sequenceConfig', nil, inherit_prefix) || source.attr('sequenceconfig', nil, inherit_prefix)
|
40
38
|
if seq_config
|
41
|
-
|
39
|
+
options[:sequence] = parent_block.normalize_system_path(seq_config, source.base_dir)
|
40
|
+
end
|
41
|
+
|
42
|
+
options[:width] = source.attr('width', nil, inherit_prefix)
|
43
|
+
|
44
|
+
mmdc = which(parent_block, 'mmdc', :raise_on_error => false)
|
45
|
+
if mmdc
|
46
|
+
options[:height] = source.attr('height', nil, inherit_prefix)
|
47
|
+
options[:theme] = source.attr('theme', nil, inherit_prefix)
|
48
|
+
options[:background] = source.attr('background', nil, inherit_prefix)
|
49
|
+
config = source.attr('config', nil, inherit_prefix) || source.attr('config', nil, inherit_prefix)
|
50
|
+
if config
|
51
|
+
options[:config] = parent_block.normalize_system_path(config, source.base_dir)
|
52
|
+
end
|
53
|
+
run_mmdc(mmdc, source, format, options)
|
54
|
+
else
|
55
|
+
mermaid = which(parent_block, 'mermaid')
|
56
|
+
run_mermaid(mermaid, parent_block, source, format, options)
|
42
57
|
end
|
58
|
+
end
|
43
59
|
|
44
|
-
|
60
|
+
private
|
61
|
+
def run_mmdc(mmdc, source, format, options = {})
|
62
|
+
generate_file(mmdc, 'mmd', format.to_s, source.to_s) do |tool_path, input_path, output_path|
|
63
|
+
args = [tool_path, '-i', Platform.native_path(input_path), '-o', Platform.native_path(output_path)]
|
64
|
+
|
65
|
+
if options[:css]
|
66
|
+
args << '--cssFile' << Platform.native_path(options[:css])
|
67
|
+
end
|
68
|
+
|
69
|
+
if options[:theme]
|
70
|
+
args << '--theme' << options[:theme]
|
71
|
+
end
|
72
|
+
|
73
|
+
if options[:width]
|
74
|
+
args << '--width' << options[:width]
|
75
|
+
end
|
76
|
+
|
77
|
+
if options[:height]
|
78
|
+
args << '--height' << options[:height]
|
79
|
+
end
|
80
|
+
|
81
|
+
if options[:background]
|
82
|
+
bg = options[:background]
|
83
|
+
bg = "##{bg}" unless bg[0] == '#'
|
84
|
+
args << '--backgroundColor' << bg
|
85
|
+
end
|
86
|
+
|
87
|
+
if options[:config]
|
88
|
+
args << '--configFile' << Platform.native_path(options[:config])
|
89
|
+
elsif options[:gantt] || options[:sequence]
|
90
|
+
config = []
|
91
|
+
|
92
|
+
if options[:gantt]
|
93
|
+
config << "\"gantt\": #{File.read(options[:gantt])}"
|
94
|
+
end
|
95
|
+
|
96
|
+
if options[:sequence]
|
97
|
+
config << "\"sequenceDiagram\": #{File.read(options[:sequence])}"
|
98
|
+
end
|
99
|
+
|
100
|
+
config_file = "#{input_path}.json"
|
101
|
+
|
102
|
+
File.write(config_file, "{#{config.join ','}}")
|
103
|
+
|
104
|
+
args << '--configFile' << Platform.native_path(config_file)
|
105
|
+
end
|
106
|
+
|
107
|
+
args
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
def run_mermaid(mermaid, parent_block, source, format, options = {})
|
112
|
+
config['mermaid>=6'] ||= ::Asciidoctor::Diagram::Cli.run(mermaid, '--version')[:out].split('.')[0].to_i >= 6
|
113
|
+
# Mermaid >= 6.0.0 requires PhantomJS 2.1; older version required 1.9
|
114
|
+
phantomjs = which(parent_block, 'phantomjs', :alt_attrs => [config['mermaid>=6'] ? 'phantomjs_2' : 'phantomjs_19'])
|
45
115
|
|
46
116
|
generate_file(mermaid, 'mmd', format.to_s, source.to_s) do |tool_path, input_path, output_path|
|
47
117
|
output_dir = File.dirname(output_path)
|
@@ -49,20 +119,20 @@ module Asciidoctor
|
|
49
119
|
|
50
120
|
args = [tool_path, '--phantomPath', Platform.native_path(phantomjs), "--#{format.to_s}", '-o', Platform.native_path(output_dir)]
|
51
121
|
|
52
|
-
if css
|
53
|
-
args << '--css' << Platform.native_path(css)
|
122
|
+
if options[:css]
|
123
|
+
args << '--css' << Platform.native_path(options[:css])
|
54
124
|
end
|
55
125
|
|
56
|
-
if
|
57
|
-
args << '--gantt_config' << Platform.native_path(
|
126
|
+
if options[:gantt]
|
127
|
+
args << '--gantt_config' << Platform.native_path(options[:gantt])
|
58
128
|
end
|
59
129
|
|
60
|
-
if
|
61
|
-
args << '--sequenceConfig' << Platform.native_path(
|
130
|
+
if options[:sequence]
|
131
|
+
args << '--sequenceConfig' << Platform.native_path(options[:sequence])
|
62
132
|
end
|
63
133
|
|
64
|
-
if width
|
65
|
-
args << '--width' << width
|
134
|
+
if options[:width]
|
135
|
+
args << '--width' << options[:width]
|
66
136
|
end
|
67
137
|
|
68
138
|
args << Platform.native_path(input_path)
|
@@ -10,7 +10,7 @@ module Asciidoctor
|
|
10
10
|
|
11
11
|
private
|
12
12
|
|
13
|
-
JARS = ['plantuml-1.3.
|
13
|
+
JARS = ['plantuml-1.3.13.jar', 'plantuml.jar', 'jlatexmath-minimal-1.0.5.jar', 'batik-all-1.7.jar'].map do |jar|
|
14
14
|
File.expand_path File.join('../..', jar), File.dirname(__FILE__)
|
15
15
|
end
|
16
16
|
Java.classpath.concat JARS
|
@@ -8,11 +8,15 @@ module Asciidoctor
|
|
8
8
|
def self.run(*args)
|
9
9
|
stdout, stderr, status = Open3.capture3(*args)
|
10
10
|
|
11
|
-
if status != 0
|
11
|
+
if status.exitstatus != 0
|
12
12
|
raise "#{File.basename(args[0])} failed: #{stdout.empty? ? stderr : stdout}"
|
13
13
|
end
|
14
14
|
|
15
|
-
|
15
|
+
{
|
16
|
+
:out => stdout,
|
17
|
+
:err => stderr,
|
18
|
+
:status => status
|
19
|
+
}
|
16
20
|
end
|
17
21
|
end
|
18
22
|
end
|
@@ -14,7 +14,7 @@ module Asciidoctor
|
|
14
14
|
|
15
15
|
opts = yield tool, target_file.path
|
16
16
|
|
17
|
-
generate(opts, target_file, :stdin_data => code)
|
17
|
+
generate(opts, target_file.path, :stdin_data => code)
|
18
18
|
ensure
|
19
19
|
target_file.unlink
|
20
20
|
end
|
@@ -33,7 +33,7 @@ module Asciidoctor
|
|
33
33
|
|
34
34
|
opts = yield tool, source_file.path, target_file.path
|
35
35
|
|
36
|
-
generate(opts, target_file)
|
36
|
+
generate(opts, target_file.path)
|
37
37
|
ensure
|
38
38
|
target_file.unlink
|
39
39
|
end
|
@@ -42,6 +42,7 @@ module Asciidoctor
|
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
|
+
private
|
45
46
|
def generate(opts, target_file, open3_opts = {})
|
46
47
|
case opts
|
47
48
|
when Array
|
@@ -54,15 +55,27 @@ module Asciidoctor
|
|
54
55
|
raise "Block passed to generate_file should return an Array or a Hash"
|
55
56
|
end
|
56
57
|
|
57
|
-
|
58
|
+
result = ::Asciidoctor::Diagram::Cli.run(*args, open3_opts)
|
58
59
|
|
59
|
-
|
60
|
+
data = read_result(target_file, out_file)
|
60
61
|
|
61
|
-
if
|
62
|
-
|
62
|
+
if data.empty?
|
63
|
+
raise "#{args[0]} failed: #{result[:out].empty? ? result[:err] : result[:out]}"
|
63
64
|
end
|
64
65
|
|
65
|
-
|
66
|
+
data
|
67
|
+
end
|
68
|
+
|
69
|
+
def read_result(target_file, out_file = nil)
|
70
|
+
if File.exist?(out_file || target_file)
|
71
|
+
if out_file
|
72
|
+
File.rename(out_file, target_file)
|
73
|
+
end
|
74
|
+
|
75
|
+
File.binread(target_file)
|
76
|
+
else
|
77
|
+
''
|
78
|
+
end
|
66
79
|
end
|
67
80
|
end
|
68
81
|
end
|
@@ -71,7 +71,7 @@ module Asciidoctor
|
|
71
71
|
when :windows
|
72
72
|
path_to(ENV['JAVA_HOME'], 'bin/java.exe') || registry_lookup || ::Asciidoctor::Diagram::Which.which('java')
|
73
73
|
when :macosx
|
74
|
-
path_to(ENV['JAVA_HOME'], 'bin/java') || path_to(::Asciidoctor::Diagram::Cli.run('/usr/libexec/java_home').strip, 'bin/java') || ::Asciidoctor::Diagram::Which.which('java')
|
74
|
+
path_to(ENV['JAVA_HOME'], 'bin/java') || path_to(::Asciidoctor::Diagram::Cli.run('/usr/libexec/java_home')[:out].strip, 'bin/java') || ::Asciidoctor::Diagram::Which.which('java')
|
75
75
|
else
|
76
76
|
path_to(ENV['JAVA_HOME'], 'bin/java') || ::Asciidoctor::Diagram::Which.which('java')
|
77
77
|
end
|
@@ -125,7 +125,7 @@ module Asciidoctor
|
|
125
125
|
args << '/s' if opts[:recursive]
|
126
126
|
|
127
127
|
begin
|
128
|
-
lines = ::Asciidoctor::Diagram::Cli.run(*args).lines.reject { |l| l.strip.empty? }.each
|
128
|
+
lines = ::Asciidoctor::Diagram::Cli.run(*args)[:out].lines.reject { |l| l.strip.empty? }.each
|
129
129
|
rescue
|
130
130
|
lines = [].each
|
131
131
|
end
|
@@ -83,7 +83,7 @@ module Asciidoctor
|
|
83
83
|
if os_variant == :cygwin
|
84
84
|
cygpath = ::Asciidoctor::Diagram::Which.which('cygpath')
|
85
85
|
if cygpath != nil
|
86
|
-
::Asciidoctor::Diagram::Cli.run(cygpath, '-w', path)
|
86
|
+
::Asciidoctor::Diagram::Cli.run(cygpath, '-w', path)[:out]
|
87
87
|
else
|
88
88
|
puts 'cygwin warning: cygpath not found'
|
89
89
|
native_path(path)
|
@@ -28,7 +28,7 @@ module Asciidoctor
|
|
28
28
|
end
|
29
29
|
else
|
30
30
|
if ::Asciidoctor::Diagram::Platform.os == :macosx
|
31
|
-
wavedrom = which(parent, 'WaveDromEditor.app', :attrs => ['WaveDromEditorApp'],:path => ['/Applications'])
|
31
|
+
wavedrom = which(parent, 'WaveDromEditor.app', :alt_cmds => ['wavedrom-editor.app'], :attrs => ['WaveDromEditorApp'],:path => ['/Applications'])
|
32
32
|
if wavedrom
|
33
33
|
wavedrom = File.join(wavedrom, 'Contents/MacOS/nwjs')
|
34
34
|
end
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/lib/plantuml.jar
CHANGED
Binary file
|
Binary file
|
data/spec/ditaa_spec.rb
CHANGED
@@ -82,6 +82,44 @@ Doc Writer <doc@example.com>
|
|
82
82
|
expect(b.attributes['height']).to_not be_nil
|
83
83
|
end
|
84
84
|
|
85
|
+
it "should generate SVG images when format is set to 'svg'" do
|
86
|
+
doc = <<-eos
|
87
|
+
= Hello, ditaa!
|
88
|
+
Doc Writer <doc@example.com>
|
89
|
+
|
90
|
+
== First Section
|
91
|
+
|
92
|
+
[ditaa, format="svg"]
|
93
|
+
----
|
94
|
+
+--------+ +-------+ +-------+
|
95
|
+
| | --+ ditaa +--> | |
|
96
|
+
| Text | +-------+ |diagram|
|
97
|
+
|Document| |!magic!| | |
|
98
|
+
| {d}| | | | |
|
99
|
+
+---+----+ +-------+ +-------+
|
100
|
+
: ^
|
101
|
+
| Lots of work |
|
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(/\.svg/)
|
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
|
+
|
85
123
|
it "should raise an error when when format is set to an invalid value" do
|
86
124
|
doc = <<-eos
|
87
125
|
= Hello, PlantUML!
|
data/spec/mermaid_spec.rb
CHANGED
@@ -253,8 +253,9 @@ mermaid::mermaid.txt["without_config"]
|
|
253
253
|
it "should respect the width attribute" do
|
254
254
|
seq_diag = <<-eos
|
255
255
|
sequenceDiagram
|
256
|
-
Alice->>
|
257
|
-
|
256
|
+
Alice->>Bob: Hello Bob, how are you?
|
257
|
+
Bob->>Claire: Hello Claire, how are you?
|
258
|
+
Claire->>Doug: Hello Doug, how are you?
|
258
259
|
eos
|
259
260
|
|
260
261
|
File.write('mermaid.txt', seq_diag)
|
@@ -274,4 +275,30 @@ mermaid::mermaid.txt["without_width"]
|
|
274
275
|
expect(File.exist?('without_width.png')).to be true
|
275
276
|
expect(File.size('with_width.png')).to_not be File.size('without_width.png')
|
276
277
|
end
|
278
|
+
|
279
|
+
it "should respect the theme attribute" do
|
280
|
+
seq_diag = <<-eos
|
281
|
+
sequenceDiagram
|
282
|
+
Alice->>Bob: Hello Bob, how are you?
|
283
|
+
Bob->>Claire: Hello Claire, how are you?
|
284
|
+
Claire->>Doug: Hello Doug, how are you?
|
285
|
+
eos
|
286
|
+
|
287
|
+
File.write('mermaid.txt', seq_diag)
|
288
|
+
|
289
|
+
doc = <<-eos
|
290
|
+
= Hello, Mermaid!
|
291
|
+
Doc Writer <doc@example.com>
|
292
|
+
|
293
|
+
== First Section
|
294
|
+
|
295
|
+
mermaid::mermaid.txt["default", format="svg"]
|
296
|
+
mermaid::mermaid.txt["dark", format="svg", theme="dark"]
|
297
|
+
eos
|
298
|
+
|
299
|
+
load_asciidoc doc
|
300
|
+
expect(File.exist?('default.svg')).to be true
|
301
|
+
expect(File.exist?('dark.svg')).to be true
|
302
|
+
expect(File.read('default.svg')).to_not be File.read('dark.svg')
|
303
|
+
end
|
277
304
|
end
|
data/spec/plantuml_spec.rb
CHANGED
@@ -67,7 +67,7 @@ plantuml::plantuml.txt[format="png"]
|
|
67
67
|
target = b.attributes['target']
|
68
68
|
expect(target).to_not be_nil
|
69
69
|
expect(target).to match(/\.png$/)
|
70
|
-
expect(File.
|
70
|
+
expect(File.exist?(target)).to be true
|
71
71
|
|
72
72
|
expect(b.attributes['width']).to_not be_nil
|
73
73
|
expect(b.attributes['height']).to_not be_nil
|
@@ -243,7 +243,7 @@ plantuml::plantuml.txt[format="png"]
|
|
243
243
|
b = d.find { |bl| bl.context == :image }
|
244
244
|
expect(b).to_not be_nil
|
245
245
|
|
246
|
-
expect(b.caption).to match
|
246
|
+
expect(b.caption).to match(/Figure \d+/)
|
247
247
|
end
|
248
248
|
end
|
249
249
|
|
@@ -374,7 +374,7 @@ Foo1 -> Foo2 : To boundary
|
|
374
374
|
eos
|
375
375
|
|
376
376
|
config = <<-eos
|
377
|
-
ArrowColor #DEADBE
|
377
|
+
skinparam ArrowColor #DEADBE
|
378
378
|
eos
|
379
379
|
|
380
380
|
File.open('test.config', 'w') do |f|
|
@@ -603,7 +603,7 @@ User -> (Start)
|
|
603
603
|
b = d.find { |bl| bl.context == :image }
|
604
604
|
expect(b).to_not be_nil
|
605
605
|
|
606
|
-
expect(b.caption).to match
|
606
|
+
expect(b.caption).to match(/Figure \d+/)
|
607
607
|
end
|
608
608
|
|
609
609
|
it 'should support salt diagrams using salt block type' 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.
|
4
|
+
version: 1.5.8
|
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:
|
11
|
+
date: 2018-02-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -127,12 +127,12 @@ files:
|
|
127
127
|
- lib/asciidoctor-diagram/wavedrom.rb
|
128
128
|
- lib/asciidoctor-diagram/wavedrom/extension.rb
|
129
129
|
- lib/batik-all-1.7.jar
|
130
|
-
- lib/ditaa-1.3.
|
131
|
-
- lib/ditaamini-0.
|
132
|
-
- lib/jlatexmath-minimal-1.0.
|
133
|
-
- lib/plantuml-1.3.
|
130
|
+
- lib/ditaa-1.3.13.jar
|
131
|
+
- lib/ditaamini-0.11.jar
|
132
|
+
- lib/jlatexmath-minimal-1.0.5.jar
|
133
|
+
- lib/plantuml-1.3.13.jar
|
134
134
|
- lib/plantuml.jar
|
135
|
-
- lib/server-1.3.
|
135
|
+
- lib/server-1.3.13.jar
|
136
136
|
- spec/blockdiag_spec.rb
|
137
137
|
- spec/ditaa_spec.rb
|
138
138
|
- spec/erd_spec.rb
|
data/lib/ditaa-1.3.12.jar
DELETED
Binary file
|
data/lib/ditaamini-0.10.jar
DELETED
Binary file
|
Binary file
|
data/lib/plantuml-1.3.12.jar
DELETED
Binary file
|