asciidoctor-diagram 1.2.0.preview.4-java → 1.2.0.preview.5-java

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
  SHA1:
3
- metadata.gz: 043f19546d87bf380b9033fcaf0484b7b3c3e8c9
4
- data.tar.gz: 7177c6504241eeffda1853fa9d829486db7bc96b
3
+ metadata.gz: 6d442d91fe6669ed506966b3a0986f5c847b9210
4
+ data.tar.gz: c2ba98ed53a5405b4e95ce72f03d4c7158e7b561
5
5
  SHA512:
6
- metadata.gz: d20500b05fc3f0a63da62968038212a2fd1a0fce575cfbd4b779fcac91b75faf8eb505bf672d84d3b9b741109fd77898a7c13732a2712403d8898fe9dcfdd4ca
7
- data.tar.gz: db1febbb4e68a028d57662e65f8efd360db70da99dd7e2c5809d0250be96dc0d65cb73873ee5c7a4912d89463c6677ced409a7200168993ebe773a6395e2f595
6
+ metadata.gz: c44d51a81c8cba3c256c2c33b26e2100d37aebb5ff7d8a9ae785d445fbe31eaba77dc8cabbff3594c2ea7f8e294eeb222b12a03b876c289a9447363525cff93f
7
+ data.tar.gz: 36ded3b76a7980587dd546f52ce1f64ae39ff87c51ac2d8e88be6d46ee1881944b302e890967c1b32716b3cae6a067f1400f57c328d3768791e1255caad0052d
data/CHANGELOG.adoc CHANGED
@@ -6,6 +6,14 @@ Enhancements::
6
6
 
7
7
  * Updated to Asciidoctor 1.5.0
8
8
 
9
+ == 1.1.5
10
+
11
+ Enhancements::
12
+
13
+ * Use the output directory (outdir attribute) as base directory if it's specified.
14
+ * Do not auto-generate width/height attributes when outputting to a non-HTML backend. This resolves issues with
15
+ oversized images in docbook output.
16
+
9
17
  == 1.1.4
10
18
 
11
19
  Bug Fixes::
@@ -1,6 +1,7 @@
1
1
  require 'asciidoctor/extensions'
2
2
  require 'digest'
3
3
  require 'json'
4
+ require 'fileutils'
4
5
  require_relative 'java'
5
6
  require_relative 'png'
6
7
  require_relative 'svg'
@@ -96,7 +97,7 @@ module Asciidoctor
96
97
  target = attributes.delete('target')
97
98
 
98
99
  image_name = "#{target || ('diag-' + source.checksum)}.#{format}"
99
- image_dir = File.expand_path(parent.document.attributes['imagesdir'] || '', parent.document.attributes['docdir'])
100
+ image_dir = File.expand_path(parent.document.attributes['imagesdir'] || '', parent.document.attributes['outdir'] || parent.document.attributes['docdir'])
100
101
  image_file = File.expand_path(image_name, image_dir)
101
102
  metadata_file = File.expand_path("#{image_name}.cache", image_dir)
102
103
 
@@ -116,14 +117,17 @@ module Asciidoctor
116
117
  metadata = {'checksum' => source.checksum}
117
118
  metadata['width'], metadata['height'] = params[:decoder].get_image_size(result)
118
119
 
120
+ FileUtils.mkdir_p(image_dir) unless Dir.exists?(image_dir)
119
121
  File.open(image_file, 'wb') { |f| f.write result }
120
122
  File.open(metadata_file, 'w') { |f| JSON.dump(metadata, f) }
121
123
  end
122
124
 
123
125
  attributes['target'] = image_name
124
- attributes['width'] ||= metadata['width'] if metadata['width']
125
- attributes['height'] ||= metadata['height'] if metadata['height']
126
- attributes['alt'] ||= if (title_text = attributes['title'])
126
+ if /html/i =~ parent.document.attributes['backend']
127
+ attributes['width'] ||= metadata['width'] if metadata['width']
128
+ attributes['height'] ||= metadata['height'] if metadata['height']
129
+ end
130
+ attributes['alt'] ||= if title_text = attributes['title']
127
131
  title_text
128
132
  elsif target
129
133
  (File.basename target, (File.extname target) || '').tr '_-', ' '
@@ -1,5 +1,5 @@
1
1
  module Asciidoctor
2
2
  module Diagram
3
- VERSION = "1.2.0.preview.4"
3
+ VERSION = "1.2.0.preview.5"
4
4
  end
5
5
  end
@@ -271,4 +271,55 @@ plantuml::plantuml.txt["foobaz"]
271
271
  expect(File.exists?('foobaz.png')).to be_true
272
272
  expect(File.exists?('plantuml.png')).to be_false
273
273
  end
274
- end
274
+
275
+
276
+ it "should write files to outdir if set" do
277
+ doc = <<-eos
278
+ = Hello, PlantUML!
279
+ Doc Writer <doc@example.com>
280
+
281
+ == First Section
282
+
283
+ [plantuml, format="svg"]
284
+ ----
285
+ actor Foo1
286
+ boundary Foo2
287
+ Foo1 -> Foo2 : To boundary
288
+ ----
289
+ eos
290
+
291
+ d = Asciidoctor.load StringIO.new(doc), {:attributes => {'outdir' => 'foo'}}
292
+ b = d.find { |b| b.context == :image }
293
+
294
+ target = b.attributes['target']
295
+ expect(target).to_not be_nil
296
+ expect(File.exists?(target)).to be_false
297
+ expect(File.exists?(File.expand_path(target, 'foo'))).to be_true
298
+ end
299
+
300
+ it "should omit width/height attributes when generating docbook" do
301
+ doc = <<-eos
302
+ = Hello, PlantUML!
303
+ Doc Writer <doc@example.com>
304
+
305
+ == First Section
306
+
307
+ [plantuml, format="png"]
308
+ ----
309
+ User -> (Start)
310
+ ----
311
+ eos
312
+
313
+ d = Asciidoctor.load StringIO.new(doc), :attributes => {'backend' => 'docbook5' }
314
+ expect(d).to_not be_nil
315
+
316
+ b = d.find { |b| b.context == :image }
317
+ expect(b).to_not be_nil
318
+
319
+ target = b.attributes['target']
320
+ expect(File.exists?(target)).to be_true
321
+
322
+ expect(b.attributes['width']).to be_nil
323
+ expect(b.attributes['height']).to be_nil
324
+ end
325
+ end
metadata CHANGED
@@ -1,69 +1,69 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asciidoctor-diagram
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0.preview.4
4
+ version: 1.2.0.preview.5
5
5
  platform: java
6
6
  authors:
7
7
  - Pepijn Van Eeckhoudt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-01 00:00:00.000000000 Z
11
+ date: 2014-04-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.3'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: asciidoctor
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: 1.5.0.preview.2
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: 1.5.0.preview.2
69
69
  description: Asciidoctor diagramming extension
@@ -114,17 +114,17 @@ require_paths:
114
114
  - lib
115
115
  required_ruby_version: !ruby/object:Gem::Requirement
116
116
  requirements:
117
- - - '>='
117
+ - - ">="
118
118
  - !ruby/object:Gem::Version
119
119
  version: '0'
120
120
  required_rubygems_version: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - '>'
122
+ - - ">"
123
123
  - !ruby/object:Gem::Version
124
124
  version: 1.3.1
125
125
  requirements: []
126
126
  rubyforge_project:
127
- rubygems_version: 2.0.3
127
+ rubygems_version: 2.2.2
128
128
  signing_key:
129
129
  specification_version: 4
130
130
  summary: An extension for asciidoctor that adds support for UML diagram generation