Skip to content

Commit 63762ea

Browse files
committed
Adapt post save hook to changed dir structure
1 parent c79d1ee commit 63762ea

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

utils/post_save_hook.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"<script>\n", " function toggle() {\n",
3030
" show ? $('div.output').hide('200') : $('div.output').show('200')\n",
3131
" show = !show\n", " }\n", "\n",
32-
" $( document ).ready(function(){\n", " show=false;\n",
32+
" $( document ).ready(function(){\n", "show=false;\n",
3333
" $('div.output').hide()\n", " });\n", "</script>\n", "\n",
3434
"<form action=\"javascript:toggle()\" style=\"text-align:center;\">\n",
3535
" <input type=\"submit\" id=\"toggleButton\" value=\"Toggle output 🐍\" \n",
@@ -67,7 +67,7 @@ def post_save(model, os_path, contents_manager):
6767
source = tmp_name
6868

6969
if SAVE_PY:
70-
out_dir_py = os.path.join(dir_, 'py')
70+
out_dir_py = os.path.join(os.path.dirname(dir_), 'py')
7171
os.makedirs(out_dir_py, exist_ok=True)
7272
cmd = 'jupyter nbconvert --to python --output-dir {} --output {}.py {}'.format(
7373
out_dir_py, out_file_base, source)
@@ -83,7 +83,7 @@ def post_save(model, os_path, contents_manager):
8383
tmp_source.write(json.dumps(content))
8484
tmp_source.truncate()
8585

86-
out_dir_html = os.path.join(dir_, 'html')
86+
out_dir_html = os.path.join(os.path.dirname(dir_), 'html')
8787
os.makedirs(out_dir_html, exist_ok=True)
8888
cmd = 'jupyter nbconvert --to html --output-dir {} --output {}.html {}'.format(
8989
out_dir_html, out_file_base, source)
@@ -94,5 +94,4 @@ def post_save(model, os_path, contents_manager):
9494
if os.path.exists(tmp_file):
9595
os.remove(tmp_file)
9696

97-
9897
c.FileContentsManager.post_save_hook = post_save

0 commit comments

Comments
 (0)