Skip to content

Commit f903ecf

Browse files
committed
translator: replace spaces with dashes when resolving title anchors
When attempting to determine the anchor target for a named title entry, replace any spaces found in a named entry to ensure it can map to an appropriate anchor value (since anchors have no spaces). This should ensure the sanity check for a target lookup help finds the title has a valid target to ensure the anchor is created. Signed-off-by: James Knight <[email protected]>
1 parent 6c2d102 commit f903ecf

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

sphinxcontrib/confluencebuilder/storage/translator.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,8 @@ def visit_title(self, node):
282282
# repsective document name) which helps allow `ac:link` macros
283283
# properly link when coming from v1 or v2 editor pages.
284284
if self.v2 and 'names' in node.parent:
285-
for anchor in node.parent['names']:
285+
for name in node.parent['names']:
286+
anchor = name.replace(' ', '-')
286287
target_name = f'{docname}/#{anchor}'
287288
target = self.state.target(target_name)
288289
if target and target not in new_targets:

0 commit comments

Comments
 (0)