asciidoctor-diagram 2.1.0 → 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.adoc +13 -0
- data/docs/antora.yml +1 -1
- data/docs/modules/ROOT/partials/advanced.adoc +13 -5
- data/docs/modules/ROOT/partials/create_diagram.adoc +1 -0
- data/docs/modules/ROOT/partials/uris.adoc +2 -0
- data/lib/asciidoctor-diagram.rb +1 -0
- data/lib/asciidoctor-diagram/diagram_converter.rb +4 -0
- data/lib/asciidoctor-diagram/diagram_processor.rb +2 -2
- data/lib/asciidoctor-diagram/diagram_source.rb +7 -7
- data/lib/asciidoctor-diagram/diagrams.rb +7 -0
- data/lib/asciidoctor-diagram/diagrams/converter.rb +49 -0
- data/lib/asciidoctor-diagram/diagrams/extension.rb +14 -0
- data/lib/asciidoctor-diagram/ditaa/ditaa-1.3.20.jar +0 -0
- data/lib/asciidoctor-diagram/http/server.rb +1 -1
- data/lib/asciidoctor-diagram/plantuml/converter.rb +53 -34
- data/lib/asciidoctor-diagram/plantuml/plantuml-1.3.20.jar +0 -0
- data/lib/asciidoctor-diagram/util/cli_generator.rb +9 -7
- data/lib/asciidoctor-diagram/util/server-1.3.20.jar +0 -0
- data/lib/asciidoctor-diagram/version.rb +1 -1
- data/spec/a2s_spec.rb +2 -2
- data/spec/bytefield_spec.rb +2 -2
- data/spec/diagrams_spec.rb +23 -0
- data/spec/msc_spec.rb +3 -3
- data/spec/nomnoml_spec.rb +2 -2
- data/spec/plantuml_spec.rb +50 -0
- data/spec/smcat_spec.rb +3 -3
- metadata +16 -10
- data/lib/asciidoctor-diagram/ditaa/ditaa-1.3.17.jar +0 -0
- data/lib/asciidoctor-diagram/plantuml/plantuml-1.3.17.jar +0 -0
- data/lib/asciidoctor-diagram/util/server-1.3.17.jar +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 674abb9267b7d32b26a63f665dff96822efea03927e194109c6301cd14530b51
|
4
|
+
data.tar.gz: fb94061afb3aefd801ea7c23bdd4e1306e45bffbdaeeeff34fb6f53f5a131324
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 46b3d4f0ff19bf97ca232f4531fa94d7a56d102de08500254a916fded1e2232c905dc540cc4b3e76279a690f105b42782211dc9f93ea13eb3dce873d54708e1a
|
7
|
+
data.tar.gz: 17891073b283b12280e2d118cd3b66a253fd8e74f30a41cae7431b47cbb663fd74cf6b80fe9d463410d991b86c0d1d55dd29bc76afd37db1653d3cccb8abe3fe
|
data/CHANGELOG.adoc
CHANGED
@@ -1,5 +1,18 @@
|
|
1
1
|
= Asciidoctor-diagram Changelog
|
2
2
|
|
3
|
+
== 2.1.1
|
4
|
+
|
5
|
+
Enhancements::
|
6
|
+
|
7
|
+
* Issue #335: The PlantUML preprocessor is now run locally before delegating rendering to Kroki.
|
8
|
+
This avoids file not found errors when using the PlantUML `!include` directive.
|
9
|
+
* Issue #339: Add support for a `size-limit` attribute on PlantUML blocks that controls the maximum size of PlantUML diagrams.
|
10
|
+
* Issue #341: Add support for https://diagrams.mingrammer.com[Minigrammer Diagrams].
|
11
|
+
|
12
|
+
Bug Fixes::
|
13
|
+
|
14
|
+
* Issue #343: The PlantUML preprocessor is now used to resolve `!include` statements instead of using the previous logic provided by this gem.
|
15
|
+
|
3
16
|
== 2.1.0
|
4
17
|
|
5
18
|
Enhancements::
|
data/docs/antora.yml
CHANGED
@@ -16,7 +16,7 @@ or load and register each extension individually.
|
|
16
16
|
require 'asciidoctor-diagram/<extension_name>'
|
17
17
|
----
|
18
18
|
|
19
|
-
`<extension_name>` can be one of `a2s`, `blockdiag`, `bytefield`, `ditaa`, `dpic`, `erd`, `gnuplot`, `graphviz`, `meme`, `mermaid`, `msc`, `pikchr`, `plantuml`, `shaape`, `smcat`, `svgbob`, `syntrax`, `umlet`, `vega` or `wavedrom`.
|
19
|
+
`<extension_name>` can be one of `a2s`, `blockdiag`, `bytefield`, `diagrams`, `ditaa`, `dpic`, `erd`, `gnuplot`, `graphviz`, `meme`, `mermaid`, `msc`, `pikchr`, `plantuml`, `shaape`, `smcat`, `svgbob`, `syntrax`, `umlet`, `vega` or `wavedrom`.
|
20
20
|
|
21
21
|
Requiring one or more of these files will automatically register the extensions for all processed documents.
|
22
22
|
|
@@ -73,6 +73,7 @@ The following table lists the tools that are required for each diagram type, the
|
|
73
73
|
|blockdiag |{uri-blockdiag}[BlockDiag] |`blockdiag`
|
74
74
|
|bpmn |{uri-bpmn}[bpmn-js-cmd] |`bpmn`
|
75
75
|
|bytefield |{uri-bytefield}[bytefield-svg] |`bytefield-svg`
|
76
|
+
|diagrams |{uri-python}[Python] |`diagrams-python`
|
76
77
|
|ditaa |{uri-java}[Java] |`java`
|
77
78
|
|dpic |{uri-dpic}[dpic] |`dpic`
|
78
79
|
|erd |{uri-erd}[Erd] |`erd`
|
@@ -140,18 +141,20 @@ This is illustrated for the blockdiag `fontpath` attribute in the example below.
|
|
140
141
|
<1> Attributes can be specified for all diagram of a certain type at the document level by prefixing them with `<blocktype>-`.
|
141
142
|
In this example, the `fontpath` attribute is specified for all diagrams of type `blockdiag`.
|
142
143
|
<2> The first diagram does not specify an explicit value for `fontpath` so the global `blockdiag-fontpath` value will be used
|
143
|
-
<3> The second diagram does
|
144
|
+
<3> The second diagram does specify a `fontpath` value.
|
144
145
|
This overrides the global `blockdiag-fontpath` value.
|
145
146
|
|
146
147
|
Each attribute can either be specified at the block level or at the document level.
|
147
|
-
The attribute name at the
|
148
|
+
The attribute name at the document level should be prefixed with the diagram type name and a dash.
|
148
149
|
|
149
150
|
==== Shared Attributes
|
150
151
|
|
151
152
|
[cols=">,<,<",options="header"]
|
152
153
|
|===
|
153
154
|
|Name |Default value |Description
|
154
|
-
|svg-type |unspecified |One of `static`, `inline` or `interactive`.
|
155
|
+
|svg-type |unspecified |One of `static`, `inline` or `interactive`.
|
156
|
+
This determines the style of SVG embedding that's used in certain backends.
|
157
|
+
The xref:asciidoc:macros:image-svg.adoc[asciidoc spec] describes this in more detail.
|
155
158
|
|===
|
156
159
|
|
157
160
|
==== AsciiToSVG
|
@@ -180,6 +183,10 @@ The attribute name at the block level should be prefixed with the name of the di
|
|
180
183
|
|width |1024 |The target width of the diagram. Does not apply for output type `svg`.
|
181
184
|
|===
|
182
185
|
|
186
|
+
==== Diagrams
|
187
|
+
|
188
|
+
No specific attributes.
|
189
|
+
|
183
190
|
==== Ditaa
|
184
191
|
|
185
192
|
[cols=">,<,<",options="header"]
|
@@ -261,6 +268,7 @@ The attribute name at the block level should be prefixed with the name of the di
|
|
261
268
|
|===
|
262
269
|
|Name |Default value |Description
|
263
270
|
|config |unspecified |Path to a config file to pass to PlantUML.
|
271
|
+
|size-limit |4096 |The maximum dimensions (width and height) of generated diagrams.
|
264
272
|
|===
|
265
273
|
|
266
274
|
==== State Machine Cat
|
@@ -300,4 +308,4 @@ The attribute name at the block level should be prefixed with the name of the di
|
|
300
308
|
|===
|
301
309
|
|Name |Default value |Description
|
302
310
|
|preamble |unspecified |Code definitions to pass to TikZ.
|
303
|
-
|===
|
311
|
+
|===
|
@@ -26,6 +26,7 @@ The following diagram types and output formats are available:
|
|
26
26
|
|{uri-blockdiag}[blockdiag] | |{check}|{check}|{check}|
|
27
27
|
|{uri-bpmn}[bpmn] | |{check}|{check}|{check}|
|
28
28
|
|{uri-bytefield}[bytefield] | | | |{check}|
|
29
|
+
|{uri-diagrams}[diagrams] | |{check}|{check}|{check}|
|
29
30
|
|{uri-ditaa}[ditaa] | | |{check}|{check}|
|
30
31
|
|{uri-dpic}[dpic] | | | |{check}|
|
31
32
|
|{uri-erd}[erd] | | |{check}|{check}|
|
@@ -5,6 +5,7 @@
|
|
5
5
|
:uri-blockdiag: http://blockdiag.com
|
6
6
|
:uri-bpmn: https://github.com/gtudan/bpmn-js-cmd
|
7
7
|
:uri-bytefield: https://github.com/Deep-Symmetry/bytefield-svg
|
8
|
+
:uri-diagrams: https://diagrams.mingrammer.com
|
8
9
|
:uri-ditaa: http://ditaa.sourceforge.net/
|
9
10
|
:uri-dpic: https://gitlab.com/aplevich/dpic
|
10
11
|
:uri-dot: https://graphviz.gitlab.io/_pages/doc/info/lang.html
|
@@ -22,6 +23,7 @@
|
|
22
23
|
:uri-pikchr: https://pikchr.org
|
23
24
|
:uri-plantuml: http://plantuml.sourceforge.net
|
24
25
|
:uri-py-plantuml: https://code.google.com/p/asciidoc-plantuml/
|
26
|
+
:uri-python: https://www.python.org
|
25
27
|
:uri-rackdiag: http://blockdiag.com/en/nwdiag/index.html
|
26
28
|
:uri-seqdiag: http://blockdiag.com/en/seqdiag/index.html
|
27
29
|
:uri-shaape: https://github.com/christiangoltz/shaape
|
data/lib/asciidoctor-diagram.rb
CHANGED
@@ -2,6 +2,7 @@ require_relative 'asciidoctor-diagram/a2s'
|
|
2
2
|
require_relative 'asciidoctor-diagram/blockdiag'
|
3
3
|
require_relative 'asciidoctor-diagram/bpmn'
|
4
4
|
require_relative 'asciidoctor-diagram/bytefield'
|
5
|
+
require_relative 'asciidoctor-diagram/diagrams'
|
5
6
|
require_relative 'asciidoctor-diagram/ditaa'
|
6
7
|
require_relative 'asciidoctor-diagram/dpic'
|
7
8
|
require_relative 'asciidoctor-diagram/erd'
|
@@ -61,10 +61,10 @@ module Asciidoctor
|
|
61
61
|
location = parent.document.reader.cursor_at_mark
|
62
62
|
|
63
63
|
normalised_attributes = attributes.inject({}) { |h, (k, v)| h[normalise_attribute_name(k)] = v; h }
|
64
|
-
source = create_source(parent, reader_or_target, normalised_attributes)
|
65
|
-
|
66
64
|
converter = config[:converter].new
|
67
65
|
|
66
|
+
source = converter.wrap_source(create_source(parent, reader_or_target, normalised_attributes))
|
67
|
+
|
68
68
|
supported_formats = converter.supported_formats
|
69
69
|
|
70
70
|
begin
|
@@ -19,6 +19,10 @@ module Asciidoctor
|
|
19
19
|
# @return [String] the String representation of the source code for the diagram
|
20
20
|
# @abstract
|
21
21
|
def code
|
22
|
+
@code ||= load_code
|
23
|
+
end
|
24
|
+
|
25
|
+
def load_code
|
22
26
|
raise NotImplementedError.new
|
23
27
|
end
|
24
28
|
|
@@ -233,8 +237,8 @@ module Asciidoctor
|
|
233
237
|
@reader = reader
|
234
238
|
end
|
235
239
|
|
236
|
-
def
|
237
|
-
@
|
240
|
+
def load_code
|
241
|
+
@parent_block.apply_subs(@reader.lines, resolve_diagram_subs).join("\n")
|
238
242
|
end
|
239
243
|
end
|
240
244
|
|
@@ -267,11 +271,7 @@ module Asciidoctor
|
|
267
271
|
(@file_name && File.mtime(@file_name) > File.mtime(image_file)) || super
|
268
272
|
end
|
269
273
|
|
270
|
-
def
|
271
|
-
@code ||= read_code
|
272
|
-
end
|
273
|
-
|
274
|
-
def read_code
|
274
|
+
def load_code
|
275
275
|
if @file_name
|
276
276
|
lines = File.readlines(@file_name)
|
277
277
|
lines = prepare_source_array(lines)
|
@@ -0,0 +1,49 @@
|
|
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 DiagramsConverter
|
9
|
+
include DiagramConverter
|
10
|
+
include CliGenerator
|
11
|
+
|
12
|
+
|
13
|
+
def supported_formats
|
14
|
+
[:png, :svg, :pdf]
|
15
|
+
end
|
16
|
+
|
17
|
+
def convert(source, format, options)
|
18
|
+
python_path = source.find_command('python3', :attrs => ['diagrams-python'], :alt_cmds => ['python'])
|
19
|
+
|
20
|
+
code = source.to_s
|
21
|
+
|
22
|
+
match_data = /Diagram\((.*?)\)/.match(code)
|
23
|
+
raise "Could not find Diagram constructor" unless match_data
|
24
|
+
|
25
|
+
args = match_data[1].strip
|
26
|
+
|
27
|
+
target_file = Tempfile.new('diagrams')
|
28
|
+
|
29
|
+
diagram = 'Diagram('
|
30
|
+
diagram << args
|
31
|
+
diagram << ',' unless args.empty?
|
32
|
+
diagram << "filename=\"#{target_file.path}\""
|
33
|
+
diagram << ",outformat=\"#{format}\""
|
34
|
+
diagram << ')'
|
35
|
+
|
36
|
+
code = match_data.pre_match + diagram + match_data.post_match
|
37
|
+
|
38
|
+
begin
|
39
|
+
target_file.close
|
40
|
+
generate_stdin_file(python_path, code, target_file.path + ".#{format}") do |tool|
|
41
|
+
[tool, '-']
|
42
|
+
end
|
43
|
+
ensure
|
44
|
+
target_file.unlink
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require_relative 'converter'
|
2
|
+
require_relative '../diagram_processor'
|
3
|
+
|
4
|
+
module Asciidoctor
|
5
|
+
module Diagram
|
6
|
+
class DiagramsBlockProcessor < DiagramBlockProcessor
|
7
|
+
use_converter DiagramsConverter
|
8
|
+
end
|
9
|
+
|
10
|
+
class DiagramsBlockMacroProcessor < DiagramBlockMacroProcessor
|
11
|
+
use_converter DiagramsConverter
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
Binary file
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require_relative '../diagram_converter'
|
2
|
+
require 'delegate'
|
2
3
|
require 'uri'
|
3
4
|
|
4
5
|
module Asciidoctor
|
@@ -23,20 +24,24 @@ module Asciidoctor
|
|
23
24
|
Java.classpath.concat Dir[File.join(File.dirname(__FILE__), '*.jar')].freeze
|
24
25
|
Java.classpath.concat PLANTUML_JARS
|
25
26
|
|
27
|
+
def wrap_source(source)
|
28
|
+
PlantUMLPreprocessedSource.new(source, self.class.tag)
|
29
|
+
end
|
30
|
+
|
26
31
|
def supported_formats
|
27
32
|
[:png, :svg, :txt, :atxt, :utxt]
|
28
33
|
end
|
29
34
|
|
30
35
|
def collect_options(source)
|
31
36
|
{
|
32
|
-
:
|
37
|
+
:size_limit => source.attr('size-limit', '4096')
|
33
38
|
}
|
34
39
|
end
|
35
40
|
|
36
41
|
def convert(source, format, options)
|
37
42
|
Java.load
|
38
43
|
|
39
|
-
code =
|
44
|
+
code = source.code
|
40
45
|
|
41
46
|
case format
|
42
47
|
when :png
|
@@ -55,9 +60,9 @@ module Asciidoctor
|
|
55
60
|
'Accept' => mime_type
|
56
61
|
}
|
57
62
|
|
58
|
-
|
59
|
-
if
|
60
|
-
headers['X-PlantUML-
|
63
|
+
size_limit = options[:size_limit]
|
64
|
+
if size_limit
|
65
|
+
headers['X-PlantUML-SizeLimit'] = size_limit
|
61
66
|
end
|
62
67
|
|
63
68
|
dot = source.find_command('dot', :alt_attrs => ['graphvizdot'], :raise_on_error => false)
|
@@ -77,35 +82,6 @@ module Asciidoctor
|
|
77
82
|
|
78
83
|
response[:body]
|
79
84
|
end
|
80
|
-
|
81
|
-
def preprocess_code(source, tag)
|
82
|
-
code = source.to_s
|
83
|
-
|
84
|
-
code = "@start#{tag}\n#{code}\n@end#{tag}" unless code.index("@start") && code.index("@end")
|
85
|
-
|
86
|
-
code.gsub!(/(?<=<img:)[^>]+(?=>)/) do |match|
|
87
|
-
resolve_path(match, source, source.attr('imagesdir', nil, false))
|
88
|
-
end
|
89
|
-
|
90
|
-
code.gsub!(/(?:(?<=!include\s)|(?<=!includesub\s))\s*[^<][^!\n\r]+/) do |match|
|
91
|
-
resolve_path(match.lstrip, source, source.base_dir)
|
92
|
-
end
|
93
|
-
|
94
|
-
code
|
95
|
-
end
|
96
|
-
|
97
|
-
def resolve_path(path, source, base_dir)
|
98
|
-
if path =~ ::URI::ABS_URI
|
99
|
-
uri = ::URI.parse(path)
|
100
|
-
if uri.scheme == 'file'
|
101
|
-
source.resolve_path(uri.path, base_dir)
|
102
|
-
else
|
103
|
-
path
|
104
|
-
end
|
105
|
-
else
|
106
|
-
source.resolve_path(path, base_dir)
|
107
|
-
end
|
108
|
-
end
|
109
85
|
end
|
110
86
|
|
111
87
|
class UmlConverter < PlantUmlConverter
|
@@ -119,5 +95,48 @@ module Asciidoctor
|
|
119
95
|
'salt'
|
120
96
|
end
|
121
97
|
end
|
98
|
+
|
99
|
+
class PlantUMLPreprocessedSource < SimpleDelegator
|
100
|
+
def initialize(source, tag)
|
101
|
+
super(source)
|
102
|
+
@tag = tag
|
103
|
+
end
|
104
|
+
|
105
|
+
def code
|
106
|
+
@code ||= load_code
|
107
|
+
end
|
108
|
+
|
109
|
+
def load_code
|
110
|
+
Java.load
|
111
|
+
|
112
|
+
code = __getobj__.code
|
113
|
+
|
114
|
+
code = "@start#{@tag}\n#{code}\n@end#{@tag}" unless code.index("@start") && code.index("@end")
|
115
|
+
|
116
|
+
headers = {}
|
117
|
+
|
118
|
+
config_file = attr('plantumlconfig', nil, true) || attr('config')
|
119
|
+
if config_file
|
120
|
+
headers['X-PlantUML-Config'] = File.expand_path(config_file, base_dir)
|
121
|
+
end
|
122
|
+
|
123
|
+
headers['X-PlantUML-Basedir'] = Platform.native_path(File.expand_path(base_dir))
|
124
|
+
|
125
|
+
response = Java.send_request(
|
126
|
+
:url => '/plantumlpreprocessor',
|
127
|
+
:body => code,
|
128
|
+
:headers => headers
|
129
|
+
)
|
130
|
+
|
131
|
+
unless response[:code] == 200
|
132
|
+
raise Java.create_error("PlantUML preprocessing failed", response)
|
133
|
+
end
|
134
|
+
|
135
|
+
code = response[:body]
|
136
|
+
code.force_encoding(Encoding::UTF_8)
|
137
|
+
|
138
|
+
code
|
139
|
+
end
|
140
|
+
end
|
122
141
|
end
|
123
142
|
end
|
Binary file
|
@@ -9,20 +9,22 @@ module Asciidoctor
|
|
9
9
|
include Asciidoctor::Logging
|
10
10
|
|
11
11
|
def generate_stdin(tool, format, code)
|
12
|
-
|
13
|
-
|
14
|
-
target_file = Tempfile.new([tool_name, ".#{format}"])
|
12
|
+
target_file = Tempfile.new([File.basename(tool), ".#{format}"])
|
15
13
|
begin
|
16
14
|
target_file.close
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
generate(opts, target_file.path, :stdin_data => code)
|
15
|
+
generate_stdin_file(tool, code, target_file.path) do |t|
|
16
|
+
yield t, target_file.path
|
17
|
+
end
|
21
18
|
ensure
|
22
19
|
target_file.unlink
|
23
20
|
end
|
24
21
|
end
|
25
22
|
|
23
|
+
def generate_stdin_file(tool, code, target_file_path)
|
24
|
+
opts = yield tool
|
25
|
+
generate(opts, target_file_path, :stdin_data => code)
|
26
|
+
end
|
27
|
+
|
26
28
|
def generate_stdin_stdout(tool, code)
|
27
29
|
if block_given?
|
28
30
|
opts = yield tool
|
Binary file
|
data/spec/a2s_spec.rb
CHANGED
@@ -20,10 +20,10 @@ code = <<-eos
|
|
20
20
|
'---------------------------------------'
|
21
21
|
eos
|
22
22
|
|
23
|
-
describe Asciidoctor::Diagram::AsciiToSvgBlockMacroProcessor
|
23
|
+
describe Asciidoctor::Diagram::AsciiToSvgBlockMacroProcessor do
|
24
24
|
include_examples "block_macro", :a2s, code, [:svg]
|
25
25
|
end
|
26
26
|
|
27
|
-
describe Asciidoctor::Diagram::AsciiToSvgBlockProcessor
|
27
|
+
describe Asciidoctor::Diagram::AsciiToSvgBlockProcessor do
|
28
28
|
include_examples "block", :svgbob, code, [:svg]
|
29
29
|
end
|
data/spec/bytefield_spec.rb
CHANGED
@@ -83,10 +83,10 @@ code = <<-eos
|
|
83
83
|
(draw-bottom)
|
84
84
|
eos
|
85
85
|
|
86
|
-
describe Asciidoctor::Diagram::BytefieldBlockMacroProcessor
|
86
|
+
describe Asciidoctor::Diagram::BytefieldBlockMacroProcessor do
|
87
87
|
include_examples "block_macro", :bytefield, code, [:svg]
|
88
88
|
end
|
89
89
|
|
90
|
-
describe Asciidoctor::Diagram::BytefieldBlockProcessor
|
90
|
+
describe Asciidoctor::Diagram::BytefieldBlockProcessor do
|
91
91
|
include_examples "block", :bytefield, code, [:svg]
|
92
92
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require_relative 'test_helper'
|
2
|
+
|
3
|
+
code = <<-eos
|
4
|
+
from diagrams import Diagram
|
5
|
+
from diagrams.aws.compute import EC2
|
6
|
+
from diagrams.aws.database import RDS
|
7
|
+
from diagrams.aws.network import ELB
|
8
|
+
|
9
|
+
with Diagram("Grouped Workers", show=False, direction="TB"):
|
10
|
+
ELB("lb") >> [EC2("worker1"),
|
11
|
+
EC2("worker2"),
|
12
|
+
EC2("worker3"),
|
13
|
+
EC2("worker4"),
|
14
|
+
EC2("worker5")] >> RDS("events")
|
15
|
+
eos
|
16
|
+
|
17
|
+
describe Asciidoctor::Diagram::DiagramsBlockMacroProcessor do
|
18
|
+
include_examples "block_macro", :diagrams, code, [:png, :svg]
|
19
|
+
end
|
20
|
+
|
21
|
+
describe Asciidoctor::Diagram::DiagramsBlockProcessor do
|
22
|
+
include_examples "block", :diagrams, code, [:png, :svg]
|
23
|
+
end
|
data/spec/msc_spec.rb
CHANGED
@@ -24,10 +24,10 @@ msc {
|
|
24
24
|
}
|
25
25
|
eos
|
26
26
|
|
27
|
-
describe Asciidoctor::Diagram::MscBlockMacroProcessor
|
27
|
+
describe Asciidoctor::Diagram::MscBlockMacroProcessor do
|
28
28
|
include_examples "block_macro", :msc, code, [:png, :svg]
|
29
29
|
end
|
30
30
|
|
31
|
-
describe Asciidoctor::Diagram::MscBlockProcessor
|
31
|
+
describe Asciidoctor::Diagram::MscBlockProcessor do
|
32
32
|
include_examples "block", :msc, code, [:png, :svg]
|
33
|
-
end
|
33
|
+
end
|
data/spec/nomnoml_spec.rb
CHANGED
@@ -27,6 +27,6 @@ describe Asciidoctor::Diagram::NomnomlBlockMacroProcessor do
|
|
27
27
|
include_examples "block_macro", :nomnoml, code, [:svg]
|
28
28
|
end
|
29
29
|
|
30
|
-
describe Asciidoctor::Diagram::NomnomlBlockProcessor
|
30
|
+
describe Asciidoctor::Diagram::NomnomlBlockProcessor do
|
31
31
|
include_examples "block", :nomnoml, code, [:svg]
|
32
|
-
end
|
32
|
+
end
|
data/spec/plantuml_spec.rb
CHANGED
@@ -591,4 +591,54 @@ Bob; Alice; foo
|
|
591
591
|
load_asciidoc doc
|
592
592
|
}.to raise_error(/syntax error/i)
|
593
593
|
end
|
594
|
+
|
595
|
+
it "should support complex preprocessor usage" do
|
596
|
+
doc = <<-eos
|
597
|
+
= Hello, PlantUML!
|
598
|
+
Doc Writer <doc@example.com>
|
599
|
+
|
600
|
+
== First Section
|
601
|
+
|
602
|
+
[plantuml,format="png"]
|
603
|
+
----
|
604
|
+
@startuml
|
605
|
+
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml
|
606
|
+
|
607
|
+
!define DEVICONS https://raw.githubusercontent.com/tupadr3/plantuml-icon-font-sprites/master/devicons
|
608
|
+
!define FONTAWESOME https://raw.githubusercontent.com/tupadr3/plantuml-icon-font-sprites/master/font-awesome-5
|
609
|
+
!include DEVICONS/angular.puml
|
610
|
+
!include DEVICONS/java.puml
|
611
|
+
!include DEVICONS/msql_server.puml
|
612
|
+
!include FONTAWESOME/users.puml
|
613
|
+
|
614
|
+
LAYOUT_WITH_LEGEND()
|
615
|
+
|
616
|
+
Person(user, "Customer", "People that need products", "users")
|
617
|
+
Container(spa, "SPA", "angular", "The main interface that the customer interacts with", "angular")
|
618
|
+
Container(api, "API", "java", "Handles all business logic", "java")
|
619
|
+
ContainerDb(db, "Database", "Microsoft SQL", "Holds product, order and invoice information", "msql_server")
|
620
|
+
|
621
|
+
Rel(user, spa, "Uses", "https")
|
622
|
+
Rel(spa, api, "Uses", "https")
|
623
|
+
Rel_R(api, db, "Reads/Writes")
|
624
|
+
@enduml
|
625
|
+
----
|
626
|
+
eos
|
627
|
+
|
628
|
+
d = load_asciidoc doc
|
629
|
+
expect(d).to_not be_nil
|
630
|
+
|
631
|
+
b = d.find { |bl| bl.context == :image }
|
632
|
+
expect(b).to_not be_nil
|
633
|
+
|
634
|
+
expect(b.content_model).to eq :empty
|
635
|
+
|
636
|
+
target = b.attributes['target']
|
637
|
+
expect(target).to_not be_nil
|
638
|
+
expect(target).to match(/\.png$/)
|
639
|
+
expect(File.exist?(target)).to be true
|
640
|
+
|
641
|
+
expect(b.attributes['width']).to_not be_nil
|
642
|
+
expect(b.attributes['height']).to_not be_nil
|
643
|
+
end
|
594
644
|
end
|
data/spec/smcat_spec.rb
CHANGED
@@ -17,10 +17,10 @@ testing => "on backlog" : test not ok;
|
|
17
17
|
testing => final : test ok;
|
18
18
|
eos
|
19
19
|
|
20
|
-
describe Asciidoctor::Diagram::SmcatBlockMacroProcessor
|
20
|
+
describe Asciidoctor::Diagram::SmcatBlockMacroProcessor do
|
21
21
|
include_examples "block_macro", :smcat, code, [:svg]
|
22
22
|
end
|
23
23
|
|
24
|
-
describe Asciidoctor::Diagram::SmcatBlockProcessor
|
24
|
+
describe Asciidoctor::Diagram::SmcatBlockProcessor do
|
25
25
|
include_examples "block", :smcat, code, [:svg]
|
26
|
-
end
|
26
|
+
end
|
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: 2.1.
|
4
|
+
version: 2.1.1
|
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: 2021-
|
11
|
+
date: 2021-03-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -78,14 +78,14 @@ dependencies:
|
|
78
78
|
requirements:
|
79
79
|
- - "~>"
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version:
|
81
|
+
version: 1.0.0
|
82
82
|
type: :runtime
|
83
83
|
prerelease: false
|
84
84
|
version_requirements: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|
86
86
|
- - "~>"
|
87
87
|
- !ruby/object:Gem::Version
|
88
|
-
version:
|
88
|
+
version: 1.0.0
|
89
89
|
- !ruby/object:Gem::Dependency
|
90
90
|
name: asciidoctor-diagram-plantuml
|
91
91
|
requirement: !ruby/object:Gem::Requirement
|
@@ -154,9 +154,12 @@ files:
|
|
154
154
|
- lib/asciidoctor-diagram/diagram_converter.rb
|
155
155
|
- lib/asciidoctor-diagram/diagram_processor.rb
|
156
156
|
- lib/asciidoctor-diagram/diagram_source.rb
|
157
|
+
- lib/asciidoctor-diagram/diagrams.rb
|
158
|
+
- lib/asciidoctor-diagram/diagrams/converter.rb
|
159
|
+
- lib/asciidoctor-diagram/diagrams/extension.rb
|
157
160
|
- lib/asciidoctor-diagram/ditaa.rb
|
158
161
|
- lib/asciidoctor-diagram/ditaa/converter.rb
|
159
|
-
- lib/asciidoctor-diagram/ditaa/ditaa-1.3.
|
162
|
+
- lib/asciidoctor-diagram/ditaa/ditaa-1.3.20.jar
|
160
163
|
- lib/asciidoctor-diagram/ditaa/extension.rb
|
161
164
|
- lib/asciidoctor-diagram/dpic.rb
|
162
165
|
- lib/asciidoctor-diagram/dpic/converter.rb
|
@@ -193,7 +196,7 @@ files:
|
|
193
196
|
- lib/asciidoctor-diagram/plantuml.rb
|
194
197
|
- lib/asciidoctor-diagram/plantuml/converter.rb
|
195
198
|
- lib/asciidoctor-diagram/plantuml/extension.rb
|
196
|
-
- lib/asciidoctor-diagram/plantuml/plantuml-1.3.
|
199
|
+
- lib/asciidoctor-diagram/plantuml/plantuml-1.3.20.jar
|
197
200
|
- lib/asciidoctor-diagram/salt.rb
|
198
201
|
- lib/asciidoctor-diagram/shaape.rb
|
199
202
|
- lib/asciidoctor-diagram/shaape/converter.rb
|
@@ -226,7 +229,7 @@ files:
|
|
226
229
|
- lib/asciidoctor-diagram/util/pdf.rb
|
227
230
|
- lib/asciidoctor-diagram/util/platform.rb
|
228
231
|
- lib/asciidoctor-diagram/util/png.rb
|
229
|
-
- lib/asciidoctor-diagram/util/server-1.3.
|
232
|
+
- lib/asciidoctor-diagram/util/server-1.3.20.jar
|
230
233
|
- lib/asciidoctor-diagram/util/svg.rb
|
231
234
|
- lib/asciidoctor-diagram/util/which.rb
|
232
235
|
- lib/asciidoctor-diagram/vega.rb
|
@@ -240,6 +243,7 @@ files:
|
|
240
243
|
- spec/blockdiag_spec.rb
|
241
244
|
- spec/bpmn_spec.rb
|
242
245
|
- spec/bytefield_spec.rb
|
246
|
+
- spec/diagrams_spec.rb
|
243
247
|
- spec/ditaa_spec.rb
|
244
248
|
- spec/dpic_spec.rb
|
245
249
|
- spec/erd_spec.rb
|
@@ -283,16 +287,18 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
283
287
|
- !ruby/object:Gem::Version
|
284
288
|
version: '0'
|
285
289
|
requirements: []
|
286
|
-
rubygems_version: 3.
|
290
|
+
rubygems_version: 3.0.3
|
287
291
|
signing_key:
|
288
292
|
specification_version: 4
|
289
|
-
summary:
|
290
|
-
|
293
|
+
summary: A family of Asciidoctor extensions that generate images from a broad range
|
294
|
+
of embedded plain text diagram descriptions, including PlantUML, ditaa, Kroki, and
|
295
|
+
many others.
|
291
296
|
test_files:
|
292
297
|
- spec/a2s_spec.rb
|
293
298
|
- spec/blockdiag_spec.rb
|
294
299
|
- spec/bpmn_spec.rb
|
295
300
|
- spec/bytefield_spec.rb
|
301
|
+
- spec/diagrams_spec.rb
|
296
302
|
- spec/ditaa_spec.rb
|
297
303
|
- spec/dpic_spec.rb
|
298
304
|
- spec/erd_spec.rb
|
Binary file
|
Binary file
|
Binary file
|