asciidoctor-diagram 1.5.4 → 1.5.5

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: d38f932148312e67e4249a2c171c71da2c796a49
4
- data.tar.gz: c50317e4443b383f73be0b3e068364185cba7a97
3
+ metadata.gz: 65e470f480837be7f630896e91d0c61368b8a2f5
4
+ data.tar.gz: 0c674e665f3f412f2181cde62163d116efbfc7de
5
5
  SHA512:
6
- metadata.gz: 9d8544bb90e946c5b20b9e675268e519cf52f9dd89a3b054b4214a9c1b3dff59d6ce9683569616c3ed9d81441dc089179cb559e1569b1c11e4d586f99d457a41
7
- data.tar.gz: d26cbf53122d923276a543f49efe434ba8690fbb85ba0e44ced6c52bd4c24779fb110bcef1c3f03c29f5b731dfc15c4a30c06d78516742987815c70a6d6886ab
6
+ metadata.gz: 487247e3185db46d245f2c7e78c43524ed4da61a200e92a2b9984ecab45bbf6db2eee009cc3b66239941af4bc3142944e97ca0ff4daad189966f31ab5a78b39e
7
+ data.tar.gz: 92dfed70c63edf7436f4af7f1ec3b6bdb9e797fcfc953d2d74409cb8d70ed071b104e2bfdd9d597c8f004230f800120bc0ce3cc01f0eeb310ab3af14793db048
data/CHANGELOG.adoc CHANGED
@@ -1,11 +1,27 @@
1
1
  = Asciidoctor-diagram Changelog
2
2
 
3
+ == Development
4
+
5
+ == 1.5.5
6
+
7
+ Enhancements::
8
+
9
+ * Update PlantUML to revision 2017.15
10
+ * Issue #147: Add support for PlantUML SVG output (@puffybsd)
11
+ * Resolve compatibility issues with Asciidoctor 1.5.6 (@robertpanzer, @mojavelinux)
12
+
13
+ Bug Fixes::
14
+
15
+ * Issue #145: Incremental runs on documents containing meme diagrams would fail
16
+ * Issue #150: Resolve Ditaa character encoding issues
17
+ * Avoid error when the `PATH` environment variable is not defined (@BrentDouglas)
18
+
3
19
  == 1.5.4
4
20
 
5
21
  Enhancements::
6
22
 
7
- * Add support for UMLet.
8
- * Issue #141: Allow blockdiag fontpath to be specified via attributes
23
+ * Add support for UMLet (@basejumpa)
24
+ * Issue #141: Allow blockdiag fontpath to be specified via attributes (@bithium)
9
25
 
10
26
  Bug Fixes::
11
27
 
@@ -28,7 +44,7 @@ Bug Fixes::
28
44
 
29
45
  Enhancements::
30
46
 
31
- * Apply anti-aliasing to blockdiag generated images
47
+ * Apply anti-aliasing to blockdiag generated images (@bithium)
32
48
  * Issue #118: Add support for Erd.
33
49
 
34
50
  Bug Fixes::
@@ -54,6 +70,7 @@ Enhancements::
54
70
  * Issue #112: Update PlantUML to revision 8043 (19/06/2016)
55
71
  * Issue #114: Asciidoctor Diagram now requires Asciidoctor if it hasn't been loaded already.
56
72
  * Issue #116: Resolve relative paths in PlantUML !include directives
73
+ * Add Chinese README translation (@diguage)
57
74
 
58
75
  == 1.4.0
59
76
 
@@ -82,12 +99,13 @@ Bug Fixes::
82
99
 
83
100
  * Issue #83: Omit stack trace information from error message that gets embedded in the output document
84
101
  * Issue #84: Restore support for specifying the location of the `dot` executable using the `graphvizdot` attribute
102
+ * Avoid deprecation warnings with JRuby 9000 (@robertpanzer)
85
103
 
86
104
  == 1.3.1
87
105
 
88
106
  Bug Fixes::
89
107
 
90
- * Issue #78: Resolve Java launch issues when running in a Cygwin environment
108
+ * Issue #78: Resolve Java launch issues when running in a Cygwin environment (@chanibal)
91
109
 
92
110
  == 1.3.0
93
111
 
@@ -102,11 +120,13 @@ Enhancements::
102
120
  * Remove dependency on RJB to simplify installation (issue #48)
103
121
  * Add diagram scaling support using the scale attribute (issue #58)
104
122
  * Add Ditaa command line option support using the options attribute (issue #69)
123
+ * Add extra usage instructions to README (@nearnshaw)
105
124
 
106
125
  Bug Fixes::
107
126
 
108
127
  * Issue #49: Resolve issue that made Java 6 installation prompt appear on Mac OS X
109
128
  * Issue #51: Resolved issue where PNG files generated by Graphviz were not processed correctly on Windows
129
+ * Fix caching issue on Travis CI (@j-manu)
110
130
 
111
131
  == 1.2.0
112
132
 
@@ -130,9 +150,9 @@ Bug Fixes::
130
150
 
131
151
  Enhancements::
132
152
 
133
- * Use the output directory (outdir attribute) as base directory if it's specified.
153
+ * Use the output directory (outdir attribute) as base directory if it's specified. (@neher)
134
154
  * Do not auto-generate width/height attributes when outputting to a non-HTML backend. This resolves issues with
135
- oversized images in docbook output.
155
+ oversized images in docbook output. (@neher)
136
156
 
137
157
  == 1.1.4
138
158
 
@@ -20,7 +20,7 @@ module Asciidoctor
20
20
  'transparent' => lambda { |o, v| o << '--transparent' if v == 'true'}
21
21
  }
22
22
 
23
- JARS = ['ditaamini-0.10.jar'].map do |jar|
23
+ JARS = ['ditaa-1.3.12.jar', 'ditaamini-0.10.jar'].map do |jar|
24
24
  File.expand_path File.join('../..', jar), File.dirname(__FILE__)
25
25
  end
26
26
  Java.classpath.concat JARS
@@ -282,12 +282,19 @@ module Asciidoctor
282
282
  subclass.option :pos_attrs, ['target', 'format']
283
283
  end
284
284
 
285
+ def apply_target_subs(parent, target)
286
+ if target
287
+ parent.sub_attributes(target, :attribute_missing => 'warn')
288
+ else
289
+ nil
290
+ end
291
+ end
292
+
285
293
  # Creates a FileSource using target as the file name.
286
294
  #
287
295
  # @return [FileSource] a FileSource
288
296
  def create_source(parent, target, attributes)
289
- target = parent.sub_attributes(target, :attribute_missing => 'warn') if target
290
- FileSource.new(parent, target, attributes)
297
+ FileSource.new(parent, apply_target_subs(parent, target), attributes)
291
298
  end
292
299
  end
293
300
 
@@ -326,7 +333,7 @@ module Asciidoctor
326
333
  # @return [String] the base directory against which relative paths in this diagram should be resolved
327
334
  # @abstract
328
335
  def base_dir
329
- raise NotImplementedError.new
336
+ attr('docdir', nil, true)
330
337
  end
331
338
 
332
339
  # Alias for code
@@ -402,10 +409,9 @@ module Asciidoctor
402
409
  protected
403
410
  def resolve_diagram_subs
404
411
  if @attributes.key? 'subs'
405
- subs = @parent_block.resolve_block_subs @attributes['subs'], nil, 'diagram'
406
- subs.empty? ? nil : subs
412
+ @parent_block.resolve_block_subs @attributes['subs'], nil, 'diagram'
407
413
  else
408
- nil
414
+ []
409
415
  end
410
416
  end
411
417
 
@@ -430,10 +436,6 @@ module Asciidoctor
430
436
  @reader = reader
431
437
  end
432
438
 
433
- def base_dir
434
- attr('docdir', nil, true)
435
- end
436
-
437
439
  def code
438
440
  @code ||= @parent_block.apply_subs(@reader.lines, resolve_diagram_subs).join("\n")
439
441
  end
@@ -447,7 +449,11 @@ module Asciidoctor
447
449
  end
448
450
 
449
451
  def base_dir
450
- File.dirname(@file_name)
452
+ if @file_name
453
+ File.dirname(@file_name)
454
+ else
455
+ super
456
+ end
451
457
  end
452
458
 
453
459
  def image_name
@@ -461,7 +467,7 @@ module Asciidoctor
461
467
  end
462
468
 
463
469
  def should_process?(image_file, image_metadata)
464
- File.mtime(@file_name) > File.mtime(image_file) || super
470
+ (@file_name && File.mtime(@file_name) > File.mtime(image_file)) || super
465
471
  end
466
472
 
467
473
  def code
@@ -107,12 +107,22 @@ module Asciidoctor
107
107
  class MemeBlockMacroProcessor < Extensions::DiagramBlockMacroProcessor
108
108
  include Meme
109
109
 
110
+ class StringReader
111
+ def initialize(str)
112
+ @str = str
113
+ end
114
+
115
+ def lines
116
+ @str.lines.map { |l| l.rstrip }
117
+ end
118
+ end
119
+
110
120
  option :pos_attrs, %w(top bottom target format)
111
121
 
112
122
  def create_source(parent, target, attributes)
113
123
  attributes = attributes.dup
114
- attributes['background'] = target
115
- ::Asciidoctor::Diagram::Extensions::FileSource.new(parent, nil, attributes)
124
+ attributes['background'] = apply_target_subs(parent, target)
125
+ ::Asciidoctor::Diagram::Extensions::ReaderSource.new(parent, StringReader.new(''), attributes)
116
126
  end
117
127
  end
118
128
  end
@@ -21,9 +21,9 @@ module Asciidoctor
21
21
 
22
22
  def mermaid(parent_block, source, format)
23
23
  mermaid = which(parent_block, 'mermaid')
24
- @is_mermaid_v6 ||= ::Asciidoctor::Diagram::Cli.run(mermaid, '--version').split('.')[0].to_i >= 6
24
+ config['mermaid>=6'] ||= ::Asciidoctor::Diagram::Cli.run(mermaid, '--version').split('.')[0].to_i >= 6
25
25
  # Mermaid >= 6.0.0 requires PhantomJS 2.1; older version required 1.9
26
- phantomjs = which(parent_block, 'phantomjs', :alt_attrs => [@is_mermaid_v6 ? 'phantomjs_2' : 'phantomjs_19'])
26
+ phantomjs = which(parent_block, 'phantomjs', :alt_attrs => [config['mermaid>=6'] ? 'phantomjs_2' : 'phantomjs_19'])
27
27
 
28
28
  css = source.attr('css', nil, 'mermaid')
29
29
  if css
@@ -10,7 +10,7 @@ module Asciidoctor
10
10
 
11
11
  private
12
12
 
13
- JARS = ['plantuml.jar'].map do |jar|
13
+ JARS = ['plantuml-1.3.12.jar', 'plantuml.jar', 'jlatexmath-minimal-1.0.3.jar', 'batik-all-1.7.jar'].map do |jar|
14
14
  File.expand_path File.join('../..', jar), File.dirname(__FILE__)
15
15
  end
16
16
  Java.classpath.concat JARS
@@ -6,7 +6,7 @@ module Asciidoctor
6
6
  module Java
7
7
  def self.classpath
8
8
  @classpath ||= [
9
- File.expand_path(File.join('../..', 'asciidoctor-diagram-java-1.3.10.jar'), File.dirname(__FILE__))
9
+ File.expand_path(File.join('../..', 'server-1.3.12.jar'), File.dirname(__FILE__))
10
10
  ]
11
11
  end
12
12
 
@@ -5,7 +5,7 @@ module Asciidoctor
5
5
  def self.which(cmd, options = {})
6
6
  exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
7
7
 
8
- paths = (options[:path] || []) + ENV['PATH'].split(File::PATH_SEPARATOR)
8
+ paths = (options[:path] || []) + (ENV['PATH'] ? ENV['PATH'].split(File::PATH_SEPARATOR) : [])
9
9
  paths.each do |path|
10
10
  exts.each { |ext|
11
11
  exe = File.join(path, "#{cmd}#{ext}")
@@ -20,10 +20,10 @@ module Asciidoctor
20
20
  attr_names = options[:attrs] || options.fetch(:alt_attrs, []) + [cmd]
21
21
  cmd_names = [cmd] + options.fetch(:alt_cmds, [])
22
22
 
23
- cmd_var = '@' + attr_names[0]
23
+ cmd_var = 'cmd-' + attr_names[0]
24
24
 
25
- if instance_variable_defined?(cmd_var)
26
- cmd_path = instance_variable_get(cmd_var)
25
+ if config.key? cmd_var
26
+ cmd_path = config[cmd_var]
27
27
  else
28
28
  cmd_path = attr_names.map { |attr_name| parent_block.attr(attr_name, nil, true) }.find { |attr| !attr.nil? }
29
29
 
@@ -35,7 +35,7 @@ module Asciidoctor
35
35
  cmd_path = cmd_paths.reject { |c| c.nil? }.first
36
36
  end
37
37
 
38
- instance_variable_set(cmd_var, cmd_path)
38
+ config[cmd_var] = cmd_path
39
39
 
40
40
  if cmd_path.nil? && options.fetch(:raise_on_error, true)
41
41
  raise "Could not find the #{cmd_names.map { |c| "'#{c}'" }.join(', ')} executable in PATH; add it to the PATH or specify its location using the '#{attr_names[0]}' document attribute"
@@ -46,4 +46,4 @@ module Asciidoctor
46
46
  end
47
47
  end
48
48
  end
49
- end
49
+ end
@@ -1,5 +1,5 @@
1
1
  module Asciidoctor
2
2
  module Diagram
3
- VERSION = "1.5.4"
3
+ VERSION = "1.5.5"
4
4
  end
5
5
  end
Binary file
Binary file
Binary file
Binary file
data/lib/plantuml.jar CHANGED
Binary file
Binary file
data/spec/ditaa_spec.rb CHANGED
@@ -186,4 +186,33 @@ Doc Writer <doc@example.com>
186
186
 
187
187
  expect(mtime2).to be > mtime1
188
188
  end
189
+
190
+ it "should support UTF-8 characters" do
191
+ doc = <<-eos
192
+ = Test
193
+
194
+ [ditaa]
195
+ ----
196
+ /-----\\
197
+ |\u00AB \u2026 \u00BB|
198
+ \\-----/
199
+ ----
200
+ eos
201
+
202
+ d = load_asciidoc doc
203
+ expect(d).to_not be_nil
204
+
205
+ b = d.find { |bl| bl.context == :image }
206
+ expect(b).to_not be_nil
207
+
208
+ expect(b.content_model).to eq :empty
209
+
210
+ target = b.attributes['target']
211
+ expect(target).to_not be_nil
212
+ expect(target).to match(/\.png$/)
213
+ expect(File.exist?(target)).to be true
214
+
215
+ expect(b.attributes['width']).to_not be_nil
216
+ expect(b.attributes['height']).to_not be_nil
217
+ end
189
218
  end
@@ -730,4 +730,125 @@ class {child-class}
730
730
  expect(content).to include('ParentClass')
731
731
  expect(content).to include('ChildClass')
732
732
  end
733
+
734
+ it "should generate PNG images for jlatexmath blocks when format is set to 'png'" do
735
+ doc = <<-eos
736
+ = Hello, PlantUML!
737
+ Doc Writer <doc@example.com>
738
+
739
+ == First Section
740
+
741
+ [plantuml,format="png"]
742
+ ----
743
+ @startlatex
744
+ e^{i\\pi} + 1 = 0
745
+ @endlatex
746
+ ----
747
+ eos
748
+
749
+ d = load_asciidoc doc
750
+ expect(d).to_not be_nil
751
+
752
+ b = d.find { |bl| bl.context == :image }
753
+ expect(b).to_not be_nil
754
+
755
+ expect(b.content_model).to eq :empty
756
+
757
+ target = b.attributes['target']
758
+ expect(target).to_not be_nil
759
+ expect(target).to match(/\.png$/)
760
+ expect(File.exist?(target)).to be true
761
+
762
+ expect(b.attributes['width']).to_not be_nil
763
+ expect(b.attributes['height']).to_not be_nil
764
+ end
765
+
766
+ it "should generate SVG images for jlatexmath blocks when format is set to 'svg'" do
767
+ doc = <<-eos
768
+ = Hello, PlantUML!
769
+ Doc Writer <doc@example.com>
770
+
771
+ == First Section
772
+
773
+ [plantuml,format="svg"]
774
+ ----
775
+ @startlatex
776
+ e^{i\\pi} + 1 = 0
777
+ @endlatex
778
+ ----
779
+ eos
780
+
781
+ d = load_asciidoc doc
782
+ expect(d).to_not be_nil
783
+
784
+ b = d.find { |bl| bl.context == :image }
785
+ expect(b).to_not be_nil
786
+
787
+ expect(b.content_model).to eq :empty
788
+
789
+ target = b.attributes['target']
790
+ expect(target).to_not be_nil
791
+ expect(target).to match(/\.svg$/)
792
+ expect(File.exist?(target)).to be true
793
+ end
794
+
795
+ it "should generate PNG images for diagrams with latex tags when format is set to 'png'" do
796
+ doc = <<-eos
797
+ = Hello, PlantUML!
798
+ Doc Writer <doc@example.com>
799
+
800
+ == First Section
801
+
802
+ [plantuml,format="png"]
803
+ ----
804
+ :<latex>P(y|\\mathbf{x}) \\mbox{ or } f(\\mathbf{x})+\\epsilon</latex>;
805
+ ----
806
+ eos
807
+
808
+ d = load_asciidoc doc
809
+ expect(d).to_not be_nil
810
+
811
+ b = d.find { |bl| bl.context == :image }
812
+ expect(b).to_not be_nil
813
+
814
+ expect(b.content_model).to eq :empty
815
+
816
+ target = b.attributes['target']
817
+ expect(target).to_not be_nil
818
+ expect(target).to match(/\.png$/)
819
+ expect(File.exist?(target)).to be true
820
+
821
+ expect(b.attributes['width']).to_not be_nil
822
+ expect(b.attributes['height']).to_not be_nil
823
+ end
824
+
825
+ it "should generate SVG images for diagrams with latex tags when format is set to 'svg'" do
826
+ doc = <<-eos
827
+ = Hello, PlantUML!
828
+ Doc Writer <doc@example.com>
829
+
830
+ == First Section
831
+
832
+ [plantuml,format="svg"]
833
+ ----
834
+ :<latex>P(y|\\mathbf{x}) \\mbox{ or } f(\\mathbf{x})+\\epsilon</latex>;
835
+ ----
836
+ eos
837
+
838
+ d = load_asciidoc doc
839
+ expect(d).to_not be_nil
840
+
841
+ b = d.find { |bl| bl.context == :image }
842
+ expect(b).to_not be_nil
843
+
844
+ expect(b.content_model).to eq :empty
845
+
846
+ target = b.attributes['target']
847
+ expect(target).to_not be_nil
848
+ expect(target).to match(/\.svg$/)
849
+ expect(File.exist?(target)).to be true
850
+
851
+ expect(b.attributes['width']).to_not be_nil
852
+ expect(b.attributes['height']).to_not be_nil
853
+ end
733
854
  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: 1.5.4
4
+ version: 1.5.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: 2017-01-14 00:00:00.000000000 Z
11
+ date: 2017-07-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -84,7 +84,6 @@ files:
84
84
  - examples/features.adoc
85
85
  - images/asciidoctor-diagram-classes.png
86
86
  - images/asciidoctor-diagram-process.png
87
- - lib/asciidoctor-diagram-java-1.3.10.jar
88
87
  - lib/asciidoctor-diagram.rb
89
88
  - lib/asciidoctor-diagram/blockdiag.rb
90
89
  - lib/asciidoctor-diagram/blockdiag/extension.rb
@@ -121,8 +120,13 @@ files:
121
120
  - lib/asciidoctor-diagram/version.rb
122
121
  - lib/asciidoctor-diagram/wavedrom.rb
123
122
  - lib/asciidoctor-diagram/wavedrom/extension.rb
123
+ - lib/batik-all-1.7.jar
124
+ - lib/ditaa-1.3.12.jar
124
125
  - lib/ditaamini-0.10.jar
126
+ - lib/jlatexmath-minimal-1.0.3.jar
127
+ - lib/plantuml-1.3.12.jar
125
128
  - lib/plantuml.jar
129
+ - lib/server-1.3.12.jar
126
130
  - spec/blockdiag_spec.rb
127
131
  - spec/ditaa_spec.rb
128
132
  - spec/erd_spec.rb