summaryrefslogtreecommitdiff
path: root/sphinx/htmlhelp.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2008-11-22 15:28:09 +0100
committerGeorg Brandl <georg@python.org>2008-11-22 15:28:09 +0100
commite8cfdda7a227924ee326523cbcb165e7a6050be8 (patch)
treed6ea850fe7e70f928d74553f9f837814d6bd1ad6 /sphinx/htmlhelp.py
parentc8e08821fdb04a15964898bbc355d7d6ab309a81 (diff)
downloadsphinx-git-e8cfdda7a227924ee326523cbcb165e7a6050be8.tar.gz
Fix three problems in HTML help index generation.
Patch from Hirokazu Yamamoto (see bugs.python.org/4252), fixes #44.
Diffstat (limited to 'sphinx/htmlhelp.py')
-rw-r--r--sphinx/htmlhelp.py20
1 files changed, 15 insertions, 5 deletions
diff --git a/sphinx/htmlhelp.py b/sphinx/htmlhelp.py
index 33dbd9ff5..4cc68bc95 100644
--- a/sphinx/htmlhelp.py
+++ b/sphinx/htmlhelp.py
@@ -55,6 +55,7 @@ from sphinx import addnodes
project_template = '''\
[OPTIONS]
Binary TOC=Yes
+Binary Index=No
Compiled file=%(outname)s.chm
Contents file=%(outname)s.hhc
Default Window=%(outname)s
@@ -191,12 +192,21 @@ def build_hhx(builder, outdir, outname):
try:
f.write('<UL>\n')
def write_index(title, refs, subitems):
- if refs:
- f.write('<LI> ')
- item = object_sitemap % (cgi.escape(title), refs[0])
+ def write_param(name, value):
+ item = ' <param name="%s" value="%s">\n' % (name, value)
f.write(item.encode('ascii', 'xmlcharrefreplace'))
- for ref in refs[1:]:
- f.write(object_sitemap % ('[Link]', ref))
+ title = cgi.escape(title)
+ f.write('<LI> <OBJECT type="text/sitemap">\n')
+ write_param('Keyword', title)
+ if len(refs) == 0:
+ write_param('See Also', title)
+ elif len(refs) == 1:
+ write_param('Local', refs[0])
+ else:
+ for i, ref in enumerate(refs):
+ write_param('Name', '[%d] %s' % (i, ref)) # XXX: better title?
+ write_param('Local', ref)
+ f.write('</OBJECT>\n')
if subitems:
f.write('<UL> ')
for subitem in subitems: