Skip to content

Commit 5e6d82d

Browse files
authored
Merge pull request #952 from sphinx-contrib/restore-math-anchor-label
translator: restore math label anchor (v1)
2 parents 8b09d9e + 98d20c9 commit 5e6d82d

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

sphinxcontrib/confluencebuilder/storage/translator.py

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1769,25 +1769,29 @@ def _visit_image(self, node, opts):
17691769
if width:
17701770
attribs['ac:width'] = width
17711771

1772-
if self.v2 and node.math_number:
1773-
self.body.append(self._start_tag(node, 'ac:layout'))
1774-
self.context.append(self._end_tag(node))
1772+
# if this node has a math number assigned to it, build an anchor so
1773+
# that we can link to this image
1774+
if node.math_number:
1775+
if self.v2:
1776+
self.body.append(self._start_tag(node, 'ac:layout'))
1777+
self.context.append(self._end_tag(node))
17751778

1776-
self.body.append(self._start_tag(node, 'ac:layout-section',
1777-
**{
1778-
'ac:type': 'three_with_sidebars',
1779-
'ac:breakout-mode': 'default',
1780-
}))
1781-
self.context.append(self._end_tag(node))
1779+
self.body.append(self._start_tag(node, 'ac:layout-section',
1780+
**{
1781+
'ac:type': 'three_with_sidebars',
1782+
'ac:breakout-mode': 'default',
1783+
}))
1784+
self.context.append(self._end_tag(node))
17821785

1783-
self.body.append(self._start_tag(node, 'ac:layout-cell'))
1786+
self.body.append(self._start_tag(node, 'ac:layout-cell'))
17841787

17851788
self._build_id_anchors(node)
17861789

1787-
self.body.append(self._end_tag(node))
1790+
if self.v2:
1791+
self.body.append(self._end_tag(node))
17881792

1789-
self.body.append(self._start_tag(node, 'ac:layout-cell'))
1790-
self.context.append(self._end_tag(node))
1793+
self.body.append(self._start_tag(node, 'ac:layout-cell'))
1794+
self.context.append(self._end_tag(node))
17911795

17921796
if not opts['key']:
17931797
# an external or embedded image

0 commit comments

Comments
 (0)