|
75 | 75 | # Setting up generic things |
76 | 76 |
|
77 | 77 | # If building this on RTD, mock out fortran sources |
78 | | -on_rtd = os.environ.get("READTHEDOCS", "false").lower() == "true" |
| 78 | +on_rtd = os.environ.get("READTHEDOCS", "false").lower() in ("1", "yes", "true") |
79 | 79 | _doc_skip = list( |
80 | 80 | map(lambda x: x.lower(), os.environ.get("_SISL_DOC_SKIP", "").split(",")) |
81 | 81 | ) |
|
85 | 85 | if on_rtd: |
86 | 86 | os.environ["SISL_NUM_PROCS"] = "1" |
87 | 87 |
|
| 88 | +# Let the builder decide what it should built. |
| 89 | +# This can be a pure HTML (for interaction), but that tends |
| 90 | +# to blow up file-sizes which isn't really suitable for |
| 91 | +# RTD. |
| 92 | +plotly_renderer = "iframe_connected" |
| 93 | +if on_rtd: |
| 94 | + plotly_renderer = "png" |
| 95 | +plotly_renderer = os.environ.get("_SISL_DOC_PLOTLY", plotly_renderer) |
| 96 | + |
| 97 | +# Store the renderer |
| 98 | +import plotly.io as pio |
| 99 | + |
| 100 | +pio.renderers.default = plotly_renderer |
| 101 | +if "PLOTLY_RENDERER" not in os.environ: |
| 102 | + os.environ["PLOTLY_RENDERER"] = plotly_renderer |
| 103 | + |
88 | 104 |
|
89 | 105 | # General information about the project. |
90 | 106 | project = "sisl" |
|
227 | 243 | .. _GULP: https://nanochemistry.curtin.edu.au/gulp/news.cfm |
228 | 244 |
|
229 | 245 | .. Other programs heavily used |
230 | | -.. _ASE: https://wiki.fysik.dtu.dk/ase |
| 246 | +.. _ASE: https://ase-lib.org |
231 | 247 | .. _kwant: https://kwant-project.org |
232 | 248 | .. _XCrySDen: http://www.xcrysden.org |
233 | 249 | .. _VMD: https://www.ks.uiuc.edu/Research/vmd |
@@ -463,14 +479,12 @@ def has_under(name: str): |
463 | 479 | # Plot directives for matplotlib |
464 | 480 | plot_include_source = True |
465 | 481 | plot_formats = [("png", 90)] |
466 | | -plot_pre_code = """\ |
| 482 | +plot_pre_code = f"""\ |
467 | 483 | import numpy as np |
468 | 484 | import matplotlib.pyplot as plt |
469 | 485 | import sisl as si |
470 | | -import plotly.io as pio |
471 | 486 | np.random.seed(123987) |
472 | 487 | np.set_printoptions(precision=4, suppress=True) |
473 | | -pio.renderers.default = "notebook_connected" |
474 | 488 | """ |
475 | 489 |
|
476 | 490 |
|
@@ -504,7 +518,7 @@ def has_under(name: str): |
504 | 518 | "python": ("https://docs.python.org/3/", None), |
505 | 519 | "numpy": ("https://numpy.org/doc/stable/", None), |
506 | 520 | "scipy": ("https://docs.scipy.org/doc/scipy/", None), |
507 | | - "ase": ("https://wiki.fysik.dtu.dk/ase/", None), |
| 521 | + "ase": ("https://ase-lib.org/", None), |
508 | 522 | "matplotlib": ("https://matplotlib.org/stable/", None), |
509 | 523 | "xarray": ("https://docs.xarray.dev/en/stable/", None), |
510 | 524 | "plotly": ("https://plotly.com/python-api-reference/", None), |
@@ -570,7 +584,7 @@ class RevYearPlain(PlainStyle): |
570 | 584 |
|
571 | 585 | # Insert a link to download the IPython notebook |
572 | 586 | nbsphinx_prolog = r""" |
573 | | -{% set docname = "docs/" + env.doc2path(env.docname, base=None) %} |
| 587 | +{% set docname = "docs/" + env.doc2path(env.docname, base=None)|string %} |
574 | 588 |
|
575 | 589 | .. raw:: html |
576 | 590 |
|
|
0 commit comments