From 7152dae3c3a4149af72db11d11cd0bec26a59259 Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Mon, 18 Nov 2024 15:02:25 +0100 Subject: [PATCH 1/4] fix: add sections ids --- src/ansys_sphinx_theme/search/fuse_search.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ansys_sphinx_theme/search/fuse_search.py b/src/ansys_sphinx_theme/search/fuse_search.py index a008fad4..fc8a89ec 100644 --- a/src/ansys_sphinx_theme/search/fuse_search.py +++ b/src/ansys_sphinx_theme/search/fuse_search.py @@ -101,7 +101,11 @@ def _process_desc_element(self, node, title): for element_child in element.children: if element_child.tagname != "desc_signature": continue - section_anchor_id = element_child.attributes["ids"][0] + section_anchor_id = ( + element_child.attributes["ids"][0] + if element_child.attributes["ids"] + else section_anchor_id + ) section_text = element.astext() section_title = _desc_anchor_to_title(title, section_anchor_id) self.sections.append( From 26a5086ab98dc4b9cd55a97fd52f40c777ada909 Mon Sep 17 00:00:00 2001 From: pyansys-ci-bot <92810346+pyansys-ci-bot@users.noreply.github.com> Date: Mon, 18 Nov 2024 15:15:59 +0000 Subject: [PATCH 2/4] chore: adding changelog file 586.miscellaneous.md [dependabot-skip] --- doc/changelog.d/586.miscellaneous.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 doc/changelog.d/586.miscellaneous.md diff --git a/doc/changelog.d/586.miscellaneous.md b/doc/changelog.d/586.miscellaneous.md new file mode 100644 index 00000000..881fbb9f --- /dev/null +++ b/doc/changelog.d/586.miscellaneous.md @@ -0,0 +1 @@ +fix: section ids with search \ No newline at end of file From 7a836a4f78052b9210ed97833e34f148dc26c419 Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Mon, 18 Nov 2024 17:13:25 +0100 Subject: [PATCH 3/4] fix: add sections ids --- src/ansys_sphinx_theme/search/fuse_search.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/ansys_sphinx_theme/search/fuse_search.py b/src/ansys_sphinx_theme/search/fuse_search.py index fc8a89ec..24f3dbc3 100644 --- a/src/ansys_sphinx_theme/search/fuse_search.py +++ b/src/ansys_sphinx_theme/search/fuse_search.py @@ -101,11 +101,8 @@ def _process_desc_element(self, node, title): for element_child in element.children: if element_child.tagname != "desc_signature": continue - section_anchor_id = ( - element_child.attributes["ids"][0] - if element_child.attributes["ids"] - else section_anchor_id - ) + if element_child.attributes.get("ids"): + section_anchor_id = element_child.attributes["ids"][0] section_text = element.astext() section_title = _desc_anchor_to_title(title, section_anchor_id) self.sections.append( From bff0e893b8138f2d532266edbda017932997d525 Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Tue, 19 Nov 2024 10:54:41 +0100 Subject: [PATCH 4/4] fix: chcek sections as list --- src/ansys_sphinx_theme/search/fuse_search.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/ansys_sphinx_theme/search/fuse_search.py b/src/ansys_sphinx_theme/search/fuse_search.py index 24f3dbc3..baff4965 100644 --- a/src/ansys_sphinx_theme/search/fuse_search.py +++ b/src/ansys_sphinx_theme/search/fuse_search.py @@ -104,7 +104,12 @@ def _process_desc_element(self, node, title): if element_child.attributes.get("ids"): section_anchor_id = element_child.attributes["ids"][0] section_text = element.astext() - section_title = _desc_anchor_to_title(title, section_anchor_id) + if isinstance(section_anchor_id, list) and len(section_anchor_id) > 0: + section_anchor_id = section_anchor_id[0] + if section_anchor_id: + section_title = _desc_anchor_to_title(title, section_anchor_id) + else: + section_title = title self.sections.append( { "title": section_title,