From edce8d347167a20843e8ee789617727b10020370 Mon Sep 17 00:00:00 2001 From: Revathy Venugopal <104772255+Revathyvenugopal162@users.noreply.github.com> Date: Wed, 19 Apr 2023 16:20:25 +0200 Subject: [PATCH 1/2] ver: bump version 0.9.8 --- pyproject.toml | 6 ++-- src/ansys_sphinx_theme/__init__.py | 31 +++++++++++++++++-- .../components/theme-version.html | 10 ++++++ .../theme/ansys_sphinx_theme/theme.conf | 1 + 4 files changed, 43 insertions(+), 5 deletions(-) create mode 100644 src/ansys_sphinx_theme/theme/ansys_sphinx_theme/components/theme-version.html diff --git a/pyproject.toml b/pyproject.toml index a677a833d..3a519d918 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,7 +25,7 @@ classifiers = [ "Programming Language :: Python :: 3", ] dependencies = [ - "Sphinx>=4.2.0,<6", + "Sphinx>=4.2.0", "pydata-sphinx-theme==0.13.3", "Jinja2>=3.1.2", ] @@ -33,8 +33,8 @@ dependencies = [ [project.optional-dependencies] doc = [ "numpydoc==1.5.0", - "Sphinx==5.3.0", - "sphinx-copybutton==0.5.1", + "Sphinx==6.1.3", + "sphinx-copybutton==0.5.2", "sphinx-notfound-page==0.8.3", "sphinx-design==0.3.0", "bs4==0.0.1", diff --git a/src/ansys_sphinx_theme/__init__.py b/src/ansys_sphinx_theme/__init__.py index bca1291f8..a12f96b1b 100644 --- a/src/ansys_sphinx_theme/__init__.py +++ b/src/ansys_sphinx_theme/__init__.py @@ -1,12 +1,13 @@ """This is the ansys-sphinx-theme module.""" import pathlib -from typing import Dict +from typing import Any, Dict +from docutils.nodes import document from sphinx.application import Sphinx from ansys_sphinx_theme.latex import generate_404 # noqa: F401 -__version__ = "0.9.7" +__version__ = "0.9.8" # Declare the fundamental paths of the theme THIS_PATH = pathlib.Path(__file__).parent.resolve() @@ -84,6 +85,31 @@ def setup_default_html_theme_options(app): app.config.html_theme_options.setdefault("collapse_navigation", True) +def update_footer_theme( + app: Sphinx, pagename: str, templatename: str, context: Dict[str, Any], doctree: document +) -> None: + """Update the version number of the Ansys Sphinx theme in the footer. + + Connect to the Sphinx application instance for rendering the documentation, + and add the current version number of the Ansys Sphinx theme to the page context. + This allows the theme to update the footer with the current version number. + + Parameters + ---------- + app : ~sphinx.application.Sphinx + Application instance for rendering the documentation. + pagename : str + The name of the current page. + templatename : str + The name of the template being used. + context : dict + The context dictionary for the page. + doctree : ~docutils.nodes.document + The document tree for the page. + """ + context["ansys_sphinx_theme_version"] = __version__ + + def setup(app: Sphinx) -> Dict: """Connect to the sphinx theme app. @@ -113,6 +139,7 @@ def setup(app: Sphinx) -> Dict: app.add_js_file(str(JS_FILE.relative_to(STATIC_PATH))) app.add_js_file("https://cdn.datatables.net/1.10.23/js/jquery.dataTables.min.js") app.add_css_file("https://cdn.datatables.net/1.10.23/css/jquery.dataTables.min.css") + app.connect("html-page-context", update_footer_theme) # Add templates for autosummary app.config.templates_path.append(str(TEMPLATES_PATH)) diff --git a/src/ansys_sphinx_theme/theme/ansys_sphinx_theme/components/theme-version.html b/src/ansys_sphinx_theme/theme/ansys_sphinx_theme/components/theme-version.html new file mode 100644 index 000000000..cc179fdef --- /dev/null +++ b/src/ansys_sphinx_theme/theme/ansys_sphinx_theme/components/theme-version.html @@ -0,0 +1,10 @@ +

+ {% trans theme_version=ansys_sphinx_theme_version|e %}Built with the Ansys Sphinx Theme {{ ansys_sphinx_theme_version }}.{% endtrans %} +
Last updated on
+

+ \ 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 0188dc63b..80f8cce51 100644 --- a/src/ansys_sphinx_theme/theme/ansys_sphinx_theme/theme.conf +++ b/src/ansys_sphinx_theme/theme/ansys_sphinx_theme/theme.conf @@ -14,3 +14,4 @@ use_edit_page_button = True switcher = use_meilisearch = article_header_start = +footer_end = theme-version.html From 56d26786177ef64624c18adec98519b27849d8f5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 14 Apr 2023 07:59:26 +0200 Subject: [PATCH 2/2] Bump sphinx-design from 0.3.0 to 0.4.1 (#234) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 3a519d918..1ed396ba7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,7 +36,7 @@ doc = [ "Sphinx==6.1.3", "sphinx-copybutton==0.5.2", "sphinx-notfound-page==0.8.3", - "sphinx-design==0.3.0", + "sphinx-design==0.4.1", "bs4==0.0.1", "html5lib==1.1", "requests==2.28.2",