From 6d6d229b3a38ace2bbe2c966aab43ce11d6c2d52 Mon Sep 17 00:00:00 2001 From: Leland McInnes Date: Sat, 12 Oct 2024 16:22:38 -0400 Subject: [PATCH] Debug auto_example doc building ... ... --- doc/conf.py | 2 +- doc/unmangle_notebook_srcdoc.py | 6 +++++- examples/plot_interactive_arxiv_ml.py | 1 + examples/plot_interactive_cord19.py | 2 ++ examples/plot_interactive_custom_cord19.py | 2 ++ examples/plot_interactive_wikipedia.py | 2 ++ 6 files changed, 13 insertions(+), 2 deletions(-) diff --git a/doc/conf.py b/doc/conf.py index 365658e..3f38a51 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -40,7 +40,7 @@ "nbsphinx", "sphinx.ext.mathjax", "sphinx_gallery.gen_gallery", - "sphinx_build_compatibility.extension", + # "sphinx_build_compatibility.extension", ] # this is needed for some reason... diff --git a/doc/unmangle_notebook_srcdoc.py b/doc/unmangle_notebook_srcdoc.py index 0106f01..7a98157 100644 --- a/doc/unmangle_notebook_srcdoc.py +++ b/doc/unmangle_notebook_srcdoc.py @@ -1,6 +1,7 @@ import os import glob import html +import shutil _ORIGINAL_NON_INLINE_WORKER = """ const parsingWorkerBlob = new Blob([` @@ -94,7 +95,7 @@ `], { type: 'application/javascript' }); """ -def unmangle_notebook_srcdoc(html_str): +def unmangle_notebook_srcdoc(html_str, auto_example=False): new_html_str = html_str.replace( html.escape(_NOTEBOOK_NON_INLINE_WORKER), html.escape(_ORIGINAL_NON_INLINE_WORKER), @@ -103,6 +104,9 @@ def unmangle_notebook_srcdoc(html_str): def process_html_files(): print(f"Processing HTML files from {os.getcwd()}") + for zipfile in glob.glob(os.environ["READTHEDOCS_OUTPUT"] + "html/*gallery*.zip"): + print(f"Moving {zipfile} to {zipfile.replace('html/', 'html/auto_examples/')}") + shutil.copy(zipfile, zipfile.replace("html/", "html/auto_examples/")) for filename in glob.glob(os.environ["READTHEDOCS_OUTPUT"] + 'html/**/*.html', recursive=True): with open(filename, 'r') as f: html_str = f.read() diff --git a/examples/plot_interactive_arxiv_ml.py b/examples/plot_interactive_arxiv_ml.py index 3437c80..96da641 100644 --- a/examples/plot_interactive_arxiv_ml.py +++ b/examples/plot_interactive_arxiv_ml.py @@ -36,5 +36,6 @@ enable_search=True, darkmode=True, inline_data=False, + file_prefix="arxivml_gallery", ) plot \ No newline at end of file diff --git a/examples/plot_interactive_cord19.py b/examples/plot_interactive_cord19.py index d1c5717..dc24c67 100644 --- a/examples/plot_interactive_cord19.py +++ b/examples/plot_interactive_cord19.py @@ -47,6 +47,8 @@ noise_color="#aaaaaa66", cluster_boundary_polygons=True, enable_search=True, + inline_data=False, + file_prefix="cord_gallery", ) plot.save("cord19.html") plot \ No newline at end of file diff --git a/examples/plot_interactive_custom_cord19.py b/examples/plot_interactive_custom_cord19.py index f4d9a9f..e6fe0c4 100644 --- a/examples/plot_interactive_custom_cord19.py +++ b/examples/plot_interactive_custom_cord19.py @@ -164,5 +164,7 @@ custom_css=custom_css, custom_html=custom_html, custom_js=custom_js, + inline_data=False, + file_prefix="custom_cord_gallery", ) plot diff --git a/examples/plot_interactive_wikipedia.py b/examples/plot_interactive_wikipedia.py index 1b74f58..98ad839 100644 --- a/examples/plot_interactive_wikipedia.py +++ b/examples/plot_interactive_wikipedia.py @@ -40,5 +40,7 @@ marker_size_array=wikipedia_marker_size_array, cluster_boundary_polygons=True, initial_zoom_fraction=0.99, + inline_data=False, + file_prefix="wikipedia_gallery", ) plot \ No newline at end of file