OLD | NEW |
| (Empty) |
1 # Copyright (c) 2001-2004 Twisted Matrix Laboratories. | |
2 # See LICENSE for details. | |
3 | |
4 | |
5 def getNumber(filename): | |
6 return None | |
7 | |
8 def getReference(filename): | |
9 return None | |
10 | |
11 class Book: | |
12 | |
13 def __init__(self, filename): | |
14 self.chapters = [] | |
15 self.indexFilename = None | |
16 | |
17 global Chapter | |
18 Chapter = self.Chapter | |
19 global getNumber | |
20 getNumber = self.getNumber | |
21 global getReference | |
22 getReference = self.getNumber | |
23 global Index | |
24 Index = self.Index | |
25 | |
26 if filename: | |
27 execfile(filename) | |
28 | |
29 def getFiles(self): | |
30 return [c[0] for c in self.chapters] | |
31 | |
32 def getNumber(self, filename): | |
33 for c in self.chapters: | |
34 if c[0] == filename: | |
35 return c[1] | |
36 return None | |
37 | |
38 def getIndexFilename(self): | |
39 return self.indexFilename | |
40 | |
41 def Chapter(self, filename, number): | |
42 self.chapters.append((filename, number)) | |
43 | |
44 def Index(self, filename): | |
45 self.indexFilename = filename | |
46 | |
47 #_book = Book(None) | |
OLD | NEW |