| 1 |
Testing object descriptions |
| 2 |
=========================== |
| 3 |
|
| 4 |
.. function:: func_without_module(a, b, *c[, d]) |
| 5 |
|
| 6 |
Does something. |
| 7 |
|
| 8 |
.. function:: func_without_body() |
| 9 |
|
| 10 |
.. function:: func_with_unknown_field() |
| 11 |
|
| 12 |
: : |
| 13 |
|
| 14 |
: empty field name: |
| 15 |
|
| 16 |
:field_name: |
| 17 |
|
| 18 |
:field_name all lower: |
| 19 |
|
| 20 |
:FIELD_NAME: |
| 21 |
|
| 22 |
:FIELD_NAME ALL CAPS: |
| 23 |
|
| 24 |
:Field_Name: |
| 25 |
|
| 26 |
:Field_Name All Word Caps: |
| 27 |
|
| 28 |
:Field_name: |
| 29 |
|
| 30 |
:Field_name First word cap: |
| 31 |
|
| 32 |
:FIELd_name: |
| 33 |
|
| 34 |
:FIELd_name PARTial caps: |
| 35 |
|
| 36 |
.. function:: func_noindex |
| 37 |
:no-index: |
| 38 |
|
| 39 |
.. function:: func_with_module |
| 40 |
:module: foolib |
| 41 |
|
| 42 |
Referring to :func:`func with no index <func_noindex>`. |
| 43 |
Referring to :func:`nothing <>`. |
| 44 |
|
| 45 |
.. module:: mod |
| 46 |
:synopsis: Module synopsis. |
| 47 |
:platform: UNIX |
| 48 |
|
| 49 |
.. function:: func_in_module |
| 50 |
|
| 51 |
.. class:: Cls |
| 52 |
|
| 53 |
.. method:: meth1 |
| 54 |
|
| 55 |
.. staticmethod:: meths |
| 56 |
|
| 57 |
.. attribute:: attr |
| 58 |
|
| 59 |
.. explicit class given |
| 60 |
.. method:: Cls.meth2 |
| 61 |
|
| 62 |
.. explicit module given |
| 63 |
.. exception:: Error(arg1, arg2) |
| 64 |
:module: errmod |
| 65 |
|
| 66 |
.. data:: var |
| 67 |
|
| 68 |
|
| 69 |
.. currentmodule:: None |
| 70 |
|
| 71 |
.. function:: func_without_module2() -> annotation |
| 72 |
|
| 73 |
.. object:: long(parameter, \ |
| 74 |
list) |
| 75 |
another one |
| 76 |
|
| 77 |
.. class:: TimeInt |
| 78 |
|
| 79 |
Has only one parameter (triggers special behavior...) |
| 80 |
|
| 81 |
:param moo: |test| |
| 82 |
:type moo: |test| |
| 83 |
|
| 84 |
.. |test| replace:: Moo |
| 85 |
|
| 86 |
.. class:: Time(hour, minute, isdst) |
| 87 |
|
| 88 |
:param year: The year. |
| 89 |
:type year: TimeInt |
| 90 |
:param TimeInt minute: The minute. |
| 91 |
:param isdst: whether it's DST |
| 92 |
:type isdst: * some complex |
| 93 |
* expression |
| 94 |
:returns: a new :class:`Time` instance |
| 95 |
:rtype: Time |
| 96 |
:raises Error: if the values are out of range |
| 97 |
:ivar int hour: like *hour* |
| 98 |
:ivar minute: like *minute* |
| 99 |
:vartype minute: int |
| 100 |
:param hour: Some parameter |
| 101 |
:type hour: DuplicateType |
| 102 |
:param hour: Duplicate param. Should not lead to crashes. |
| 103 |
:type hour: DuplicateType |
| 104 |
:param .Cls extcls: A class from another module. |
| 105 |
|
| 106 |
.. raw:: latex |
| 107 |
|
| 108 |
\begingroup |
| 109 |
\let\oldhref\href |
| 110 |
\def\href{\ifnum\catcode`\-=\active\errorwithsphinxhref\fi\oldhref} |
| 111 |
|
| 112 |
.. class:: MyClass |
| 113 |
|
| 114 |
.. attribute:: config |
| 115 |
:type: sphinx.config.Config |
| 116 |
|
| 117 |
A configuration object. |
| 118 |
|
| 119 |
.. raw:: latex |
| 120 |
|
| 121 |
\endgroup |
| 122 |
|
| 123 |
C items |
| 124 |
======= |
| 125 |
|
| 126 |
.. c:function:: void Sphinx_DoSomething() |
| 127 |
|
| 128 |
.. c:member:: int SphinxStruct.member |
| 129 |
|
| 130 |
.. c:macro:: SPHINX_USE_PYTHON |
| 131 |
|
| 132 |
.. c:type:: SphinxType |
| 133 |
|
| 134 |
.. c:var:: int sphinx_global |
| 135 |
|
| 136 |
.. c:function:: PyObject* Py_SphinxFoo(void) |
| 137 |
|
| 138 |
|
| 139 |
Javascript items |
| 140 |
================ |
| 141 |
|
| 142 |
.. js:function:: foo() |
| 143 |
|
| 144 |
.. js:data:: bar |
| 145 |
|
| 146 |
.. documenting the method of any object |
| 147 |
.. js:function:: bar.baz(href, callback[, errback]) |
| 148 |
|
| 149 |
:param string href: The location of the resource. |
| 150 |
:param callback: Gets called with the data returned by the resource. |
| 151 |
:throws InvalidHref: If the `href` is invalid. |
| 152 |
:returns: `undefined` |
| 153 |
|
| 154 |
.. js:attribute:: bar.spam |
| 155 |
|
| 156 |
References |
| 157 |
========== |
| 158 |
|
| 159 |
Referencing :class:`mod.Cls` or :Class:`mod.Cls` should be the same. |
| 160 |
|
| 161 |
With target: :c:func:`Sphinx_DoSomething()` (parentheses are handled), |
| 162 |
:c:member:`SphinxStruct.member`, :c:macro:`SPHINX_USE_PYTHON`, |
| 163 |
:c:type:`SphinxType *` (pointer is handled), :c:data:`sphinx_global`. |
| 164 |
|
| 165 |
Without target: :c:func:`CFunction`. :c:func:`!malloc`. |
| 166 |
|
| 167 |
:js:func:`foo()` |
| 168 |
:js:func:`foo` |
| 169 |
|
| 170 |
:js:data:`bar` |
| 171 |
:js:func:`bar.baz()` |
| 172 |
:js:func:`bar.baz` |
| 173 |
:js:func:`~bar.baz()` |
| 174 |
|
| 175 |
:js:attr:`bar.baz` |
| 176 |
|
| 177 |
|
| 178 |
Others |
| 179 |
====== |
| 180 |
|
| 181 |
.. envvar:: HOME |
| 182 |
|
| 183 |
.. program:: python |
| 184 |
|
| 185 |
.. cmdoption:: -c command |
| 186 |
|
| 187 |
.. program:: perl |
| 188 |
|
| 189 |
.. cmdoption:: -c |
| 190 |
|
| 191 |
.. option:: +p |
| 192 |
|
| 193 |
.. option:: --ObjC++ |
| 194 |
|
| 195 |
.. option:: --plugin.option |
| 196 |
|
| 197 |
.. option:: create-auth-token |
| 198 |
|
| 199 |
.. option:: arg |
| 200 |
|
| 201 |
.. option:: -j[=N] |
| 202 |
|
| 203 |
Link to :option:`perl +p`, :option:`--ObjC++`, :option:`--plugin.option`, :option:`create-auth-token`, :option:`arg` and :option:`-j` |
| 204 |
|
| 205 |
.. program:: hg |
| 206 |
|
| 207 |
.. option:: commit |
| 208 |
|
| 209 |
.. program:: git commit |
| 210 |
|
| 211 |
.. option:: -p |
| 212 |
|
| 213 |
Link to :option:`hg commit` and :option:`git commit -p`. |
| 214 |
|
| 215 |
.. option:: --abi={TYPE} |
| 216 |
|
| 217 |
.. option:: --test={WHERE}-{COUNT} |
| 218 |
|
| 219 |
.. option:: --wrap=\{\{value\}\} |
| 220 |
|
| 221 |
.. option:: -allowable_client {client_name} |
| 222 |
|
| 223 |
Foo bar. |
| 224 |
|
| 225 |
Test repeated option directive. |
| 226 |
|
| 227 |
.. option:: -mapi |
| 228 |
|
| 229 |
My API. |
| 230 |
|
| 231 |
.. option:: -mapi=secret |
| 232 |
|
| 233 |
My secret API. |
| 234 |
|
| 235 |
Reference the first option :option:`-mapi=secret`, :option:`-mapi[=xxx]` |
| 236 |
or :option:`-mapi with_space`. |
| 237 |
|
| 238 |
|
| 239 |
User markup |
| 240 |
=========== |
| 241 |
|
| 242 |
.. userdesc:: myobj:parameter |
| 243 |
|
| 244 |
Description of userdesc. |
| 245 |
|
| 246 |
|
| 247 |
Referencing :userdescrole:`myobj`. |
| 248 |
|
| 249 |
|
| 250 |
CPP domain |
| 251 |
========== |
| 252 |
|
| 253 |
.. cpp:class:: n::Array |
| 254 |
|
| 255 |
.. cpp:function:: T& operator[]( unsigned j ) |
| 256 |
const T& operator[]( unsigned j ) const |
| 257 |
|
| 258 |
.. cpp:function:: template<typename T1, typename T2> \ |
| 259 |
requires A<T1, T2> \ |
| 260 |
void f() |
| 261 |
|
| 262 |
- :cpp:expr:`a + b` |