asciidoctor-diagram 1.2.0.preview.4 → 1.2.0.preview.5
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.
- checksums.yaml +4 -4
- data/CHANGELOG.adoc +8 -0
- data/lib/asciidoctor-diagram/util/diagram.rb +8 -4
- data/lib/asciidoctor-diagram/version.rb +1 -1
- data/spec/plantuml_spec.rb +52 -1
- metadata +15 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed05ad18a6da6febe775f07fda8713b77fe25a82
|
4
|
+
data.tar.gz: c2ba98ed53a5405b4e95ce72f03d4c7158e7b561
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 655e2240b3fa83d06d3e379281cfda32158965b4254ba9b9e4125ec520b064a87fffa59c220d058e0cd0947b3c516970429ea839c686152058d777b782a7a7c9
|
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
|
-
|
125
|
-
|
126
|
-
|
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 '_-', ' '
|
data/spec/plantuml_spec.rb
CHANGED
@@ -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
|
-
|
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,83 +1,83 @@
|
|
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
|
+
version: 1.2.0.preview.5
|
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: 2014-
|
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
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rjb
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - ~>
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: 1.4.8
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - ~>
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 1.4.8
|
83
83
|
description: Asciidoctor diagramming extension
|
@@ -128,17 +128,17 @@ require_paths:
|
|
128
128
|
- lib
|
129
129
|
required_ruby_version: !ruby/object:Gem::Requirement
|
130
130
|
requirements:
|
131
|
-
- -
|
131
|
+
- - ">="
|
132
132
|
- !ruby/object:Gem::Version
|
133
133
|
version: '0'
|
134
134
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- -
|
136
|
+
- - ">"
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: 1.3.1
|
139
139
|
requirements: []
|
140
140
|
rubyforge_project:
|
141
|
-
rubygems_version: 2.
|
141
|
+
rubygems_version: 2.2.2
|
142
142
|
signing_key:
|
143
143
|
specification_version: 4
|
144
144
|
summary: An extension for asciidoctor that adds support for UML diagram generation
|