Instantly share code, notes, and snippets.

Embed
What would you like to do?
Unofficial patch for asciidoctor-diagram-1.2.1
--- diagram.rb.orig 2015-06-26 22:31:23.000000000 +0900
+++ diagram.rb 2015-06-26 22:31:52.000000000 +0900
@@ -114,7 +114,9 @@ module Asciidoctor
target = attributes.delete('target')
image_name = "#{target || ('diag-' + source.checksum)}.#{format}"
- image_dir = File.expand_path(parent.document.attributes['imagesdir'] || '', parent.document.attributes['outdir'] || parent.document.attributes['docdir'])
+ outdir = parent.document.attributes['outdir'] || parent.document.attributes['docdir']
+ imagesdir = lambda {|s| outdir && s.chr == '/' ? s[1,s.length] : s}[(parent.document.attributes['imagesdir'] || '')]
+ image_dir = File.expand_path(imagesdir, outdir)
image_file = File.expand_path(image_name, image_dir)
metadata_file = File.expand_path("#{image_name}.cache", image_dir)
@succzero

This comment has been minimized.

Show comment
Hide comment
@succzero

succzero Jun 26, 2015

diagram.rb is located in vendor/bundle/ruby/2.2.0/gems/asciidoctor-diagram-1.2.1/lib/asciidoctor-diagram/util.

Owner

succzero commented Jun 26, 2015

diagram.rb is located in vendor/bundle/ruby/2.2.0/gems/asciidoctor-diagram-1.2.1/lib/asciidoctor-diagram/util.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment