asciidoctor-diagram 2.3.1 → 2.3.2
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 +10 -0
- data/lib/asciidoctor-diagram/diagram_processor.rb +21 -4
- data/lib/asciidoctor-diagram/diagram_source.rb +1 -9
- data/lib/asciidoctor-diagram/gnuplot/converter.rb +1 -0
- data/lib/asciidoctor-diagram/http/converter.rb +7 -2
- data/lib/asciidoctor-diagram/pintora/converter.rb +60 -0
- data/lib/asciidoctor-diagram/pintora/extension.rb +18 -0
- data/lib/asciidoctor-diagram/pintora.rb +8 -0
- data/lib/asciidoctor-diagram/plantuml/converter.rb +40 -6
- data/lib/asciidoctor-diagram/plantuml/plantuml-2.2.4.jar +0 -0
- data/lib/asciidoctor-diagram/structurizr/structurizr-2.2.2.jar +0 -0
- data/lib/asciidoctor-diagram/util/java.rb +15 -7
- data/lib/asciidoctor-diagram/util/{server-2.2.0.jar → server-2.2.3.jar} +0 -0
- data/lib/asciidoctor-diagram/version.rb +1 -1
- data/lib/asciidoctor-diagram.rb +1 -0
- metadata +8 -5
- data/lib/asciidoctor-diagram/plantuml/plantuml-2.2.1.jar +0 -0
- data/lib/asciidoctor-diagram/structurizr/structurizr-2.2.0.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: e68570e8ec8e10bd6815b05ef8a6884716fe9bdeb6da30c30d813fe15eef3514
|
4
|
+
data.tar.gz: 426bebf1b41d3f4f3d262a41d90db635f1dffe711de6bde0ac112ffd03b6e496
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f97b8cad30f43d309e2607c8cbcec8e8f64998de86255ea80e717e5886165632b8e5f0ab97674375cf59edb1249807d2a23c475a9b58de64a611a9182b574ccc
|
7
|
+
data.tar.gz: 5d0ff9dd8bed877c2e5db712320779486735b5cc24ea87c0c3623f94a27be949d84849ed6e504e8428535cdf394ffbccaecebdeb4d7e9d98525a8ddf12f66849
|
data/CHANGELOG.adoc
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
= Asciidoctor-diagram Changelog
|
2
2
|
|
3
|
+
== 2.3.2
|
4
|
+
|
5
|
+
Enhancements::
|
6
|
+
|
7
|
+
* Issue #465: Add support for https://pintorajs.vercel.app/[Pintora]
|
8
|
+
* Issue #476: Use PlantUML's Smetana layout engine by default if Graphviz cannot be located
|
9
|
+
* Issue #477: Improve support for using plantuml.com as PlantUML rendering server
|
10
|
+
* Add support for Structurizr JSON workspaces
|
11
|
+
* Prefer non-PDF formats when rendering with HTML backend
|
12
|
+
|
3
13
|
== 2.3.1
|
4
14
|
|
5
15
|
Enhancements::
|
@@ -81,6 +81,13 @@ module Asciidoctor
|
|
81
81
|
begin
|
82
82
|
source = converter.wrap_source(source)
|
83
83
|
|
84
|
+
if /html/i =~ parent.document.attributes['backend']
|
85
|
+
# Move PDF to the back of the list for the HTML backend
|
86
|
+
if supported_formats.delete(:pdf)
|
87
|
+
supported_formats << :pdf
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
84
91
|
format = source.attributes.delete('format') || source.global_attr('format', supported_formats[0])
|
85
92
|
format = format.to_sym if format.respond_to?(:to_sym)
|
86
93
|
|
@@ -187,17 +194,27 @@ module Asciidoctor
|
|
187
194
|
|
188
195
|
options = converter.collect_options(source)
|
189
196
|
result = converter.convert(source, format, options)
|
190
|
-
|
191
|
-
|
197
|
+
if result.is_a? Hash
|
198
|
+
image = result[:result]
|
199
|
+
extra = result[:extra]
|
200
|
+
else
|
201
|
+
image = result
|
202
|
+
extra = {}
|
203
|
+
end
|
204
|
+
image.force_encoding(params[:encoding])
|
192
205
|
|
193
206
|
metadata = source.create_image_metadata
|
194
207
|
metadata[:options] = options
|
195
208
|
|
196
209
|
allow_image_optimisation = !source.global_opt('nooptimise')
|
197
|
-
|
210
|
+
image, metadata[:width], metadata[:height] = params[:decoder].post_process_image(image, allow_image_optimisation)
|
198
211
|
|
199
212
|
FileUtils.mkdir_p(File.dirname(image_file)) unless Dir.exist?(File.dirname(image_file))
|
200
|
-
File.open(image_file, 'wb') {|f| f.write
|
213
|
+
File.open(image_file, 'wb') {|f| f.write image}
|
214
|
+
|
215
|
+
extra.each do |name, data|
|
216
|
+
File.open(image_file + ".#{name}", 'wb') {|f| f.write data}
|
217
|
+
end
|
201
218
|
|
202
219
|
if use_cache
|
203
220
|
FileUtils.mkdir_p(File.dirname(metadata_file)) unless Dir.exist?(File.dirname(metadata_file))
|
@@ -202,14 +202,6 @@ module Asciidoctor
|
|
202
202
|
name = [name] unless name.is_a?(Enumerable)
|
203
203
|
|
204
204
|
value = name.lazy.map { |n| @attributes[n] }.reject { |v| v.nil? }.first
|
205
|
-
if value.nil?
|
206
|
-
attr_position = config[:positional_attrs] || 1
|
207
|
-
while value.nil? && !@attributes[attr_position].nil?
|
208
|
-
if @attributes[attr_position] == name
|
209
|
-
value = true
|
210
|
-
end
|
211
|
-
end
|
212
|
-
end
|
213
205
|
|
214
206
|
if value.nil? && inherit
|
215
207
|
inherited_values = name.lazy.map do |n|
|
@@ -345,4 +337,4 @@ module Asciidoctor
|
|
345
337
|
end
|
346
338
|
end
|
347
339
|
end
|
348
|
-
end
|
340
|
+
end
|
@@ -72,7 +72,8 @@ module Asciidoctor
|
|
72
72
|
|
73
73
|
get_path = path.dup << '/' << data
|
74
74
|
|
75
|
-
|
75
|
+
host = uri.host
|
76
|
+
if (host.nil? || !host.downcase.end_with?('plantuml.com')) && get_path.length > options[:max_get_size]
|
76
77
|
uri.path = path
|
77
78
|
get_uri(uri, code, 'text/plain; charset=utf-8')
|
78
79
|
else
|
@@ -110,7 +111,11 @@ module Asciidoctor
|
|
110
111
|
resolved_uri = new_uri
|
111
112
|
end
|
112
113
|
|
113
|
-
|
114
|
+
if response.code == '307'
|
115
|
+
get_uri(resolved_uri, post_data, post_content_type, attempt + 1)
|
116
|
+
else
|
117
|
+
get_uri(resolved_uri, nil, nil, attempt + 1)
|
118
|
+
end
|
114
119
|
else
|
115
120
|
response.value
|
116
121
|
end
|
@@ -0,0 +1,60 @@
|
|
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 PintoraConverter
|
10
|
+
include DiagramConverter
|
11
|
+
include CliGenerator
|
12
|
+
|
13
|
+
|
14
|
+
def supported_formats
|
15
|
+
[:png, :svg]
|
16
|
+
end
|
17
|
+
|
18
|
+
def collect_options(source)
|
19
|
+
options = {}
|
20
|
+
|
21
|
+
options[:width] = source.attr('width')
|
22
|
+
options[:theme] = source.attr('theme')
|
23
|
+
options[:background_color] = source.attr('background-color')
|
24
|
+
options[:pixel_ratio] = source.attr('pixel-ratio')
|
25
|
+
|
26
|
+
options
|
27
|
+
end
|
28
|
+
|
29
|
+
def convert(source, format, options)
|
30
|
+
pintora = source.find_command('pintora')
|
31
|
+
|
32
|
+
generate_file(pintora, 'pintora', format.to_s, source.to_s) do |tool_path, input_path, output_path|
|
33
|
+
args = [tool_path, 'render', '-i', Platform.native_path(input_path), '-o', Platform.native_path(output_path)]
|
34
|
+
|
35
|
+
|
36
|
+
if options[:width]
|
37
|
+
args << '-w' << options[:width]
|
38
|
+
end
|
39
|
+
|
40
|
+
if options[:theme]
|
41
|
+
args << '-t' << options[:theme]
|
42
|
+
end
|
43
|
+
|
44
|
+
if options[:pixel_ratio]
|
45
|
+
args << '-p' << options[:pixel_ratio]
|
46
|
+
end
|
47
|
+
|
48
|
+
if options[:background_color]
|
49
|
+
args << '-b' << options[:background_color]
|
50
|
+
end
|
51
|
+
|
52
|
+
{
|
53
|
+
:args => args,
|
54
|
+
:chdir => source.base_dir
|
55
|
+
}
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require_relative 'converter'
|
2
|
+
require_relative '../diagram_processor'
|
3
|
+
|
4
|
+
module Asciidoctor
|
5
|
+
module Diagram
|
6
|
+
class PintoraBlockProcessor < DiagramBlockProcessor
|
7
|
+
use_converter PintoraConverter
|
8
|
+
end
|
9
|
+
|
10
|
+
class PintoraBlockMacroProcessor < DiagramBlockMacroProcessor
|
11
|
+
use_converter PintoraConverter
|
12
|
+
end
|
13
|
+
|
14
|
+
class PintoraInlineMacroProcessor < DiagramInlineMacroProcessor
|
15
|
+
use_converter PintoraConverter
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
require 'asciidoctor/extensions'
|
2
|
+
require_relative 'pintora/extension'
|
3
|
+
|
4
|
+
Asciidoctor::Extensions.register do
|
5
|
+
block Asciidoctor::Diagram::PintoraBlockProcessor, :pintora
|
6
|
+
block_macro Asciidoctor::Diagram::PintoraBlockMacroProcessor, :pintora
|
7
|
+
inline_macro Asciidoctor::Diagram::PintoraInlineMacroProcessor, :pintora
|
8
|
+
end
|
@@ -45,6 +45,8 @@ module Asciidoctor
|
|
45
45
|
theme = source.attr('theme', nil)
|
46
46
|
options[:theme] = theme if theme
|
47
47
|
|
48
|
+
options[:debug] = true if source.opt('debug')
|
49
|
+
|
48
50
|
options
|
49
51
|
end
|
50
52
|
|
@@ -108,13 +110,15 @@ module Asciidoctor
|
|
108
110
|
add_theme_header(headers, options[:theme])
|
109
111
|
add_size_limit_header(headers, options[:size_limit])
|
110
112
|
|
111
|
-
|
113
|
+
dot = source.find_command('dot', :alt_attrs => ['graphvizdot'], :raise_on_error => false)
|
114
|
+
if options[:smetana] || !dot
|
112
115
|
headers['X-Graphviz'] = 'smetana'
|
113
116
|
else
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
117
|
+
headers['X-Graphviz'] = ::Asciidoctor::Diagram::Platform.host_os_path(dot)
|
118
|
+
end
|
119
|
+
|
120
|
+
if options[:debug]
|
121
|
+
headers['X-PlantUML-Debug'] = 'true'
|
118
122
|
end
|
119
123
|
|
120
124
|
response = Java.send_request(
|
@@ -127,7 +131,37 @@ module Asciidoctor
|
|
127
131
|
raise Java.create_error("PlantUML image generation failed", response)
|
128
132
|
end
|
129
133
|
|
130
|
-
response[:
|
134
|
+
if response[:headers]['content-type'] =~ /multipart\/form-data;\s*boundary=(.*)/
|
135
|
+
boundary = $1
|
136
|
+
parts = {}
|
137
|
+
|
138
|
+
multipart_data = StringIO.new(response[:body])
|
139
|
+
while true
|
140
|
+
multipart_data.readline
|
141
|
+
marker = multipart_data.readline
|
142
|
+
if marker.start_with? "--#{boundary}--"
|
143
|
+
break
|
144
|
+
elsif marker.start_with? "--#{boundary}"
|
145
|
+
part = Java.parse_body(multipart_data)
|
146
|
+
if part[:headers]['content-disposition'] =~ /form-data;\s*name="([^"]*)"/
|
147
|
+
if $1 == 'image'
|
148
|
+
parts[:result] = part[:body]
|
149
|
+
else
|
150
|
+
parts[:extra] ||= {}
|
151
|
+
parts[:extra][$1] = part[:body]
|
152
|
+
end
|
153
|
+
else
|
154
|
+
raise "Unexpected multipart content disposition"
|
155
|
+
end
|
156
|
+
else
|
157
|
+
raise "Unexpected multipart boundary"
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
parts
|
162
|
+
else
|
163
|
+
response[:body]
|
164
|
+
end
|
131
165
|
end
|
132
166
|
end
|
133
167
|
|
Binary file
|
Binary file
|
@@ -58,25 +58,34 @@ module Asciidoctor
|
|
58
58
|
resp[:code] = status_line_parts[1].to_i
|
59
59
|
resp[:reason] = status_line_parts[2]
|
60
60
|
|
61
|
+
resp.merge! parse_body(io)
|
62
|
+
|
63
|
+
resp
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.parse_body(io)
|
67
|
+
body = {}
|
68
|
+
|
69
|
+
io.set_encoding Encoding::US_ASCII
|
61
70
|
headers = {}
|
62
71
|
until (header = io.readline(CRLF).strip).empty?
|
63
72
|
key, value = header.split ':', 2
|
64
|
-
headers[key] = value.strip
|
73
|
+
headers[key.downcase] = value.strip
|
65
74
|
end
|
66
75
|
|
67
|
-
|
76
|
+
body[:headers] = headers
|
68
77
|
|
69
|
-
content_length = headers['
|
78
|
+
content_length = headers['content-length']
|
70
79
|
if content_length
|
71
80
|
io.set_encoding Encoding::BINARY
|
72
|
-
|
81
|
+
body[:body] = io.read(content_length.to_i)
|
73
82
|
end
|
74
83
|
|
75
|
-
|
84
|
+
body
|
76
85
|
end
|
77
86
|
|
78
87
|
def self.create_error(prefix_msg, response)
|
79
|
-
content_type = response[:headers]['
|
88
|
+
content_type = response[:headers]['content-type'] || 'text/plain'
|
80
89
|
if content_type.start_with? 'application/json'
|
81
90
|
json = JSON.parse(response[:body].force_encoding(Encoding::UTF_8))
|
82
91
|
ruby_bt = Kernel.caller(2)
|
@@ -97,7 +106,6 @@ module Asciidoctor
|
|
97
106
|
@java_exe
|
98
107
|
end
|
99
108
|
|
100
|
-
private
|
101
109
|
def self.find_java
|
102
110
|
case ::Asciidoctor::Diagram::Platform.os
|
103
111
|
when :windows
|
Binary file
|
data/lib/asciidoctor-diagram.rb
CHANGED
@@ -19,6 +19,7 @@ require_relative 'asciidoctor-diagram/msc'
|
|
19
19
|
require_relative 'asciidoctor-diagram/nomnoml'
|
20
20
|
require_relative 'asciidoctor-diagram/penrose'
|
21
21
|
require_relative 'asciidoctor-diagram/pikchr'
|
22
|
+
require_relative 'asciidoctor-diagram/pintora'
|
22
23
|
require_relative 'asciidoctor-diagram/plantuml'
|
23
24
|
require_relative 'asciidoctor-diagram/salt'
|
24
25
|
require_relative 'asciidoctor-diagram/shaape'
|
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.3.
|
4
|
+
version: 2.3.2
|
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: 2025-03-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -196,10 +196,13 @@ files:
|
|
196
196
|
- lib/asciidoctor-diagram/pikchr.rb
|
197
197
|
- lib/asciidoctor-diagram/pikchr/converter.rb
|
198
198
|
- lib/asciidoctor-diagram/pikchr/extension.rb
|
199
|
+
- lib/asciidoctor-diagram/pintora.rb
|
200
|
+
- lib/asciidoctor-diagram/pintora/converter.rb
|
201
|
+
- lib/asciidoctor-diagram/pintora/extension.rb
|
199
202
|
- lib/asciidoctor-diagram/plantuml.rb
|
200
203
|
- lib/asciidoctor-diagram/plantuml/converter.rb
|
201
204
|
- lib/asciidoctor-diagram/plantuml/extension.rb
|
202
|
-
- lib/asciidoctor-diagram/plantuml/plantuml-2.2.
|
205
|
+
- lib/asciidoctor-diagram/plantuml/plantuml-2.2.4.jar
|
203
206
|
- lib/asciidoctor-diagram/salt.rb
|
204
207
|
- lib/asciidoctor-diagram/shaape.rb
|
205
208
|
- lib/asciidoctor-diagram/shaape/converter.rb
|
@@ -211,7 +214,7 @@ files:
|
|
211
214
|
- lib/asciidoctor-diagram/structurizr/converter.rb
|
212
215
|
- lib/asciidoctor-diagram/structurizr/extension.rb
|
213
216
|
- lib/asciidoctor-diagram/structurizr/renderers.rb
|
214
|
-
- lib/asciidoctor-diagram/structurizr/structurizr-2.2.
|
217
|
+
- lib/asciidoctor-diagram/structurizr/structurizr-2.2.2.jar
|
215
218
|
- lib/asciidoctor-diagram/svgbob.rb
|
216
219
|
- lib/asciidoctor-diagram/svgbob/converter.rb
|
217
220
|
- lib/asciidoctor-diagram/svgbob/extension.rb
|
@@ -239,7 +242,7 @@ files:
|
|
239
242
|
- lib/asciidoctor-diagram/util/pdf.rb
|
240
243
|
- lib/asciidoctor-diagram/util/platform.rb
|
241
244
|
- lib/asciidoctor-diagram/util/png.rb
|
242
|
-
- lib/asciidoctor-diagram/util/server-2.2.
|
245
|
+
- lib/asciidoctor-diagram/util/server-2.2.3.jar
|
243
246
|
- lib/asciidoctor-diagram/util/svg.rb
|
244
247
|
- lib/asciidoctor-diagram/util/which.rb
|
245
248
|
- lib/asciidoctor-diagram/vega.rb
|
Binary file
|
Binary file
|