Skip to content

Commit 5879b40

Browse files
committed
translator: linkcode v2 editor support
For `sphinx.ext.linkcode` references, the original handling of these nodes would right-align the links for the "[source]" references. Using a div-float for this alignment is not supported with Confluence's new editor style. For an initial rendering support for this preliminary linkcode support, ensure the link is place appropriately on the same link as a autodoc line description, and that the content is properly spaced. Signed-off-by: James Knight <[email protected]>
1 parent 5e0c709 commit 5879b40

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

sphinxcontrib/confluencebuilder/storage/translator.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1140,9 +1140,12 @@ def _visit_reference_extern(self, node):
11401140
next_child = first(findall(node, include_self=False))
11411141
if isinstance(next_child, nodes.inline):
11421142
if 'viewcode-link' in next_child.get('classes', []):
1143-
self.body.append(self._start_tag(node, 'div',
1144-
**{'style': 'float: right'}))
1145-
self._reference_context.append(self._end_tag(node))
1143+
if self.v2:
1144+
self.body.append(' ')
1145+
else:
1146+
self.body.append(self._start_tag(node, 'div',
1147+
**{'style': 'float: right'}))
1148+
self._reference_context.append(self._end_tag(node))
11461149

11471150
if 'reftitle' in node:
11481151
title = node['reftitle']

0 commit comments

Comments
 (0)