@@ -30,7 +30,8 @@ def parse_java_source(path):
3030 # This is dumb -- do we want to do better?
3131 doc = {}
3232 doc ['content' ] = '' .join (lines )
33- doc ['title' ] = str (path )
33+ title = str (path )
34+ doc ['title' ] = title [title .find ("tutorials/" )+ len ("tutorials/" ):]
3435 doc ['icon' ] = '/media/icons/imagej.png'
3536 doc ['score' ] = 90
3637 doc ['description' ] = ''
@@ -46,12 +47,12 @@ def parse_notebook(path):
4647
4748 doc = {}
4849 doc ['content' ] = ''
49- doc ['title' ] = str (path )
50+ title = str (path )
51+ doc ['title' ] = title [title .find ("tutorials/" )+ len ("tutorials/" ):]
5052 doc ['icon' ] = '/media/icons/imagej.png'
5153 doc ['score' ] = 90
5254 doc ['description' ] = ''
5355 for cell in data ['cells' ]:
54- # TODO: implement process_cell: extract source and output(s) if present
5556 doc ['content' ] += process_cell (cell )
5657
5758 return doc
@@ -97,7 +98,7 @@ def load_imagej_tutorials(root):
9798 try :
9899 doc = parse_java_source (javafile )
99100 if doc :
100- nbpath = str (javafile )[len (str (root )) + 1 :]
101+ nbpath = str (javafile )[len (str (root )):]
101102 doc ['id' ] = f'https://github.com/imagej/tutorials/blob/master/{ nbpath } '
102103 documents .append (doc )
103104 except :
@@ -109,7 +110,7 @@ def load_imagej_tutorials(root):
109110 try :
110111 doc = parse_notebook (nbfile )
111112 if doc :
112- nbpath = str (nbfile )[len (str (root )) + 1 :]
113+ nbpath = str (nbfile )[len (str (root )):]
113114 doc ['id' ] = f'https://github.com/imagej/tutorials/blob/master/{ nbpath } '
114115 documents .append (doc )
115116 except :
0 commit comments