Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e6b63e6

Browse files
committed
project_template: use dict interpolation instead of giant tuples.
1 parent a905363 commit e6b63e6

1 file changed

Lines changed: 13 additions & 14 deletions

File tree

Doc/tools/prechm.py

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@
2222
import string
2323
import getopt
2424

25-
26-
27-
# moved all the triple_quote up here because my syntax-coloring editor
28-
# sucks a little bit.
2925
usage_mode = '''
3026
Usage: make_chm.py [-c] [-k] [-p] [-v 1.5[.x]] filename
3127
-c: does not build filename.hhc (Table of Contents)
@@ -35,23 +31,27 @@
3531
(default is python 1.5.2 docs)
3632
'''
3733

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).
3939
project_template = '''
4040
[OPTIONS]
4141
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
4545
Default topic=index.html
4646
Display compile progress=No
4747
Full-text search=Yes
48-
Index file=%s.hhk
48+
Index file=%(arch)s.hhk
4949
Language=0x409
50-
Title=Python %s Documentation
50+
Title=Python %(version)s Documentation
5151
5252
[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
5555
5656
[FILES]
5757
'''
@@ -285,8 +285,7 @@ def do_content(library, version, output) :
285285

286286

287287
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())
290289
for book in library :
291290
for page in os.listdir(book[0]) :
292291
if page[string.rfind(page, '.'):] == '.html' or \

0 commit comments

Comments
 (0)