asciidoctor-diagram 2.2.14 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c2447be8f4a47717d6ef4856ed210cbf44eaa09cd0ae154bb64119f3e309384d
4
- data.tar.gz: 8e40700cddd6d026c7ae4cd7cfafdf22704e01b4941eba2d274db91e103d700e
3
+ metadata.gz: 0b7d586b723b3485288bc8127bbae0ce102fb2d6b07269a98790c01952aa2434
4
+ data.tar.gz: 97316ae03795b92cd09fd0baf9ecd86b5a68618a5a653e20d905fe3e66dd4c6f
5
5
  SHA512:
6
- metadata.gz: 2e4c640aaa5ce31f00f94a10398d9ab9a29eca0a97359073645a82cd777ec860ad2a90ebc5ed549e65186a88d3e1c43a9f39250c1d2b6ba2745f31d4b3dd3679
7
- data.tar.gz: 9f54def1db4fd022b510a46daf33328b4854fb0d1dd7d3ba4bbc5a5dc1c966e4a37f548fdaa82c626024fdb31bdbf62218e1edbb1e8bdf1a7bf43fbf10116567
6
+ metadata.gz: 498776729f7aa965ad47f6ff9fe11bd16a09e389eab45a060b80675fd638bd05c4917a686e1effa787afaa67002c549817cdb36c8453453cb9010b9c33effa68
7
+ data.tar.gz: 6d6dc3314c9163832907cf7a5a45a2802976de6c9c04ef737463cdb2ec7ecb0c87db5f79dcf6bc5001705a10ea959635d66a88af7aa2f8b72bdde40af658d26b
data/CHANGELOG.adoc CHANGED
@@ -1,5 +1,40 @@
1
1
  = Asciidoctor-diagram Changelog
2
2
 
3
+ == 2.3.0
4
+
5
+ Enhancements::
6
+
7
+ * Issue #457: Relaxed Java version requirement from 11 to 1.8 (for tools that support it)
8
+
9
+ == 2.2.18
10
+
11
+ Enhancements::
12
+
13
+ * Add opt-in support for the PlantUML Smetana layout engine
14
+
15
+ == 2.2.17
16
+
17
+ Bugfixes::
18
+
19
+ * Issue #455: Fix regression in reading of UTF-8 source files introduced in 2.2.15
20
+
21
+ == 2.2.16
22
+
23
+ Bugfixes::
24
+
25
+ * Issue #453: Avoid internal error when WaveDrom cannot be located
26
+
27
+ == 2.2.15
28
+
29
+ Enhacements::
30
+
31
+ * Issue #453: Improve error message when WaveDrom cannot be located
32
+
33
+ Bugfixes::
34
+
35
+ * Issue #428: Improve support for reading UTF-16 encoded source files
36
+ * Issue #449: Fix resolving of relative `!include` paths in Structurizr DSL input.
37
+
3
38
  == 2.2.14
4
39
 
5
40
  Bugfixes::
data/README.adoc CHANGED
@@ -2,9 +2,9 @@
2
2
  Pepijn Van_Eeckhoudt <https://github.com/pepijnve[@pepijnve]>; Sarah White <https://github.com/graphitefriction[@graphitefriction]>
3
3
  :description: README for the Asciidoctor Diagram extension for Asciidoctor.
4
4
 
5
- image:https://github.com/asciidoctor/asciidoctor-diagram/workflows/Linux%20unit%20tests/badge.svg?branch=master["Linux Build Status", link="https://github.com/asciidoctor/asciidoctor-diagram/actions?query=workflow%3A%22Linux+unit+tests%22"]
6
- // image:https://github.com/asciidoctor/asciidoctor-diagram/workflows/macOS%20unit%20tests/badge.svg?branch=master["macOS Build Status", link="https://github.com/asciidoctor/asciidoctor-diagram/actions?query=workflow%3A%22macOS+unit+tests%22"]
7
- // image:https://github.com/asciidoctor/asciidoctor-diagram/workflows/Windows%20unit%20tests/badge.svg?branch=master["Windows Build Status", link="https://github.com/asciidoctor/asciidoctor-diagram/actions?query=workflow%3A%22Windows+unit+tests%22"]
5
+ image:https://github.com/asciidoctor/asciidoctor-diagram/workflows/Linux%20unit%20tests/badge.svg?branch=main["Linux Build Status", link="https://github.com/asciidoctor/asciidoctor-diagram/actions?query=workflow%3A%22Linux+unit+tests%22"]
6
+ // image:https://github.com/asciidoctor/asciidoctor-diagram/workflows/macOS%20unit%20tests/badge.svg?branch=main["macOS Build Status", link="https://github.com/asciidoctor/asciidoctor-diagram/actions?query=workflow%3A%22macOS+unit+tests%22"]
7
+ // image:https://github.com/asciidoctor/asciidoctor-diagram/workflows/Windows%20unit%20tests/badge.svg?branch=main["Windows Build Status", link="https://github.com/asciidoctor/asciidoctor-diagram/actions?query=workflow%3A%22Windows+unit+tests%22"]
8
8
  image:https://badge.fury.io/rb/asciidoctor-diagram.svg[Gem Version, link=https://rubygems.org/gems/asciidoctor-diagram]
9
9
 
10
10
  Asciidoctor Diagram is a set of Asciidoctor extensions that enable you to add diagrams, which you describe using plain text, to your AsciiDoc document.
@@ -23,16 +23,16 @@ The example below shows an embedded Ditaa diagram block.
23
23
  ---------
24
24
  [ditaa]
25
25
  ----
26
- +-------------+
27
- | asciidoctor |-----------+
28
- | diagram | |
29
- +-------------+ | image
30
- ^ |
31
- | diagram source |
32
- | v
33
- +--------+ +-----+-------+ /---------------\
34
- | adoc |-->+ asciidoctor + | HTML + image |
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
- if cmd_path.nil? && options.fetch(:raise_on_error, true)
142
- 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"
143
- end
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.readlines(@file_name)
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
- # Byte arrays for UTF-* Byte Order Marks
319
- BOM_BYTES_UTF_8 = [0xef, 0xbb, 0xbf]
320
- BOM_BYTES_UTF_16LE = [0xff, 0xfe]
321
- BOM_BYTES_UTF_16BE = [0xfe, 0xff]
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 Array for parsing.
323
+ # Prepare the source data for parsing.
324
324
  #
325
- # Encodes the data to UTF-8, if necessary, and removes any trailing
325
+ # Encodes the data to UTF-8 and removes any trailing
326
326
  # whitespace from every line.
327
327
  #
328
- # If a BOM is found at the beginning of the data, a best attempt is made to
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
- if (leading_2_bytes = (leading_bytes = (first = data[0]).unpack 'C3').slice 0, 2) == BOM_BYTES_UTF_16LE
337
- data[0] = first.byteslice 2, first.bytesize
338
- # NOTE you can't split a UTF-16LE string using .lines when encoding is UTF-8; doing so will cause this line to fail
339
- return data.map {|line| (line.encode ::Encoding::UTF_8, ::Encoding::UTF_16LE).rstrip}
340
- elsif leading_2_bytes == BOM_BYTES_UTF_16BE
341
- data[0] = first.byteslice 2, first.bytesize
342
- return data.map {|line| (line.encode ::Encoding::UTF_8, ::Encoding::UTF_16BE).rstrip}
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.map {|line| (line.encode ::Encoding::UTF_8).rstrip}
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
@@ -37,9 +37,11 @@ module Asciidoctor
37
37
 
38
38
  def collect_options(source)
39
39
  options = {
40
- :size_limit => source.attr('size-limit', '4096')
40
+ :size_limit => source.attr('size-limit', '4096'),
41
41
  }
42
42
 
43
+ options[:smetana] = true if source.opt('smetana')
44
+
43
45
  theme = source.attr('theme', nil)
44
46
  options[:theme] = theme if theme
45
47
 
@@ -106,9 +108,13 @@ module Asciidoctor
106
108
  add_theme_header(headers, options[:theme])
107
109
  add_size_limit_header(headers, options[:size_limit])
108
110
 
109
- dot = source.find_command('dot', :alt_attrs => ['graphvizdot'], :raise_on_error => false)
110
- if dot
111
- headers['X-Graphviz'] = ::Asciidoctor::Diagram::Platform.host_os_path(dot)
111
+ if options[:smetana]
112
+ headers['X-Graphviz'] = 'smetana'
113
+ else
114
+ dot = source.find_command('dot', :alt_attrs => ['graphvizdot'], :raise_on_error => false)
115
+ if dot
116
+ headers['X-Graphviz'] = ::Asciidoctor::Diagram::Platform.host_os_path(dot)
117
+ end
112
118
  end
113
119
 
114
120
  response = Java.send_request(
@@ -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',
@@ -1,5 +1,5 @@
1
1
  module Asciidoctor
2
2
  module Diagram
3
- VERSION = "2.2.14"
3
+ VERSION = "2.3.0"
4
4
  end
5
5
  end
@@ -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
- wavedrom_cli = source.find_command('wavedrom-cli', :raise_on_error => false)
20
- if wavedrom_cli
21
- generate_file(wavedrom_cli, 'wvd', format.to_s, source.to_s) do |tool_path, input_path, output_path|
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
- wavedrom_cli = source.find_command('wavedrom', :raise_on_error => false)
29
- phantomjs = source.find_command('phantomjs', :alt_attrs => ['phantomjs_2'], :raise_on_error => false)
30
-
31
- if wavedrom_cli && !wavedrom_cli.include?('WaveDromEditor') && phantomjs
32
- generate_file(wavedrom_cli, 'wvd', format.to_s, source.to_s) do |tool_path, input_path, output_path|
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.14
4
+ version: 2.3.0
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: 2023-09-20 00:00:00.000000000 Z
11
+ date: 2024-02-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -156,7 +156,7 @@ files:
156
156
  - lib/asciidoctor-diagram/diagrams/extension.rb
157
157
  - lib/asciidoctor-diagram/ditaa.rb
158
158
  - lib/asciidoctor-diagram/ditaa/converter.rb
159
- - lib/asciidoctor-diagram/ditaa/ditaa-2.0.0.jar
159
+ - lib/asciidoctor-diagram/ditaa/ditaa-2.1.0.jar
160
160
  - lib/asciidoctor-diagram/ditaa/extension.rb
161
161
  - lib/asciidoctor-diagram/dpic.rb
162
162
  - lib/asciidoctor-diagram/dpic/converter.rb
@@ -199,7 +199,7 @@ files:
199
199
  - lib/asciidoctor-diagram/plantuml.rb
200
200
  - lib/asciidoctor-diagram/plantuml/converter.rb
201
201
  - lib/asciidoctor-diagram/plantuml/extension.rb
202
- - lib/asciidoctor-diagram/plantuml/plantuml-2.0.0.jar
202
+ - lib/asciidoctor-diagram/plantuml/plantuml-2.1.1.jar
203
203
  - lib/asciidoctor-diagram/salt.rb
204
204
  - lib/asciidoctor-diagram/shaape.rb
205
205
  - lib/asciidoctor-diagram/shaape/converter.rb
@@ -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.3.jar
214
+ - lib/asciidoctor-diagram/structurizr/structurizr-2.1.1.jar
215
215
  - lib/asciidoctor-diagram/svgbob.rb
216
216
  - lib/asciidoctor-diagram/svgbob/converter.rb
217
217
  - lib/asciidoctor-diagram/svgbob/extension.rb
@@ -221,7 +221,7 @@ files:
221
221
  - lib/asciidoctor-diagram/syntrax.rb
222
222
  - lib/asciidoctor-diagram/syntrax/converter.rb
223
223
  - lib/asciidoctor-diagram/syntrax/extension.rb
224
- - lib/asciidoctor-diagram/syntrax/syntrax-2.0.2.jar
224
+ - lib/asciidoctor-diagram/syntrax/syntrax-2.1.0.jar
225
225
  - lib/asciidoctor-diagram/tikz.rb
226
226
  - lib/asciidoctor-diagram/tikz/converter.rb
227
227
  - lib/asciidoctor-diagram/tikz/extension.rb
@@ -238,7 +238,7 @@ files:
238
238
  - lib/asciidoctor-diagram/util/pdf.rb
239
239
  - lib/asciidoctor-diagram/util/platform.rb
240
240
  - lib/asciidoctor-diagram/util/png.rb
241
- - lib/asciidoctor-diagram/util/server-2.0.0.jar
241
+ - lib/asciidoctor-diagram/util/server-2.1.0.jar
242
242
  - lib/asciidoctor-diagram/util/svg.rb
243
243
  - lib/asciidoctor-diagram/util/which.rb
244
244
  - lib/asciidoctor-diagram/vega.rb
@@ -253,7 +253,7 @@ licenses:
253
253
  - MIT
254
254
  metadata:
255
255
  bug_tracker_uri: https://github.com/asciidoctor/asciidoctor-diagram/issues
256
- changelog_uri: https://github.com/asciidoctor/asciidoctor-diagram/blob/master/CHANGELOG.adoc
256
+ changelog_uri: https://github.com/asciidoctor/asciidoctor-diagram/blob/main/CHANGELOG.adoc
257
257
  documentation_uri: https://docs.asciidoctor.org/diagram-extension/latest/
258
258
  homepage_uri: https://github.com/asciidoctor/asciidoctor-diagram
259
259
  source_code_uri: https://github.com/asciidoctor/asciidoctor-diagram.git