Skip to content

Instantly share code, notes, and snippets.

@succzero
Created June 26, 2015 13:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save succzero/34e57c01209ed9581fd9 to your computer and use it in GitHub Desktop.
Save succzero/34e57c01209ed9581fd9 to your computer and use it in GitHub Desktop.
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
Copy link
Author

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