@@ -30,7 +30,8 @@ def parse_java_source(path):
30
30
# This is dumb -- do we want to do better?
31
31
doc = {}
32
32
doc ['content' ] = '' .join (lines )
33
- doc ['title' ] = str (path )
33
+ title = str (path )
34
+ doc ['title' ] = title [title .find ("tutorials/" )+ len ("tutorials/" ):]
34
35
doc ['icon' ] = '/media/icons/imagej.png'
35
36
doc ['score' ] = 90
36
37
doc ['description' ] = ''
@@ -46,12 +47,12 @@ def parse_notebook(path):
46
47
47
48
doc = {}
48
49
doc ['content' ] = ''
49
- doc ['title' ] = str (path )
50
+ title = str (path )
51
+ doc ['title' ] = title [title .find ("tutorials/" )+ len ("tutorials/" ):]
50
52
doc ['icon' ] = '/media/icons/imagej.png'
51
53
doc ['score' ] = 90
52
54
doc ['description' ] = ''
53
55
for cell in data ['cells' ]:
54
- # TODO: implement process_cell: extract source and output(s) if present
55
56
doc ['content' ] += process_cell (cell )
56
57
57
58
return doc
@@ -97,7 +98,7 @@ def load_imagej_tutorials(root):
97
98
try :
98
99
doc = parse_java_source (javafile )
99
100
if doc :
100
- nbpath = str (javafile )[len (str (root )) + 1 :]
101
+ nbpath = str (javafile )[len (str (root )):]
101
102
doc ['id' ] = f'https://github.com/imagej/tutorials/blob/master/{ nbpath } '
102
103
documents .append (doc )
103
104
except :
@@ -109,7 +110,7 @@ def load_imagej_tutorials(root):
109
110
try :
110
111
doc = parse_notebook (nbfile )
111
112
if doc :
112
- nbpath = str (nbfile )[len (str (root )) + 1 :]
113
+ nbpath = str (nbfile )[len (str (root )):]
113
114
doc ['id' ] = f'https://github.com/imagej/tutorials/blob/master/{ nbpath } '
114
115
documents .append (doc )
115
116
except :
0 commit comments