@@ -206,7 +206,7 @@ def apply(self):
206206 # Write certain cell outputs (e.g. images) to separate files, and
207207 # modify the metadata of the associated cells in 'notebook' to
208208 # 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 )
210210
211211 try :
212212 cm_language = notebook .metadata .language_info .codemirror_mode .name
@@ -239,7 +239,7 @@ def execute_cells(kernel_name, cells, execute_kwargs):
239239 return notebook
240240
241241
242- def write_notebook_output (notebook , output_dir , notebook_name ):
242+ def write_notebook_output (notebook , output_dir , notebook_name , location = None ):
243243 """Extract output from notebook cells and write to files in output_dir.
244244
245245 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):
263263 ext = ".txt"
264264 js .logger .warning (
265265 "Notebook code has no file extension metadata, " "defaulting to `.txt`" ,
266- # TODO correct location
267- # location=document.settings.env.docname,
266+ location = location ,
268267 )
269268 contents = "\n \n " .join (cell .source for cell in notebook .cells )
270269 with open (os .path .join (output_dir , notebook_name + ext ), "w" ,
0 commit comments