diff options
Diffstat (limited to 'giscanner/doctemplates')
-rw-r--r-- | giscanner/doctemplates/C/function.tmpl | 34 | ||||
-rw-r--r-- | giscanner/doctemplates/Gjs/function.tmpl | 8 | ||||
-rw-r--r-- | giscanner/doctemplates/Python/function.tmpl | 25 |
3 files changed, 19 insertions, 48 deletions
diff --git a/giscanner/doctemplates/C/function.tmpl b/giscanner/doctemplates/C/function.tmpl index 01c653b9..4472ec5f 100644 --- a/giscanner/doctemplates/C/function.tmpl +++ b/giscanner/doctemplates/C/function.tmpl @@ -10,19 +10,13 @@ <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: +% for arg in node.all_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:name>${formatter.format_parameter_name(node, arg)}</api:name> </api:arg> % endif % endfor @@ -31,18 +25,10 @@ <%block name="synopsis"> <synopsis><code mime="text/x-csrc"> ${node.retval.type.ctype} ${node.symbol} (\ -% if node.is_method: -${node.parent.ctype} *self\ -%endif -% if len(node.parameters) == 0: -% if not node.is_method: +% if len(node.all_parameters) == 0: void\ -%endif -); -% elif node.is_method: -, -% endif -% for arg, ix in zip(node.parameters, range(len(node.parameters))): +% else: +% for arg, ix in zip(node.all_parameters, range(len(node.all_parameters))): % if ix != 0: ${' ' * (len(formatter.format_type(node.retval.type)) + len(node.symbol) + 3)}\ % endif @@ -51,16 +37,16 @@ ${' ' * (len(formatter.format_type(node.retval.type)) + len(node.symbol) + 3)}\ % else: ${formatter.format_type(arg.type) | x} ${arg.argname}\ % endif -% if ix == len(node.parameters) - 1: -); -% else: +% if ix != len(node.all_parameters) - 1: , -%endif +% endif % endfor +% endif +); </code></synopsis> </%block> <%block name="details"> -% if node.parameters or node.retval: +% if node.all_parameters or node.retval: <dl> % for arg, ix in zip(node.parameters, range(len(node.parameters))): <dt><p>${arg.argname} :</p></dt> diff --git a/giscanner/doctemplates/Gjs/function.tmpl b/giscanner/doctemplates/Gjs/function.tmpl index 92bfb3a9..d0fa096e 100644 --- a/giscanner/doctemplates/Gjs/function.tmpl +++ b/giscanner/doctemplates/Gjs/function.tmpl @@ -10,19 +10,13 @@ <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:name>${formatter.format_parameter_name(node, arg)}</api:name> </api:arg> % endif % endfor diff --git a/giscanner/doctemplates/Python/function.tmpl b/giscanner/doctemplates/Python/function.tmpl index 467cfcbe..fa705bd0 100644 --- a/giscanner/doctemplates/Python/function.tmpl +++ b/giscanner/doctemplates/Python/function.tmpl @@ -10,19 +10,13 @@ <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: +% for arg in node.all_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:name>${formatter.format_parameter_name(node, arg)}</api:name> </api:arg> % endif % endfor @@ -30,27 +24,24 @@ </%block> <%block name="synopsis"> <synopsis><code mime="text/x-python"> -% if len(node.parameters) != 0: +% if len(node.all_parameters) != 0: @accepts(\ -${', '.join((formatter.format_type(arg.type) for arg in node.parameters))}\ +${', '.join((formatter.format_type(arg.type) for arg in node.all_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))}\ +${', '.join((formatter.format_parameter_name(node, arg) for arg in node.all_parameters))}\ ): # Python wrapper for ${node.symbol}() </code></synopsis> </%block> <%block name="details"> -% if node.parameters or node.retval: +% if node.all_parameters or node.retval: <dl> -% for arg, ix in zip(node.parameters, range(len(node.parameters))): -<dt><p>${arg.argname} :</p></dt> +% for arg, ix in zip(node.all_parameters, range(len(node.all_parameters))): +<dt><p>${formatter.format_parameter_name(node, arg)} :</p></dt> <dd>${formatter.format(node, arg.doc)}</dd> % endfor % if node.retval and node.retval.type.ctype != 'void': |