asciidoctor-diagram 2.3.0 → 2.3.1

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: 0b7d586b723b3485288bc8127bbae0ce102fb2d6b07269a98790c01952aa2434
4
- data.tar.gz: 97316ae03795b92cd09fd0baf9ecd86b5a68618a5a653e20d905fe3e66dd4c6f
3
+ metadata.gz: ba1fe3f7c564342dde9942ddb021de41fd84e10d2661b0fe29f8e716c960e145
4
+ data.tar.gz: 5b504adb1364e2c7a709adebebe54b68af6e5571de5192f3784567178839c24a
5
5
  SHA512:
6
- metadata.gz: 498776729f7aa965ad47f6ff9fe11bd16a09e389eab45a060b80675fd638bd05c4917a686e1effa787afaa67002c549817cdb36c8453453cb9010b9c33effa68
7
- data.tar.gz: 6d6dc3314c9163832907cf7a5a45a2802976de6c9c04ef737463cdb2ec7ecb0c87db5f79dcf6bc5001705a10ea959635d66a88af7aa2f8b72bdde40af658d26b
6
+ metadata.gz: cd0ce65811837cd0ee3be1b00eb1e3fe8a951f3b4f0e8c94846450489adc8692d80eab616d1a653fc8bfc8444e92b345e9cb79acac007f5ef49e1fae99108553
7
+ data.tar.gz: 2289407dc63908392cdcd9bd3e4980b7ec95dd0f2e0ed38f493ea243d62c2f3fa68fff8128b4a3ef7a7dbbc7e46822696551e70b1ef4230f2bf9a7f130a37d49
data/CHANGELOG.adoc CHANGED
@@ -1,5 +1,16 @@
1
1
  = Asciidoctor-diagram Changelog
2
2
 
3
+ == 2.3.1
4
+
5
+ Enhancements::
6
+
7
+ * Issue #423: Add support for loading JSyntrax via the `asciidoctor-diagram-jsyntrax` gem (@inponomarev)
8
+ * Issue #464: Remove usage of 'base64' gem to resolve Ruby 3.3+ compatibility issues
9
+
10
+ Bugfixes::
11
+
12
+ * Issue #459: Fix lookup of `wavedrom-cli` location on Windows
13
+
3
14
  == 2.3.0
4
15
 
5
16
  Enhancements::
@@ -1,7 +1,7 @@
1
1
  require_relative '../diagram_converter'
2
+ require_relative '../util/base64'
2
3
  require_relative '../util/platform'
3
4
 
4
- require 'base64'
5
5
  require 'net/http'
6
6
  require 'uri'
7
7
  require 'zlib'
@@ -47,15 +47,20 @@ module Asciidoctor
47
47
  compressed = deflate.deflate(code, Zlib::FINISH)
48
48
  deflate.close
49
49
 
50
- encoded = Base64.urlsafe_encode64(compressed)
51
- data = '0A' + encoded
50
+ data = Base64.urlsafe_encode(compressed)
51
+ # See https://plantuml.com/text-encoding
52
+ # PlantUML uses a different alphabet than the one from RFC 4648
53
+ data.tr!(
54
+ 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789',
55
+ '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
56
+ )
52
57
 
53
58
  path = uri.path.dup
54
59
  path << '/' unless path.end_with? '/'
55
60
  path << format.to_s
56
61
  when :kroki_io
57
62
  compressed = Zlib.deflate(code, Zlib::BEST_COMPRESSION)
58
- data = Base64.urlsafe_encode64(compressed)
63
+ data = Base64.urlsafe_encode(compressed)
59
64
 
60
65
  path = uri.path.dup
61
66
  path << '/' unless path.end_with? '/'
@@ -1,10 +1,10 @@
1
- require 'base64'
2
1
  require 'json'
3
2
  require 'sinatra/base'
4
3
  require 'zlib'
5
4
 
6
5
  require_relative '../diagram_source'
7
6
  require_relative '../graphviz/converter'
7
+ require_relative '../util/base64'
8
8
  require_relative '../util/which'
9
9
 
10
10
  module Asciidoctor
@@ -14,7 +14,7 @@ module Asciidoctor
14
14
  type = params['type']
15
15
  accepts = lambda { |t| params['format'].downcase.to_sym == t }
16
16
  raw_source = params['source']
17
- decoded_source = Base64.urlsafe_decode64(raw_source)
17
+ decoded_source = Base64.urlsafe_decode(raw_source)
18
18
  decompressed_source = Zlib::Inflate.inflate(decoded_source)
19
19
  source = decompressed_source
20
20
  render_diagram(type, accepts, source, {})
@@ -17,7 +17,12 @@ module Asciidoctor
17
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
- nil
20
+ begin
21
+ require 'asciidoctor-diagram/jsyntrax/classpath'
22
+ ::Asciidoctor::Diagram::JsyntraxClasspath::JAR_FILES
23
+ rescue LoadError
24
+ nil
25
+ end
21
26
  end
22
27
 
23
28
  if JSYNTRAX_JARS
@@ -15,7 +15,7 @@ module Asciidoctor
15
15
 
16
16
  def collect_options(source)
17
17
  {
18
- :preamble => source.attr('preamble') == 'true'
18
+ :preamble => source.opt('preamble') || source.attr('preamble') == 'true'
19
19
  }
20
20
  end
21
21
 
@@ -0,0 +1,25 @@
1
+ module Asciidoctor
2
+ module Diagram
3
+ module Base64
4
+ def self.urlsafe_encode(bin, padding: true)
5
+ str = [bin].pack("m0")
6
+ str.chomp!("==") or str.chomp!("=") unless padding
7
+ str.tr!("+/", "-_")
8
+ str
9
+ end
10
+
11
+ def self.urlsafe_decode(str)
12
+ # NOTE: RFC 4648 does say nothing about unpadded input, but says that
13
+ # "the excess pad characters MAY also be ignored", so it is inferred that
14
+ # unpadded input is also acceptable.
15
+ if !str.end_with?("=") && str.length % 4 != 0
16
+ str = str.ljust((str.length + 3) & ~3, "=")
17
+ str.tr!("-_", "+/")
18
+ else
19
+ str = str.tr("-_", "+/")
20
+ end
21
+ str.unpack1("m0")
22
+ end
23
+ end
24
+ end
25
+ end
@@ -1,5 +1,5 @@
1
1
  module Asciidoctor
2
2
  module Diagram
3
- VERSION = "2.3.0"
3
+ VERSION = "2.3.1"
4
4
  end
5
5
  end
@@ -35,7 +35,7 @@ module Asciidoctor
35
35
  source.find_command('wavedrom-cli', :attrs => ['wavedrom'])
36
36
  end
37
37
 
38
- if wavedrom.end_with?('-cli')
38
+ if wavedrom.include?('-cli')
39
39
  generate_file(wavedrom, 'wvd', format.to_s, source.to_s) do |tool_path, input_path, output_path|
40
40
  {
41
41
  :args => [Platform.native_path(tool_path), '--input', Platform.native_path(input_path), "--#{format.to_s}", Platform.native_path(output_path)],
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.0
4
+ version: 2.3.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: 2024-02-10 00:00:00.000000000 Z
11
+ date: 2024-06-16 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.1.0.jar
159
+ - lib/asciidoctor-diagram/ditaa/ditaa-2.2.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.1.1.jar
202
+ - lib/asciidoctor-diagram/plantuml/plantuml-2.2.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.1.1.jar
214
+ - lib/asciidoctor-diagram/structurizr/structurizr-2.2.0.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,13 +221,14 @@ 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.1.0.jar
224
+ - lib/asciidoctor-diagram/syntrax/syntrax-2.2.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
228
228
  - lib/asciidoctor-diagram/umlet.rb
229
229
  - lib/asciidoctor-diagram/umlet/converter.rb
230
230
  - lib/asciidoctor-diagram/umlet/extension.rb
231
+ - lib/asciidoctor-diagram/util/base64.rb
231
232
  - lib/asciidoctor-diagram/util/binaryio.rb
232
233
  - lib/asciidoctor-diagram/util/cli.rb
233
234
  - lib/asciidoctor-diagram/util/cli_generator.rb
@@ -238,7 +239,7 @@ files:
238
239
  - lib/asciidoctor-diagram/util/pdf.rb
239
240
  - lib/asciidoctor-diagram/util/platform.rb
240
241
  - lib/asciidoctor-diagram/util/png.rb
241
- - lib/asciidoctor-diagram/util/server-2.1.0.jar
242
+ - lib/asciidoctor-diagram/util/server-2.2.0.jar
242
243
  - lib/asciidoctor-diagram/util/svg.rb
243
244
  - lib/asciidoctor-diagram/util/which.rb
244
245
  - lib/asciidoctor-diagram/vega.rb