[gobject-introspection: 19/30] devdocs: Format in and out parameters correctly



commit 0a9b0d8c8d7e89f7ff639f5bc8ff3ffdc6abccb7
Author: Philip Chimento <philip chimento gmail com>
Date:   Sun Dec 13 22:35:52 2015 -0800

    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.

 giscanner/doctemplates/devdocs/Gjs/_method.tmpl | 27 ++++++++++++++++++-------
 1 file 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:
+                &mdash; ${formatter.format_inline(m, p.doc)}
+              % endif
+            </li>
+          % endfor
+        </ul>
       </dd>
     % endif
   </dl>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]