Reputation: 19165
I'm trying to create a reStructuredText directive that takes it's content, creates an image based on that content using PIL, and then displays the generated image in the document. What I've done so far is subclass the image directive, create the file at a certain path (say, images/diagram.png), and then pass images/diagram.png to the image directive. The problem with this is that the file gets saved to ./images/ but the generated html document looks for it in {output_dir}/static/images/.
My question is how do I access the value of the directory that reST is using to store the output, so I can stash my image in the right place?
Upvotes: 0
Views: 159
Reputation: 27890
Take a look at sphinx.ext.graphviz
sources (e.g. here), this Sphinx extension is doing almost the same thing you describe.
Upvotes: 1