asciidoctor-diagram 1.3.2 → 1.4.0
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 +54 -10
- data/lib/{asciidoctor-diagram-java-1.3.7.jar → asciidoctor-diagram-java-1.3.8.jar} +0 -0
- data/lib/asciidoctor-diagram.rb +2 -0
- data/lib/asciidoctor-diagram/blockdiag/extension.rb +1 -1
- data/lib/asciidoctor-diagram/ditaa/extension.rb +0 -10
- data/lib/asciidoctor-diagram/extensions.rb +22 -6
- data/lib/asciidoctor-diagram/graphviz/extension.rb +1 -1
- data/lib/asciidoctor-diagram/meme.rb +8 -0
- data/lib/asciidoctor-diagram/meme/extension.rb +116 -0
- data/lib/asciidoctor-diagram/mermaid.rb +9 -0
- data/lib/asciidoctor-diagram/mermaid/extension.rb +57 -0
- data/lib/asciidoctor-diagram/plantuml/extension.rb +7 -0
- data/lib/asciidoctor-diagram/shaape/extension.rb +1 -1
- data/lib/asciidoctor-diagram/util/binaryio.rb +18 -0
- data/lib/asciidoctor-diagram/util/cli_generator.rb +41 -21
- data/lib/asciidoctor-diagram/util/gif.rb +21 -0
- data/lib/asciidoctor-diagram/util/java.rb +1 -1
- data/lib/asciidoctor-diagram/util/platform.rb +25 -0
- data/lib/asciidoctor-diagram/util/svg.rb +3 -3
- data/lib/asciidoctor-diagram/util/which.rb +9 -3
- data/lib/asciidoctor-diagram/version.rb +1 -1
- data/lib/asciidoctor-diagram/wavedrom/extension.rb +18 -8
- data/spec/ditaa_spec.rb +1 -1
- data/spec/man.jpg +0 -0
- data/spec/meme_spec.rb +67 -0
- data/spec/mermaid_spec.rb +277 -0
- data/spec/plantuml_spec.rb +25 -0
- data/spec/shaape_spec.rb +2 -2
- data/spec/test_helper.rb +11 -1
- data/spec/wavedrom_spec.rb +2 -2
- metadata +15 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d373774bdb564cd5b002d0c09fa3473f9e5760c3
|
4
|
+
data.tar.gz: 37ac247cb289425bed03821a56573d7d2b45e9c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40e342aa5f7f6625d260b7de22d0bc68dbfcc859b8f5d0dc0e260be05e937f3b39ded65596aabfc09dc084103d086aa8a5e8c75c7d913ee53fa4b9ea2d876a90
|
7
|
+
data.tar.gz: c5355e1ad0d749eb88204ac3b824cf53e91a6fa6f286fdc92a7a6b74655a6b9a40b2e300c2b62a1f23230fa43773279524552df8bdf0b97b89b7b2c2bac97ab3
|
data/CHANGELOG.adoc
CHANGED
@@ -1,5 +1,18 @@
|
|
1
1
|
= Asciidoctor-diagram Changelog
|
2
2
|
|
3
|
+
== 1.4.0
|
4
|
+
|
5
|
+
Enhancements::
|
6
|
+
|
7
|
+
* Use wavedrom-cli when available
|
8
|
+
* Add meme generator
|
9
|
+
|
10
|
+
Bug Fixes::
|
11
|
+
|
12
|
+
* Issue #71: Don't fail early for PlantUML diagrams if `dot` can't be found. PlantUML doesn't need it for all diagrams
|
13
|
+
types so invoke PlantUML without specifying the location of `dot` and let PlantUML produce an error when necessary.
|
14
|
+
* Issue #85: Support target attribute values containing one or more directory names.
|
15
|
+
|
3
16
|
== 1.3.2
|
4
17
|
|
5
18
|
Enhancements::
|
data/README.adoc
CHANGED
@@ -4,13 +4,16 @@ Pepijn Van_Eeckhoudt
|
|
4
4
|
Asciidoctor Diagram is a set of extensions for http://asciidoctor.org[Asciidoctor], the Ruby-based AsciiDoc processor.
|
5
5
|
These extensions allow you to embed plain text diagrams inside your AsciiDoc documents using one of the following syntaxes:
|
6
6
|
|
7
|
-
- http://plantuml.sourceforge.net[PlantUML]
|
8
|
-
- http://ditaa.sourceforge.net[Ditaa].
|
9
|
-
- https://github.com/christiangoltz/shaape[Shaape]
|
10
7
|
- http://blockdiag.com[BlockDiag, SeqDiag, ActDiag, NwDiag]
|
8
|
+
- http://ditaa.sourceforge.net[Ditaa].
|
11
9
|
- http://www.graphviz.org/content/dot-language[GraphViz DOT]
|
10
|
+
- http://knsv.github.io/mermaid/[Mermaid]
|
11
|
+
- http://plantuml.sourceforge.net[PlantUML]
|
12
|
+
- https://github.com/christiangoltz/shaape[Shaape]
|
12
13
|
- http://wavedrom.com[WaveDrom]
|
13
14
|
|
15
|
+
Additionally Asciidoctor Diagram includes a basic meme generator extension.
|
16
|
+
|
14
17
|
The extension takes care of running the diagram processor to generate the images from the input text and insert them into the rendered document.
|
15
18
|
|
16
19
|
This gem was inspired by the https://code.google.com/p/asciidoc-plantuml/[AsciiDoc PlantUML filter] for AsciiDoc Python.
|
@@ -41,9 +44,12 @@ Or install it yourself as:
|
|
41
44
|
|
42
45
|
Certain diagram types require other tools to be installed seperately.
|
43
46
|
|
44
|
-
- PlantUML and Graphviz: the Graphviz `dot` tool.
|
45
|
-
- Shaape: the Shaape Python package
|
46
47
|
- Block/Seq/Act/Nw diag: the block/seq/act/nw diag Python packages
|
48
|
+
- Graphviz: the http://www.graphviz.org[Graphviz] package
|
49
|
+
- Meme: http://www.imagemagick.org[ImageMagick]
|
50
|
+
- Mermaid: the http://knsv.github.io/mermaid[Mermaid] CLI and http://phantomjs.org[PhantomJS] 1.9.x
|
51
|
+
- PlantUML: http://www.graphviz.org[Graphviz] package for certain diagram types.
|
52
|
+
- Shaape: the Shaape Python package
|
47
53
|
- WaveDrom: the https://github.com/wavedrom/wavedrom.github.io/releases[WaveDrom editor] application
|
48
54
|
|
49
55
|
== Usage
|
@@ -58,6 +64,8 @@ In your script you can then either require one or more of the following files:
|
|
58
64
|
. `asciidoctor-diagram/blockdiag`: to enable the block/act/seq/nw diag extension
|
59
65
|
. `asciidoctor-diagram/ditaa`: to enable the ditaa extension
|
60
66
|
. `asciidoctor-diagram/graphviz`: to enable the graphviz extension
|
67
|
+
. `asciidoctor-diagram/meme`: to enable the mermaid extension
|
68
|
+
. `asciidoctor-diagram/mermaid`: to enable the mermaid extension
|
61
69
|
. `asciidoctor-diagram/plantuml`: to enable the plantuml extension
|
62
70
|
. `asciidoctor-diagram/shaape`: to enable the shaape extension
|
63
71
|
. `asciidoctor-diagram/wavedrom`: to enable the wavedrom extension
|
@@ -74,13 +82,16 @@ Once the extensions are enabled the following block types becomes available for
|
|
74
82
|
- `blockdiag`, `actdiag`, `seqdiag`, `nwdiag`, `rackdiag` and `packetdiag`
|
75
83
|
- `ditaa`
|
76
84
|
- `graphviz`
|
85
|
+
- `meme`
|
86
|
+
- `mermaid`
|
77
87
|
- `plantuml`
|
78
88
|
- `shaape`
|
79
89
|
- `wavedrom`
|
80
90
|
|
81
|
-
Detailed descriptions of the supported syntax inside these blocks is available on
|
91
|
+
Detailed descriptions of the supported syntax inside these blocks is available on websites of the respective projects.
|
82
92
|
|
83
|
-
At this point you can start adding diagrams to your application
|
93
|
+
At this point you can start adding diagrams to your application.
|
94
|
+
Here's an example to get you started:
|
84
95
|
|
85
96
|
----
|
86
97
|
["plantuml", "asciidoctor-diagram-classes", "png"]
|
@@ -96,16 +107,49 @@ DiagramBlock <|-- PlantUmlBlock
|
|
96
107
|
---------------------------------------------------------------------
|
97
108
|
----
|
98
109
|
|
99
|
-
|
110
|
+
All the diagram blocks except `meme` support the following attributes:
|
100
111
|
|
101
|
-
. `target` (
|
102
|
-
. `format` (
|
112
|
+
. `target` (1st positional attribute): the basename of the file to generate. If not specified an auto-generated name will be used.
|
113
|
+
. `format` (2nd positional attribute): the output format. PlantUML blocks support `png`, `svg` and `txt`. Graphviz, Shaape and BlockDiag support `png` and `svg`. Ditaa only supports `png`.
|
103
114
|
|
104
115
|
Once you have all of this in place and your original AsciiDoc file contains a diagram block, it's time to build it into an HTML file with Asciidoctor Diagram magic!
|
105
116
|
When executing Asciidoctor, you must reference the Adciidoctor Diagram library, otherwise your diagram blocks won't be recognized as such. When executing Asciidoctor from the command line, do it using the -r parameter to reference this external library:
|
106
117
|
|
118
|
+
----
|
107
119
|
$ asciidoctor -r asciidoctor-diagram doc.adoc
|
120
|
+
----
|
121
|
+
|
122
|
+
If you don't want to embed your diagram code in your document then you can use the diagram extension as block macros.
|
123
|
+
The target of diagram block macro should refer to the file containing the diagram source code.
|
124
|
+
The attributes for the block macros are the same as for the inline blocks.
|
125
|
+
The example above in block macro form becomes
|
126
|
+
|
127
|
+
----
|
128
|
+
plantuml::mydiagram.puml["asciidoctor-diagram-classes", "png"]
|
129
|
+
----
|
130
|
+
|
131
|
+
=== The meme extension
|
132
|
+
|
133
|
+
The meme extension provides a basic 'Advice Animal' style image generator.
|
134
|
+
It's usage is easiest to explain with an example.
|
135
|
+
|
136
|
+
----
|
137
|
+
meme::doge.jpg[Perhaps haters...,Just hate to \\ love?]
|
138
|
+
----
|
139
|
+
|
140
|
+
The target of the block macro tells the extension which image to use as background.
|
141
|
+
The first two positional attributes are `top` and `bottom` and are used for the top and bottom label.
|
142
|
+
Occurrences of ` \\ ` are interpreted as line breaks.
|
143
|
+
|
144
|
+
The block macro also supports the following named attributes:
|
108
145
|
|
146
|
+
. `fillColor`: the fill color for the text. Defaults to `white`.
|
147
|
+
. `strokeColor`: the outline color for the text. Defaults to `black`.
|
148
|
+
. `strokeWidth`: the width of the text outline. Defaults to `2`.
|
149
|
+
. `font`: the font face to use for the text. Defaults to `Impact`.
|
150
|
+
. `options`: a comma separate list of flags that modify the image rendering. Currently only `noupcase` is supported which disable upper casing the labels.
|
151
|
+
. `target` (3rd positional attribute): the basename of the file to generate. If not specified an auto-generated name will be used.
|
152
|
+
. `format` (4th positional attribute): the output image format. The meme extension supports `png` and `gif`.
|
109
153
|
|
110
154
|
== Contributing
|
111
155
|
|
Binary file
|
data/lib/asciidoctor-diagram.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
require 'asciidoctor-diagram/blockdiag'
|
2
2
|
require 'asciidoctor-diagram/ditaa'
|
3
3
|
require 'asciidoctor-diagram/graphviz'
|
4
|
+
require 'asciidoctor-diagram/meme'
|
5
|
+
require 'asciidoctor-diagram/mermaid'
|
4
6
|
require 'asciidoctor-diagram/plantuml'
|
5
7
|
require 'asciidoctor-diagram/salt'
|
6
8
|
require 'asciidoctor-diagram/shaape'
|
@@ -92,7 +92,7 @@ module Asciidoctor
|
|
92
92
|
|
93
93
|
[:png, :svg].each do |f|
|
94
94
|
register_format(f, :image) do |c, p|
|
95
|
-
CliGenerator.generate_stdin(which(p, tool.downcase), c.to_s) do |tool_path, output_path|
|
95
|
+
CliGenerator.generate_stdin(which(p, tool.downcase), f.to_s, c.to_s) do |tool_path, output_path|
|
96
96
|
[tool_path, '-o', output_path, "-T#{f.to_s}", '-']
|
97
97
|
end
|
98
98
|
end
|
@@ -73,16 +73,6 @@ module Asciidoctor
|
|
73
73
|
|
74
74
|
@options = options.join(' ')
|
75
75
|
end
|
76
|
-
|
77
|
-
def should_process?(image_file, image_metadata)
|
78
|
-
super(image_file, image_metadata) || image_metadata['options'] != @options
|
79
|
-
end
|
80
|
-
|
81
|
-
def create_image_metadata
|
82
|
-
metadata = super
|
83
|
-
metadata['options'] = @options
|
84
|
-
metadata
|
85
|
-
end
|
86
76
|
end
|
87
77
|
end
|
88
78
|
|
@@ -3,6 +3,7 @@ require 'digest'
|
|
3
3
|
require 'json'
|
4
4
|
require 'fileutils'
|
5
5
|
require_relative 'util/java'
|
6
|
+
require_relative 'util/gif'
|
6
7
|
require_relative 'util/png'
|
7
8
|
require_relative 'util/svg'
|
8
9
|
|
@@ -64,6 +65,10 @@ module Asciidoctor
|
|
64
65
|
:encoding => Encoding::UTF_8,
|
65
66
|
:decoder => SVG
|
66
67
|
},
|
68
|
+
:gif => {
|
69
|
+
:encoding => Encoding::ASCII_8BIT,
|
70
|
+
:decoder => GIF
|
71
|
+
},
|
67
72
|
:png => {
|
68
73
|
:encoding => Encoding::ASCII_8BIT,
|
69
74
|
:decoder => PNG
|
@@ -159,7 +164,7 @@ module Asciidoctor
|
|
159
164
|
metadata = source.create_image_metadata
|
160
165
|
metadata['width'], metadata['height'] = params[:decoder].get_image_size(result)
|
161
166
|
|
162
|
-
FileUtils.mkdir_p(
|
167
|
+
FileUtils.mkdir_p(File.dirname(image_file)) unless Dir.exist?(File.dirname(image_file))
|
163
168
|
File.open(image_file, 'wb') { |f| f.write result }
|
164
169
|
File.open(metadata_file, 'w') { |f| JSON.dump(metadata, f) }
|
165
170
|
end
|
@@ -260,7 +265,7 @@ module Asciidoctor
|
|
260
265
|
#
|
261
266
|
# @return [FileSource] a FileSource
|
262
267
|
def create_source(parent, target, attributes)
|
263
|
-
FileSource.new(
|
268
|
+
FileSource.new(target.empty? ? nil : parent.normalize_system_path(target, parent.document.base_dir), attributes)
|
264
269
|
end
|
265
270
|
end
|
266
271
|
|
@@ -331,9 +336,14 @@ module Asciidoctor
|
|
331
336
|
@checksum ||= compute_checksum(code)
|
332
337
|
end
|
333
338
|
|
339
|
+
private
|
334
340
|
def compute_checksum(code)
|
335
341
|
md5 = Digest::MD5.new
|
336
342
|
md5 << code
|
343
|
+
attributes.each do |k, v|
|
344
|
+
md5 << k.to_s if k
|
345
|
+
md5 << v.to_s if v
|
346
|
+
end
|
337
347
|
md5.hexdigest
|
338
348
|
end
|
339
349
|
end
|
@@ -362,8 +372,10 @@ module Asciidoctor
|
|
362
372
|
def image_name
|
363
373
|
if @attributes['target']
|
364
374
|
super
|
365
|
-
|
375
|
+
elsif @file_name
|
366
376
|
File.basename(@file_name, File.extname(@file_name))
|
377
|
+
else
|
378
|
+
checksum
|
367
379
|
end
|
368
380
|
end
|
369
381
|
|
@@ -372,9 +384,13 @@ module Asciidoctor
|
|
372
384
|
end
|
373
385
|
|
374
386
|
def code
|
375
|
-
|
376
|
-
|
377
|
-
|
387
|
+
if @file_name
|
388
|
+
lines = File.readlines(@file_name)
|
389
|
+
lines = ::Asciidoctor::Helpers.normalize_lines(lines)
|
390
|
+
@code ||= lines.join("\n")
|
391
|
+
else
|
392
|
+
@code ||= ''
|
393
|
+
end
|
378
394
|
end
|
379
395
|
end
|
380
396
|
end
|
@@ -11,7 +11,7 @@ module Asciidoctor
|
|
11
11
|
def self.included(mod)
|
12
12
|
[:png, :svg].each do |f|
|
13
13
|
mod.register_format(f, :image) do |c, p|
|
14
|
-
CliGenerator.generate_stdin(which(p, 'dot', :attr_names => ['dot', 'graphvizdot']), c.to_s) do |tool_path, output_path|
|
14
|
+
CliGenerator.generate_stdin(which(p, 'dot', :attr_names => ['dot', 'graphvizdot']), f.to_s, c.to_s) do |tool_path, output_path|
|
15
15
|
[tool_path, "-o#{output_path}", "-T#{f.to_s}"]
|
16
16
|
end
|
17
17
|
end
|
@@ -0,0 +1,116 @@
|
|
1
|
+
require_relative '../extensions'
|
2
|
+
require_relative '../util/cli_generator'
|
3
|
+
require_relative '../util/which'
|
4
|
+
require 'tempfile'
|
5
|
+
require 'open3'
|
6
|
+
|
7
|
+
module Asciidoctor
|
8
|
+
module Diagram
|
9
|
+
# @private
|
10
|
+
module Meme
|
11
|
+
include Which
|
12
|
+
|
13
|
+
def self.included(mod)
|
14
|
+
[:png, :gif].each do |format|
|
15
|
+
mod.register_format(format, :image) do |c, p|
|
16
|
+
convert = which(p, 'convert')
|
17
|
+
identify = which(p, 'identify')
|
18
|
+
|
19
|
+
attrs = c.attributes
|
20
|
+
bg_img = attrs["background"]
|
21
|
+
raise "background attribute is required" unless bg_img
|
22
|
+
|
23
|
+
bg_img = p.normalize_system_path(bg_img, p.document.attr('imagesdir'))
|
24
|
+
|
25
|
+
top_label = attrs["top"]
|
26
|
+
bottom_label = attrs["bottom"]
|
27
|
+
fill_color = attrs.fetch('fillColor', 'white')
|
28
|
+
stroke_color = attrs.fetch('strokeColor', 'black')
|
29
|
+
stroke_width = attrs.fetch('strokeWidth', '2')
|
30
|
+
font = attrs.fetch('font', 'Impact')
|
31
|
+
options = attrs.fetch('options', '').split(',')
|
32
|
+
noupcase = options.include?('noupcase')
|
33
|
+
|
34
|
+
dimensions = CliGenerator.run_cli(identify, '-format', '%w %h', bg_img).match /(?<w>\d+) (?<h>\d+)/
|
35
|
+
bg_width = dimensions['w'].to_i
|
36
|
+
bg_height = dimensions['h'].to_i
|
37
|
+
label_width = bg_width
|
38
|
+
label_height = bg_height / 5
|
39
|
+
|
40
|
+
if top_label
|
41
|
+
top_img = Tempfile.new(['meme', '.png'])
|
42
|
+
CliGenerator.run_cli(
|
43
|
+
convert,
|
44
|
+
'-background', 'none',
|
45
|
+
'-fill', fill_color,
|
46
|
+
'-stroke', stroke_color,
|
47
|
+
'-strokewidth', stroke_width,
|
48
|
+
'-font', font,
|
49
|
+
'-size', "#{label_width}x#{label_height}",
|
50
|
+
'-gravity', 'north',
|
51
|
+
"label:#{prepare_label(top_label, noupcase)}",
|
52
|
+
top_img.path
|
53
|
+
)
|
54
|
+
else
|
55
|
+
top_img = nil
|
56
|
+
end
|
57
|
+
|
58
|
+
if bottom_label
|
59
|
+
bottom_img = Tempfile.new(['meme', '.png'])
|
60
|
+
CliGenerator.run_cli(
|
61
|
+
convert,
|
62
|
+
'-background', 'none',
|
63
|
+
'-fill', fill_color,
|
64
|
+
'-stroke', stroke_color,
|
65
|
+
'-strokewidth', stroke_width,
|
66
|
+
'-font', font,
|
67
|
+
'-size', "#{label_width}x#{label_height}",
|
68
|
+
'-gravity', 'south',
|
69
|
+
"label:#{prepare_label(bottom_label, noupcase)}",
|
70
|
+
bottom_img.path
|
71
|
+
)
|
72
|
+
else
|
73
|
+
bottom_img = nil
|
74
|
+
end
|
75
|
+
|
76
|
+
final_img = Tempfile.new(['meme', ".#{format.to_s}"])
|
77
|
+
|
78
|
+
args = [convert, bg_img]
|
79
|
+
if top_img
|
80
|
+
args << top_img.path << '-geometry'<< '+0+0' << '-composite'
|
81
|
+
end
|
82
|
+
|
83
|
+
if bottom_img
|
84
|
+
args << bottom_img.path << '-geometry'<< "+0+#{bg_height - label_height}" << '-composite'
|
85
|
+
end
|
86
|
+
|
87
|
+
args << final_img.path
|
88
|
+
|
89
|
+
CliGenerator.run_cli(*args)
|
90
|
+
|
91
|
+
File.binread(final_img)
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
private
|
97
|
+
def prepare_label(label, noupcase)
|
98
|
+
label = label.upcase unless noupcase
|
99
|
+
label = label.gsub(' // ', '\n')
|
100
|
+
label
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
class MemeBlockMacroProcessor < Extensions::DiagramBlockMacroProcessor
|
105
|
+
include Meme
|
106
|
+
|
107
|
+
option :pos_attrs, %w(top bottom target format)
|
108
|
+
|
109
|
+
def create_source(parent, target, attributes)
|
110
|
+
attributes = attributes.dup
|
111
|
+
attributes['background'] = target
|
112
|
+
::Asciidoctor::Diagram::Extensions::FileSource.new(nil, attributes)
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
require 'asciidoctor/extensions'
|
2
|
+
require_relative 'version'
|
3
|
+
|
4
|
+
Asciidoctor::Extensions.register do
|
5
|
+
require_relative 'mermaid/extension'
|
6
|
+
|
7
|
+
block Asciidoctor::Diagram::MermaidBlockProcessor, :mermaid
|
8
|
+
block_macro Asciidoctor::Diagram::MermaidBlockMacroProcessor, :mermaid
|
9
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require_relative '../extensions'
|
2
|
+
require_relative '../util/cli_generator'
|
3
|
+
require_relative '../util/which'
|
4
|
+
|
5
|
+
module Asciidoctor
|
6
|
+
module Diagram
|
7
|
+
# @private
|
8
|
+
module Mermaid
|
9
|
+
include Which
|
10
|
+
|
11
|
+
def self.included(mod)
|
12
|
+
[:png, :svg].each do |f|
|
13
|
+
mod.register_format(f, :image) do |c, p|
|
14
|
+
mermaid = which(p, 'mermaid')
|
15
|
+
|
16
|
+
seq_config = c.attributes['sequenceConfig'] || p.attr('sequenceConfig')
|
17
|
+
if seq_config
|
18
|
+
seq_config = p.normalize_system_path(seq_config, p.document.base_dir)
|
19
|
+
end
|
20
|
+
|
21
|
+
width = c.attributes['width']
|
22
|
+
|
23
|
+
CliGenerator.generate_file(mermaid, f.to_s, c.to_s) do |tool_path, input_path, output_path|
|
24
|
+
output_dir = File.dirname(output_path)
|
25
|
+
output_file = File.expand_path(File.basename(input_path) + ".#{f.to_s}", output_dir)
|
26
|
+
|
27
|
+
args = [tool_path, "--#{f.to_s}", '-o', output_dir]
|
28
|
+
|
29
|
+
if seq_config
|
30
|
+
args << '--sequenceConfig' << seq_config
|
31
|
+
end
|
32
|
+
|
33
|
+
if width
|
34
|
+
args << '--width' << width
|
35
|
+
end
|
36
|
+
|
37
|
+
args << input_path
|
38
|
+
|
39
|
+
{
|
40
|
+
:args => args,
|
41
|
+
:out_file => output_file
|
42
|
+
}
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
class MermaidBlockProcessor < Extensions::DiagramBlockProcessor
|
50
|
+
include Mermaid
|
51
|
+
end
|
52
|
+
|
53
|
+
class MermaidBlockMacroProcessor < Extensions::DiagramBlockMacroProcessor
|
54
|
+
include Mermaid
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|