asciidoctor-diagram 1.5.19 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.adoc +10 -0
- data/README.adoc +22 -9
- data/examples/features.adoc +2 -2
- data/lib/asciidoctor-diagram.rb +1 -0
- data/lib/asciidoctor-diagram/a2s/converter.rb +55 -0
- data/lib/asciidoctor-diagram/a2s/extension.rb +6 -52
- data/lib/asciidoctor-diagram/blockdiag/converter.rb +37 -0
- data/lib/asciidoctor-diagram/blockdiag/extension.rb +9 -116
- data/lib/asciidoctor-diagram/bpmn.rb +7 -0
- data/lib/asciidoctor-diagram/bpmn/converter.rb +62 -0
- data/lib/asciidoctor-diagram/bpmn/extension.rb +14 -0
- data/lib/asciidoctor-diagram/diagram_converter.rb +19 -0
- data/lib/asciidoctor-diagram/diagram_processor.rb +320 -0
- data/lib/asciidoctor-diagram/diagram_source.rb +275 -0
- data/lib/asciidoctor-diagram/ditaa/converter.rb +86 -0
- data/lib/asciidoctor-diagram/ditaa/extension.rb +6 -71
- data/lib/asciidoctor-diagram/erd/converter.rb +31 -0
- data/lib/asciidoctor-diagram/erd/extension.rb +6 -35
- data/lib/asciidoctor-diagram/gnuplot/converter.rb +63 -0
- data/lib/asciidoctor-diagram/gnuplot/extension.rb +6 -62
- data/lib/asciidoctor-diagram/graphviz/converter.rb +32 -0
- data/lib/asciidoctor-diagram/graphviz/extension.rb +6 -35
- data/lib/asciidoctor-diagram/http/server.rb +127 -0
- data/lib/asciidoctor-diagram/lilypond/converter.rb +54 -0
- data/lib/asciidoctor-diagram/lilypond/extension.rb +6 -53
- data/lib/asciidoctor-diagram/meme/converter.rb +122 -0
- data/lib/asciidoctor-diagram/meme/extension.rb +5 -107
- data/lib/asciidoctor-diagram/mermaid/converter.rb +178 -0
- data/lib/asciidoctor-diagram/mermaid/extension.rb +6 -159
- data/lib/asciidoctor-diagram/msc/converter.rb +35 -0
- data/lib/asciidoctor-diagram/msc/extension.rb +6 -36
- data/lib/asciidoctor-diagram/nomnoml/converter.rb +25 -0
- data/lib/asciidoctor-diagram/nomnoml/extension.rb +6 -28
- data/lib/asciidoctor-diagram/plantuml/converter.rb +115 -0
- data/lib/asciidoctor-diagram/plantuml/extension.rb +10 -119
- data/lib/asciidoctor-diagram/shaape/converter.rb +25 -0
- data/lib/asciidoctor-diagram/shaape/extension.rb +6 -28
- data/lib/asciidoctor-diagram/smcat/converter.rb +44 -0
- data/lib/asciidoctor-diagram/smcat/extension.rb +6 -42
- data/lib/asciidoctor-diagram/svgbob/converter.rb +25 -0
- data/lib/asciidoctor-diagram/svgbob/extension.rb +6 -28
- data/lib/asciidoctor-diagram/syntrax/converter.rb +55 -0
- data/lib/asciidoctor-diagram/syntrax/extension.rb +6 -51
- data/lib/asciidoctor-diagram/tikz/converter.rb +56 -0
- data/lib/asciidoctor-diagram/tikz/extension.rb +6 -60
- data/lib/asciidoctor-diagram/umlet/converter.rb +24 -0
- data/lib/asciidoctor-diagram/umlet/extension.rb +6 -28
- data/lib/asciidoctor-diagram/util/java.rb +1 -1
- data/lib/asciidoctor-diagram/util/java_socket.rb +7 -9
- data/lib/asciidoctor-diagram/util/which.rb +0 -29
- data/lib/asciidoctor-diagram/vega/converter.rb +47 -0
- data/lib/asciidoctor-diagram/vega/extension.rb +6 -44
- data/lib/asciidoctor-diagram/version.rb +1 -1
- data/lib/asciidoctor-diagram/wavedrom/converter.rb +50 -0
- data/lib/asciidoctor-diagram/wavedrom/extension.rb +6 -54
- data/lib/ditaa-1.3.14.jar +0 -0
- data/lib/plantuml-1.3.14.jar +0 -0
- data/lib/plantuml.jar +0 -0
- data/lib/server-1.3.14.jar +0 -0
- data/spec/bpmn-example.xml +44 -0
- data/spec/bpmn_spec.rb +96 -0
- data/spec/mermaid_spec.rb +33 -1
- data/spec/plantuml_spec.rb +89 -0
- metadata +37 -8
- data/lib/asciidoctor-diagram/extensions.rb +0 -568
- data/lib/ditaa-1.3.13.jar +0 -0
- data/lib/plantuml-1.3.13.jar +0 -0
- data/lib/server-1.3.13.jar +0 -0
@@ -0,0 +1,178 @@
|
|
1
|
+
require_relative '../diagram_converter'
|
2
|
+
require_relative '../util/cli'
|
3
|
+
require_relative '../util/cli_generator'
|
4
|
+
require_relative '../util/platform'
|
5
|
+
|
6
|
+
module Asciidoctor
|
7
|
+
module Diagram
|
8
|
+
# @private
|
9
|
+
class MermaidConverter
|
10
|
+
include DiagramConverter
|
11
|
+
include CliGenerator
|
12
|
+
|
13
|
+
|
14
|
+
def supported_formats
|
15
|
+
[:png, :svg]
|
16
|
+
end
|
17
|
+
|
18
|
+
def collect_options(source, name)
|
19
|
+
options = {}
|
20
|
+
|
21
|
+
options[:css] = source.attr('css', nil, name)
|
22
|
+
options[:gantt_config] = source.attr('ganttconfig', nil, name) || source.attr('gantt-config', nil, name)
|
23
|
+
options[:seq_config] = source.attr('sequenceconfig', nil, name) || source.attr('sequence-config', nil, name)
|
24
|
+
options[:width] = source.attr('width', nil, name)
|
25
|
+
options[:height] = source.attr('height', nil, name)
|
26
|
+
options[:theme] = source.attr('theme', nil, name)
|
27
|
+
options[:background] = source.attr('background', nil, name)
|
28
|
+
options[:config] = source.attr('config', nil, name)
|
29
|
+
options[:puppeteer_config] = source.attr('puppeteerconfig', nil, name) || source.attr('puppeteer-config', nil, name)
|
30
|
+
|
31
|
+
options
|
32
|
+
end
|
33
|
+
|
34
|
+
def convert(source, format, options)
|
35
|
+
opts = {}
|
36
|
+
|
37
|
+
css = options[:css]
|
38
|
+
if css
|
39
|
+
opts[:css] = source.resolve_path(css)
|
40
|
+
end
|
41
|
+
|
42
|
+
gantt_config = options[:gantt_config]
|
43
|
+
if gantt_config
|
44
|
+
opts[:gantt] = source.resolve_path(gantt_config)
|
45
|
+
end
|
46
|
+
|
47
|
+
seq_config = options[:seq_config]
|
48
|
+
if seq_config
|
49
|
+
opts[:sequence] = source.resolve_path(seq_config)
|
50
|
+
end
|
51
|
+
|
52
|
+
puppeteer_config = options[:puppeteer_config]
|
53
|
+
if puppeteer_config
|
54
|
+
opts[:puppeteer] = source.resolve_path(puppeteer_config)
|
55
|
+
end
|
56
|
+
|
57
|
+
opts[:width] = options[:width]
|
58
|
+
|
59
|
+
mmdc = source.find_command('mmdc', :raise_on_error => false)
|
60
|
+
if mmdc
|
61
|
+
opts[:height] = options[:height]
|
62
|
+
opts[:theme] = options[:theme]
|
63
|
+
opts[:background] = options[:background]
|
64
|
+
config = options[:config]
|
65
|
+
if config
|
66
|
+
opts[:config] = source.resolve_path(config)
|
67
|
+
end
|
68
|
+
run_mmdc(mmdc, source, format, opts)
|
69
|
+
else
|
70
|
+
mermaid = source.find_command('mermaid')
|
71
|
+
run_mermaid(mermaid, source, format, opts)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
private
|
76
|
+
def run_mmdc(mmdc, source, format, options = {})
|
77
|
+
generate_file(mmdc, 'mmd', format.to_s, source.to_s) do |tool_path, input_path, output_path|
|
78
|
+
args = [tool_path, '-i', Platform.native_path(input_path), '-o', Platform.native_path(output_path)]
|
79
|
+
|
80
|
+
if options[:css]
|
81
|
+
args << '--cssFile' << Platform.native_path(options[:css])
|
82
|
+
end
|
83
|
+
|
84
|
+
if options[:theme]
|
85
|
+
args << '--theme' << options[:theme]
|
86
|
+
end
|
87
|
+
|
88
|
+
if options[:width]
|
89
|
+
args << '--width' << options[:width]
|
90
|
+
end
|
91
|
+
|
92
|
+
if options[:height]
|
93
|
+
args << '--height' << options[:height]
|
94
|
+
end
|
95
|
+
|
96
|
+
if options[:background]
|
97
|
+
bg = options[:background]
|
98
|
+
bg = "##{bg}" unless bg[0] == '#'
|
99
|
+
args << '--backgroundColor' << bg
|
100
|
+
end
|
101
|
+
|
102
|
+
if options[:config]
|
103
|
+
args << '--configFile' << Platform.native_path(options[:config])
|
104
|
+
elsif options[:gantt] || options[:sequence]
|
105
|
+
mermaidConfig = []
|
106
|
+
|
107
|
+
if options[:gantt]
|
108
|
+
mermaidConfig << "\"gantt\": #{File.read(options[:gantt])}"
|
109
|
+
end
|
110
|
+
|
111
|
+
if options[:sequence]
|
112
|
+
configKey = source.config['mmdcSequenceConfigKey'] ||= begin
|
113
|
+
version_parts = ::Asciidoctor::Diagram::Cli.run(mmdc, '--version')[:out].split('.').map { |p| p.to_i }
|
114
|
+
major = version_parts[0] || 0
|
115
|
+
minor = version_parts[1] || 0
|
116
|
+
patch = version_parts[2] || 0
|
117
|
+
if major > 0 || (major == 0 && minor > 4) || (major == 0 && minor == 4 && patch > 1)
|
118
|
+
'sequence'
|
119
|
+
else
|
120
|
+
'sequenceDiagram'
|
121
|
+
end
|
122
|
+
end
|
123
|
+
mermaidConfig << "\"#{configKey}\": #{File.read(options[:sequence])}"
|
124
|
+
end
|
125
|
+
|
126
|
+
config_file = "#{input_path}.json"
|
127
|
+
|
128
|
+
File.write(config_file, "{#{mermaidConfig.join ','}}")
|
129
|
+
|
130
|
+
args << '--configFile' << Platform.native_path(config_file)
|
131
|
+
end
|
132
|
+
|
133
|
+
if options[:puppeteer]
|
134
|
+
args << '--puppeteerConfigFile' << Platform.native_path(options[:puppeteer])
|
135
|
+
end
|
136
|
+
|
137
|
+
args
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
def run_mermaid(mermaid, source, format, options = {})
|
142
|
+
source.config['mermaid>=6'] ||= ::Asciidoctor::Diagram::Cli.run(mermaid, '--version')[:out].split('.')[0].to_i >= 6
|
143
|
+
# Mermaid >= 6.0.0 requires PhantomJS 2.1; older version required 1.9
|
144
|
+
phantomjs = source.find_command('phantomjs', :alt_attrs => [source.config['mermaid>=6'] ? 'phantomjs_2' : 'phantomjs_19'])
|
145
|
+
|
146
|
+
generate_file(mermaid, 'mmd', format.to_s, source.to_s) do |tool_path, input_path, output_path|
|
147
|
+
output_dir = File.dirname(output_path)
|
148
|
+
output_file = File.expand_path(File.basename(input_path) + ".#{format.to_s}", output_dir)
|
149
|
+
|
150
|
+
args = [tool_path, '--phantomPath', Platform.native_path(phantomjs), "--#{format.to_s}", '-o', Platform.native_path(output_dir)]
|
151
|
+
|
152
|
+
if options[:css]
|
153
|
+
args << '--css' << Platform.native_path(options[:css])
|
154
|
+
end
|
155
|
+
|
156
|
+
if options[:gantt]
|
157
|
+
args << '--gantt_config' << Platform.native_path(options[:gantt])
|
158
|
+
end
|
159
|
+
|
160
|
+
if options[:sequence]
|
161
|
+
args << '--sequenceConfig' << Platform.native_path(options[:sequence])
|
162
|
+
end
|
163
|
+
|
164
|
+
if options[:width]
|
165
|
+
args << '--width' << options[:width]
|
166
|
+
end
|
167
|
+
|
168
|
+
args << Platform.native_path(input_path)
|
169
|
+
|
170
|
+
{
|
171
|
+
:args => args,
|
172
|
+
:out_file => output_file
|
173
|
+
}
|
174
|
+
end
|
175
|
+
end
|
176
|
+
end
|
177
|
+
end
|
178
|
+
end
|
@@ -1,167 +1,14 @@
|
|
1
|
-
require_relative '
|
2
|
-
require_relative '../
|
3
|
-
require_relative '../util/cli_generator'
|
4
|
-
require_relative '../util/platform'
|
5
|
-
require_relative '../util/which'
|
1
|
+
require_relative 'converter'
|
2
|
+
require_relative '../diagram_processor'
|
6
3
|
|
7
4
|
module Asciidoctor
|
8
5
|
module Diagram
|
9
|
-
|
10
|
-
|
11
|
-
include CliGenerator
|
12
|
-
include Which
|
13
|
-
|
14
|
-
def self.included(mod)
|
15
|
-
[:png, :svg].each do |f|
|
16
|
-
mod.register_format(f, :image) do |parent, source|
|
17
|
-
mermaid(parent, source, f)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def mermaid(parent_block, source, format)
|
23
|
-
inherit_prefix = name
|
24
|
-
|
25
|
-
options = {}
|
26
|
-
|
27
|
-
css = source.attr('css', nil, inherit_prefix)
|
28
|
-
if css
|
29
|
-
options[:css] = parent_block.normalize_system_path(css, source.base_dir)
|
30
|
-
end
|
31
|
-
|
32
|
-
gantt_config = source.attr('ganttConfig', nil, inherit_prefix) || source.attr('ganttconfig', nil, inherit_prefix)
|
33
|
-
if gantt_config
|
34
|
-
options[:gantt] = parent_block.normalize_system_path(gantt_config, source.base_dir)
|
35
|
-
end
|
36
|
-
|
37
|
-
seq_config = source.attr('sequenceConfig', nil, inherit_prefix) || source.attr('sequenceconfig', nil, inherit_prefix)
|
38
|
-
if seq_config
|
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)
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
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
|
-
mermaidConfig = []
|
91
|
-
|
92
|
-
if options[:gantt]
|
93
|
-
mermaidConfig << "\"gantt\": #{File.read(options[:gantt])}"
|
94
|
-
end
|
95
|
-
|
96
|
-
if options[:sequence]
|
97
|
-
configKey = config['mmdcSequenceConfigKey'] ||= begin
|
98
|
-
version_parts = ::Asciidoctor::Diagram::Cli.run(mmdc, '--version')[:out].split('.').map { |p| p.to_i }
|
99
|
-
major = version_parts[0] || 0
|
100
|
-
minor = version_parts[1] || 0
|
101
|
-
patch = version_parts[2] || 0
|
102
|
-
if major > 0 || (major == 0 && minor > 4) || (major == 0 && minor == 4 && patch > 1)
|
103
|
-
'sequence'
|
104
|
-
else
|
105
|
-
'sequenceDiagram'
|
106
|
-
end
|
107
|
-
end
|
108
|
-
mermaidConfig << "\"#{configKey}\": #{File.read(options[:sequence])}"
|
109
|
-
end
|
110
|
-
|
111
|
-
config_file = "#{input_path}.json"
|
112
|
-
|
113
|
-
File.write(config_file, "{#{mermaidConfig.join ','}}")
|
114
|
-
|
115
|
-
args << '--configFile' << Platform.native_path(config_file)
|
116
|
-
end
|
117
|
-
|
118
|
-
args
|
119
|
-
end
|
120
|
-
end
|
121
|
-
|
122
|
-
def run_mermaid(mermaid, parent_block, source, format, options = {})
|
123
|
-
config['mermaid>=6'] ||= ::Asciidoctor::Diagram::Cli.run(mermaid, '--version')[:out].split('.')[0].to_i >= 6
|
124
|
-
# Mermaid >= 6.0.0 requires PhantomJS 2.1; older version required 1.9
|
125
|
-
phantomjs = which(parent_block, 'phantomjs', :alt_attrs => [config['mermaid>=6'] ? 'phantomjs_2' : 'phantomjs_19'])
|
126
|
-
|
127
|
-
generate_file(mermaid, 'mmd', format.to_s, source.to_s) do |tool_path, input_path, output_path|
|
128
|
-
output_dir = File.dirname(output_path)
|
129
|
-
output_file = File.expand_path(File.basename(input_path) + ".#{format.to_s}", output_dir)
|
130
|
-
|
131
|
-
args = [tool_path, '--phantomPath', Platform.native_path(phantomjs), "--#{format.to_s}", '-o', Platform.native_path(output_dir)]
|
132
|
-
|
133
|
-
if options[:css]
|
134
|
-
args << '--css' << Platform.native_path(options[:css])
|
135
|
-
end
|
136
|
-
|
137
|
-
if options[:gantt]
|
138
|
-
args << '--gantt_config' << Platform.native_path(options[:gantt])
|
139
|
-
end
|
140
|
-
|
141
|
-
if options[:sequence]
|
142
|
-
args << '--sequenceConfig' << Platform.native_path(options[:sequence])
|
143
|
-
end
|
144
|
-
|
145
|
-
if options[:width]
|
146
|
-
args << '--width' << options[:width]
|
147
|
-
end
|
148
|
-
|
149
|
-
args << Platform.native_path(input_path)
|
150
|
-
|
151
|
-
{
|
152
|
-
:args => args,
|
153
|
-
:out_file => output_file
|
154
|
-
}
|
155
|
-
end
|
156
|
-
end
|
157
|
-
end
|
158
|
-
|
159
|
-
class MermaidBlockProcessor < Extensions::DiagramBlockProcessor
|
160
|
-
include Mermaid
|
6
|
+
class MermaidBlockProcessor < DiagramBlockProcessor
|
7
|
+
use_converter MermaidConverter
|
161
8
|
end
|
162
9
|
|
163
|
-
class MermaidBlockMacroProcessor <
|
164
|
-
|
10
|
+
class MermaidBlockMacroProcessor < DiagramBlockMacroProcessor
|
11
|
+
use_converter MermaidConverter
|
165
12
|
end
|
166
13
|
end
|
167
14
|
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require_relative '../diagram_converter'
|
2
|
+
require_relative '../util/cli_generator'
|
3
|
+
require_relative '../util/platform'
|
4
|
+
|
5
|
+
module Asciidoctor
|
6
|
+
module Diagram
|
7
|
+
# @private
|
8
|
+
class MscgenConverter
|
9
|
+
include DiagramConverter
|
10
|
+
include CliGenerator
|
11
|
+
|
12
|
+
|
13
|
+
def supported_formats
|
14
|
+
[:png, :svg]
|
15
|
+
end
|
16
|
+
|
17
|
+
def collect_options(source, name)
|
18
|
+
{:font => source.attr('font', nil, name)}
|
19
|
+
end
|
20
|
+
|
21
|
+
def convert(source, format, options)
|
22
|
+
font = options[:font]
|
23
|
+
|
24
|
+
generate_stdin(source.find_command('mscgen'), format.to_s, source.to_s) do |tool_path, output_path|
|
25
|
+
args = [tool_path, '-o', Platform.native_path(output_path), '-T', format.to_s]
|
26
|
+
if font
|
27
|
+
args << '-F' << font
|
28
|
+
end
|
29
|
+
args << '-'
|
30
|
+
args
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -1,44 +1,14 @@
|
|
1
|
-
require_relative '
|
2
|
-
require_relative '../
|
3
|
-
require_relative '../util/platform'
|
4
|
-
require_relative '../util/which'
|
1
|
+
require_relative 'converter'
|
2
|
+
require_relative '../diagram_processor'
|
5
3
|
|
6
4
|
module Asciidoctor
|
7
5
|
module Diagram
|
8
|
-
|
9
|
-
|
10
|
-
include CliGenerator
|
11
|
-
include Which
|
12
|
-
|
13
|
-
def self.included(mod)
|
14
|
-
[:png, :svg].each do |f|
|
15
|
-
mod.register_format(f, :image) do |parent, source|
|
16
|
-
mscgen(parent, source, f)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def mscgen(parent, source, format)
|
22
|
-
inherit_prefix = name
|
23
|
-
font = source.attr('font', nil, inherit_prefix)
|
24
|
-
|
25
|
-
generate_stdin(which(parent, 'mscgen'), format.to_s, source.to_s) do |tool_path, output_path|
|
26
|
-
args = [tool_path, '-o', Platform.native_path(output_path), '-T', format.to_s]
|
27
|
-
if font
|
28
|
-
args << '-F' << font
|
29
|
-
end
|
30
|
-
args << '-'
|
31
|
-
args
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
class MscBlockProcessor < Extensions::DiagramBlockProcessor
|
37
|
-
include Mscgen
|
6
|
+
class MscBlockProcessor < DiagramBlockProcessor
|
7
|
+
use_converter MscgenConverter
|
38
8
|
end
|
39
9
|
|
40
|
-
class MscBlockMacroProcessor <
|
41
|
-
|
10
|
+
class MscBlockMacroProcessor < DiagramBlockMacroProcessor
|
11
|
+
use_converter MscgenConverter
|
42
12
|
end
|
43
13
|
end
|
44
14
|
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require_relative '../diagram_converter'
|
2
|
+
require_relative '../util/cli_generator'
|
3
|
+
require_relative '../util/platform'
|
4
|
+
|
5
|
+
module Asciidoctor
|
6
|
+
module Diagram
|
7
|
+
# @private
|
8
|
+
class NomnomlConverter
|
9
|
+
include DiagramConverter
|
10
|
+
include CliGenerator
|
11
|
+
|
12
|
+
|
13
|
+
def supported_formats
|
14
|
+
[:svg]
|
15
|
+
end
|
16
|
+
|
17
|
+
|
18
|
+
def convert(source, format, options)
|
19
|
+
generate_file(source.find_command('nomnoml'), 'nomnoml', format.to_s, source.to_s) do |tool_path, input_path, output_path|
|
20
|
+
[tool_path, Platform.native_path(input_path), Platform.native_path(output_path)]
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|