88
99PAGEFILE = """title:{title}
1010slug:{slug}
11- Template: page
11+ Template: {template}
1212
1313{{% notebook notebooks/{notebook_file} cells[{cells}] %}}
1414"""
@@ -38,7 +38,7 @@ def copy_notebooks():
3838shutil .copytree (figsource , figdest )
3939
4040figurelist = os .listdir (abspath_from_here ('content' , 'figures' ))
41- figure_map = {os .path .join ('figures' , fig ) : os .path .join ('/figures' , fig )
41+ figure_map = {os .path .join ('figures' , fig ) : os .path .join ('/PythonDataScienceHandbook/ figures' , fig )
4242for fig in figurelist }
4343
4444for nb in nblist :
@@ -50,16 +50,20 @@ def copy_notebooks():
5050
5151if nb == 'Index.ipynb' :
5252cells = '1:'
53+ template = 'page'
5354title = 'Python Data Science Handbook'
5455else :
5556cells = '2:'
56- # put nav below title
57+ template = 'booksection'
5758title = content .cells [2 ].source
5859if not title .startswith ('#' ) or len (title .splitlines ()) > 1 :
5960raise ValueError ('title not found in third cell' )
6061title = title .lstrip ('#' ).strip ()
61- content .cells [1 ], content .cells [2 ] = content .cells [2 ], content .cells [1 ]
6262
63+ # put nav below title
64+ content .cells [0 ], content .cells [1 ], content .cells [2 ] = content .cells [2 ], content .cells [0 ], content .cells [1 ]
65+
66+ # Replace internal URLs and figure links in notebook
6367for cell in content .cells :
6468if cell .cell_type == 'markdown' :
6569for nbname , htmlname in name_map .items ():
@@ -76,6 +80,7 @@ def copy_notebooks():
7680f .write (PAGEFILE .format (title = title ,
7781slug = base .lower (),
7882notebook_file = nb ,
83+ template = template ,
7984cells = cells ))
8085
8186if __name__ == '__main__' :
0 commit comments