diff --git a/CHANGES b/CHANGES index dea12e681..944275f8d 100644 --- a/CHANGES +++ b/CHANGES @@ -13,6 +13,9 @@ Features added Bugs fixed ---------- +* #3588: No compact (p tag) html output in the i18n document build even when + :confval:`html_compact_lists` is True. + Testing -------- diff --git a/sphinx/transforms/i18n.py b/sphinx/transforms/i18n.py index 7776af237..2618c7246 100644 --- a/sphinx/transforms/i18n.py +++ b/sphinx/transforms/i18n.py @@ -215,12 +215,12 @@ class Locale(SphinxTransform): for child in patch.children: child.parent = node node.children = patch.children - node['translated'] = True + node['translated'] = True # to avoid double translation # phase2: translation for node, msg in extract_messages(self.document): - if node.get('translated', False): - continue + if node.get('translated', False): # to avoid double translation + continue # skip if the node is already translated by phase1 msgstr = catalog.gettext(msg) # XXX add marker to untranslated parts @@ -395,7 +395,7 @@ class Locale(SphinxTransform): if isinstance(node, IMAGE_TYPE_NODES): node.update_all_atts(patch) - node['translated'] = True + node['translated'] = True # to avoid double translation if 'index' in self.config.gettext_additional_targets: # Extract and translate messages for index entries. @@ -415,6 +415,12 @@ class Locale(SphinxTransform): node['raw_entries'] = entries node['entries'] = new_entries + # remove translated attribute that is used for avoiding double translation. + def has_translatable(node): + return isinstance(node, nodes.Element) and 'translated' in node + for node in self.document.traverse(has_translatable): + node.delattr('translated') + class RemoveTranslatableInline(SphinxTransform): """