[Python-checkins] r66917 - in doctools/trunk: CHANGES doc/config.rst sphinx/config.py sphinx/environment.py sphinx/quickstart.py
georg.brandl
python-checkins at python.org
Thu Oct 16 21:21:07 CEST 2008
Author: georg.brandl
Date: Thu Oct 16 21:21:06 2008
New Revision: 66917
Log:
Add "source_encoding" config value.
Modified:
doctools/trunk/CHANGES
doctools/trunk/doc/config.rst
doctools/trunk/sphinx/config.py
doctools/trunk/sphinx/environment.py
doctools/trunk/sphinx/quickstart.py
Modified: doctools/trunk/CHANGES
==============================================================================
--- doctools/trunk/CHANGES (original)
+++ doctools/trunk/CHANGES Thu Oct 16 21:21:06 2008
@@ -55,6 +55,8 @@
- Added ``exclude_dirnames`` config value that can be used to exclude
e.g. CVS directories from source file search.
+ - Added ``source_encoding`` config value to select input encoding.
+
* Extensions:
- The new extensions ``sphinx.ext.jsmath`` and ``sphinx.ext.pngmath``
Modified: doctools/trunk/doc/config.rst
==============================================================================
--- doctools/trunk/doc/config.rst (original)
+++ doctools/trunk/doc/config.rst Thu Oct 16 21:21:06 2008
@@ -67,8 +67,16 @@
.. confval:: source_suffix
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
The document name of the "master" document, that is, the document that
Modified: doctools/trunk/sphinx/config.py
==============================================================================
--- doctools/trunk/sphinx/config.py (original)
+++ doctools/trunk/sphinx/config.py Thu Oct 16 21:21:06 2008
@@ -35,6 +35,7 @@
master_doc = ('contents', True),
source_suffix = ('.rst', True),
+ source_encoding = ('utf-8', True),
unused_docs = ([], True),
exclude_dirs = ([], True),
exclude_trees = ([], True),
Modified: doctools/trunk/sphinx/environment.py
==============================================================================
--- doctools/trunk/sphinx/environment.py (original)
+++ doctools/trunk/sphinx/environment.py Thu Oct 16 21:21:06 2008
@@ -496,9 +496,14 @@
return data
self.docname = docname
- doctree = publish_doctree(None, src_path, SphinxSourceClass,
- settings_overrides=self.settings,
- reader=SphinxStandaloneReader())
+ self.settings['input_encoding'] = self.config.source_encoding
+ try:
+ 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.process_dependencies(docname, doctree)
self.process_images(docname, doctree)
Modified: doctools/trunk/sphinx/quickstart.py
==============================================================================
--- doctools/trunk/sphinx/quickstart.py (original)
+++ doctools/trunk/sphinx/quickstart.py Thu Oct 16 21:21:06 2008
@@ -54,6 +54,9 @@
# The suffix of source filenames.
source_suffix = '%(suffix)s'
+# The encoding of source files.
+#source_encoding = 'utf-8'
+
# The master toctree document.
master_doc = '%(master)s'
More information about the Python-checkins
mailing list