From db5ef6be530804e35efd69af87470bddaba81e1c Mon Sep 17 00:00:00 2001 From: Bill Little Date: Fri, 22 Dec 2023 22:14:53 +0000 Subject: [PATCH] conditional sphinx note on rtd --- docs/src/conf.py | 5 +++++ src/geovista/examples/README.rst | 7 +++++++ src/geovista/examples/spatial_index/uber_h3.py | 10 ++++++---- src/geovista/examples/unstructured/dynamico.py | 5 ----- src/geovista/examples/unstructured/dynamico_poly.py | 5 ----- 5 files changed, 18 insertions(+), 14 deletions(-) diff --git a/docs/src/conf.py b/docs/src/conf.py index 36130827..abe18606 100644 --- a/docs/src/conf.py +++ b/docs/src/conf.py @@ -69,6 +69,11 @@ author = f"{project} Contributors" on_rtd = os.environ.get("READTHEDOCS") +if on_rtd: + # https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#including-content-based-on-tags + # https://www.sphinx-doc.org/en/master/usage/configuration.html#conf-tags + tags.add("on_rtd") # noqa: F821 + # The full version, including alpha/beta/rc tags release = get_version("geovista") if release.endswith("+dirty"): diff --git a/src/geovista/examples/README.rst b/src/geovista/examples/README.rst index 0dcff05d..4c22e6e0 100644 --- a/src/geovista/examples/README.rst +++ b/src/geovista/examples/README.rst @@ -11,3 +11,10 @@ The gallery is generated from the ``geovista.examples``, which can also be run from the command line:: geovista examples --run all --verbose + +.. only:: on_rtd + + .. note:: + Title text and graticule labels will **not** be rendered when viewing the + documentation on ``ReadtheDocs``, as these are not supported in this + headless environment. diff --git a/src/geovista/examples/spatial_index/uber_h3.py b/src/geovista/examples/spatial_index/uber_h3.py index 024c658d..ebab24df 100755 --- a/src/geovista/examples/spatial_index/uber_h3.py +++ b/src/geovista/examples/spatial_index/uber_h3.py @@ -381,10 +381,12 @@ def callback(actor: Actor, flag: bool) -> None: # %% -# .. note:: -# The checkboxes will **not** be rendered when viewing the documentation on -# ``ReadtheDocs``, as the appropriate VTK widget is not supported in this -# headless environment. +# .. only:: on_rtd +# +# .. note:: +# The checkboxes will **not** be rendered when viewing the documentation on +# ``ReadtheDocs``, as the appropriate VTK widget is not supported in this +# headless environment. # %% # Finally, we create the :class:`~geovista.geoplotter.GeoPlotter` and add the diff --git a/src/geovista/examples/unstructured/dynamico.py b/src/geovista/examples/unstructured/dynamico.py index c95a2468..2100de19 100755 --- a/src/geovista/examples/unstructured/dynamico.py +++ b/src/geovista/examples/unstructured/dynamico.py @@ -70,8 +70,3 @@ def main() -> None: if __name__ == "__main__": main() - -# %% -# .. note:: -# Graticule labels will **not** be rendered when viewing the documentation on -# ``ReadtheDocs``, as labels are not supported in this headless environment. diff --git a/src/geovista/examples/unstructured/dynamico_poly.py b/src/geovista/examples/unstructured/dynamico_poly.py index 0830d0e2..9975bdfe 100755 --- a/src/geovista/examples/unstructured/dynamico_poly.py +++ b/src/geovista/examples/unstructured/dynamico_poly.py @@ -72,8 +72,3 @@ def main() -> None: if __name__ == "__main__": main() - -# %% -# .. note:: -# Graticule labels will **not** be rendered when viewing the documentation on -# ``ReadtheDocs``, as labels are not supported in this headless environment.