diff options
author | Philip Chimento <philip.chimento@gmail.com> | 2015-12-13 22:35:52 -0800 |
---|---|---|
committer | rockon999 <rockon999@users.noreply.github.com> | 2018-08-06 02:53:45 -0500 |
commit | 0a9b0d8c8d7e89f7ff639f5bc8ff3ffdc6abccb7 (patch) | |
tree | 0053f36297d6f3ef7eae13a3d302d7e6cc41a0ae /giscanner/doctemplates | |
parent | d1ca314d0b5f6ad44825514cc1e41917735a31f3 (diff) | |
download | gobject-introspection-0a9b0d8c8d7e89f7ff639f5bc8ff3ffdc6abccb7.tar.gz |
devdocs: Format in and out parameters correctly
Previously the functions template did not properly use
formatter.get_in_parameters() and formatter.get_out_parameters(), so we
had inaccurate function arguments in the documentation. In particular, I
originally didn't take functions with multiple return values into
account.
Diffstat (limited to 'giscanner/doctemplates')
-rw-r--r-- | giscanner/doctemplates/devdocs/Gjs/_method.tmpl | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/giscanner/doctemplates/devdocs/Gjs/_method.tmpl b/giscanner/doctemplates/devdocs/Gjs/_method.tmpl index 71569946..59e9ab8b 100644 --- a/giscanner/doctemplates/devdocs/Gjs/_method.tmpl +++ b/giscanner/doctemplates/devdocs/Gjs/_method.tmpl @@ -9,11 +9,15 @@ <dt>Type:</dt> <dd>Virtual</dd> % endif - % if m.parameters: + <% + in_params = formatter.get_in_parameters(m) + out_params = formatter.get_out_parameters(m) + %> + % if in_params: <dt>Parameters:</dt> <dd> <ul> - % for p in m.parameters: + % for p in in_params: <li> <strong>${p.argname}</strong> (<code>${formatter.format_type(p.type)}</code>) @@ -25,13 +29,22 @@ </ul> </dd> % endif - % if m.retval.type != ast.TYPE_NONE: + % if out_params: <dt>Returns:</dt> <dd> - (<code>${formatter.format_type(m.retval.type)}</code>) - % if m.retval.doc: - ${formatter.format_inline(m, m.retval.doc)} - % endif + <ul> + % for p in out_params: + <li> + % if len(out_params) > 1: + <strong>${p.argname}</strong> + % endif + (<code>${formatter.format_type(p.type)}</code>) + % if p.doc: + — ${formatter.format_inline(m, p.doc)} + % endif + </li> + % endfor + </ul> </dd> % endif </dl> |