Closes #1732. Localized table caption raises exception.

It is potentially bug that appears by a change 7cd470f59a
This commit is contained in:
shimizukawa 2015-02-21 12:23:26 +09:00
parent 334c4ebd9b
commit 95d6c68371
2 changed files with 27 additions and 20 deletions

View File

@ -38,6 +38,7 @@ Bugs fixed
* bizstyle theme: all breadcrumb items become 'Top' on some mobile browser * bizstyle theme: all breadcrumb items become 'Top' on some mobile browser
(iPhone5s safari). (iPhone5s safari).
* #1722: restore ``toctree()`` template function behavior that was changed at 1.3b1. * #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) Release 1.3b2 (released Dec 5, 2014)

View File

@ -248,29 +248,35 @@ class Locale(Transform):
# * if explicit: _id is label. title node need another id. # * if explicit: _id is label. title node need another id.
# * if not explicit: # * if not explicit:
# #
# * _id is None: # * if _id is None:
# #
# _id is None means _id was duplicated. # _id is None means:
# old_name entry still exists in nameids and
# nametypes for another duplicated entry.
# #
# * _id is provided: bellow process # 1. _id was not provided yet.
if not explicit and _id: #
# _id was not duplicated. # 2. _id was duplicated.
# remove old_name entry from document ids database #
# to reuse original _id. # old_name entry still exists in nameids and
self.document.nameids.pop(old_name, None) # nametypes for another duplicated entry.
self.document.nametypes.pop(old_name, None) #
self.document.ids.pop(_id, None) # * 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. # re-entry with new named section node.
# #
# Note: msgnode that is a second parameter of the # Note: msgnode that is a second parameter of the
# `note_implicit_target` is not necessary here because # `note_implicit_target` is not necessary here because
# section_node has been noted previously on rst parsing by # section_node has been noted previously on rst parsing by
# `docutils.parsers.rst.states.RSTState.new_subsection()` # `docutils.parsers.rst.states.RSTState.new_subsection()`
# and already has `system_message` if needed. # and already has `system_message` if needed.
self.document.note_implicit_target(section_node) self.document.note_implicit_target(section_node)
# replace target's refname to new target name # replace target's refname to new target name
def is_named_target(node): def is_named_target(node):