Not sure if File::join is the best way, but this fixes an issue where nested documents broke the path to the stem/latexmath images when imagesdir is defined.
In a large project, you want to run asciidoctor-pdf from the base directory using a wildcard to find all the files. The imagesdir attribute expands to its string ../../images, which is then interpreted as relative to the working directory from which asciidoctor-pdf was called, rather than the directory of the source file containing the attribute. I've appended imagesdir the docdir attribute so that it is always interpreted from the point of view that it was declared.
I've never programmed in Ruby before, so I had trouble referencing the join_path method from the path_resolver.rb class, but maybe that would be more desirable than File::join?
Not sure if
File::join
is the best way, but this fixes an issue where nested documents broke the path to the stem/latexmath images whenimagesdir
is defined.For example, you have this project file tree:
basedir/images/cat.png basedir/subdir/source.adoc
Assume source.adoc defines attributes as:
In a large project, you want to run asciidoctor-pdf from the base directory using a wildcard to find all the files. The
imagesdir
attribute expands to its string../../images
, which is then interpreted as relative to the working directory from which asciidoctor-pdf was called, rather than the directory of the source file containing the attribute. I've appendedimagesdir
thedocdir
attribute so that it is always interpreted from the point of view that it was declared.I've never programmed in Ruby before, so I had trouble referencing the
join_path
method from thepath_resolver.rb
class, but maybe that would be more desirable thanFile::join
?