mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Allow giving values for dict type config values in the overrides.
This commit is contained in:
12
CHANGES
12
CHANGES
@@ -1,3 +1,15 @@
|
||||
Release 0.6 (in development)
|
||||
============================
|
||||
|
||||
New features added
|
||||
------------------
|
||||
|
||||
* Other changes:
|
||||
|
||||
- Allow giving config overrides for single dict keys on the command
|
||||
line.
|
||||
|
||||
|
||||
Release 0.5 (Nov 23, 2008) -- Birthday release!
|
||||
===============================================
|
||||
|
||||
|
||||
@@ -111,8 +111,12 @@ The :program:`sphinx-build` script has several more options:
|
||||
.. versionadded:: 0.5
|
||||
|
||||
**-D** *setting=value*
|
||||
Override a configuration value set in the :file:`conf.py` file. (The value
|
||||
must be a string value.)
|
||||
Override a configuration value set in the :file:`conf.py` file. The value
|
||||
must be a string or dictionary value. For the latter, supply the setting
|
||||
name and key like this: ``-D latex_elements.docclass=scrartcl``.
|
||||
|
||||
.. versionchanged:: 0.6
|
||||
The value can now be a dictionary value.
|
||||
|
||||
**-A** *name=value*
|
||||
Make the *name* assigned to *value* in the HTML templates.
|
||||
|
||||
@@ -111,6 +111,12 @@ class Config(object):
|
||||
|
||||
def init_values(self):
|
||||
config = self._raw_config
|
||||
for valname, value in self.overrides.iteritems():
|
||||
if '.' in valname:
|
||||
realvalname, key = valname.split('.', 1)
|
||||
config.setdefault(realvalname, {})[key] = value
|
||||
else:
|
||||
config[valname] = value
|
||||
config.update(self.overrides)
|
||||
for name in config:
|
||||
if name in self.values:
|
||||
|
||||
@@ -15,7 +15,8 @@ from util import *
|
||||
from sphinx.application import ExtensionError
|
||||
|
||||
|
||||
@with_app(confoverrides={'master_doc': 'master', 'nonexisting_value': 'True'})
|
||||
@with_app(confoverrides={'master_doc': 'master', 'nonexisting_value': 'True',
|
||||
'latex_elements.docclass': 'scrartcl'})
|
||||
def test_core_config(app):
|
||||
cfg = app.config
|
||||
|
||||
@@ -26,6 +27,7 @@ def test_core_config(app):
|
||||
|
||||
# overrides
|
||||
assert cfg.master_doc == 'master'
|
||||
assert cfg.latex_elements['docclass'] == 'scrartcl'
|
||||
|
||||
# simple default values
|
||||
assert 'exclude_dirs' not in cfg.__dict__
|
||||
|
||||
Reference in New Issue
Block a user