/
mkindex
executable file
·41 lines (32 loc) · 1.24 KB
/
mkindex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/python
import os,sys,os.path,glob,re,markdown
print markdown.markdown("""
Lecture Notes: Neural Computation and Self-Organization
-----------------------
This is the lecture note and slide archive for Neural Computation and Self-Organization course.
For the course pages themselves, please go to [ncso.iupr.com](http://ncso.iupr.com/).
[All the lecture notes are available in PDF Format](ncso.pdf). This is a single, large
PDF file that contains the content from the slides/worksheets, plus some additional
text.
Below are all the notebooks and corresponding slides from the lecture.
_Note that slides and notes will get updated throughout the class_
""")
print "<table>"
for nb in sorted(glob.glob("[0-9]*.ipynb")):
with open(nb) as stream: text = stream.read()
title = re.findall(r"Title:\s+([^\\\"]*)",text)
base,_ = os.path.splitext(nb)
if len(title)>0: title = title[0]
else:
title = base
title = re.sub('^\d+-','',title)
title = re.sub('[_-]+',' ',title)
print "<tr>"
print "<td>{}</td>".format(title)
print "<td><a href='{}'>notebook</a></td>".format(nb)
print "<td><a href='{}'>slides</a></td>".format(base+"-slides.pdf")
print "</td>"
print "</table>"
print """
</body>
"""