| 1 |
.. highlight:: rst |
| 2 |
|
| 3 |
=================== |
| 4 |
The Standard Domain |
| 5 |
=================== |
| 6 |
|
| 7 |
.. versionadded:: 1.0 |
| 8 |
|
| 9 |
The so-called "standard" domain collects all markup that doesn't warrant a |
| 10 |
domain of its own. Its directives and roles are not prefixed with a domain |
| 11 |
name. |
| 12 |
|
| 13 |
The standard domain is also where custom object descriptions, added using the |
| 14 |
:func:`~sphinx.application.Sphinx.add_object_type` API, are placed. |
| 15 |
|
| 16 |
There is a set of directives allowing documenting command-line programs: |
| 17 |
|
| 18 |
.. rst:directive:: .. option:: name args, name args, ... |
| 19 |
|
| 20 |
Describes a command line argument or switch. Option argument names should |
| 21 |
be enclosed in angle brackets. Examples:: |
| 22 |
|
| 23 |
.. option:: dest_dir |
| 24 |
|
| 25 |
Destination directory. |
| 26 |
|
| 27 |
.. option:: -m <module>, --module <module> |
| 28 |
|
| 29 |
Run a module as a script. |
| 30 |
|
| 31 |
The directive will create cross-reference targets for the given options, |
| 32 |
referenceable by :rst:role:`option` (in the example case, you'd use something |
| 33 |
like ``:option:`dest_dir```, ``:option:`-m```, or ``:option:`--module```). |
| 34 |
|
| 35 |
.. versionchanged:: 5.3 |
| 36 |
|
| 37 |
One can cross-reference including an option value: ``:option:`--module=foobar```, |
| 38 |
,``:option:`--module[=foobar]``` or ``:option:`--module foobar```. |
| 39 |
|
| 40 |
Use :confval:`option_emphasise_placeholders` for parsing of |
| 41 |
"variable part" of a literal text (similarly to the :rst:role:`samp` role). |
| 42 |
|
| 43 |
``cmdoption`` directive is a deprecated alias for the ``option`` directive. |
| 44 |
|
| 45 |
.. rst:directive:: .. confval:: name |
| 46 |
|
| 47 |
.. versionadded:: 7.4 |
| 48 |
|
| 49 |
Describes a configuration value or setting that the documented |
| 50 |
code or program uses or defines. |
| 51 |
Referenceable by :rst:role:`confval`. |
| 52 |
|
| 53 |
.. rst:directive:option:: type |
| 54 |
:type: text |
| 55 |
|
| 56 |
Describes the type of the configuration value. |
| 57 |
This is optional, and if specified will be interpreted as reStructuredText. |
| 58 |
|
| 59 |
.. rst:directive:option:: default |
| 60 |
:type: text |
| 61 |
|
| 62 |
Describes the default value of the configuration value. |
| 63 |
This is optional, and if specified will be interpreted as reStructuredText. |
| 64 |
|
| 65 |
Example: |
| 66 |
|
| 67 |
.. code-block:: rst |
| 68 |
|
| 69 |
.. confval:: the_answer |
| 70 |
:type: ``int`` (a *number*) |
| 71 |
:default: **42** |
| 72 |
|
| 73 |
This is a setting that controls the value of the answer. |
| 74 |
|
| 75 |
will be rendered as follows: |
| 76 |
|
| 77 |
.. confval:: the_answer |
| 78 |
:no-contents-entry: |
| 79 |
:no-index-entry: |
| 80 |
:type: ``int`` (a *number*) |
| 81 |
:default: **42** |
| 82 |
|
| 83 |
This is a setting that controls the value of the answer. |
| 84 |
|
| 85 |
.. rst:directive:: .. envvar:: name |
| 86 |
|
| 87 |
Describes an environment variable that the documented code or program uses |
| 88 |
or defines. Referenceable by :rst:role:`envvar`. |
| 89 |
|
| 90 |
.. rst:directive:: .. program:: name |
| 91 |
|
| 92 |
Like :rst:dir:`py:currentmodule`, this directive produces no output. |
| 93 |
Instead, it serves to notify Sphinx that all following :rst:dir:`option` |
| 94 |
directives document options for the program called *name*. |
| 95 |
|
| 96 |
If you use :rst:dir:`program`, you have to qualify the references in your |
| 97 |
:rst:role:`option` roles by the program name, so if you have the following |
| 98 |
situation :: |
| 99 |
|
| 100 |
.. program:: rm |
| 101 |
|
| 102 |
.. option:: -r |
| 103 |
|
| 104 |
Work recursively. |
| 105 |
|
| 106 |
.. program:: svn |
| 107 |
|
| 108 |
.. option:: -r <revision> |
| 109 |
|
| 110 |
Specify the revision to work upon. |
| 111 |
|
| 112 |
then ``:option:`rm -r``` would refer to the first option, while |
| 113 |
``:option:`svn -r``` would refer to the second one. |
| 114 |
|
| 115 |
If ``None`` is passed to the argument, the directive will reset the |
| 116 |
current program name. |
| 117 |
|
| 118 |
The program name may contain spaces (in case you want to document |
| 119 |
subcommands like ``svn add`` and ``svn commit`` separately). |
| 120 |
|
| 121 |
.. versionadded:: 0.5 |
| 122 |
|
| 123 |
There is also a very generic object description directive, which is not tied to |
| 124 |
any domain: |
| 125 |
|
| 126 |
.. rst:directive:: .. describe:: text |
| 127 |
.. object:: text |
| 128 |
|
| 129 |
This directive produces the same formatting as the specific ones provided by |
| 130 |
domains, but does not create index entries or cross-referencing targets. |
| 131 |
Example:: |
| 132 |
|
| 133 |
.. describe:: PAPER |
| 134 |
|
| 135 |
You can set this variable to select a paper size. |