asciidoctor-diagram 2.2.9 → 2.2.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.adoc +16 -0
- data/docs/antora.yml +3 -1
- data/docs/modules/ROOT/images/a2s.svg +44 -0
- data/docs/modules/ROOT/images/actdiag.png +0 -0
- data/docs/modules/ROOT/images/asciidoctor-diagram-process.png +0 -0
- data/docs/modules/ROOT/images/barcode.png +0 -0
- data/docs/modules/ROOT/images/barcode2.png +0 -0
- data/docs/modules/ROOT/images/blockdiag.png +0 -0
- data/docs/modules/ROOT/images/d2.png +0 -0
- data/docs/modules/ROOT/images/lilypond.png +0 -0
- data/docs/modules/ROOT/images/penrose.png +0 -0
- data/docs/modules/ROOT/nav.adoc +41 -0
- data/docs/modules/ROOT/{partials/create_diagram.adoc → pages/blocks.adoc} +52 -48
- data/docs/modules/ROOT/pages/diagram_types/a2s.adoc +47 -0
- data/docs/modules/ROOT/pages/diagram_types/actdiag.adoc +46 -0
- data/docs/modules/ROOT/pages/diagram_types/barcode.adoc +72 -0
- data/docs/modules/ROOT/pages/diagram_types/blockdiag.adoc +38 -0
- data/docs/modules/ROOT/pages/diagram_types/bpmn.adoc +21 -0
- data/docs/modules/ROOT/pages/diagram_types/bytefield.adoc +16 -0
- data/docs/modules/ROOT/pages/diagram_types/d2.adoc +43 -0
- data/docs/modules/ROOT/pages/diagram_types/dbml.adoc +16 -0
- data/docs/modules/ROOT/pages/diagram_types/diagrams.adoc +20 -0
- data/docs/modules/ROOT/pages/diagram_types/ditaa.adoc +31 -0
- data/docs/modules/ROOT/pages/diagram_types/dpic.adoc +16 -0
- data/docs/modules/ROOT/pages/diagram_types/erd.adoc +17 -0
- data/docs/modules/ROOT/pages/diagram_types/gnuplot.adoc +27 -0
- data/docs/modules/ROOT/pages/diagram_types/graphviz.adoc +21 -0
- data/docs/modules/ROOT/pages/diagram_types/lilypond.adoc +27 -0
- data/docs/modules/ROOT/pages/diagram_types/meme.adoc +34 -0
- data/docs/modules/ROOT/pages/diagram_types/mermaid.adoc +28 -0
- data/docs/modules/ROOT/pages/diagram_types/msc.adoc +23 -0
- data/docs/modules/ROOT/pages/diagram_types/nomnoml.adoc +16 -0
- data/docs/modules/ROOT/pages/diagram_types/nwdiag.adoc +22 -0
- data/docs/modules/ROOT/pages/diagram_types/penrose.adoc +50 -0
- data/docs/modules/ROOT/pages/diagram_types/pikchr.adoc +16 -0
- data/docs/modules/ROOT/pages/diagram_types/plantuml.adoc +24 -0
- data/docs/modules/ROOT/pages/diagram_types/seqdiag.adoc +18 -0
- data/docs/modules/ROOT/pages/diagram_types/shaape.adoc +18 -0
- data/docs/modules/ROOT/pages/diagram_types/smcat.adoc +18 -0
- data/docs/modules/ROOT/pages/diagram_types/structurizr.adoc +29 -0
- data/docs/modules/ROOT/pages/diagram_types/svgbob.adoc +21 -0
- data/docs/modules/ROOT/pages/diagram_types/symbolator.adoc +19 -0
- data/docs/modules/ROOT/pages/diagram_types/syntrax.adoc +28 -0
- data/docs/modules/ROOT/pages/diagram_types/tikz.adoc +21 -0
- data/docs/modules/ROOT/pages/diagram_types/umlet.adoc +19 -0
- data/docs/modules/ROOT/pages/diagram_types/vega.adoc +28 -0
- data/docs/modules/ROOT/pages/diagram_types/wavedrom.adoc +17 -0
- data/docs/modules/ROOT/pages/enabling.adoc +25 -0
- data/docs/modules/ROOT/{partials → pages}/generate.adoc +1 -1
- data/docs/modules/ROOT/pages/index.adoc +5 -14
- data/docs/modules/ROOT/pages/installation.adoc +32 -0
- data/docs/modules/ROOT/pages/output.adoc +19 -0
- data/docs/modules/ROOT/partials/shared-attrs.adoc +12 -0
- data/docs/modules/ROOT/partials/uris.adoc +2 -0
- data/lib/asciidoctor-diagram/barcode/converter.rb +83 -78
- data/lib/asciidoctor-diagram/diagram_processor.rb +10 -1
- data/lib/asciidoctor-diagram/diagram_source.rb +2 -2
- data/lib/asciidoctor-diagram/ditaa/converter.rb +3 -3
- data/lib/asciidoctor-diagram/lilypond/converter.rb +2 -2
- data/lib/asciidoctor-diagram/penrose/converter.rb +50 -0
- data/lib/asciidoctor-diagram/penrose/extension.rb +18 -0
- data/lib/asciidoctor-diagram/penrose.rb +8 -0
- data/lib/asciidoctor-diagram/plantuml/converter.rb +3 -3
- data/lib/asciidoctor-diagram/structurizr/converter.rb +6 -6
- data/lib/asciidoctor-diagram/structurizr/structurizr-2.0.3.jar +0 -0
- data/lib/asciidoctor-diagram/syntrax/converter.rb +6 -6
- data/lib/asciidoctor-diagram/util/java_jruby.rb +4 -0
- data/lib/asciidoctor-diagram/util/java_socket.rb +4 -0
- data/lib/asciidoctor-diagram/version.rb +1 -1
- data/lib/asciidoctor-diagram.rb +1 -0
- data/spec/barcode_spec.rb +3 -3
- data/spec/d2_spec.rb +1 -1
- data/spec/mermaid_spec.rb +0 -37
- data/spec/test_helper_methods.rb +4 -1
- metadata +56 -8
- data/docs/modules/ROOT/partials/advanced.adoc +0 -397
- data/docs/modules/ROOT/partials/installation.adoc +0 -19
- data/lib/asciidoctor-diagram/structurizr/structurizr-2.0.1.jar +0 -0
@@ -0,0 +1,32 @@
|
|
1
|
+
= Installation
|
2
|
+
include::partial$uris.adoc[]
|
3
|
+
|
4
|
+
Asciidoctor Diagram is a RubyGem, which can be installed using the `gem` or `bundle` commands.
|
5
|
+
|
6
|
+
You can install the Asciidoctor Diagram gem by typing `gem install` in the CLI.
|
7
|
+
|
8
|
+
$ gem install asciidoctor-diagram
|
9
|
+
|
10
|
+
To install the gem using Bundler, first add the following entry to your project's [.path]_Gemfile_.
|
11
|
+
|
12
|
+
.Gemfile
|
13
|
+
[source,ruby]
|
14
|
+
----
|
15
|
+
gem 'asciidoctor-diagram'
|
16
|
+
----
|
17
|
+
|
18
|
+
Then execute `bundle` in the CLI.
|
19
|
+
|
20
|
+
$ bundle
|
21
|
+
|
22
|
+
== Diagram Renderer Installation Paths
|
23
|
+
|
24
|
+
Asciidoctor Diagram depends on external tools to generate images.
|
25
|
+
In most cases it will locate these tools automatically for you by looking for specific executables in each directory in the `PATH` environment variable.
|
26
|
+
|
27
|
+
In case you've installed a tool in a way where the executable is not in the `PATH`, you can override its location manually using document attributes.
|
28
|
+
If, for instance, you installed `diag_tool` in `/home/me/diag_tool/bin` and this path is not included in the `PATH` you can specify its location on the command line
|
29
|
+
|
30
|
+
$ asciidoctor -a diag_tool=/home/me/actdiag/bin/diag_tool -r asciidoctor-diagram sample.adoc
|
31
|
+
|
32
|
+
The exact document attributes to use are described in the documentation of each diagram type.
|
@@ -0,0 +1,19 @@
|
|
1
|
+
= Output Directories
|
2
|
+
|
3
|
+
== Image Output Directory
|
4
|
+
|
5
|
+
When Asciidoctor Diagram writes images to disk it will go over the following options in order to determine where to write the files.
|
6
|
+
|
7
|
+
. `\{imagesoutdir\}` if the `imagesoutdir` attribute has been specified
|
8
|
+
. `\{outdir\}/\{imagesdir\}` if the `outdir` attribute has been specified
|
9
|
+
. `\{to_dir\}/\{imagesdir\}` if the `to_dir` attribute has been specified
|
10
|
+
. `\{base_dir\}/\{imagesdir\}`
|
11
|
+
|
12
|
+
== Image Cache Directory
|
13
|
+
|
14
|
+
The image generation also outputs metadata files that by default are located in `.asciidoctor/diagram`.
|
15
|
+
To place them in different location, Asciidoctor Diagram checks for (in this order).
|
16
|
+
|
17
|
+
. `\{cachedir\}` attribute is specified in the block header (i.e. `[plantuml, png, cachedir=my-cache]`)
|
18
|
+
. `\{diagram-cachedir\}` if the `diagram-cachedir` attribute has been specified
|
19
|
+
. `\{outdir\}/\{imagesdir\}`
|
@@ -0,0 +1,12 @@
|
|
1
|
+
[cols=">,<,<",options="header"]
|
2
|
+
|===
|
3
|
+
|Name |Default value |Description
|
4
|
+
|svg-type |unspecified |One of `static`, `inline` or `interactive`.
|
5
|
+
This determines the style of SVG embedding that's used in certain backends.
|
6
|
+
The xref:asciidoc:macros:image-svg.adoc[asciidoc spec] describes this in more detail.
|
7
|
+
|server-url |unspecified |External service to render diagram.
|
8
|
+
Usage removes the need to depend on external tools to be installed locally.
|
9
|
+
|server-type |unspecified |One of `plantuml` or `kroki_io`
|
10
|
+
|max-get-size |1024 |The maximum size of the URI path for HTTP GET requests.
|
11
|
+
If the maximum size is exceeded, POST requests are used instead
|
12
|
+
|===
|
@@ -18,12 +18,14 @@
|
|
18
18
|
:uri-imagemagick: http://www.imagemagick.org
|
19
19
|
:uri-java: http://java.sun.com
|
20
20
|
:uri-jsyntrax: https://atp-mipt.github.io/jsyntrax/
|
21
|
+
:uri-lilypond: https://lilypond.org
|
21
22
|
:uri-mermaid: https://github.com/mermaid-js/mermaid-cli
|
22
23
|
:uri-mscgen: http://www.mcternan.me.uk/mscgen/
|
23
24
|
:uri-mscgen-js: https://github.com/mscgenjs/mscgenjs-cli
|
24
25
|
:uri-nomnoml: http://nomnoml.com
|
25
26
|
:uri-nwdiag: http://blockdiag.com/en/nwdiag/index.html
|
26
27
|
:uri-packetdiag: http://blockdiag.com/en/nwdiag/index.html
|
28
|
+
:uri-penrose: https://penrose.cs.cmu.edu
|
27
29
|
:uri-phantomjs: http://phantomjs.org
|
28
30
|
:uri-pikchr: https://pikchr.org
|
29
31
|
:uri-plantuml: http://plantuml.sourceforge.net
|
@@ -27,7 +27,7 @@ module Asciidoctor
|
|
27
27
|
include DiagramConverter
|
28
28
|
|
29
29
|
def supported_formats
|
30
|
-
[:
|
30
|
+
[:svg, :png, :txt]
|
31
31
|
end
|
32
32
|
|
33
33
|
def collect_options(source)
|
@@ -52,84 +52,88 @@ module Asciidoctor
|
|
52
52
|
code = source.code
|
53
53
|
type = source.config[:type]
|
54
54
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
55
|
+
begin
|
56
|
+
case type
|
57
|
+
when :bookland
|
58
|
+
require 'barby/barcode/bookland'
|
59
|
+
barcode = Barby::Bookland.new(code)
|
60
|
+
when :codabar
|
61
|
+
require 'barby/barcode/codabar'
|
62
|
+
barcode = Barby::Codabar.new(code)
|
63
|
+
when :code25
|
64
|
+
require 'barby/barcode/code_25'
|
65
|
+
barcode = Barby::Code25.new(code)
|
66
|
+
when :code25iata
|
67
|
+
require 'barby/barcode/code_25_iata'
|
68
|
+
barcode = Barby::Code25IATA.new(code)
|
69
|
+
when :code25interleaved
|
70
|
+
require 'barby/barcode/code_25_interleaved'
|
71
|
+
barcode = Barby::Code25Interleaved.new(code)
|
72
|
+
when :code39
|
73
|
+
require 'barby/barcode/code_39'
|
74
|
+
barcode = Barby::Code39.new(code)
|
75
|
+
when :code93
|
76
|
+
require 'barby/barcode/code_93'
|
77
|
+
barcode = Barby::Code93.new(code)
|
78
|
+
when :code128
|
79
|
+
require 'barby/barcode/code_128'
|
80
|
+
barcode = Barby::Code128.new(code)
|
81
|
+
when :code128a
|
82
|
+
require 'barby/barcode/code_128'
|
83
|
+
barcode = Barby::Code128A.new(code)
|
84
|
+
when :code128b
|
85
|
+
require 'barby/barcode/code_128'
|
86
|
+
barcode = Barby::Code128B.new(code)
|
87
|
+
when :code128c
|
88
|
+
require 'barby/barcode/code_128'
|
89
|
+
barcode = Barby::Code128C.new(code)
|
90
|
+
when :ean8
|
91
|
+
require 'barby/barcode/ean_8'
|
92
|
+
barcode = Barby::EAN8.new(code)
|
93
|
+
when :ean13
|
94
|
+
require 'barby/barcode/ean_13'
|
95
|
+
barcode = Barby::EAN13.new(code)
|
96
|
+
when :gs1_128
|
97
|
+
require 'barby/barcode/code_128'
|
98
|
+
gs1_code = code.gsub /\([^)]+\)/ do |control|
|
99
|
+
case control.upcase
|
100
|
+
when '(FNC1)'
|
101
|
+
Barby::Code128::FNC1
|
102
|
+
when '(FNC2)'
|
103
|
+
Barby::Code128::FNC2
|
104
|
+
when '(FNC3)'
|
105
|
+
Barby::Code128::FNC3
|
106
|
+
when '(FNC4)'
|
107
|
+
Barby::Code128::FNC4
|
108
|
+
when '(CODEA)'
|
109
|
+
Barby::Code128::CODEA
|
110
|
+
when '(CODEB)'
|
111
|
+
Barby::Code128::CODEB
|
112
|
+
when '(CODEC)'
|
113
|
+
Barby::Code128::CODEC
|
114
|
+
when '(SHIFT)'
|
115
|
+
Barby::Code128::SHIFT
|
116
|
+
when '(SP)'
|
117
|
+
' '
|
118
|
+
else
|
119
|
+
control
|
120
|
+
end
|
119
121
|
end
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
122
|
+
gs1_code = gs1_code.gsub(/\s+/, '')
|
123
|
+
gs1_code = gs1_code.prepend(Barby::Code128::FNC1) unless gs1_code[0] == Barby::Code128::FNC1
|
124
|
+
barcode = Barby::Code128.new(gs1_code)
|
125
|
+
when :qrcode
|
126
|
+
BarcodeDependencies::QRCODE_DEPENDENCIES.each_pair { |n, v| source.ensure_gem(n, v) }
|
127
|
+
require 'barby/barcode/qr_code'
|
128
|
+
barcode = Barby::QrCode.new(code)
|
129
|
+
when :upca
|
130
|
+
require 'barby/barcode/ean_13'
|
131
|
+
barcode = Barby::UPCA.new(code)
|
132
|
+
else
|
133
|
+
raise "Unsupported barcode type: #{type}"
|
134
|
+
end
|
135
|
+
rescue ArgumentError
|
136
|
+
raise "Invalid #{type} data"
|
133
137
|
end
|
134
138
|
|
135
139
|
case format
|
@@ -142,6 +146,7 @@ module Asciidoctor
|
|
142
146
|
barcode.to_png(options)
|
143
147
|
when :svg
|
144
148
|
require_relative 'svg_outputter'
|
149
|
+
options[:title] = code
|
145
150
|
options[:foreground] = "##{options[:foreground]}" if options[:foreground] =~ /^[0-9a-f]+$/i
|
146
151
|
options[:background] = "##{options[:background]}" if options[:background] =~ /^[0-9a-f]+$/i
|
147
152
|
barcode.to_svg(options)
|
@@ -423,7 +423,16 @@ module Asciidoctor
|
|
423
423
|
block = generate_block(parent, reader_or_target, attributes)
|
424
424
|
attrs = block.attributes.dup
|
425
425
|
target = attrs.delete('target')
|
426
|
-
|
426
|
+
|
427
|
+
# Don't let the asciidoctor try to apply substitutions.
|
428
|
+
# The text of inline macros is nil which will cause an error
|
429
|
+
attrs.delete('subs')
|
430
|
+
|
431
|
+
if block.context == :image
|
432
|
+
create_inline(parent, :image, nil, :type => 'image', :target => target, :attributes => attrs)
|
433
|
+
else
|
434
|
+
create_inline(parent, :quoted, block.source, :type => :monospaced, :attributes => attrs)
|
435
|
+
end
|
427
436
|
end
|
428
437
|
|
429
438
|
def supported_formats(converter)
|
@@ -226,7 +226,7 @@ module Asciidoctor
|
|
226
226
|
end
|
227
227
|
|
228
228
|
def checksum
|
229
|
-
@checksum ||= compute_checksum(code)
|
229
|
+
@checksum ||= "#{config[:type]}:#{compute_checksum(code)}"
|
230
230
|
end
|
231
231
|
|
232
232
|
protected
|
@@ -248,7 +248,7 @@ module Asciidoctor
|
|
248
248
|
md5 << k.to_s if k
|
249
249
|
md5 << v.to_s if v
|
250
250
|
end
|
251
|
-
md5.hexdigest
|
251
|
+
"md5:#{md5.hexdigest}"
|
252
252
|
end
|
253
253
|
end
|
254
254
|
|
@@ -24,9 +24,9 @@ module Asciidoctor
|
|
24
24
|
:bullet_characters => lambda { |o, v| o << '--bullet-characters' << v if v }
|
25
25
|
}
|
26
26
|
|
27
|
-
CLASSPATH_ENV = 'DIAGRAM_DITAA_CLASSPATH'
|
28
|
-
DITAA_JARS = if
|
29
|
-
|
27
|
+
CLASSPATH_ENV = Java.environment_variable('DIAGRAM_DITAA_CLASSPATH')
|
28
|
+
DITAA_JARS = if CLASSPATH_ENV
|
29
|
+
CLASSPATH_ENV.split(File::PATH_SEPARATOR)
|
30
30
|
else
|
31
31
|
begin
|
32
32
|
require 'asciidoctor-diagram/ditaa/classpath'
|
@@ -47,7 +47,7 @@ module Asciidoctor
|
|
47
47
|
generate_stdin(source.find_command('lilypond', :path => EXTRA_PATH), format.to_s, code) do |tool_path, output_path|
|
48
48
|
args = [tool_path, '-daux-files=#f', '-dbackend=eps', '-dno-gs-load-fonts', '-dinclude-eps-fonts', '-o', Platform.native_path(output_path), '-f', format.to_s]
|
49
49
|
|
50
|
-
args <<
|
50
|
+
args << "-dcrop=#t"
|
51
51
|
args << "-dresolution=#{resolution}" if resolution
|
52
52
|
args << "-dpixmap-format=pngalpha" if format == :png
|
53
53
|
|
@@ -55,7 +55,7 @@ module Asciidoctor
|
|
55
55
|
|
56
56
|
{
|
57
57
|
:args => args,
|
58
|
-
:out_file => "#{output_path}.#{format.to_s}"
|
58
|
+
:out_file => "#{output_path}.cropped.#{format.to_s}"
|
59
59
|
}
|
60
60
|
end
|
61
61
|
end
|
@@ -0,0 +1,50 @@
|
|
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 PenroseConverter
|
9
|
+
include DiagramConverter
|
10
|
+
include CliGenerator
|
11
|
+
|
12
|
+
def supported_formats
|
13
|
+
[:svg]
|
14
|
+
end
|
15
|
+
|
16
|
+
def collect_options(source)
|
17
|
+
{
|
18
|
+
:domain => source.attr('domain_file'),
|
19
|
+
:style => source.attr('style_file'),
|
20
|
+
:variation => source.attr('variation')
|
21
|
+
}
|
22
|
+
end
|
23
|
+
|
24
|
+
def convert(source, format, options)
|
25
|
+
domain_path = options[:domain]
|
26
|
+
raise "Domain file is required" unless domain_path
|
27
|
+
style_path = options[:style]
|
28
|
+
raise "Style file is required" unless style_path
|
29
|
+
variation = options[:variation]
|
30
|
+
|
31
|
+
generate_file(source.find_command('roger'), 'substance', format.to_s, source.to_s) do |tool_path, source_path, output_path|
|
32
|
+
args = [tool_path, 'trio', '-o', Platform.native_path(output_path)]
|
33
|
+
|
34
|
+
args << "-v" << variation if variation
|
35
|
+
|
36
|
+
args << "--path"
|
37
|
+
args << "/"
|
38
|
+
|
39
|
+
args << "--trio"
|
40
|
+
args << Platform.native_path(source_path)
|
41
|
+
args << Platform.native_path(source.resolve_path(domain_path))
|
42
|
+
args << Platform.native_path(source.resolve_path(style_path))
|
43
|
+
args << "--"
|
44
|
+
|
45
|
+
args
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require_relative 'converter'
|
2
|
+
require_relative '../diagram_processor'
|
3
|
+
|
4
|
+
module Asciidoctor
|
5
|
+
module Diagram
|
6
|
+
class PenroseBlockProcessor < DiagramBlockProcessor
|
7
|
+
use_converter PenroseConverter
|
8
|
+
end
|
9
|
+
|
10
|
+
class PenroseBlockMacroProcessor < DiagramBlockMacroProcessor
|
11
|
+
use_converter PenroseConverter
|
12
|
+
end
|
13
|
+
|
14
|
+
class PenroseInlineMacroProcessor < DiagramInlineMacroProcessor
|
15
|
+
use_converter PenroseConverter
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
require 'asciidoctor/extensions'
|
2
|
+
require_relative 'penrose/extension'
|
3
|
+
|
4
|
+
Asciidoctor::Extensions.register do
|
5
|
+
block Asciidoctor::Diagram::PenroseBlockProcessor, :penrose
|
6
|
+
block_macro Asciidoctor::Diagram::PenroseBlockMacroProcessor, :penrose
|
7
|
+
inline_macro Asciidoctor::Diagram::PenroseInlineMacroProcessor, :penrose
|
8
|
+
end
|
@@ -8,10 +8,10 @@ module Asciidoctor
|
|
8
8
|
class PlantUmlConverter
|
9
9
|
include DiagramConverter
|
10
10
|
|
11
|
-
CLASSPATH_ENV = 'DIAGRAM_PLANTUML_CLASSPATH'
|
11
|
+
CLASSPATH_ENV = Java.environment_variable('DIAGRAM_PLANTUML_CLASSPATH')
|
12
12
|
LIB_DIR = File.expand_path('../..', File.dirname(__FILE__))
|
13
|
-
PLANTUML_JARS = if
|
14
|
-
|
13
|
+
PLANTUML_JARS = if CLASSPATH_ENV
|
14
|
+
CLASSPATH_ENV.split(File::PATH_SEPARATOR)
|
15
15
|
else
|
16
16
|
begin
|
17
17
|
require 'asciidoctor-diagram/plantuml/classpath'
|
@@ -11,12 +11,12 @@ module Asciidoctor
|
|
11
11
|
class StructurizrConverter
|
12
12
|
include DiagramConverter
|
13
13
|
|
14
|
-
CLASSPATH_ENV = 'DIAGRAM_STRUCTURIZR_CLASSPATH'
|
15
|
-
CLI_HOME_ENV = 'DIAGRAM_STRUCTURIZRCLI_HOME'
|
16
|
-
STRUCTURIZR_JARS = if
|
17
|
-
|
18
|
-
elsif
|
19
|
-
lib_dir = File.expand_path('lib',
|
14
|
+
CLASSPATH_ENV = Java.environment_variable('DIAGRAM_STRUCTURIZR_CLASSPATH')
|
15
|
+
CLI_HOME_ENV = Java.environment_variable('DIAGRAM_STRUCTURIZRCLI_HOME')
|
16
|
+
STRUCTURIZR_JARS = if CLASSPATH_ENV
|
17
|
+
CLASSPATH_ENV.split(File::PATH_SEPARATOR)
|
18
|
+
elsif CLI_HOME_ENV
|
19
|
+
lib_dir = File.expand_path('lib', CLI_HOME_ENV)
|
20
20
|
Dir[File.join(lib_dir, '*.jar')]
|
21
21
|
else
|
22
22
|
nil
|
Binary file
|
@@ -9,12 +9,12 @@ module Asciidoctor
|
|
9
9
|
include DiagramConverter
|
10
10
|
include CliGenerator
|
11
11
|
|
12
|
-
CLASSPATH_ENV = 'DIAGRAM_JSYNTRAX_CLASSPATH'
|
13
|
-
CLI_HOME_ENV = 'DIAGRAM_JSYNTRAX_HOME'
|
14
|
-
JSYNTRAX_JARS = if
|
15
|
-
|
16
|
-
elsif
|
17
|
-
lib_dir = File.expand_path('lib',
|
12
|
+
CLASSPATH_ENV = Java.environment_variable('DIAGRAM_JSYNTRAX_CLASSPATH')
|
13
|
+
CLI_HOME_ENV = Java.environment_variable('DIAGRAM_JSYNTRAX_HOME')
|
14
|
+
JSYNTRAX_JARS = if CLASSPATH_ENV
|
15
|
+
CLASSPATH_ENV.split(File::PATH_SEPARATOR)
|
16
|
+
elsif CLI_HOME_ENV
|
17
|
+
lib_dir = File.expand_path('lib', CLI_HOME_ENV)
|
18
18
|
Dir.children(lib_dir).select { |c| c.end_with? '.jar' }.map { |c| File.expand_path(c, lib_dir) }
|
19
19
|
else
|
20
20
|
nil
|
data/lib/asciidoctor-diagram.rb
CHANGED
@@ -17,6 +17,7 @@ require_relative 'asciidoctor-diagram/meme'
|
|
17
17
|
require_relative 'asciidoctor-diagram/mermaid'
|
18
18
|
require_relative 'asciidoctor-diagram/msc'
|
19
19
|
require_relative 'asciidoctor-diagram/nomnoml'
|
20
|
+
require_relative 'asciidoctor-diagram/penrose'
|
20
21
|
require_relative 'asciidoctor-diagram/pikchr'
|
21
22
|
require_relative 'asciidoctor-diagram/plantuml'
|
22
23
|
require_relative 'asciidoctor-diagram/salt'
|
data/spec/barcode_spec.rb
CHANGED
@@ -99,7 +99,7 @@ END:VCARD
|
|
99
99
|
|
100
100
|
target = b.attributes['target']
|
101
101
|
expect(target).to_not be_nil
|
102
|
-
expect(target).to match(/\.
|
102
|
+
expect(target).to match(/\.svg$/)
|
103
103
|
expect(File.exist?(target)).to be true
|
104
104
|
|
105
105
|
expect(b.attributes['width']).to_not be_nil
|
@@ -129,7 +129,7 @@ Doc Writer <doc@example.com>
|
|
129
129
|
|
130
130
|
target = b.attributes['target']
|
131
131
|
expect(target).to_not be_nil
|
132
|
-
expect(target).to match(/\.
|
132
|
+
expect(target).to match(/\.svg$/)
|
133
133
|
expect(File.exist?(target)).to be true
|
134
134
|
|
135
135
|
expect(b.attributes['width']).to_not be_nil
|
@@ -166,7 +166,7 @@ Doc Writer <doc@example.com>
|
|
166
166
|
src = src_match[1]
|
167
167
|
|
168
168
|
expect(src).to_not be_nil
|
169
|
-
expect(src).to match(/\.
|
169
|
+
expect(src).to match(/\.svg$/)
|
170
170
|
expect(File.exist?(src)).to be true
|
171
171
|
|
172
172
|
expect(/width="([^"]*)"/.match(img)).to_not be_nil
|
data/spec/d2_spec.rb
CHANGED
data/spec/mermaid_spec.rb
CHANGED
@@ -141,43 +141,6 @@ end
|
|
141
141
|
describe Asciidoctor::Diagram::MermaidBlockProcessor do
|
142
142
|
include_examples "block", :mermaid, MERMAID_CODE, [:png, :svg]
|
143
143
|
|
144
|
-
it "should work with kroki.io" do
|
145
|
-
doc = <<-eos
|
146
|
-
= Hello, kroki!
|
147
|
-
:diagram-server-url: https://kroki.io/
|
148
|
-
:diagram-server-type: kroki_io
|
149
|
-
Doc Writer <doc@example.com>
|
150
|
-
|
151
|
-
== First Section
|
152
|
-
|
153
|
-
[mermaid, format=svg]
|
154
|
-
----
|
155
|
-
graph TD
|
156
|
-
A[ Anyone ] -->|Can help | B( Go to github.com/yuzutech/kroki )
|
157
|
-
B --> C{ How to contribute? }
|
158
|
-
C --> D[ Reporting bugs ]
|
159
|
-
C --> E[ Sharing ideas ]
|
160
|
-
C --> F[ Advocating ]
|
161
|
-
----
|
162
|
-
eos
|
163
|
-
|
164
|
-
d = load_asciidoc doc
|
165
|
-
expect(d).to_not be_nil
|
166
|
-
|
167
|
-
b = d.find { |bl| bl.context == :image }
|
168
|
-
expect(b).to_not be_nil
|
169
|
-
|
170
|
-
expect(b.content_model).to eq :empty
|
171
|
-
|
172
|
-
target = b.attributes['target']
|
173
|
-
expect(target).to_not be_nil
|
174
|
-
expect(target).to match(/\.svg$/)
|
175
|
-
expect(File.exist?(target)).to be true
|
176
|
-
|
177
|
-
expect(b.attributes['width']).to_not be_nil
|
178
|
-
expect(b.attributes['height']).to_not be_nil
|
179
|
-
end
|
180
|
-
|
181
144
|
it "should report unsupported scaling factors" do
|
182
145
|
doc = <<-eos
|
183
146
|
= Hello, Mermaid!
|
data/spec/test_helper_methods.rb
CHANGED
@@ -47,6 +47,8 @@ end
|
|
47
47
|
module Asciidoctor
|
48
48
|
module Diagram
|
49
49
|
module TestHelpers
|
50
|
+
include ::Asciidoctor::Logging
|
51
|
+
|
50
52
|
def load_asciidoc(source, options = {})
|
51
53
|
options = options.dup
|
52
54
|
options[:trace] = true
|
@@ -71,7 +73,8 @@ module Asciidoctor
|
|
71
73
|
options[:attributes]['diagram-on-error'] = 'abort'
|
72
74
|
end
|
73
75
|
|
74
|
-
|
76
|
+
logger.level = ::Logger::Severity::DEBUG
|
77
|
+
::Asciidoctor.load(StringIO.new(source), options.merge({:trace => true, :verbose => 2}))
|
75
78
|
end
|
76
79
|
end
|
77
80
|
end
|