Skip to content

Commit

Permalink
asciidoctor#76 Update Ditaa to latest revision
Browse files Browse the repository at this point in the history
asciidoctor#76 Add support for additional Ditaa options
  • Loading branch information
Pepijn Van Eeckhoudt committed Aug 4, 2015
1 parent e163030 commit a09e3bd
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 17 deletions.
Binary file removed lib/asciidoctor-diagram-java-1.3.2.jar
Binary file not shown.
Binary file added lib/asciidoctor-diagram-java-1.3.3.jar
Binary file not shown.
33 changes: 17 additions & 16 deletions lib/asciidoctor-diagram/ditaa/extension.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module Asciidoctor
module Diagram
# @private
module Ditaa
JARS = ['ditaamini0_9.jar'].map do |jar|
JARS = ['ditaamini-0.10.jar'].map do |jar|
File.expand_path File.join('../..', jar), File.dirname(__FILE__)
end
Java.classpath.concat JARS
Expand Down Expand Up @@ -48,26 +48,27 @@ def create_source(parent, reader, attributes)
module DitaaSource
attr_reader :options

OPTIONS = {
'scale' => lambda { |o, v| o << '--scale' << v if v },
'tabs' => lambda { |o, v| o << '--tabs' << v if v },
'background' => lambda { |o, v| o << '--background' << v if v },
'antialias' => lambda { |o, v| o << '--no-antialias' if v == 'false' },
'separation' => lambda { |o, v| o << '--no-separation' if v == 'false'},
'round-corners' => lambda { |o, v| o << '--round-corners' if v == 'true'},
'shadows' => lambda { |o, v| o << '--no-shadows' if v == 'false'},
'debug' => lambda { |o, v| o << '--debug' if v == 'true'},
'fixed-slope' => lambda { |o, v| o << '--fixed-slope' if v == 'true'},
'transparent' => lambda { |o, v| o << '--transparent' if v == 'true'}
}

def init_ditaa_options(parent, attributes)
global_attributes = parent.document.attributes

option_values = {}

['scale', 'antialias', 'separation', 'round-corners', 'shadows', 'debug'].each do |key|
option_values[key] = attributes.delete(key) || global_attributes["ditaa-option-#{key}"]
end

options = []

begin
options << '--scale' << option_values['scale'] if option_values['scale']
options << '--no-antialias' if option_values['antialias'] == 'false'
options << '--no-separation' if option_values['separation'] == 'false'
options << '--round-corners' if option_values['round-corners'] == 'true'
options << '--no-shadows' if option_values['shadows'] == 'false'
options << '--debug' if option_values['debug'] == 'true'
rescue => e
e.backtrace.each { |l| puts l }
OPTIONS.keys.each do |key|
value = attributes.delete(key) || global_attributes["ditaa-option-#{key}"]
OPTIONS[key].call(options, value)
end

@options = options.join(' ')
Expand Down
2 changes: 1 addition & 1 deletion lib/asciidoctor-diagram/util/java.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Diagram
module Java
def self.classpath
@classpath ||= [
File.expand_path(File.join('../..', 'asciidoctor-diagram-java-1.3.2.jar'), File.dirname(__FILE__))
File.expand_path(File.join('../..', 'asciidoctor-diagram-java-1.3.3.jar'), File.dirname(__FILE__))
]
end

Expand Down
Binary file added lib/ditaamini-0.10.jar
Binary file not shown.
Binary file removed lib/ditaamini0_9.jar
Binary file not shown.

0 comments on commit a09e3bd

Please sign in to comment.