#232: Support non-ASCII metadata in Qt help builder.

This commit is contained in:
Georg Brandl 2009-08-06 21:13:23 +02:00
parent 3d062aa042
commit b242c6b47c
2 changed files with 7 additions and 4 deletions

View File

@ -1,6 +1,8 @@
Release 0.6.3 (in development) Release 0.6.3 (in development)
============================== ==============================
* #232: Support non-ASCII metadata in Qt help builder.
* Properly format bullet lists nested in definition lists for LaTeX. * Properly format bullet lists nested in definition lists for LaTeX.
* Section titles are now allowed inside ``only`` directives. * Section titles are now allowed inside ``only`` directives.

View File

@ -12,6 +12,7 @@
import os import os
import re import re
import cgi import cgi
import codecs
from os import path from os import path
from docutils import nodes from docutils import nodes
@ -28,7 +29,7 @@ _idpattern = re.compile(
# It contains references to compressed help files which should be # It contains references to compressed help files which should be
# included in the collection. # included in the collection.
# It may contain various other information for customizing Qt Assistant. # It may contain various other information for customizing Qt Assistant.
collection_template = '''\ collection_template = u'''\
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<QHelpCollectionProject version="1.0"> <QHelpCollectionProject version="1.0">
<docFiles> <docFiles>
@ -50,7 +51,7 @@ collection_template = '''\
# It contains the table of contents, indices and references to the # It contains the table of contents, indices and references to the
# actual documentation files (*.html). # actual documentation files (*.html).
# In addition it defines a unique namespace for the documentation. # In addition it defines a unique namespace for the documentation.
project_template = '''\ project_template = u'''\
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<QtHelpProject version="1.0"> <QtHelpProject version="1.0">
<namespace>%(outname)s.org.%(outname)s.%(nversion)s</namespace> <namespace>%(outname)s.org.%(outname)s.%(nversion)s</namespace>
@ -109,7 +110,7 @@ class QtHelpBuilder(StandaloneHTMLBuilder):
def build_qhcp(self, outdir, outname): def build_qhcp(self, outdir, outname):
self.info('writing collection project file...') self.info('writing collection project file...')
f = open(path.join(outdir, outname+'.qhcp'), 'w') f = codecs.open(path.join(outdir, outname+'.qhcp'), 'w', 'utf-8')
try: try:
f.write(collection_template % {'outname': outname}) f.write(collection_template % {'outname': outname})
finally: finally:
@ -161,7 +162,7 @@ class QtHelpBuilder(StandaloneHTMLBuilder):
projectfiles = '\n'.join(projectfiles) projectfiles = '\n'.join(projectfiles)
# write the project file # write the project file
f = open(path.join(outdir, outname+'.qhp'), 'w') f = codecs.open(path.join(outdir, outname+'.qhp'), 'w', 'utf-8')
try: try:
nversion = self.config.version.replace('.', '_') nversion = self.config.version.replace('.', '_')
nversion = nversion.replace(' ', '_') nversion = nversion.replace(' ', '_')