Skip to content

Commit cfc787b

Browse files
Make open_notebooks auto-generate the notebooks on demand
1 parent 1306fb0 commit cfc787b

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/SciMLTutorials.jl

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ cssfile = joinpath(@__DIR__, "..", "templates", "skeleton_css.css")
77
latexfile = joinpath(@__DIR__, "..", "templates", "julia_tex.tpl")
88

99
function weave_file(folder,file,build_list=(:script,:html,:pdf,:github,:notebook))
10-
target = joinpath(folder, file)
10+
target = joinpath(repo_directory, "tutorials", folder, file)
1111
@info("Weaving $(target)")
1212

13-
if isfile(joinpath(folder, "Project.toml"))
13+
if isfile(joinpath(repo_directory, folder, "Project.toml"))
1414
@info("Instantiating", folder)
1515
Pkg.activate(folder)
1616
Pkg.instantiate()
@@ -54,22 +54,22 @@ function weave_file(folder,file,build_list=(:script,:html,:pdf,:github,:notebook
5454
end
5555
end
5656

57-
function weave_all()
57+
function weave_all(build_list=(:script,:html,:pdf,:github,:notebook))
5858
for folder in readdir(joinpath(repo_directory,"tutorials"))
5959
folder == "test.jmd" && continue
60-
weave_folder(folder)
60+
weave_folder(folder,build_list)
6161
end
6262
end
6363

64-
function weave_folder(folder)
65-
for file in readdir(folder)
64+
function weave_folder(folder,build_list=(:script,:html,:pdf,:github,:notebook))
65+
for file in readdir(joinpath(repo_directory,"tutorials",folder))
6666
# Skip non-`.jmd` files
6767
if !endswith(file, ".jmd")
6868
continue
6969
end
7070

7171
try
72-
weave_file(folder,file)
72+
weave_file(folder,file,build_list)
7373
catch e
7474
@error(e)
7575
end
@@ -124,6 +124,7 @@ end
124124

125125
function open_notebooks()
126126
Base.eval(Main, Meta.parse("import IJulia"))
127+
weave_all((:notebook,))
127128
path = joinpath(repo_directory,"notebook")
128129
IJulia.notebook(;dir=path)
129130
end

0 commit comments

Comments
 (0)