Skip to content
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

dev-python/sphinx: Backport fixes for compatibility with docutils 0.13 #452

Merged
merged 1 commit into from
Jan 24, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions dev-python/sphinx/files/sphinx-1.4.1-docutils13.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# git diff 3adc236114^..7dabcdee91 -- sphinx/writers/html.py
# and parts of edfdd3ec78 as well in order to make these apply

diff --git a/sphinx/writers/html.py b/sphinx/writers/html.py
index 7b666aa5..d6bdd833 100644
--- a/sphinx/writers/html.py
+++ b/sphinx/writers/html.py
@@ -458,9 +458,9 @@ class HTMLTranslator(BaseTranslator):
node['uri'] = posixpath.join(self.builder.imgpath,
self.builder.images[olduri])

- if node['uri'].lower().endswith('svg') or \
- node['uri'].lower().endswith('svgz'):
- atts = {'src': node['uri']}
+ uri = node['uri']
+ if uri.lower().endswith(('svg', 'svgz')):
+ atts = {'src': uri}
if 'width' in node:
atts['width'] = node['width']
if 'height' in node:
@@ -492,6 +492,13 @@ class HTMLTranslator(BaseTranslator):
node['height'] = str(size[1])
BaseTranslator.visit_image(self, node)

+ # overwritten
+ def depart_image(self, node):
+ if node['uri'].lower().endswith(('svg', 'svgz')):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You depart from upstream fix by not checking for the docutils version. Is this safe to use with docutils-0.12 which is in stable?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Upstream reverted that version check in sphinx-doc/sphinx@b98e2e3. The important aspect is to keep things balanced: if visit_image does call the base version without modifying the stack itself, then so does depart_image. If visit_image returns without calling the base version, and does push something on the stack, then depart_image doesn't call the base version either, and makes use of the item on the stack. The common check for file extension achieves that these code paths will always match one another.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I hadn't inspected that commit. So long as it doesn't lock use in docutils-0.13 over 0.12 I see no reason not to merge.

+ self.body.append(self.context.pop())
+ else:
+ BaseTranslator.depart_image(self, node)
+
def visit_toctree(self, node):
# this only happens when formatting a toc from env.tocs -- in this
# case we don't want to include the subtree
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ DEPEND="${RDEPEND}

PATCHES=(
"${FILESDIR}"/${PN}-1.4.1-Makefile.patch
"${FILESDIR}"/${PN}-1.4.1-docutils13.patch
)

S="${WORKDIR}/${MY_P}"
Expand Down