#116: Added `html_output_encoding` config value.

This commit is contained in:
Georg Brandl 2009-06-16 22:19:51 +02:00
parent 0ed845462f
commit 041d7c37a5
6 changed files with 16 additions and 4 deletions

View File

@ -1,7 +1,9 @@
Release 1.0 (in development)
============================
* Add ``latexpdf`` target in quickstart Makefile.
* Added ``html_output_encoding`` config value.
* Added ``latexpdf`` target in quickstart Makefile.
* #200: Added ``Sphinx.add_stylesheet()``.

View File

@ -536,6 +536,14 @@ that use Sphinx' HTMLWriter class.
.. versionadded:: 0.4
.. confval:: html_output_encoding
Encoding of HTML output files. Default is ``'utf-8'``. Note that this
encoding name must both be a valid Python encoding name and a valid HTML
``charset`` value.
.. versionadded:: 1.0
.. confval:: htmlhelp_basename
Output file base name for HTML help builder. Default is ``'pydoc'``.

View File

@ -665,6 +665,7 @@ class StandaloneHTMLBuilder(Builder):
ctx['pathto'] = pathto
ctx['hasdoc'] = lambda name: name in self.env.all_docs
ctx['customsidebar'] = self.config.html_sidebars.get(pagename)
ctx['encoding'] = encoding = self.config.html_output_encoding
ctx['toctree'] = lambda **kw: self._get_local_toctree(pagename, **kw)
ctx.update(addctx)
@ -677,7 +678,7 @@ class StandaloneHTMLBuilder(Builder):
# outfilename's path is in general different from self.outdir
ensuredir(path.dirname(outfilename))
try:
f = codecs.open(outfilename, 'w', 'utf-8')
f = codecs.open(outfilename, 'w', encoding)
try:
f.write(output)
finally:

View File

@ -86,6 +86,7 @@ class Config(object):
html_show_copyright = (True, 'html'),
html_show_sphinx = (True, 'html'),
html_context = ({}, 'html'),
html_output_encoding = ('utf-8', 'html'),
# HTML help only options
htmlhelp_basename = (lambda self: make_filename(self.project), None),

View File

@ -56,7 +56,7 @@ templates_path = ['%(dot)stemplates']
source_suffix = '%(suffix)s'
# The encoding of source files.
#source_encoding = 'utf-8'
#source_encoding = 'utf-8-sig'
# The master toctree document.
master_doc = '%(master_str)s'

View File

@ -91,7 +91,7 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset={{ encoding }}" />
{{ metatags }}
{%- if not embedded %}
{%- set titlesuffix = " &mdash; "|safe + docstitle|e %}