From 4ffe844b1a2fa7a1917f3a927a4581b7f972e92a Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Wed, 15 Feb 2023 11:14:37 +0100 Subject: [PATCH 01/24] Replace the searchfield --- .../components/meilisearch.html | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/ansys_sphinx_theme/theme/ansys_sphinx_theme/components/meilisearch.html diff --git a/src/ansys_sphinx_theme/theme/ansys_sphinx_theme/components/meilisearch.html b/src/ansys_sphinx_theme/theme/ansys_sphinx_theme/components/meilisearch.html new file mode 100644 index 000000000..223178de1 --- /dev/null +++ b/src/ansys_sphinx_theme/theme/ansys_sphinx_theme/components/meilisearch.html @@ -0,0 +1,21 @@ + \ No newline at end of file From 189ed283236655c798ec9815b6d941904f76636b Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Wed, 15 Feb 2023 11:40:23 +0100 Subject: [PATCH 02/24] ADD the env variables --- doc/source/conf.py | 14 +++++++++- .../components/meilisearch.html | 28 +++++++++---------- .../theme/ansys_sphinx_theme/theme.conf | 3 ++ 3 files changed, 29 insertions(+), 16 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index da4e46b03..775480170 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -5,6 +5,10 @@ from pathlib import Path from typing import List +from sphinx.util import logging + +logger = logging.getLogger(__name__) + from bs4 import BeautifulSoup import requests from sphinx.builders.latex import LaTeXBuilder @@ -37,6 +41,11 @@ # use the default ansys logo html_logo = ansys_logo_black html_theme = "ansys_sphinx_theme" +meilisearch_index_uid = "ansys-ansys-sphinx-theme-sphinx-docs" +meilisearch_host = os.environ.get("MEILISEARCH_HOST") +meilisearch_api_key = os.environ.get("MEILISEARCH_API_KEY") + +# In the html_context dictionary in conf.py html_context = { "github_user": "ansys", @@ -44,7 +53,7 @@ "github_version": "main", "doc_path": "doc/source", } - +logger.info("Setting custom theme options...") # specify the location of your github repo html_theme_options = { "github_url": "https://github.com/ansys/ansys-sphinx-theme", @@ -62,6 +71,9 @@ "json_url": f"https://{cname}/release/versions.json", "version_match": get_version_match(__version__), }, + "meilisearch_host": meilisearch_host, + "meilisearch_api_key": meilisearch_api_key, + "meilisearch_index_uid": meilisearch_index_uid, } html_short_title = html_title = "Ansys Sphinx Theme" diff --git a/src/ansys_sphinx_theme/theme/ansys_sphinx_theme/components/meilisearch.html b/src/ansys_sphinx_theme/theme/ansys_sphinx_theme/components/meilisearch.html index 223178de1..8ffd57e0d 100644 --- a/src/ansys_sphinx_theme/theme/ansys_sphinx_theme/components/meilisearch.html +++ b/src/ansys_sphinx_theme/theme/ansys_sphinx_theme/components/meilisearch.html @@ -1,21 +1,19 @@ \ No newline at end of file diff --git a/src/ansys_sphinx_theme/theme/ansys_sphinx_theme/theme.conf b/src/ansys_sphinx_theme/theme/ansys_sphinx_theme/theme.conf index f0112da94..755e2225b 100644 --- a/src/ansys_sphinx_theme/theme/ansys_sphinx_theme/theme.conf +++ b/src/ansys_sphinx_theme/theme/ansys_sphinx_theme/theme.conf @@ -12,3 +12,6 @@ hidden_icons = additional_breadcrumbs = use_edit_page_button = True switcher = +meilisearch_host= +meilisearch_api_key= +meilisearch_index_uid= From c58d9cf422aeb97599412fe1d5181953a3f0720e Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Wed, 15 Feb 2023 12:13:28 +0100 Subject: [PATCH 03/24] Add the dict --- doc/source/conf.py | 12 ++++++------ .../ansys_sphinx_theme/components/meilisearch.html | 13 +++++++------ .../theme/ansys_sphinx_theme/theme.conf | 4 +--- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index 775480170..790faef55 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -41,10 +41,12 @@ # use the default ansys logo html_logo = ansys_logo_black html_theme = "ansys_sphinx_theme" -meilisearch_index_uid = "ansys-ansys-sphinx-theme-sphinx-docs" -meilisearch_host = os.environ.get("MEILISEARCH_HOST") -meilisearch_api_key = os.environ.get("MEILISEARCH_API_KEY") +MEILISEARCH = { + "host": os.environ.get("MEILISEARCH_HOST_NAME", ""), + "api_key": os.environ.get("MEILISEARCH_API_KEY", ""), + "index_uid": os.environ.get("ansys-ansys-sphinx-theme-sphinx-docs", ""), +} # In the html_context dictionary in conf.py html_context = { @@ -71,9 +73,7 @@ "json_url": f"https://{cname}/release/versions.json", "version_match": get_version_match(__version__), }, - "meilisearch_host": meilisearch_host, - "meilisearch_api_key": meilisearch_api_key, - "meilisearch_index_uid": meilisearch_index_uid, + "meilisearch": MEILISEARCH, } html_short_title = html_title = "Ansys Sphinx Theme" diff --git a/src/ansys_sphinx_theme/theme/ansys_sphinx_theme/components/meilisearch.html b/src/ansys_sphinx_theme/theme/ansys_sphinx_theme/components/meilisearch.html index 8ffd57e0d..4d43daa44 100644 --- a/src/ansys_sphinx_theme/theme/ansys_sphinx_theme/components/meilisearch.html +++ b/src/ansys_sphinx_theme/theme/ansys_sphinx_theme/components/meilisearch.html @@ -1,15 +1,16 @@ \ No newline at end of file + From 7b1c04c705aac2fc293bfada0b0a7425ca85ca21 Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Wed, 15 Feb 2023 15:09:15 +0100 Subject: [PATCH 06/24] MAking the search field --- doc/source/conf.py | 21 ++-- .../components/meilisearch.html | 48 --------- .../components/search-field.html | 102 ++++++++++++++++++ 3 files changed, 112 insertions(+), 59 deletions(-) delete mode 100644 src/ansys_sphinx_theme/theme/ansys_sphinx_theme/components/meilisearch.html create mode 100644 src/ansys_sphinx_theme/theme/ansys_sphinx_theme/components/search-field.html diff --git a/doc/source/conf.py b/doc/source/conf.py index 025935ea0..686155dd7 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -42,17 +42,8 @@ html_logo = ansys_logo_black html_theme = "ansys_sphinx_theme" -MEILISEARCH = { - "host": os.environ.get("MEILISEARCH_HOST_NAME", ""), - "api_key": os.environ.get("MEILISEARCH_API_KEY", ""), - "index_uids": { - "pyansys-docs-all-public": "PyAnsys", - "pyaedt": "pyaedt", - "ansys-sphinx-theme": "ansys", - }, -} -# In the html_context dictionary in conf.py +# In the html_context dictionary in conf.py html_context = { "github_user": "ansys", "github_repo": "ansys-sphinx-theme", @@ -77,7 +68,15 @@ "json_url": f"https://{cname}/release/versions.json", "version_match": get_version_match(__version__), }, - "meilisearch": MEILISEARCH, + "meilisearch": { + "host": os.getenv("MEILISEARCH_HOST_NAME"), + "api_key": os.getenv("MEILISEARCH_API_KEY", ""), + "index_uids": { + "pyansys-docs-all-public": "PyAnsys", + "pyaedt": "pyaedt", + "pymapdl": "ansys", + }, + }, } html_short_title = html_title = "Ansys Sphinx Theme" diff --git a/src/ansys_sphinx_theme/theme/ansys_sphinx_theme/components/meilisearch.html b/src/ansys_sphinx_theme/theme/ansys_sphinx_theme/components/meilisearch.html deleted file mode 100644 index 79dd582ba..000000000 --- a/src/ansys_sphinx_theme/theme/ansys_sphinx_theme/components/meilisearch.html +++ /dev/null @@ -1,48 +0,0 @@ - - -

Example Search

- -
-
- -
- - {% if html_theme_options.meilisearch_index_uids %} - - {% endif %} - -
- - - {% if html_theme_options.meilisearch %} - - - {% endif %} - diff --git a/src/ansys_sphinx_theme/theme/ansys_sphinx_theme/components/search-field.html b/src/ansys_sphinx_theme/theme/ansys_sphinx_theme/components/search-field.html new file mode 100644 index 000000000..1708f3b4e --- /dev/null +++ b/src/ansys_sphinx_theme/theme/ansys_sphinx_theme/components/search-field.html @@ -0,0 +1,102 @@ + + + + + + From 976e523acd5431aa8c2efeff9a87c55a292f7f50 Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Wed, 15 Feb 2023 15:14:20 +0100 Subject: [PATCH 07/24] Add the styles --- .../components/search-field.html | 69 +------------------ .../static/css/breadcrumbs.css | 59 ++++++++++++++++ 2 files changed, 60 insertions(+), 68 deletions(-) diff --git a/src/ansys_sphinx_theme/theme/ansys_sphinx_theme/components/search-field.html b/src/ansys_sphinx_theme/theme/ansys_sphinx_theme/components/search-field.html index 1708f3b4e..e32e08628 100644 --- a/src/ansys_sphinx_theme/theme/ansys_sphinx_theme/components/search-field.html +++ b/src/ansys_sphinx_theme/theme/ansys_sphinx_theme/components/search-field.html @@ -1,72 +1,5 @@ - - - - -