asciidoctor-diagram 1.5.11 → 1.5.12

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
- SHA256:
3
- metadata.gz: 5cba39190bfc72114adb239749953ef15fa8f7bfdf2265a49243a848e0577129
4
- data.tar.gz: 8393028bf7f8891f130e431ab4581c5332cc7c03b0c56d1eec656605a0d24255
2
+ SHA1:
3
+ metadata.gz: 5913cbd36fd3b829ac50411bfa45bf67077c8ac2
4
+ data.tar.gz: fc549589f2920e44418d44befc61ea469dd831bc
5
5
  SHA512:
6
- metadata.gz: 2dd40ea17f2ae6f3210df55d01cb159f2e9cd0b454a1b7e4a9a176c59e5f264da29a307f9bfbe543b1dfb9d28e4a6d5bb53c7c0e6d53af974e002641964ef87d
7
- data.tar.gz: 3e4f4863daceb0ae205280d01479501ce758cadc814cbe53c3ba5bf273699ae5cffc8cb7d6fe231bf73c950ef0de3b199dcac89d86acec60c4f5559a20b10359
6
+ metadata.gz: 59573e38cc1ab7ea78ac87169857c43b88b29c1430175ae63a64f5828d0ce600d43c5f7684223fa413789db5120a4b33cb4511da24e145249e2db410b8652c58
7
+ data.tar.gz: fac3eab000034f0d4b5df6e549a4bb678d50dee313abf4ce01b99246461e0530bd5bb043b39b84c6db559628756357e68f8ca8c78b5d226ed2161c2e799b7ba1
@@ -1,5 +1,14 @@
1
1
  = Asciidoctor-diagram Changelog
2
2
 
3
+ == 1.5.12
4
+
5
+ Bug Fixes::
6
+
7
+ * Issue #201: Respect `destination-dir` CLI flag for diagrams embedded in tables
8
+ * Issue #203: Update Batik to 1.10
9
+ * Issue #205: Resolve errors when executing CLI commands using certain versions of JRuby.
10
+ * Update PlantUML to 2018.13
11
+
3
12
  == 1.5.11
4
13
 
5
14
  Enhancements::
@@ -250,7 +250,7 @@ module Asciidoctor
250
250
  if images_dir
251
251
  base_dir = nil
252
252
  else
253
- base_dir = parent.attr('outdir') || (document.respond_to?(:options) && document.options[:to_dir])
253
+ base_dir = parent.attr('outdir') || doc_option(document, :to_dir)
254
254
  images_dir = parent.attr('imagesdir')
255
255
  end
256
256
 
@@ -260,7 +260,7 @@ module Asciidoctor
260
260
  def cache_dir(parent)
261
261
  document = parent.document
262
262
  cache_dir = '.asciidoctor/diagram'
263
- base_dir = parent.attr('outdir') || (document.respond_to?(:options) && document.options[:to_dir])
263
+ base_dir = parent.attr('outdir') || doc_option(document, :to_dir)
264
264
  parent.normalize_system_path(cache_dir, base_dir)
265
265
  end
266
266
 
@@ -273,6 +273,20 @@ module Asciidoctor
273
273
  result.force_encoding(Encoding::UTF_8)
274
274
  Asciidoctor::Block.new parent, :literal, :source => result, :attributes => literal_attributes
275
275
  end
276
+
277
+ def doc_option(document, key)
278
+ if document.respond_to?(:options)
279
+ value = document.options[key]
280
+ else
281
+ value = nil
282
+ end
283
+
284
+ if document.nested? && value.nil?
285
+ doc_option(docuemnt.parent_document, key)
286
+ else
287
+ value
288
+ end
289
+ end
276
290
  end
277
291
 
278
292
  # Base class for diagram block processors.
@@ -333,14 +347,14 @@ module Asciidoctor
333
347
  end
334
348
 
335
349
  # Get the value for the specified attribute. First look in the attributes on
336
- # this node and return the value of the attribute if found. Otherwise, if
337
- # this node is a child of the Document node, look in the attributes of the
338
- # Document node and return the value of the attribute if found. Otherwise,
350
+ # this document and return the value of the attribute if found. Otherwise, if
351
+ # this document is a child of the Document document, look in the attributes of the
352
+ # Document document and return the value of the attribute if found. Otherwise,
339
353
  # return the default value, which defaults to nil.
340
354
  #
341
355
  # @param name [String, Symbol] the name of the attribute to lookup
342
356
  # @param default_value [Object] the value to return if the attribute is not found
343
- # @inherit [Boolean, String] indicates whether to check for the attribute on the AsciiDoctor::Document if not found on this node.
357
+ # @inherit [Boolean, String] indicates whether to check for the attribute on the AsciiDoctor::Document if not found on this document.
344
358
  # When a non-nil String is given the an attribute name "#{inherit}-#{name}" is looked for on the document.
345
359
  #
346
360
  # @return the value of the attribute or the default value if the attribute is not found in the attributes of this node or the document node
@@ -10,7 +10,12 @@ module Asciidoctor
10
10
 
11
11
  private
12
12
 
13
- JARS = ['plantuml-1.3.13.jar', 'plantuml.jar', 'jlatexmath-minimal-1.0.5.jar', 'batik-all-1.7.jar'].map do |jar|
13
+ JARS = [
14
+ 'plantuml-1.3.13.jar',
15
+ 'plantuml.jar',
16
+ 'jlatexmath-minimal-1.0.5.jar',
17
+ 'batik-all-1.10.jar'
18
+ ].map do |jar|
14
19
  File.expand_path File.join('../..', jar), File.dirname(__FILE__)
15
20
  end
16
21
  Java.classpath.concat JARS
@@ -1,22 +1,77 @@
1
- require 'tempfile'
2
- require 'open3'
3
-
4
1
  module Asciidoctor
5
2
  module Diagram
6
3
  # @private
7
4
  module Cli
8
- def self.run(*args)
9
- stdout, stderr, status = Open3.capture3(*args)
5
+ if RUBY_PLATFORM == "java"
6
+ require_relative 'java'
7
+
8
+ def self.run(*args)
9
+ opts = args.pop if args.last.is_a? Hash
10
+ in_data = opts && opts[:stdin_data]
11
+
12
+ pb = java.lang.ProcessBuilder.new(*args)
13
+ p = pb.start
14
+
15
+ stdout = ""
16
+ out_reader = start_stream_reader(p.getInputStream, stdout)
17
+ stderr = ""
18
+ err_reader = start_stream_reader(p.getErrorStream, stderr)
19
+
20
+ if in_data
21
+ p.getOutputStream.write(in_data.to_java_bytes)
22
+ p.getOutputStream.close
23
+ end
24
+
25
+ p.waitFor
26
+
27
+ out_reader.join
28
+ err_reader.join
29
+
30
+ status = p.exitValue
10
31
 
11
- if status.exitstatus != 0
12
- raise "#{File.basename(args[0])} failed: #{stdout.empty? ? stderr : stdout}"
32
+ if status != 0
33
+ raise "#{File.basename(args[0])} failed: #{stdout.empty? ? stderr : stdout}"
34
+ end
35
+
36
+ {
37
+ :out => stdout,
38
+ :err => stderr,
39
+ :status => status
40
+ }
41
+ end
42
+
43
+ private
44
+ def self.start_stream_reader(in_stream, out_string)
45
+ Thread.new {
46
+ buffer = ::Java::byte[4096].new
47
+ while (bytes_read = in_stream.read(buffer)) != -1
48
+ if bytes_read < buffer.length
49
+ str = String.from_java_bytes(java.util.Arrays.copyOf(buffer, bytes_read))
50
+ else
51
+ str = String.from_java_bytes(buffer)
52
+ end
53
+ out_string << str
54
+ end
55
+ }
13
56
  end
57
+ else
58
+ require 'open3'
59
+
60
+ def self.run(*args)
61
+ stdout, stderr, status = Open3.capture3(*args)
14
62
 
15
- {
16
- :out => stdout,
17
- :err => stderr,
18
- :status => status
19
- }
63
+ exit = status.exitstatus
64
+
65
+ if exit != 0
66
+ raise "#{File.basename(args[0])} failed: #{stdout.empty? ? stderr : stdout}"
67
+ end
68
+
69
+ {
70
+ :out => stdout,
71
+ :err => stderr,
72
+ :status => exit
73
+ }
74
+ end
20
75
  end
21
76
  end
22
77
  end
@@ -1,5 +1,5 @@
1
1
  module Asciidoctor
2
2
  module Diagram
3
- VERSION = "1.5.11"
3
+ VERSION = "1.5.12"
4
4
  end
5
5
  end
Binary file
Binary file
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: 1.5.11
4
+ version: 1.5.12
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: 2018-11-02 00:00:00.000000000 Z
11
+ date: 2019-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -132,7 +132,7 @@ files:
132
132
  - lib/asciidoctor-diagram/version.rb
133
133
  - lib/asciidoctor-diagram/wavedrom.rb
134
134
  - lib/asciidoctor-diagram/wavedrom/extension.rb
135
- - lib/batik-all-1.7.jar
135
+ - lib/batik-all-1.10.jar
136
136
  - lib/ditaa-1.3.13.jar
137
137
  - lib/ditaamini-0.11.jar
138
138
  - lib/jlatexmath-minimal-1.0.5.jar
@@ -177,7 +177,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
177
177
  version: '0'
178
178
  requirements: []
179
179
  rubyforge_project:
180
- rubygems_version: 2.7.6
180
+ rubygems_version: 2.5.1
181
181
  signing_key:
182
182
  specification_version: 4
183
183
  summary: An extension for asciidoctor that adds support for UML diagram generation
Binary file