[Python-modules-commits] r23138 - in packages/sphinx/trunk/debian/patches (l10n_fixes.diff)
mitya57-guest at users.alioth.debian.org
mitya57-guest at users.alioth.debian.org
Fri Dec 7 12:54:24 UTC 2012
Date: Friday, December 7, 2012 @ 12:54:22
Author: mitya57-guest
Revision: 23138
Update l10n_fixes.diff patch to the latest version
(which has been accepted and applied upstream)
Modified:
packages/sphinx/trunk/debian/patches/l10n_fixes.diff
Modified: packages/sphinx/trunk/debian/patches/l10n_fixes.diff
===================================================================
--- packages/sphinx/trunk/debian/patches/l10n_fixes.diff 2012-12-06 22:57:43 UTC (rev 23137)
+++ packages/sphinx/trunk/debian/patches/l10n_fixes.diff 2012-12-07 12:54:22 UTC (rev 23138)
@@ -3,13 +3,14 @@
(upstream pull request #86).
Bug: https://bitbucket.org/birkenfeld/sphinx/issue/955/cant-build-html-with-footnotes-when-using
Bug-Debian: http://bugs.debian.org/691719
+Origin: upstream, changesets b7b808e468 and 870a91ca86
Author: Takayuki Shimizukawa <shimizukawa at gmail.com>
-Last-Update: 2012-11-27
+Last-Update: 2012-12-07
=== modified file 'sphinx/environment.py'
--- a/sphinx/environment.py 2012-03-12 12:18:37 +0000
-+++ b/sphinx/environment.py 2012-11-27 14:05:36 +0000
-@@ -213,16 +213,44 @@
++++ b/sphinx/environment.py 2012-12-07 12:22:33 +0000
+@@ -213,16 +213,61 @@
parser = RSTParser()
for node, msg in extract_messages(self.document):
@@ -26,31 +27,48 @@
if not isinstance(patch, nodes.paragraph):
continue # skip for now
+
-+ footnote_refs = [r for r in node.children
-+ if isinstance(r, nodes.footnote_reference)
-+ and r.get('auto') == 1]
-+ refs = [r for r in node.children if isinstance(r, nodes.reference)]
++ # auto-numbered foot note reference should use original 'ids'.
++ is_autonumber_footnote_ref = lambda node: \
++ isinstance(node, nodes.footnote_reference) \
++ and node.get('auto') == 1
++ old_foot_refs = node.traverse(is_autonumber_footnote_ref)
++ new_foot_refs = patch.traverse(is_autonumber_footnote_ref)
++ if len(old_foot_refs) != len(new_foot_refs):
++ env.warn_node('inconsistent footnote references in '
++ 'translated message', node)
++ for old, new in zip(old_foot_refs, new_foot_refs):
++ new['ids'] = old['ids']
++ self.document.autofootnote_refs.remove(old)
++ self.document.note_autofootnote_ref(new)
+
-+ for i, child in enumerate(patch.children): # update leaves
-+ if isinstance(child, nodes.footnote_reference) \
-+ and child.get('auto') == 1:
-+ # use original 'footnote_reference' object.
-+ # this object is already registered in self.document.autofootnote_refs
-+ patch.children[i] = footnote_refs.pop(0)
-+ # Some duplicated footnote_reference in msgstr causes
-+ # IndexError in .pop(0). That is invalid msgstr.
++ # reference should use original 'refname'.
++ # * reference target ".. _Python: ..." is not translatable.
++ # * section refname is not translatable.
++ # * inline reference "`Python <...>`_" has no 'refname'.
++ is_refnamed_ref = lambda node: \
++ isinstance(node, nodes.reference) \
++ and 'refname' in node
++ old_refs = node.traverse(is_refnamed_ref)
++ new_refs = patch.traverse(is_refnamed_ref)
++ applied_refname_map = {}
++ if len(old_refs) != len(new_refs):
++ env.warn_node('inconsistent references in '
++ 'translated message', node)
++ for new in new_refs:
++ if new['refname'] in applied_refname_map:
++ # 2nd appearance of the reference
++ new['refname'] = applied_refname_map[new['refname']]
++ elif old_refs:
++ # 1st appearance of the reference in old_refs
++ old = old_refs.pop(0)
++ refname = old['refname']
++ new['refname'] = refname
++ applied_refname_map[new['refname']] = refname
++ else:
++ # the reference is not found in old_refs
++ applied_refname_map[new['refname']] = new['refname']
+
-+ elif isinstance(child, nodes.reference):
-+ # reference should use original 'refname'.
-+ # * reference target ".. _Python: ..." is not translatable.
-+ # * section refname is not translatable.
-+ # * inline reference "`Python <...>`_" has no 'refname'.
-+ if refs and 'refname' in refs[0]:
-+ refname = child['refname'] = refs.pop(0)['refname']
-+ self.document.refnames.setdefault(
-+ refname, []).append(child)
-+ # if number of reference nodes had been changed, that
-+ # would often generate unknown link target warning.
++ self.document.note_refname(new)
+
for child in patch.children: # update leaves
child.parent = node
More information about the Python-modules-commits
mailing list