Skip to content

Commit 1bbd4c5

Browse files
fix: section ids with search (#586)
Co-authored-by: pyansys-ci-bot <[email protected]>
1 parent 558df99 commit 1bbd4c5

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
fix: section ids with search

src/ansys_sphinx_theme/search/fuse_search.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,15 @@ def _process_desc_element(self, node, title):
101101
for element_child in element.children:
102102
if element_child.tagname != "desc_signature":
103103
continue
104-
section_anchor_id = element_child.attributes["ids"][0]
104+
if element_child.attributes.get("ids"):
105+
section_anchor_id = element_child.attributes["ids"][0]
105106
section_text = element.astext()
106-
section_title = _desc_anchor_to_title(title, section_anchor_id)
107+
if isinstance(section_anchor_id, list) and len(section_anchor_id) > 0:
108+
section_anchor_id = section_anchor_id[0]
109+
if section_anchor_id:
110+
section_title = _desc_anchor_to_title(title, section_anchor_id)
111+
else:
112+
section_title = title
107113
self.sections.append(
108114
{
109115
"title": section_title,

0 commit comments

Comments
 (0)