mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Add "source_encoding" config value.
This commit is contained in:
parent
918fbecb12
commit
516d1a2872
2
CHANGES
2
CHANGES
@ -55,6 +55,8 @@ New features added
|
|||||||
- Added ``exclude_dirnames`` config value that can be used to exclude
|
- Added ``exclude_dirnames`` config value that can be used to exclude
|
||||||
e.g. CVS directories from source file search.
|
e.g. CVS directories from source file search.
|
||||||
|
|
||||||
|
- Added ``source_encoding`` config value to select input encoding.
|
||||||
|
|
||||||
* Extensions:
|
* Extensions:
|
||||||
|
|
||||||
- The new extensions ``sphinx.ext.jsmath`` and ``sphinx.ext.pngmath``
|
- The new extensions ``sphinx.ext.jsmath`` and ``sphinx.ext.pngmath``
|
||||||
|
@ -67,8 +67,16 @@ General configuration
|
|||||||
.. confval:: source_suffix
|
.. confval:: source_suffix
|
||||||
|
|
||||||
The file name extension of source files. Only files with this suffix will be
|
The file name extension of source files. Only files with this suffix will be
|
||||||
read as sources. Default is ``.rst``.
|
read as sources. Default is ``'.rst'``.
|
||||||
|
|
||||||
|
.. confval:: source_encoding
|
||||||
|
|
||||||
|
The encoding of all reST source files. The recommended encoding, and the
|
||||||
|
default value, is ``'utf-8'``.
|
||||||
|
|
||||||
|
.. versionadded:: 0.5
|
||||||
|
Previously, Sphinx accepted only UTF-8 encoded sources.
|
||||||
|
|
||||||
.. confval:: master_doc
|
.. confval:: master_doc
|
||||||
|
|
||||||
The document name of the "master" document, that is, the document that
|
The document name of the "master" document, that is, the document that
|
||||||
|
@ -35,6 +35,7 @@ class Config(object):
|
|||||||
|
|
||||||
master_doc = ('contents', True),
|
master_doc = ('contents', True),
|
||||||
source_suffix = ('.rst', True),
|
source_suffix = ('.rst', True),
|
||||||
|
source_encoding = ('utf-8', True),
|
||||||
unused_docs = ([], True),
|
unused_docs = ([], True),
|
||||||
exclude_dirs = ([], True),
|
exclude_dirs = ([], True),
|
||||||
exclude_trees = ([], True),
|
exclude_trees = ([], True),
|
||||||
|
@ -496,9 +496,14 @@ class BuildEnvironment:
|
|||||||
return data
|
return data
|
||||||
|
|
||||||
self.docname = docname
|
self.docname = docname
|
||||||
doctree = publish_doctree(None, src_path, SphinxSourceClass,
|
self.settings['input_encoding'] = self.config.source_encoding
|
||||||
settings_overrides=self.settings,
|
try:
|
||||||
reader=SphinxStandaloneReader())
|
doctree = publish_doctree(None, src_path, SphinxSourceClass,
|
||||||
|
settings_overrides=self.settings,
|
||||||
|
reader=SphinxStandaloneReader())
|
||||||
|
except UnicodeError, err:
|
||||||
|
from sphinx.application import SphinxError
|
||||||
|
raise SphinxError(err.message)
|
||||||
self.filter_messages(doctree)
|
self.filter_messages(doctree)
|
||||||
self.process_dependencies(docname, doctree)
|
self.process_dependencies(docname, doctree)
|
||||||
self.process_images(docname, doctree)
|
self.process_images(docname, doctree)
|
||||||
|
@ -54,6 +54,9 @@ templates_path = ['%(dot)stemplates']
|
|||||||
# The suffix of source filenames.
|
# The suffix of source filenames.
|
||||||
source_suffix = '%(suffix)s'
|
source_suffix = '%(suffix)s'
|
||||||
|
|
||||||
|
# The encoding of source files.
|
||||||
|
#source_encoding = 'utf-8'
|
||||||
|
|
||||||
# The master toctree document.
|
# The master toctree document.
|
||||||
master_doc = '%(master)s'
|
master_doc = '%(master)s'
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user