Skip to content

Commit 98d20c9

Browse files
committed
translator: restore math label anchor (v1)
Ensures when using the v1 editor that an anchor link is created. Signed-off-by: James Knight <[email protected]>
1 parent c01af01 commit 98d20c9

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
@@ -1789,25 +1789,29 @@ def _visit_image(self, node, opts):
17891789
if width:
17901790
attribs['ac:width'] = width
17911791

1792-
if self.v2 and node.math_number:
1793-
self.body.append(self._start_tag(node, 'ac:layout'))
1794-
self.context.append(self._end_tag(node))
1792+
# if this node has a math number assigned to it, build an anchor so
1793+
# that we can link to this image
1794+
if node.math_number:
1795+
if self.v2:
1796+
self.body.append(self._start_tag(node, 'ac:layout'))
1797+
self.context.append(self._end_tag(node))
17951798

1796-
self.body.append(self._start_tag(node, 'ac:layout-section',
1797-
**{
1798-
'ac:type': 'three_with_sidebars',
1799-
'ac:breakout-mode': 'default',
1800-
}))
1801-
self.context.append(self._end_tag(node))
1799+
self.body.append(self._start_tag(node, 'ac:layout-section',
1800+
**{
1801+
'ac:type': 'three_with_sidebars',
1802+
'ac:breakout-mode': 'default',
1803+
}))
1804+
self.context.append(self._end_tag(node))
18021805

1803-
self.body.append(self._start_tag(node, 'ac:layout-cell'))
1806+
self.body.append(self._start_tag(node, 'ac:layout-cell'))
18041807

18051808
self._build_id_anchors(node)
18061809

1807-
self.body.append(self._end_tag(node))
1810+
if self.v2:
1811+
self.body.append(self._end_tag(node))
18081812

1809-
self.body.append(self._start_tag(node, 'ac:layout-cell'))
1810-
self.context.append(self._end_tag(node))
1813+
self.body.append(self._start_tag(node, 'ac:layout-cell'))
1814+
self.context.append(self._end_tag(node))
18111815

18121816
if not opts['key']:
18131817
# an external or embedded image

0 commit comments

Comments
 (0)