Debian Codegraph @

tests/roots/test-ext-viewcode/objects.rst

raw
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_noindex
11 :no-index:
12
13 .. function:: func_with_module
14 :module: foolib
15
16 Referring to :func:`func with no index <func_noindex>`.
17 Referring to :func:`nothing <>`.
18
19 .. module:: mod
20 :synopsis: Module synopsis.
21 :platform: UNIX
22
23 .. function:: func_in_module
24
25 .. class:: Cls
26
27 .. method:: meth1
28
29 .. staticmethod:: meths
30
31 .. attribute:: attr
32
33 .. explicit class given
34 .. method:: Cls.meth2
35
36 .. explicit module given
37 .. exception:: Error(arg1, arg2)
38 :module: errmod
39
40 .. data:: var
41
42
43 .. currentmodule:: None
44
45 .. function:: func_without_module2() -> annotation
46
47 .. object:: long(parameter, \
48 list)
49 another one
50
51 .. class:: TimeInt
52
53 Has only one parameter (triggers special behavior...)
54
55 :param moo: |test|
56 :type moo: |test|
57
58 .. |test| replace:: Moo
59
60 .. class:: Time(hour, minute, isdst)
61
62 :param year: The year.
63 :type year: TimeInt
64 :param TimeInt minute: The minute.
65 :param isdst: whether it's DST
66 :type isdst: * some complex
67 * expression
68 :returns: a new :class:`Time` instance
69 :rtype: :class:`Time`
70 :raises ValueError: if the values are out of range
71 :ivar int hour: like *hour*
72 :ivar minute: like *minute*
73 :vartype minute: int
74 :param hour: Some parameter
75 :type hour: DuplicateType
76 :param hour: Duplicate param. Should not lead to crashes.
77 :type hour: DuplicateType
78 :param .Cls extcls: A class from another module.
79
80
81 C items
82 =======
83
84 .. c:function:: Sphinx_DoSomething()
85
86 .. c:member:: SphinxStruct.member
87
88 .. c:macro:: SPHINX_USE_PYTHON
89
90 .. c:type:: SphinxType
91
92 .. c:var:: sphinx_global
93
94
95 Javascript items
96 ================
97
98 .. js:function:: foo()
99
100 .. js:data:: bar
101
102 .. documenting the method of any object
103 .. js:function:: bar.baz(href, callback[, errback])
104
105 :param string href: The location of the resource.
106 :param callback: Gets called with the data returned by the resource.
107 :throws InvalidHref: If the `href` is invalid.
108 :returns: `undefined`
109
110 .. js:attribute:: bar.spam
111
112 References
113 ==========
114
115 Referencing :class:`mod.Cls` or :Class:`mod.Cls` should be the same.
116
117 With target: :c:func:`Sphinx_DoSomething()` (parentheses are handled),
118 :c:member:`SphinxStruct.member`, :c:macro:`SPHINX_USE_PYTHON`,
119 :c:type:`SphinxType *` (pointer is handled), :c:data:`sphinx_global`.
120
121 Without target: :c:func:`CFunction`. :c:func:`!malloc`.
122
123 :js:func:`foo()`
124 :js:func:`foo`
125
126 :js:data:`bar`
127 :js:func:`bar.baz()`
128 :js:func:`bar.baz`
129 :js:func:`~bar.baz()`
130
131 :js:attr:`bar.baz`
132
133
134 Others
135 ======
136
137 .. envvar:: HOME
138
139 .. program:: python
140
141 .. cmdoption:: -c command
142
143 .. program:: perl
144
145 .. cmdoption:: -c
146
147 .. option:: +p
148
149 Link to :option:`perl +p`.
150
151
152 User markup
153 ===========
154
155 .. userdesc:: myobj:parameter
156
157 Description of userdesc.
158
159
160 Referencing :userdescrole:`myobj`.
161
162
163 CPP domain
164 ==========
165
166 .. cpp:class:: n::Array<T,d>
167
168 .. cpp:function:: T& operator[]( unsigned j )
169 const T& operator[]( unsigned j ) const
170
171 rST domain
172 ==========
173
174 .. rst:role:: foo
175
176 Foo description.