1515def find_notebooks ():
1616 """Return a list of filenames of the example notebooks."""
1717 path = os .path .dirname (__file__ )
18- pattern = os .path .join (path , ".." , ".." , "examples " , "*.ipynb " )
18+ pattern = os .path .join (path , ".." , ".." , "docs " , "*.md " )
1919 files = glob .glob (pattern )
20- files = [f for f in files if not f .endswith (".nbconvert.ipynb" )]
21- files .extend (glob .glob (os .path .join (path , ".." , ".." , "docs" , "*.md" )))
2220 if files :
2321 return files
2422 else :
@@ -42,30 +40,17 @@ def test_notebook(filepath, driver):
4240
4341
4442def get_notebook_html (filepath_notebook ):
45- """Store iframes from a notebook in html files, remove them when done."""
46- if filepath_notebook .endswith (".ipynb" ):
47- subprocess .run (
48- [
49- "jupyter" ,
50- "nbconvert" ,
51- "--to" ,
52- "notebook" ,
53- "--execute" ,
54- filepath_notebook ,
55- ]
56- )
57- filepath_notebook = filepath_notebook .replace (".ipynb" , ".nbconvert.ipynb" )
58- else :
59- subprocess .run (
60- [
61- "jupytext" ,
62- "--to" ,
63- "notebook" ,
64- "--execute" ,
65- filepath_notebook ,
66- ]
67- )
68- filepath_notebook = filepath_notebook .replace (".md" , ".ipynb" )
43+ """Convert markdown to notebook to html files, remove them when done."""
44+ subprocess .run (
45+ [
46+ "jupytext" ,
47+ "--to" ,
48+ "notebook" ,
49+ "--execute" ,
50+ filepath_notebook ,
51+ ]
52+ )
53+ filepath_notebook = filepath_notebook .replace (".md" , ".ipynb" )
6954
7055 html_exporter = nbconvert .HTMLExporter ()
7156 body , _ = html_exporter .from_filename (filepath_notebook )
0 commit comments