|
22 | 22 | import string |
23 | 23 | import getopt |
24 | 24 |
|
25 | | - |
26 | | - |
27 | | -# moved all the triple_quote up here because my syntax-coloring editor |
28 | | -# sucks a little bit. |
29 | 25 | usage_mode = ''' |
30 | 26 | Usage: make_chm.py [-c] [-k] [-p] [-v 1.5[.x]] filename |
31 | 27 | -c: does not build filename.hhc (Table of Contents) |
|
35 | 31 | (default is python 1.5.2 docs) |
36 | 32 | ''' |
37 | 33 |
|
38 | | -# project file (*.hhp) template. there are seven %s |
| 34 | +# Project file (*.hhp) template. 'arch' is the file basename (like |
| 35 | +# the pythlp in pythlp.hhp); 'version' is the doc version number (like |
| 36 | +# the 2.2 in Python 2.2). |
| 37 | +# The magical numbers in the long line under [WINDOWS] set most of the |
| 38 | +# user-visible features (visible buttons, tabs, etc). |
39 | 39 | project_template = ''' |
40 | 40 | [OPTIONS] |
41 | 41 | Compatibility=1.1 |
42 | | -Compiled file=%s.chm |
43 | | -Contents file=%s.hhc |
44 | | -Default Window=%s |
| 42 | +Compiled file=%(arch)s.chm |
| 43 | +Contents file=%(arch)s.hhc |
| 44 | +Default Window=%(arch)s |
45 | 45 | Default topic=index.html |
46 | 46 | Display compile progress=No |
47 | 47 | Full-text search=Yes |
48 | | -Index file=%s.hhk |
| 48 | +Index file=%(arch)s.hhk |
49 | 49 | Language=0x409 |
50 | | -Title=Python %s Documentation |
| 50 | +Title=Python %(version)s Documentation |
51 | 51 |
|
52 | 52 | [WINDOWS] |
53 | | -%s="Python %s Documentation","%s.hhc","%s.hhk","index.html","index.html",\ |
54 | | -,,,,0x63520,220,0x384e,[271,372,740,718],,,,,,,0 |
| 53 | +%(arch)s="Python %(version)s Documentation","%(arch)s.hhc","%(arch)s.hhk",\ |
| 54 | +"index.html","index.html",,,,,0x63520,220,0x384e,[271,372,740,718],,,,,,,0 |
55 | 55 |
|
56 | 56 | [FILES] |
57 | 57 | ''' |
@@ -285,8 +285,7 @@ def do_content(library, version, output) : |
285 | 285 |
|
286 | 286 |
|
287 | 287 | def do_project( library, output, arch, version) : |
288 | | - output.write( project_template % \ |
289 | | - (arch, arch, arch, arch, version, arch, version, arch, arch) ) |
| 288 | + output.write(project_template % locals()) |
290 | 289 | for book in library : |
291 | 290 | for page in os.listdir(book[0]) : |
292 | 291 | if page[string.rfind(page, '.'):] == '.html' or \ |
|
0 commit comments