Closed mojavelinux closed 6 years ago
The correct path calculation is as follows:
opts[:to_dir] = ::File.dirname ::File.join \
(ctx.app.root_path.join ctx.app.config[:build_dir].to_s),
ctx.current_page.destination_path
I decided to go ahead and also pass the outfile and outdir attributes to the AsciiDoc processor. The value of the outdir attribute will match the value of the :to_dir
option.
When loading the document during the conversion/rendering phase (i.e., in the Tilt template), set the
:to_dir
option to the location where the file will be written (build_dir + dirname of destination_path).Setting the
:to_dir
option on the document allows extensions (such as Asciidoctor Diagram) to know where the file will be output so it can write additional assets to that directory (or relative to it).An alternate strategy is to add the
outdir
andoutfile
attributes to the attributes Hash. The benefit of this approach is that it also gives the content access to this information. We could also consider taking both approaches.