summaryrefslogtreecommitdiff
path: root/giscanner/doctemplates/Python/mallard-Python-function.tmpl
blob: 65adb1d744fdc6f9f3df3f4cabcdcd065125f311 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<%inherit file="mallard-base.tmpl"/>
<%block name="info">
% if node.parent is not None:
    <link type="guide" xref="${namespace.name}.${node.parent.name}" group="${page_style}"/>
% else:
    <link type="guide" xref="index" group="${page_style}"/>
% endif
    <api:function>
      <api:returns>
        <api:type>${formatter.format_type(node.retval.type) | x}</api:type>
      </api:returns>
      <api:name>${node.symbol}</api:name>
% if node.is_method:
      <api:arg>
        <api:type>${node.parent.ctype} *</api:type>
        <api:name>self</api:name>
      </api:arg>
% endif
% for arg in node.parameters:
% if arg.type.ctype == '<varargs>':
      <api:varargs/>
% else:
      <api:arg>
        <api:type>${formatter.format_type(arg.type) | x}</api:type>
        <api:name>${arg.argname}</api:name>
      </api:arg>
% endif
% endfor
    </api:function>
</%block>
<%block name="synopsis">
<synopsis><code mime="text/x-python">
% if len(node.parameters) != 0:
@accepts(\
${', '.join((formatter.format_type(arg.type) for arg in node.parameters))}\
)
% endif
@returns(${formatter.format_type(node.retval.type) | x})
def \
${node.name}(\
% if node.is_method:
self, \
% endif
${', '.join((arg.argname for arg in node.parameters))}\
):
    # Python wrapper for ${node.symbol}()
</code></synopsis>
</%block>
<%block name="details">
% if node.parameters or node.retval:
<dl>
% for arg, ix in zip(node.parameters, range(len(node.parameters))):
<dt><p>${arg.argname} :</p></dt>
<dd>${formatter.format(node, arg.doc)}</dd>
% endfor
% if node.retval and node.retval.type.ctype != 'void':
<dt><p>Returns :</p></dt>
<dd>${formatter.format(node, node.retval.doc)}</dd>
% endif
</dl>
% endif
</%block>