@@ -206,7 +206,7 @@ def apply(self):
206
206
# Write certain cell outputs (e.g. images) to separate files, and
207
207
# modify the metadata of the associated cells in 'notebook' to
208
208
# include the path to the output file.
209
- write_notebook_output (notebook , output_dir , file_name )
209
+ write_notebook_output (notebook , output_dir , file_name , self . env . docname )
210
210
211
211
try :
212
212
cm_language = notebook .metadata .language_info .codemirror_mode .name
@@ -239,7 +239,7 @@ def execute_cells(kernel_name, cells, execute_kwargs):
239
239
return notebook
240
240
241
241
242
- def write_notebook_output (notebook , output_dir , notebook_name ):
242
+ def write_notebook_output (notebook , output_dir , notebook_name , location = None ):
243
243
"""Extract output from notebook cells and write to files in output_dir.
244
244
245
245
This also modifies 'notebook' in-place, adding metadata to each cell that
@@ -263,8 +263,7 @@ def write_notebook_output(notebook, output_dir, notebook_name):
263
263
ext = ".txt"
264
264
js .logger .warning (
265
265
"Notebook code has no file extension metadata, " "defaulting to `.txt`" ,
266
- # TODO correct location
267
- # location=document.settings.env.docname,
266
+ location = location ,
268
267
)
269
268
contents = "\n \n " .join (cell .source for cell in notebook .cells )
270
269
with open (os .path .join (output_dir , notebook_name + ext ), "w" ,
0 commit comments