|
1 | | -''' |
| 1 | +""" |
2 | 2 | Makes the necesary files to convert from plain html of |
3 | 3 | Python 1.5 and 1.5.x Documentation to |
4 | 4 | Microsoft HTML Help format version 1.1 |
|
13 | 13 | project, 19-Apr-2002 by Tim Peters. Assorted modifications by Tim |
14 | 14 | and Fred Drake. Obtained from Robin Dunn's .chm packaging of the |
15 | 15 | Python 2.2 docs, at <http://alldunn.com/python/>. |
16 | | -''' |
| 16 | +""" |
17 | 17 |
|
18 | 18 | import sys |
19 | 19 | import os |
|
38 | 38 | # user-visible features (visible buttons, tabs, etc). |
39 | 39 | project_template = ''' |
40 | 40 | [OPTIONS] |
41 | | -Compatibility=1.1 |
42 | 41 | Compiled file=%(arch)s.chm |
43 | 42 | Contents file=%(arch)s.hhc |
44 | 43 | Default Window=%(arch)s |
45 | 44 | Default topic=index.html |
46 | 45 | Display compile progress=No |
| 46 | +Full text search stop list file=%(arch)s.stp |
47 | 47 | Full-text search=Yes |
48 | 48 | Index file=%(arch)s.hhk |
49 | 49 | Language=0x409 |
|
80 | 80 | </OBJECT> |
81 | 81 | ''' |
82 | 82 |
|
| 83 | + |
| 84 | +# List of words the full text search facility shouldn't index. This |
| 85 | +# becomes file ARCH.stp. Note that this list must be pretty small! |
| 86 | +# Different versions of the MS docs claim the file has a maximum size of |
| 87 | +# 256 or 512 bytes (including \r\n at the end of each line). |
| 88 | +# Note that "and", "or", "not" and "near" are operators in the search |
| 89 | +# language, so not point indexing them even if wanted to. |
| 90 | +stop_list = ''' |
| 91 | +a an and |
| 92 | +is |
| 93 | +near |
| 94 | +not |
| 95 | +of |
| 96 | +or |
| 97 | +the |
| 98 | +''' |
| 99 | + |
83 | 100 | # Library Doc list of tuples: |
84 | 101 | # each 'book' : ( Dir, Title, First page, Content page, Index page) |
85 | 102 | # |
@@ -335,6 +352,15 @@ def do_it(args = None) : |
335 | 352 | library = supported_libraries[ version ] |
336 | 353 |
|
337 | 354 | if not (('-p','') in optlist) : |
| 355 | + fname = arch + '.stp' |
| 356 | + f = openfile(fname) |
| 357 | + print "Building stoplist", fname, "..." |
| 358 | + words = stop_list.split() |
| 359 | + words.sort() |
| 360 | + for word in words: |
| 361 | + print >> f, word |
| 362 | + f.close() |
| 363 | + |
338 | 364 | f = openfile(arch + '.hhp') |
339 | 365 | print "Building Project..." |
340 | 366 | do_project(library, f, arch, version) |
|
0 commit comments