Skip to content

Commit 9b4660f

Browse files
authored
Merge pull request #2753 from gabyx/master
added path to the resources metadata, the same as in from_filename(...) in nbconvert.exporters.py
2 parents de09c12 + 447d79f commit 9b4660f

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

notebook/nbconvert/handlers.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,13 @@ def get(self, format, path):
8383
exporter = get_exporter(format, config=self.config, log=self.log)
8484

8585
path = path.strip('/')
86+
# If the notebook relates to a real file (default contents manager),
87+
# give its path to nbconvert.
88+
if hasattr(self.contents_manager, '_get_os_path'):
89+
os_path = self.contents_manager._get_os_path(path)
90+
else:
91+
os_path = ''
92+
8693
model = self.contents_manager.get(path=path)
8794
name = model['name']
8895
if model['type'] != 'notebook':
@@ -98,7 +105,8 @@ def get(self, format, path):
98105
"metadata": {
99106
"name": name[:name.rfind('.')],
100107
"modified_date": (model['last_modified']
101-
.strftime(text.date_format))
108+
.strftime(text.date_format)),
109+
"path" : os_path
102110
},
103111
"config_dir": self.application.settings['config_dir'],
104112
}

0 commit comments

Comments
 (0)