- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed two more bugs with SVG inheritance-diagram links #11634
Conversation
Looking at 7.2.5. A |
@ayshih would you be able to look over the changes I've made here? A |
Hmm, one of your changes has caused this PR to no longer fix the matplotlib docs, so I'll track down why (and also expand the test accordingly). |
# Conflicts: # CHANGES
A |
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Thanks for fixing this PR! I have verified that the matplotlib docs build correctly with the most recent changes. I have also expanded the unit test to cover what was being missed (linking between files in the same subdirectory), and verified that the unit test correctly fails when run on the earlier version (commit af8a1f4). |
Subject: Fixed two more bugs with SVG inheritance-diagram links
Feature or Bugfix
Purpose
This PR is a follow-on to fixes to inheritance-diagram links (#10614), because I discovered two bugs when trying to re-enable SVG inheritance diagrams on matplotlib (see matplotlib/matplotlib#26567). One of these bugs is actually in the graphviz writer, so affects use cases beyond just inheritance diagrams.
Detail
sphinx.ext.graphviz
#11078) is that it usesself.builder.outdir
(e.g.,build/html
) as the base directory for relative URLs rather than the directory of the current document (e.g.,build/html/api
forbuild/html/api/doc1.rst
). This happens to still work fine for many cases because the base directory can "cancel out" when determining the correct relative path from the image directory (e.g.,build/html/_images
). However, when the relative URL doesn't need to go all the way down toself.builder.outdir
(e.g.,build/html/api/doc1.rst
pointing tobuild/html/api/doc2.rst
means that the relative URL is simplydoc2.rst
), parts of the provided base directory get pulled into the generated relative path, and so passing in the wrong base directory results in an incorrect relative path (e.g.,../html/doc2.rst
instead of../api/doc2.rst
).self.builder.outdir
instead of using just the filename.Relates