29
29
"<script>\n " , " function toggle() {\n " ,
30
30
" show ? $('div.output').hide('200') : $('div.output').show('200')\n " ,
31
31
" show = !show\n " , " }\n " , "\n " ,
32
- " $( document ).ready(function(){\n " , " show=false;\n " ,
32
+ " $( document ).ready(function(){\n " , "show=false;\n " ,
33
33
" $('div.output').hide()\n " , " });\n " , "</script>\n " , "\n " ,
34
34
"<form action=\" javascript:toggle()\" style=\" text-align:center;\" >\n " ,
35
35
" <input type=\" submit\" id=\" toggleButton\" value=\" Toggle output 🐍\" \n " ,
@@ -67,7 +67,7 @@ def post_save(model, os_path, contents_manager):
67
67
source = tmp_name
68
68
69
69
if SAVE_PY :
70
- out_dir_py = os .path .join (dir_ , 'py' )
70
+ out_dir_py = os .path .join (os . path . dirname ( dir_ ) , 'py' )
71
71
os .makedirs (out_dir_py , exist_ok = True )
72
72
cmd = 'jupyter nbconvert --to python --output-dir {} --output {}.py {}' .format (
73
73
out_dir_py , out_file_base , source )
@@ -83,7 +83,7 @@ def post_save(model, os_path, contents_manager):
83
83
tmp_source .write (json .dumps (content ))
84
84
tmp_source .truncate ()
85
85
86
- out_dir_html = os .path .join (dir_ , 'html' )
86
+ out_dir_html = os .path .join (os . path . dirname ( dir_ ) , 'html' )
87
87
os .makedirs (out_dir_html , exist_ok = True )
88
88
cmd = 'jupyter nbconvert --to html --output-dir {} --output {}.html {}' .format (
89
89
out_dir_html , out_file_base , source )
@@ -94,5 +94,4 @@ def post_save(model, os_path, contents_manager):
94
94
if os .path .exists (tmp_file ):
95
95
os .remove (tmp_file )
96
96
97
-
98
97
c .FileContentsManager .post_save_hook = post_save
0 commit comments