asciidoctor-diagram 2.2.14 → 2.2.17
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 +23 -0
- data/README.adoc +10 -10
- data/lib/asciidoctor-diagram/diagram_source.rb +22 -28
- data/lib/asciidoctor-diagram/structurizr/converter.rb +2 -0
- data/lib/asciidoctor-diagram/structurizr/structurizr-2.0.5.jar +0 -0
- data/lib/asciidoctor-diagram/version.rb +1 -1
- data/lib/asciidoctor-diagram/wavedrom/converter.rb +36 -31
- metadata +3 -3
- data/lib/asciidoctor-diagram/structurizr/structurizr-2.0.3.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: 23e0718c877d72f84af027588bb5a9d100dda3568b34e89655f26c7cf7a4eb07
|
4
|
+
data.tar.gz: a4ecd6791f531cb9654651ae982e7e52406a462075814a78106188729388f45e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5982bee6e194b651cac1b55af22fb0cc7ccc51341e952f08f70c978efbf2a58d1392f2095607e574ab3078bc4c3b4c9b2424f75c0420f2bad7f8e033c45b52ee
|
7
|
+
data.tar.gz: 402707bbd842e2ec8fcf3da65ee60287d08dcbb0f5b0610313ca05985899c03d06a1199aab25632b06239df57d83408f7be73b53981653aaaa49c4f4884df4b8
|
data/CHANGELOG.adoc
CHANGED
@@ -1,5 +1,28 @@
|
|
1
1
|
= Asciidoctor-diagram Changelog
|
2
2
|
|
3
|
+
== 2.2.17
|
4
|
+
|
5
|
+
Bugfixes::
|
6
|
+
|
7
|
+
* Issue #455: Fix regression in reading of UTF-8 source files introduced in 2.2.15
|
8
|
+
|
9
|
+
== 2.2.16
|
10
|
+
|
11
|
+
Bugfixes::
|
12
|
+
|
13
|
+
* Issue #453: Avoid internal error when WaveDrom cannot be located
|
14
|
+
|
15
|
+
== 2.2.15
|
16
|
+
|
17
|
+
Enhacements::
|
18
|
+
|
19
|
+
* Issue #453: Improve error message when WaveDrom cannot be located
|
20
|
+
|
21
|
+
Bugfixes::
|
22
|
+
|
23
|
+
* Issue #428: Improve support for reading UTF-16 encoded source files
|
24
|
+
* Issue #449: Fix resolving of relative `!include` paths in Structurizr DSL input.
|
25
|
+
|
3
26
|
== 2.2.14
|
4
27
|
|
5
28
|
Bugfixes::
|
data/README.adoc
CHANGED
@@ -23,16 +23,16 @@ The example below shows an embedded Ditaa diagram block.
|
|
23
23
|
---------
|
24
24
|
[ditaa]
|
25
25
|
----
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
+--------+
|
34
|
-
| adoc
|
35
|
-
+--------+
|
26
|
+
+-------------+
|
27
|
+
| asciidoctor |---------------+
|
28
|
+
| diagram | |
|
29
|
+
+-------------+ | image
|
30
|
+
^ |
|
31
|
+
| diagram source |
|
32
|
+
| v
|
33
|
+
+--------+ +------+------+ /--------------\
|
34
|
+
| adoc |------>+ asciidoctor +------->| HTML + image |
|
35
|
+
+--------+ +-------------+ html \--------------/
|
36
36
|
----
|
37
37
|
---------
|
38
38
|
|
@@ -138,9 +138,10 @@ module Asciidoctor
|
|
138
138
|
|
139
139
|
config[cmd_var] = cmd_path
|
140
140
|
|
141
|
-
|
142
|
-
|
143
|
-
|
141
|
+
end
|
142
|
+
|
143
|
+
if cmd_path.nil? && options.fetch(:raise_on_error, true)
|
144
|
+
raise "Could not find the #{cmd_names.map { |c| "'#{c}'" }.join(', ')} executable in PATH; add it to the PATH or specify its location using the '#{attr_names[0]}' document attribute"
|
144
145
|
end
|
145
146
|
|
146
147
|
cmd_path
|
@@ -305,8 +306,7 @@ module Asciidoctor
|
|
305
306
|
|
306
307
|
def load_code
|
307
308
|
if @file_name
|
308
|
-
lines = File.
|
309
|
-
lines = prepare_source_array(lines)
|
309
|
+
lines = prepare_source_array(File.read(@file_name, :mode => 'rb'))
|
310
310
|
@parent_block.apply_subs(lines, resolve_diagram_subs).join("\n")
|
311
311
|
else
|
312
312
|
''
|
@@ -315,39 +315,33 @@ module Asciidoctor
|
|
315
315
|
|
316
316
|
private
|
317
317
|
|
318
|
-
#
|
319
|
-
BOM_BYTES_UTF_8 =
|
320
|
-
BOM_BYTES_UTF_16LE =
|
321
|
-
BOM_BYTES_UTF_16BE =
|
318
|
+
# Raw binary strings for UTF-* Byte Order Marks
|
319
|
+
BOM_BYTES_UTF_8 = String.new("\xef\xbb\xbf", :encoding => Encoding::ASCII_8BIT)
|
320
|
+
BOM_BYTES_UTF_16LE = String.new("\xff\xfe", :encoding => Encoding::ASCII_8BIT)
|
321
|
+
BOM_BYTES_UTF_16BE = String.new("\xfe\xff", :encoding => Encoding::ASCII_8BIT)
|
322
322
|
|
323
|
-
# Prepare the source data
|
323
|
+
# Prepare the source data for parsing.
|
324
324
|
#
|
325
|
-
# Encodes the data to UTF-8
|
325
|
+
# Encodes the data to UTF-8 and removes any trailing
|
326
326
|
# whitespace from every line.
|
327
327
|
#
|
328
|
-
#
|
329
|
-
# encode it to UTF-8 from the specified source encoding.
|
330
|
-
#
|
331
|
-
# data - the source data Array to prepare (no nil entries allowed)
|
328
|
+
# data - the source data to prepare
|
332
329
|
#
|
333
330
|
# returns a String Array of prepared lines
|
334
331
|
def prepare_source_array data
|
335
332
|
return [] if data.empty?
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
elsif leading_bytes == BOM_BYTES_UTF_8
|
344
|
-
data[0] = first.byteslice 3, first.bytesize
|
345
|
-
end
|
346
|
-
if first.encoding == ::Encoding::UTF_8
|
347
|
-
data.map {|line| line.rstrip}
|
333
|
+
|
334
|
+
if data.start_with?(BOM_BYTES_UTF_16LE)
|
335
|
+
utf8_data = data.byteslice(2, data.bytesize).encode(::Encoding::UTF_8, ::Encoding::UTF_16LE)
|
336
|
+
elsif data.start_with?(BOM_BYTES_UTF_16BE)
|
337
|
+
utf8_data = data.byteslice(2, data.bytesize).encode(::Encoding::UTF_8, ::Encoding::UTF_16BE)
|
338
|
+
elsif data.start_with?(BOM_BYTES_UTF_8)
|
339
|
+
utf8_data = data.byteslice(3, data.bytesize).force_encoding(::Encoding::UTF_8)
|
348
340
|
else
|
349
|
-
data.
|
341
|
+
utf8_data = data.force_encoding(::Encoding::UTF_8)
|
350
342
|
end
|
343
|
+
|
344
|
+
utf8_data.lines.map {|line| line.rstrip}
|
351
345
|
end
|
352
346
|
end
|
353
347
|
end
|
@@ -49,6 +49,8 @@ module Asciidoctor
|
|
49
49
|
'Accept' => Renderers.mime_type(options[:renderer])
|
50
50
|
}
|
51
51
|
headers['X-Structurizr-View'] = options[:view] if options[:view]
|
52
|
+
headers['X-Structurizr-IncludeDir'] = Platform.native_path(source.base_dir)
|
53
|
+
|
52
54
|
|
53
55
|
response = Java.send_request(
|
54
56
|
:url => '/structurizr',
|
Binary file
|
@@ -9,48 +9,53 @@ module Asciidoctor
|
|
9
9
|
include DiagramConverter
|
10
10
|
include CliGenerator
|
11
11
|
|
12
|
-
|
13
12
|
def supported_formats
|
14
13
|
[:png, :svg]
|
15
14
|
end
|
16
15
|
|
17
|
-
|
18
16
|
def convert(source, format, options)
|
19
|
-
|
20
|
-
|
21
|
-
|
17
|
+
wavedrom = source.find_command('wavedrom-cli', :attrs => ['wavedrom'], :raise_on_error => false)
|
18
|
+
|
19
|
+
unless wavedrom
|
20
|
+
wavedrom = source.find_command('wavedrom', :raise_on_error => false)
|
21
|
+
end
|
22
|
+
|
23
|
+
unless wavedrom
|
24
|
+
if ::Asciidoctor::Diagram::Platform.os == :macosx
|
25
|
+
wavedrom = source.find_command('WaveDromEditor.app', :alt_cmds => ['wavedrom-editor.app'], :attrs => ['WaveDromEditorApp'], :path => ['/Applications'], :raise_on_error => false)
|
26
|
+
if wavedrom
|
27
|
+
wavedrom = File.join(wavedrom, 'Contents/MacOS/nwjs')
|
28
|
+
end
|
29
|
+
else
|
30
|
+
wavedrom = source.find_command('WaveDromEditor', :raise_on_error => false)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
unless wavedrom
|
35
|
+
source.find_command('wavedrom-cli', :attrs => ['wavedrom'])
|
36
|
+
end
|
37
|
+
|
38
|
+
if wavedrom.end_with?('-cli')
|
39
|
+
generate_file(wavedrom, 'wvd', format.to_s, source.to_s) do |tool_path, input_path, output_path|
|
22
40
|
{
|
23
41
|
:args => [Platform.native_path(tool_path), '--input', Platform.native_path(input_path), "--#{format.to_s}", Platform.native_path(output_path)],
|
24
42
|
:chdir => source.base_dir
|
25
43
|
}
|
26
44
|
end
|
45
|
+
elsif wavedrom.include?('WaveDromEditor')
|
46
|
+
generate_file(wavedrom, 'wvd', format.to_s, source.to_s) do |tool_path, input_path, output_path|
|
47
|
+
{
|
48
|
+
:args => [tool_path, 'source', Platform.native_path(input_path), format.to_s, Platform.native_path(output_path)],
|
49
|
+
:chdir => source.base_dir
|
50
|
+
}
|
51
|
+
end
|
27
52
|
else
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
:args => [phantomjs, Platform.native_path(tool_path), '-i', Platform.native_path(input_path), "-#{format.to_s[0]}", Platform.native_path(output_path)],
|
35
|
-
:chdir => source.base_dir
|
36
|
-
}
|
37
|
-
end
|
38
|
-
else
|
39
|
-
if ::Asciidoctor::Diagram::Platform.os == :macosx
|
40
|
-
wavedrom = source.find_command('WaveDromEditor.app', :alt_cmds => ['wavedrom-editor.app'], :attrs => ['WaveDromEditorApp'], :path => ['/Applications'])
|
41
|
-
if wavedrom
|
42
|
-
wavedrom = File.join(wavedrom, 'Contents/MacOS/nwjs')
|
43
|
-
end
|
44
|
-
else
|
45
|
-
wavedrom = source.find_command('WaveDromEditor')
|
46
|
-
end
|
47
|
-
|
48
|
-
generate_file(wavedrom, 'wvd', format.to_s, source.to_s) do |tool_path, input_path, output_path|
|
49
|
-
{
|
50
|
-
:args => [tool_path, 'source', Platform.native_path(input_path), format.to_s, Platform.native_path(output_path)],
|
51
|
-
:chdir => source.base_dir
|
52
|
-
}
|
53
|
-
end
|
53
|
+
phantomjs = source.find_command('phantomjs', :alt_attrs => ['phantomjs_2'])
|
54
|
+
generate_file(wavedrom, 'wvd', format.to_s, source.to_s) do |tool_path, input_path, output_path|
|
55
|
+
{
|
56
|
+
:args => [phantomjs, Platform.native_path(tool_path), '-i', Platform.native_path(input_path), "-#{format.to_s[0]}", Platform.native_path(output_path)],
|
57
|
+
:chdir => source.base_dir
|
58
|
+
}
|
54
59
|
end
|
55
60
|
end
|
56
61
|
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.2.
|
4
|
+
version: 2.2.17
|
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: 2024-02-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -211,7 +211,7 @@ files:
|
|
211
211
|
- lib/asciidoctor-diagram/structurizr/converter.rb
|
212
212
|
- lib/asciidoctor-diagram/structurizr/extension.rb
|
213
213
|
- lib/asciidoctor-diagram/structurizr/renderers.rb
|
214
|
-
- lib/asciidoctor-diagram/structurizr/structurizr-2.0.
|
214
|
+
- lib/asciidoctor-diagram/structurizr/structurizr-2.0.5.jar
|
215
215
|
- lib/asciidoctor-diagram/svgbob.rb
|
216
216
|
- lib/asciidoctor-diagram/svgbob/converter.rb
|
217
217
|
- lib/asciidoctor-diagram/svgbob/extension.rb
|
Binary file
|