diff options
Diffstat (limited to 'giscanner')
-rw-r--r-- | giscanner/mallard-C-vfunc.tmpl | 35 | ||||
-rw-r--r-- | giscanner/mallard-Python-class.tmpl | 3 | ||||
-rw-r--r-- | giscanner/mallard-Python-vfunc.tmpl | 56 | ||||
-rw-r--r-- | giscanner/mallardwriter.py | 3 |
4 files changed, 97 insertions, 0 deletions
diff --git a/giscanner/mallard-C-vfunc.tmpl b/giscanner/mallard-C-vfunc.tmpl new file mode 100644 index 00000000..5b5bbfb1 --- /dev/null +++ b/giscanner/mallard-C-vfunc.tmpl @@ -0,0 +1,35 @@ +<?xml version="1.0"?> +<page id="${page_id}" + type="topic" + style="vfunc" + xmlns="http://projectmallard.org/1.0/" + xmlns:api="http://projectmallard.org/experimental/api/" + xmlns:ui="http://projectmallard.org/experimental/ui/"> + <info> + <link type="guide" xref="${namespace.name}.${node.parent.name}" group="vfunc"/> + </info> + <title>${node.name}</title> +<synopsis><code mime="text/x-csrc"> +</code></synopsis> +${formatter.format(node.doc)} + +% if node.parameters or node.retval: +<table> +% for arg, ix in zip(node.parameters, range(len(node.parameters))): +<tr> +<td><p>${arg.argname} :</p></td> +<td>${formatter.format(arg.doc)}</td> +</tr> +% endfor +% if node.retval: +<tr> +<td><p>Returns :</p></td> +<td>${formatter.format(node.retval.doc)}</td> +</tr> +% endif +</table> +% endif +% if node.version: +<p>Since ${node.version}</p> +% endif +</page> diff --git a/giscanner/mallard-Python-class.tmpl b/giscanner/mallard-Python-class.tmpl index 62feb9ab..04e5fc72 100644 --- a/giscanner/mallard-Python-class.tmpl +++ b/giscanner/mallard-Python-class.tmpl @@ -57,6 +57,9 @@ ${formatter.to_underscores(node.name).lower()} = ${namespace.name}.${node.name}( <links type="topic" ui:expanded="yes" groups="signal" style="linklist"> <title>Signals</title> </links> + <links type="topic" ui:expanded="yes" groups="vfunc" style="linklist"> + <title>Virtual functions</title> + </links> <links type="topic" ui:expanded="yes" groups="#first #default #last" style="linklist"> <title>Other</title> </links> diff --git a/giscanner/mallard-Python-vfunc.tmpl b/giscanner/mallard-Python-vfunc.tmpl new file mode 100644 index 00000000..7e95bc85 --- /dev/null +++ b/giscanner/mallard-Python-vfunc.tmpl @@ -0,0 +1,56 @@ +<?xml version="1.0"?> +<page id="${page_id}" + type="topic" + style="vfunc" + xmlns="http://projectmallard.org/1.0/" + xmlns:api="http://projectmallard.org/experimental/api/" + xmlns:ui="http://projectmallard.org/experimental/ui/"> + <info> + <link type="guide" xref="${namespace.name}.${node.parent.name}" group="vfunc"/> + <title type="link" role="topic">${node.name}</title> + </info> + <title>${namespace.name}.${node.parent.name}.${node.name}</title> +<synopsis><code mime="text/x-python"> +% if len(node.parameters) != 0: +@accepts(\ +% for arg, ix in zip(node.parameters, range(len(node.parameters))): +${formatter.format_type(arg.type) | x}\ +% if ix != len(node.parameters) - 1: +, \ +%endif +% endfor +) +% endif +@returns(${formatter.format_type(node.retval.type) | x}) +def \ +do_${node.name}(self, \ +% for arg, ix in zip(node.parameters, range(len(node.parameters))): +${arg.argname}\ +% if ix != len(node.parameters) - 1: +, \ +%endif +% endfor +): +</code></synopsis> +${formatter.format(node.doc)} + +% if node.parameters or node.retval: +<table> +% for arg, ix in zip(node.parameters, range(len(node.parameters))): +<tr> +<td><p>${arg.argname} :</p></td> +<td>${formatter.format(arg.doc)}</td> +</tr> +% endfor +% if node.retval and node.retval.type.ctype != 'void': +<tr> +<td><p>Returns :</p></td> +<td>${formatter.format(node.retval.doc)}</td> +</tr> +% endif +</table> +% endif +% if node.version: +<p>Since ${node.version}</p> +% endif +</page> diff --git a/giscanner/mallardwriter.py b/giscanner/mallardwriter.py index 9f11c60b..bb268be7 100644 --- a/giscanner/mallardwriter.py +++ b/giscanner/mallardwriter.py @@ -220,6 +220,9 @@ class MallardWriter(object): elif isinstance(node, ast.Signal) and node.parent is not None: template_name = 'mallard-%s-signal.tmpl' % self._language page_id = '%s.%s-%s' % (namespace.name, node.parent.name, node.name) + elif isinstance(node, ast.VFunction) and node.parent is not None: + template_name = 'mallard-%s-vfunc.tmpl' % self._language + page_id = '%s.%s-%s' % (namespace.name, node.parent.name, node.name) else: template_name = 'mallard-%s-default.tmpl' % self._language page_id = '%s.%s' % (namespace.name, node.name) |