asciidoctor-diagram 2.2.12 → 2.2.13

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.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.adoc +11 -0
  3. data/lib/asciidoctor-diagram/a2s/converter.rb +4 -1
  4. data/lib/asciidoctor-diagram/blockdiag/converter.rb +5 -1
  5. data/lib/asciidoctor-diagram/bpmn/converter.rb +4 -1
  6. data/lib/asciidoctor-diagram/bytefield/converter.rb +4 -1
  7. data/lib/asciidoctor-diagram/d2/converter.rb +2 -2
  8. data/lib/asciidoctor-diagram/dbml/converter.rb +6 -1
  9. data/lib/asciidoctor-diagram/diagram_processor.rb +10 -4
  10. data/lib/asciidoctor-diagram/diagram_source.rb +4 -0
  11. data/lib/asciidoctor-diagram/diagrams/converter.rb +4 -1
  12. data/lib/asciidoctor-diagram/dpic/converter.rb +4 -1
  13. data/lib/asciidoctor-diagram/erd/converter.rb +4 -1
  14. data/lib/asciidoctor-diagram/gnuplot/converter.rb +6 -1
  15. data/lib/asciidoctor-diagram/graphviz/converter.rb +4 -1
  16. data/lib/asciidoctor-diagram/graphviz_py/converter.rb +4 -1
  17. data/lib/asciidoctor-diagram/http/converter.rb +0 -1
  18. data/lib/asciidoctor-diagram/lilypond/converter.rb +2 -1
  19. data/lib/asciidoctor-diagram/mermaid/converter.rb +4 -2
  20. data/lib/asciidoctor-diagram/msc/converter.rb +5 -1
  21. data/lib/asciidoctor-diagram/nomnoml/converter.rb +4 -1
  22. data/lib/asciidoctor-diagram/penrose/converter.rb +4 -1
  23. data/lib/asciidoctor-diagram/pikchr/converter.rb +4 -1
  24. data/lib/asciidoctor-diagram/shaape/converter.rb +4 -1
  25. data/lib/asciidoctor-diagram/smcat/converter.rb +5 -1
  26. data/lib/asciidoctor-diagram/svgbob/converter.rb +4 -1
  27. data/lib/asciidoctor-diagram/symbolator/converter.rb +4 -1
  28. data/lib/asciidoctor-diagram/syntrax/converter.rb +4 -1
  29. data/lib/asciidoctor-diagram/tikz/converter.rb +4 -1
  30. data/lib/asciidoctor-diagram/umlet/converter.rb +4 -1
  31. data/lib/asciidoctor-diagram/vega/converter.rb +5 -3
  32. data/lib/asciidoctor-diagram/version.rb +1 -1
  33. data/lib/asciidoctor-diagram/wavedrom/converter.rb +13 -4
  34. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8fa9df554bdc548c3c2ab23f18f44f1931a24b9aca2d691d2514a3ed4f6ac7f5
4
- data.tar.gz: f03d45985571af9290798a36220cbbb1d70a7bad321c3f58181a28e975f499ab
3
+ metadata.gz: 2bcfe1104d151f5da05b3f237b06e2310ca670ee84f6e4e9b6f43a769820fcf0
4
+ data.tar.gz: 1d44562539b7320c7fd4b767d16428aa3bc896e181575be73e5e87f2dc59b93f
5
5
  SHA512:
6
- metadata.gz: a058672b892ced01c4c6686601f8d2f0f4d8ba4393911b96912d204072beb8af2f9be455adf38bb2018049a9b1cd3f3eb6c8de8da697d4717349fa75f0bf7e33
7
- data.tar.gz: e6625a076b2dfee01b6e2267fe448aa7a11ddd6f3c0282553670e0ed067988a50109722d1cd408fc4530435df15195cb63718c05354248e613312f239be55af8
6
+ metadata.gz: ce2fb9ac70813787758f76eccf886f4e538313c7c2574915c1034c19ebedd7b7af93ddeeed297c91e24db8d7056acecf9df98d7b01e522b61a7240ed52f8614e
7
+ data.tar.gz: 1a68a3fa835c7fb8c9d61d4754f4a2a7d1a37eaad67895aabcdb0183d101e45b30c61067e4293a8392e70f54bf19ef327eab00fc6255ea3507fa7cde1a77293d
data/CHANGELOG.adoc CHANGED
@@ -1,5 +1,16 @@
1
1
  = Asciidoctor-diagram Changelog
2
2
 
3
+ == 2.2.13
4
+
5
+ Enhancements::
6
+
7
+ * Issue #436: Allow diagram caching to be disabled using the `nocache` option.
8
+
9
+ Bugfixes::
10
+
11
+ * Issue #437: Set working directory when generating diagrams.
12
+ * Issue #439: Resolve errors when using relative imports in D2 diagrams
13
+
3
14
  == 2.2.12
4
15
 
5
16
  Enhancements::
@@ -49,7 +49,10 @@ module Asciidoctor
49
49
  args << '-f' << font
50
50
  end
51
51
 
52
- args
52
+ {
53
+ :args => args,
54
+ :chdir => source.base_dir
55
+ }
53
56
  end
54
57
  end
55
58
 
@@ -25,7 +25,11 @@ module Asciidoctor
25
25
  args = [tool_path, '-a', '-o', Platform.native_path(output_path), "-T#{format.to_s}"]
26
26
  args << "-f#{Platform.native_path(font_path)}" if font_path
27
27
  args << '-'
28
- args
28
+
29
+ {
30
+ :args => args,
31
+ :chdir => source.base_dir
32
+ }
29
33
  end
30
34
  end
31
35
  end
@@ -54,7 +54,10 @@ module Asciidoctor
54
54
  args << '--height' << options[:height]
55
55
  end
56
56
 
57
- args
57
+ {
58
+ :args => args,
59
+ :chdir => source.base_dir
60
+ }
58
61
  end
59
62
  end
60
63
  end
@@ -18,7 +18,10 @@ module Asciidoctor
18
18
  bytefield_path = source.find_command('bytefield-svg')
19
19
 
20
20
  generate_stdin(bytefield_path, format.to_s, source.to_s) do |tool_path, output_path|
21
- [tool_path, "--output", Platform.native_path(output_path)]
21
+ {
22
+ :args => [tool_path, "--output", Platform.native_path(output_path)],
23
+ :chdir => source.base_dir
24
+ }
22
25
  end
23
26
  end
24
27
  end
@@ -27,7 +27,7 @@ module Asciidoctor
27
27
  end
28
28
 
29
29
  def convert(source, format, options)
30
- generate_file(source.find_command('d2'), "d2", format.to_s, source.code) do |tool_path, input_path, output_path|
30
+ generate_stdin(source.find_command('d2'), format.to_s, source.code) do |tool_path, output_path|
31
31
  args = [tool_path, '--browser', 'false']
32
32
 
33
33
  options.each_pair do |key, value|
@@ -43,7 +43,7 @@ module Asciidoctor
43
43
  end
44
44
  end
45
45
 
46
- args << Platform.native_path(input_path)
46
+ args << '-'
47
47
  args << Platform.native_path(output_path)
48
48
 
49
49
  {
@@ -15,7 +15,12 @@ module Asciidoctor
15
15
  end
16
16
 
17
17
  def convert(source, format, options)
18
- generate_stdin_stdout(source.find_command('dbml-renderer'), source.code)
18
+ generate_stdin_stdout(source.find_command('dbml-renderer'), source.code) do |tool|
19
+ {
20
+ :args => [tool],
21
+ :chdir => source.base_dir
22
+ }
23
+ end
19
24
  end
20
25
  end
21
26
  end
@@ -165,7 +165,9 @@ module Asciidoctor
165
165
  image_file = parent.normalize_system_path(image_name, image_output_dir(parent))
166
166
  metadata_file = parent.normalize_system_path("#{image_name}.cache", cache_dir(source, parent))
167
167
 
168
- if File.exist? metadata_file
168
+ use_cache = !source.global_opt('nocache')
169
+
170
+ if use_cache && File.exist?(metadata_file)
169
171
  metadata = File.open(metadata_file, 'r') {|f| JSON.load(f, nil, :symbolize_names => true, :create_additions => false) }
170
172
  else
171
173
  metadata = {}
@@ -191,14 +193,18 @@ module Asciidoctor
191
193
  metadata = source.create_image_metadata
192
194
  metadata[:options] = options
193
195
 
194
- allow_image_optimisation = source.attr('optimise', 'true') == 'true'
196
+ allow_image_optimisation = !source.global_opt('nooptimise')
195
197
  result, metadata[:width], metadata[:height] = params[:decoder].post_process_image(result, allow_image_optimisation)
196
198
 
197
199
  FileUtils.mkdir_p(File.dirname(image_file)) unless Dir.exist?(File.dirname(image_file))
198
200
  File.open(image_file, 'wb') {|f| f.write result}
199
201
 
200
- FileUtils.mkdir_p(File.dirname(metadata_file)) unless Dir.exist?(File.dirname(metadata_file))
201
- File.open(metadata_file, 'w') {|f| JSON.dump(metadata, f)}
202
+ if use_cache
203
+ FileUtils.mkdir_p(File.dirname(metadata_file)) unless Dir.exist?(File.dirname(metadata_file))
204
+ File.open(metadata_file, 'w') { |f| JSON.dump(metadata, f) }
205
+ else
206
+ File.delete(metadata_file) if File.exist?(metadata_file)
207
+ end
202
208
  end
203
209
 
204
210
  scale = image_attributes['scale']
@@ -26,6 +26,10 @@ module Asciidoctor
26
26
  raise NotImplementedError.new
27
27
  end
28
28
 
29
+ def global_opt(opt)
30
+ global_attr("#{opt}-option")
31
+ end
32
+
29
33
  def global_attr(name, default_value = nil)
30
34
  attr(name) || attr(name, default_value, 'diagram')
31
35
  end
@@ -38,7 +38,10 @@ module Asciidoctor
38
38
  begin
39
39
  target_file.close
40
40
  generate_stdin_file(python_path, code, target_file.path + ".#{format}") do |tool|
41
- [tool, '-']
41
+ {
42
+ :args => [tool, '-'],
43
+ :chdir => source.base_dir
44
+ }
42
45
  end
43
46
  ensure
44
47
  target_file.unlink
@@ -22,7 +22,10 @@ module Asciidoctor
22
22
  code << "\n.PE" unless code.start_with?("\n.PE")
23
23
 
24
24
  generate_file_stdout(dpic_path, format.to_s, code) do |tool_path, input_path|
25
- [tool_path, "-v", "-z", input_path]
25
+ {
26
+ :args => [tool_path, "-v", "-z", input_path],
27
+ :chdir => source.base_dir
28
+ }
26
29
  end
27
30
  end
28
31
  end
@@ -23,7 +23,10 @@ module Asciidoctor
23
23
  end
24
24
 
25
25
  generate_stdin(dot_path, format.to_s, dot_code) do |tool_path, output_path|
26
- [tool_path, "-o#{Platform.native_path(output_path)}", "-T#{format.to_s}"]
26
+ {
27
+ :args => [tool_path, "-o#{Platform.native_path(output_path)}", "-T#{format.to_s}"],
28
+ :chdir => source.base_dir
29
+ }
27
30
  end
28
31
  end
29
32
  end
@@ -56,7 +56,12 @@ module Asciidoctor
56
56
  code << "\n"
57
57
  code << source.to_s
58
58
 
59
- generate_stdin_stdout(source.find_command('gnuplot'), code)
59
+ generate_stdin_stdout(source.find_command('gnuplot'), code) do |tool|
60
+ {
61
+ :args => [tool],
62
+ :chdir => source.base_dir
63
+ }
64
+ end
60
65
  end
61
66
  end
62
67
  end
@@ -24,7 +24,10 @@ module Asciidoctor
24
24
  layout = options[:layout]
25
25
  args << "-K#{layout}" if layout
26
26
 
27
- args
27
+ {
28
+ :args => args,
29
+ :chdir => source.base_dir
30
+ }
28
31
  end
29
32
  end
30
33
  end
@@ -34,7 +34,10 @@ module Asciidoctor
34
34
  args << argument
35
35
  end
36
36
 
37
- args
37
+ {
38
+ :args => args,
39
+ :chdir => source.base_dir
40
+ }
38
41
  end
39
42
  end
40
43
  end
@@ -1,5 +1,4 @@
1
1
  require_relative '../diagram_converter'
2
- require_relative '../util/cli_generator'
3
2
  require_relative '../util/platform'
4
3
 
5
4
  require 'base64'
@@ -55,7 +55,8 @@ module Asciidoctor
55
55
 
56
56
  {
57
57
  :args => args,
58
- :out_file => "#{output_path}.cropped.#{format.to_s}"
58
+ :out_file => "#{output_path}.cropped.#{format.to_s}",
59
+ :chdir => source.base_dir
59
60
  }
60
61
  end
61
62
  end
@@ -164,7 +164,8 @@ module Asciidoctor
164
164
 
165
165
  {
166
166
  :args => args,
167
- :env => {'NODE_OPTIONS' => '--unhandled-rejections=strict'}
167
+ :env => {'NODE_OPTIONS' => '--unhandled-rejections=strict'},
168
+ :chdir => source.base_dir
168
169
  }
169
170
  end
170
171
  end
@@ -200,7 +201,8 @@ module Asciidoctor
200
201
 
201
202
  {
202
203
  :args => args,
203
- :out_file => output_file
204
+ :out_file => output_file,
205
+ :chdir => source.base_dir
204
206
  }
205
207
  end
206
208
  end
@@ -27,7 +27,11 @@ module Asciidoctor
27
27
  args << '-F' << font
28
28
  end
29
29
  args << '-'
30
- args
30
+
31
+ {
32
+ :args => args,
33
+ :chdir => source.base_dir
34
+ }
31
35
  end
32
36
  end
33
37
  end
@@ -17,7 +17,10 @@ module Asciidoctor
17
17
 
18
18
  def convert(source, format, options)
19
19
  generate_file(source.find_command('nomnoml'), 'nomnoml', format.to_s, source.to_s) do |tool_path, input_path, output_path|
20
- [tool_path, Platform.native_path(input_path), Platform.native_path(output_path)]
20
+ {
21
+ :args => [tool_path, Platform.native_path(input_path), Platform.native_path(output_path)],
22
+ :chdir => source.base_dir
23
+ }
21
24
  end
22
25
  end
23
26
  end
@@ -42,7 +42,10 @@ module Asciidoctor
42
42
  args << Platform.native_path(source.resolve_path(style_path))
43
43
  args << "--"
44
44
 
45
- args
45
+ {
46
+ :args => args,
47
+ :chdir => source.base_dir
48
+ }
46
49
  end
47
50
  end
48
51
  end
@@ -18,7 +18,10 @@ module Asciidoctor
18
18
  pikchr_path = source.find_command('pikchr')
19
19
 
20
20
  output = generate_file_stdout(pikchr_path, format.to_s, source.to_s) do |tool_path, input_path|
21
- [tool_path, "--svg-only", input_path]
21
+ {
22
+ :args => [tool_path, "--svg-only", input_path],
23
+ :chdir => source.base_dir
24
+ }
22
25
  end
23
26
 
24
27
  if output.start_with? '<svg'
@@ -17,7 +17,10 @@ module Asciidoctor
17
17
 
18
18
  def convert(source, format, options)
19
19
  generate_stdin(source.find_command('shaape'), format.to_s, source.to_s) do |tool_path, output_path|
20
- [tool_path, '-o', Platform.native_path(output_path), '-t', format.to_s, '-']
20
+ {
21
+ :args => [tool_path, '-o', Platform.native_path(output_path), '-t', format.to_s, '-'],
22
+ :chdir => source.base_dir
23
+ }
21
24
  end
22
25
  end
23
26
  end
@@ -36,7 +36,11 @@ module Asciidoctor
36
36
  end
37
37
 
38
38
  args << '-'
39
- args
39
+
40
+ {
41
+ :args => args,
42
+ :chdir => source.base_dir
43
+ }
40
44
  end
41
45
  end
42
46
  end
@@ -46,7 +46,10 @@ module Asciidoctor
46
46
  end
47
47
 
48
48
  generate_stdin(source.find_command('svgbob', :alt_cmds => ['svgbob_cli']), format.to_s, source.to_s) do |tool_path, output_path|
49
- ([tool_path, '-o', Platform.native_path(output_path)] + flags)
49
+ {
50
+ :args => ([tool_path, '-o', Platform.native_path(output_path)] + flags),
51
+ :chdir => source.base_dir
52
+ }
50
53
  end
51
54
  end
52
55
  end
@@ -15,7 +15,10 @@ module Asciidoctor
15
15
 
16
16
  def convert(source, format, options)
17
17
  generate_stdin(source.find_command('symbolator'), format.to_s, source.to_s) do |tool_path, output_path|
18
- [tool_path, "-i-", "-o#{Platform.native_path(output_path)}", "-f#{format.to_s}"]
18
+ {
19
+ :args => [tool_path, "-i-", "-o#{Platform.native_path(output_path)}", "-f#{format.to_s}"],
20
+ :chdir => source.base_dir
21
+ }
19
22
  end
20
23
  end
21
24
  end
@@ -91,7 +91,10 @@ module Asciidoctor
91
91
  response[:body]
92
92
  else
93
93
  generate_file(source.find_command('syntrax'), 'spec', format.to_s, source.to_s) do |tool_path, input_path, output_path|
94
- [tool_path, '-i', Platform.native_path(input_path), '-o', Platform.native_path(output_path)] + shared_args
94
+ {
95
+ :args => ([tool_path, '-i', Platform.native_path(input_path), '-o', Platform.native_path(output_path)] + shared_args),
96
+ :chdir => source.base_dir
97
+ }
95
98
  end
96
99
  end
97
100
 
@@ -64,7 +64,10 @@ END
64
64
 
65
65
  if svgpath
66
66
  generate_file(svgpath, 'pdf', 'svg', pdf) do |tool_path, input_path, output_path|
67
- [tool_path, Platform.native_path(input_path), Platform.native_path(output_path)]
67
+ {
68
+ :args => [tool_path, Platform.native_path(input_path), Platform.native_path(output_path)],
69
+ :chdir => source.base_dir
70
+ }
68
71
  end
69
72
  else
70
73
  pdf
@@ -25,7 +25,10 @@ module Asciidoctor
25
25
  end
26
26
 
27
27
  generate_file(java, 'uxf', format.to_s, source.to_s) do |tool_path, input_path, output_path|
28
- [tool_path, '-jar', Platform.native_path(umlet), '-action=convert', "-format=#{format.to_s}", "-filename=#{Platform.native_path(input_path)}", "-output=#{Platform.native_path(output_path)}"]
28
+ {
29
+ :args => [tool_path, '-jar', Platform.native_path(umlet), '-action=convert', "-format=#{format.to_s}", "-filename=#{Platform.native_path(input_path)}", "-output=#{Platform.native_path(output_path)}"],
30
+ :chdir => source.base_dir
31
+ }
29
32
  end
30
33
  end
31
34
  end
@@ -32,14 +32,16 @@ module Asciidoctor
32
32
  vega_code = code
33
33
  end
34
34
 
35
- generate_file(source.find_command("vg2#{format}"), "json", format.to_s, vega_code) do |tool_path, input_path, output_path|
35
+ generate_stdin_stdout(source.find_command("vg2#{format}"), vega_code) do |tool_path|
36
36
  args = [tool_path, '--base', Platform.native_path(base_dir)]
37
37
  if format == :svg
38
38
  args << '--header'
39
39
  end
40
40
 
41
- args << Platform.native_path(input_path)
42
- args << Platform.native_path(output_path)
41
+ {
42
+ :args => args,
43
+ :chdir => source.base_dir
44
+ }
43
45
  end
44
46
  end
45
47
  end
@@ -1,5 +1,5 @@
1
1
  module Asciidoctor
2
2
  module Diagram
3
- VERSION = "2.2.12"
3
+ VERSION = "2.2.13"
4
4
  end
5
5
  end
@@ -18,8 +18,11 @@ module Asciidoctor
18
18
  def convert(source, format, options)
19
19
  wavedrom_cli = source.find_command('wavedrom-cli', :raise_on_error => false)
20
20
  if wavedrom_cli
21
- generate_file(wavedrom_cli, 'wvd', format.to_s, source.to_s) do |tool_path, input_path, output_path|
22
- [Platform.native_path(tool_path), '--input', Platform.native_path(input_path), "--#{format.to_s}", Platform.native_path(output_path)]
21
+ generate_stdin(wavedrom_cli, format.to_s, source.to_s) do |tool_path, output_path|
22
+ {
23
+ :args => [Platform.native_path(tool_path), '--input', '-', "--#{format.to_s}", Platform.native_path(output_path)],
24
+ :chdir => source.base_dir
25
+ }
23
26
  end
24
27
  else
25
28
  wavedrom_cli = source.find_command('wavedrom', :raise_on_error => false)
@@ -27,7 +30,10 @@ module Asciidoctor
27
30
 
28
31
  if wavedrom_cli && !wavedrom_cli.include?('WaveDromEditor') && phantomjs
29
32
  generate_file(wavedrom_cli, 'wvd', format.to_s, source.to_s) do |tool_path, input_path, output_path|
30
- [phantomjs, Platform.native_path(tool_path), '-i', Platform.native_path(input_path), "-#{format.to_s[0]}", Platform.native_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
+ }
31
37
  end
32
38
  else
33
39
  if ::Asciidoctor::Diagram::Platform.os == :macosx
@@ -40,7 +46,10 @@ module Asciidoctor
40
46
  end
41
47
 
42
48
  generate_file(wavedrom, 'wvd', format.to_s, source.to_s) do |tool_path, input_path, output_path|
43
- [tool_path, 'source', Platform.native_path(input_path), format.to_s, Platform.native_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
+ }
44
53
  end
45
54
  end
46
55
  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.12
4
+ version: 2.2.13
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-09 00:00:00.000000000 Z
11
+ date: 2023-09-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler