From 95d6c683716c2a4a310eeee483d54ee7aa2a0586 Mon Sep 17 00:00:00 2001 From: shimizukawa Date: Sat, 21 Feb 2015 12:23:26 +0900 Subject: [PATCH] Closes #1732. Localized table caption raises exception. It is potentially bug that appears by a change https://github.com/sphinx-doc/sphinx/commit/7cd470f59a0710f7ad4d5a94c10cd907aa135af0 --- CHANGES | 1 + sphinx/transforms.py | 46 +++++++++++++++++++++++++------------------- 2 files changed, 27 insertions(+), 20 deletions(-) diff --git a/CHANGES b/CHANGES index 8fd4646a6..65ad40b9f 100644 --- a/CHANGES +++ b/CHANGES @@ -38,6 +38,7 @@ Bugs fixed * bizstyle theme: all breadcrumb items become 'Top' on some mobile browser (iPhone5s safari). * #1722: restore ``toctree()`` template function behavior that was changed at 1.3b1. +* #1732: i18n: localized table caption raises exception. Release 1.3b2 (released Dec 5, 2014) diff --git a/sphinx/transforms.py b/sphinx/transforms.py index 2ef3424e1..39c4db5b5 100644 --- a/sphinx/transforms.py +++ b/sphinx/transforms.py @@ -248,29 +248,35 @@ class Locale(Transform): # * if explicit: _id is label. title node need another id. # * if not explicit: # - # * _id is None: + # * if _id is None: # - # _id is None means _id was duplicated. - # old_name entry still exists in nameids and - # nametypes for another duplicated entry. + # _id is None means: # - # * _id is provided: bellow process - if not explicit and _id: - # _id was not duplicated. - # remove old_name entry from document ids database - # to reuse original _id. - self.document.nameids.pop(old_name, None) - self.document.nametypes.pop(old_name, None) - self.document.ids.pop(_id, None) + # 1. _id was not provided yet. + # + # 2. _id was duplicated. + # + # old_name entry still exists in nameids and + # nametypes for another duplicated entry. + # + # * if _id is provided: bellow process + if _id: + if not explicit: + # _id was not duplicated. + # remove old_name entry from document ids database + # to reuse original _id. + self.document.nameids.pop(old_name, None) + self.document.nametypes.pop(old_name, None) + self.document.ids.pop(_id, None) - # re-entry with new named section node. - # - # Note: msgnode that is a second parameter of the - # `note_implicit_target` is not necessary here because - # section_node has been noted previously on rst parsing by - # `docutils.parsers.rst.states.RSTState.new_subsection()` - # and already has `system_message` if needed. - self.document.note_implicit_target(section_node) + # re-entry with new named section node. + # + # Note: msgnode that is a second parameter of the + # `note_implicit_target` is not necessary here because + # section_node has been noted previously on rst parsing by + # `docutils.parsers.rst.states.RSTState.new_subsection()` + # and already has `system_message` if needed. + self.document.note_implicit_target(section_node) # replace target's refname to new target name def is_named_target(node):