Closed confluence closed 10 years ago
The relevant code in blockdiag appears to be:
if hasattr(self.builder, 'imgpath'):
# HTML
relfn = posixpath.join(self.builder.imgpath, fname)
outfn = os.path.join(self.builder.outdir, '_images', fname)
The only way I can see for relfn
to be an absolute filename is if self.builder.imgpath
somehow ends up being absolute.
The images also appear in the EPUB.
Ah, issue located in sphinxcontrib.blockdiag
at https://bitbucket.org/birkenfeld/sphinx-contrib/src/d7b8cc81b9098ed214b5d20de25a344a3e87d786/blockdiag/sphinxcontrib/blockdiag.py?at=default#cl-306:
The blockdiag
extension skips some special processing if the builder is a kind it knows it has already produced output for:
def on_doctree_resolved(self, doctree, docname):
if self.builder.name in ('gettext', 'singlehtml', 'html', 'latex', 'epub'):
return
Of course the readthedocs
builder and dirhtml
are not in the list.
There also appears to be a bug in the special processing where it uses outfn
instead of relfn
.'
P.S. checking self.builder.format in ('latex', 'html')
would be a good fix.
Sounds like it isn't our issue?
Yep. @confluence filed https://bitbucket.org/birkenfeld/sphinx-contrib/issue/64/blockdiag-image-links-broken-in-builders with the sphinxcontrib package.
Pull request created at https://bitbucket.org/birkenfeld/sphinx-contrib/pull-request/55/fix-broken-blockdiag-and-friends-image/diff. Also confirmed that the fix works on rtfd.org.
Thanks for sending that patch, rtd has gotten a good number of support requests due to this.
On Thu, Feb 20, 2014 at 11:01 AM, Simon Cross notifications@github.comwrote:
Pull request created at https://bitbucket.org/birkenfeld/sphinx-contrib/pull-request/55/fix-broken-blockdiag-and-friends-image/diff. Also confirmed that the fix works on rtfd.org.
Reply to this email directly or view it on GitHubhttps://github.com/rtfd/readthedocs.org/issues/685#issuecomment-35656314 .
Closing since this isn't our issue.
Hello,
I have added a Sphinx project to RTD which uses the blockdiag extension. The images which are generated by blockdiag are not showing up in the HTML because the image paths are incorrect (they are absolute filesystem paths and not relative paths to the _images directory). The actual blockdiag documentation on RTD is showing the same problem, so it looks like this is a RTD issue.
My project: https://python-textbok.readthedocs.org/en/1.0/Selection_Control_Statements.html
blockdiag docs: http://blockdiag-readthedocs.readthedocs.org/en/latest/
The images do appear to be generated by blockdiag; here's the first image from the page at the correct path: http://python-textbok.readthedocs.org/en/1.0/_images/blockdiag-17428c50dc8e8b45de1cacd260b64e0de9806cc5.png
The images show up correctly in the PDF.
When I build the docs locally, the images in the HTML are fine, and all the image paths are relative. So it looks like RTD is rewriting these paths -- perhaps there is some confusion because the images are generated during the build, and not embedded statically.