Skip to content

Commit 3f1441f

Browse files
committed
Update sphinx-build --define with nested values
* Remove the mention to "dictionary value" * Mention that "None" will be treated as a string * Minor change in paragraphs order (complex cases at the end) * Examples for list/dict * Note about limited nested values/keys and how to deal with that * Update an old versionchanged Fix: #14539
1 parent c1b618c commit 3f1441f

1 file changed

Lines changed: 21 additions & 7 deletions

File tree

doc/man/sphinx-build.rst

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -168,19 +168,33 @@ Options
168168

169169
.. option:: -D setting=value, --define setting=value
170170

171-
Override a configuration value set in the :file:`conf.py` file. The value
172-
must be a number, string, list or dictionary value.
171+
Override a configuration value set in the :file:`conf.py` file. The
172+
``value`` must be a number, a string or a list. The literal value ``None``
173+
is treated as the string ``"None"``.
173174

174-
For lists, you can separate elements with a comma like this: ``-D
175-
html_theme_path=path1,path2``.
175+
For boolean values, use ``0`` or ``1`` as the value.
176+
177+
For lists, you can separate elements with a comma like this:
178+
``-D html_theme_path=path1,path2``. This is equivalent to:
179+
180+
.. code-block:: python
181+
182+
html_theme_path = ["path1", "path2"]
176183
177184
For dictionary values, supply the setting name and key like this:
178-
``-D latex_elements.docclass=scrartcl``.
185+
``-D latex_elements.docclass=scrartcl``. This is equivalent to:
179186

180-
For boolean values, use ``0`` or ``1`` as the value.
187+
.. code-block:: python
188+
189+
latex_elements = {"docclass": "scrartcl"}
190+
191+
.. note::
192+
193+
``--define`` can override only top-level dictionary entries and cannot
194+
construct nested list or dictionary values.
181195

182196
.. versionchanged:: 0.6
183-
The value can now be a dictionary value.
197+
Individual dictionary entries can now be overridden.
184198

185199
.. versionchanged:: 1.3
186200
The value can now also be a list value.

0 commit comments

Comments
 (0)