mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
#116: Added `html_output_encoding
` config value.
This commit is contained in:
parent
0ed845462f
commit
041d7c37a5
4
CHANGES
4
CHANGES
@ -1,7 +1,9 @@
|
|||||||
Release 1.0 (in development)
|
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()``.
|
* #200: Added ``Sphinx.add_stylesheet()``.
|
||||||
|
|
||||||
|
@ -536,6 +536,14 @@ that use Sphinx' HTMLWriter class.
|
|||||||
|
|
||||||
.. versionadded:: 0.4
|
.. 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
|
.. confval:: htmlhelp_basename
|
||||||
|
|
||||||
Output file base name for HTML help builder. Default is ``'pydoc'``.
|
Output file base name for HTML help builder. Default is ``'pydoc'``.
|
||||||
|
@ -665,6 +665,7 @@ class StandaloneHTMLBuilder(Builder):
|
|||||||
ctx['pathto'] = pathto
|
ctx['pathto'] = pathto
|
||||||
ctx['hasdoc'] = lambda name: name in self.env.all_docs
|
ctx['hasdoc'] = lambda name: name in self.env.all_docs
|
||||||
ctx['customsidebar'] = self.config.html_sidebars.get(pagename)
|
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['toctree'] = lambda **kw: self._get_local_toctree(pagename, **kw)
|
||||||
ctx.update(addctx)
|
ctx.update(addctx)
|
||||||
|
|
||||||
@ -677,7 +678,7 @@ class StandaloneHTMLBuilder(Builder):
|
|||||||
# outfilename's path is in general different from self.outdir
|
# outfilename's path is in general different from self.outdir
|
||||||
ensuredir(path.dirname(outfilename))
|
ensuredir(path.dirname(outfilename))
|
||||||
try:
|
try:
|
||||||
f = codecs.open(outfilename, 'w', 'utf-8')
|
f = codecs.open(outfilename, 'w', encoding)
|
||||||
try:
|
try:
|
||||||
f.write(output)
|
f.write(output)
|
||||||
finally:
|
finally:
|
||||||
|
@ -86,6 +86,7 @@ class Config(object):
|
|||||||
html_show_copyright = (True, 'html'),
|
html_show_copyright = (True, 'html'),
|
||||||
html_show_sphinx = (True, 'html'),
|
html_show_sphinx = (True, 'html'),
|
||||||
html_context = ({}, 'html'),
|
html_context = ({}, 'html'),
|
||||||
|
html_output_encoding = ('utf-8', 'html'),
|
||||||
|
|
||||||
# HTML help only options
|
# HTML help only options
|
||||||
htmlhelp_basename = (lambda self: make_filename(self.project), None),
|
htmlhelp_basename = (lambda self: make_filename(self.project), None),
|
||||||
|
@ -56,7 +56,7 @@ templates_path = ['%(dot)stemplates']
|
|||||||
source_suffix = '%(suffix)s'
|
source_suffix = '%(suffix)s'
|
||||||
|
|
||||||
# The encoding of source files.
|
# The encoding of source files.
|
||||||
#source_encoding = 'utf-8'
|
#source_encoding = 'utf-8-sig'
|
||||||
|
|
||||||
# The master toctree document.
|
# The master toctree document.
|
||||||
master_doc = '%(master_str)s'
|
master_doc = '%(master_str)s'
|
||||||
|
@ -91,7 +91,7 @@
|
|||||||
|
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
<meta http-equiv="Content-Type" content="text/html; charset={{ encoding }}" />
|
||||||
{{ metatags }}
|
{{ metatags }}
|
||||||
{%- if not embedded %}
|
{%- if not embedded %}
|
||||||
{%- set titlesuffix = " — "|safe + docstitle|e %}
|
{%- set titlesuffix = " — "|safe + docstitle|e %}
|
||||||
|
Loading…
Reference in New Issue
Block a user