Skip to content

Commit

Permalink
Address RTD deprecation for build-time Sphinx context injection (pyba…
Browse files Browse the repository at this point in the history
…mm-team#4305)

* Set HTML baseurl and add RTD env vars to context

* Fix failing links

* suggestions from Arjun

Co-authored-by: Arjun Verma <arjunverma.oc@gmail.com>

---------

Co-authored-by: Ferran Brosa Planella <Ferran.Brosa-Planella@warwick.ac.uk>
Co-authored-by: Arjun Verma <arjunverma.oc@gmail.com>
  • Loading branch information
3 people authored and js1tr3 committed Aug 12, 2024
1 parent c31e3b1 commit 6946072
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,9 @@ All code requires testing. We use the [pytest](https://docs.pytest.org/en/stable

We use following plugins for various needs:

[nbmake](https://github.com/treebeardtech/nbmake&#41) : plugins to test the example notebooks.
[nbmake](https://github.com/treebeardtech/nbmake/) : plugins to test the example notebooks.

[pytest-xdist](https://pypi.org/project/pytest-xdist/&#41) : plugins to run tests in parallel.
[pytest-xdist](https://pypi.org/project/pytest-xdist/) : plugins to run tests in parallel.

If you have `nox` installed, to run unit tests, type

Expand Down
20 changes: 14 additions & 6 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,21 @@
html_sidebars = {"**": ["sidebar-nav-bs.html", "sidebar-ethical-ads.html"]}

# For edit button
html_context = {
"github_user": "pybamm-team",
"github_repo": "pybamm",
"github_version": "develop",
"doc_path": "docs/",
}
html_context.update(
{
"github_user": "pybamm-team",
"github_repo": "pybamm",
"github_version": "develop",
"doc_path": "docs/",
}
)

# Set canonical URL from the Read the Docs Domain
html_baseurl = os.getenv("READTHEDOCS_CANONICAL_URL", "")

# Tell Jinja2 templates the build is running on Read the Docs
if os.getenv("READTHEDOCS") == "True":
html_context["READTHEDOCS"] = True

# -- Options for HTMLHelp output ---------------------------------------------

Expand Down

0 comments on commit 6946072

Please sign in to comment.