From a13edb86318b21e224cf1365fc9c5edb05df18dc Mon Sep 17 00:00:00 2001 From: shimizukawa Date: Sun, 20 Nov 2016 17:32:05 +0900 Subject: [PATCH] refs #3093: gettext build broken on substituted images. --- CHANGES | 1 + sphinx/transforms.py | 4 ++-- sphinx/util/nodes.py | 2 ++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 49b0ca941e..ef2997d105 100644 --- a/CHANGES +++ b/CHANGES @@ -11,6 +11,7 @@ Bugs fixed * #3074: ``add_source_parser()`` crashes in debug mode * #3135: ``sphinx.ext.autodoc`` crashes with plain Callable * #3150: Fix query word splitter in JavaScript. It behaves as same as Python's regular expression. +* #3093: gettext build broken on substituted images. Release 1.4.8 (released Oct 1, 2016) ==================================== diff --git a/sphinx/transforms.py b/sphinx/transforms.py index cb4a5779bd..ba15ae6141 100644 --- a/sphinx/transforms.py +++ b/sphinx/transforms.py @@ -166,7 +166,7 @@ class ApplySourceWorkaround(Transform): def apply(self): for n in self.document.traverse(): - if isinstance(n, nodes.TextElement): + if isinstance(n, (nodes.TextElement, nodes.image)): apply_source_workaround(n) @@ -192,7 +192,7 @@ class ExtraTranslatableNodes(Transform): """ make nodes translatable """ - default_priority = 10 + default_priority = 9 def apply(self): targets = self.document.settings.env.config.gettext_additional_targets diff --git a/sphinx/util/nodes.py b/sphinx/util/nodes.py index e4a2fd73b8..e51ad29727 100644 --- a/sphinx/util/nodes.py +++ b/sphinx/util/nodes.py @@ -46,6 +46,8 @@ def apply_source_workaround(node): node.source = definition_list_item.source node.line = definition_list_item.line - 1 node.rawsource = node.astext() # set 'classifier1' (or 'classifier2') + if isinstance(node, nodes.image) and node.source is None: + node.source, node.line = node.parent.source, node.parent.line if isinstance(node, nodes.term): # strip classifier from rawsource of term for classifier in reversed(node.parent.traverse(nodes.classifier)):