diff options
author | Andy Holmes <andyholmes@gnome.org> | 2022-08-31 04:17:09 +0000 |
---|---|---|
committer | Philip Chimento <philip.chimento@gmail.com> | 2022-08-31 04:17:09 +0000 |
commit | 5743511f21c0597d70a148f05481e0c6f9666803 (patch) | |
tree | 84d265e50870fd5d4179cc88f939fcc50b42199d /giscanner | |
parent | 6a934c41190740b4e69bdeaae2e7b57bb5e33ac8 (diff) | |
download | gobject-introspection-5743511f21c0597d70a148f05481e0c6f9666803.tar.gz |
doctool: prepend the emitting object for GJS signal callbacks
Diffstat (limited to 'giscanner')
-rw-r--r-- | giscanner/doctemplates/devdocs/Gjs/_index.tmpl | 2 | ||||
-rw-r--r-- | giscanner/doctemplates/devdocs/Gjs/_method.tmpl | 9 | ||||
-rw-r--r-- | giscanner/doctemplates/devdocs/Gjs/_signals.tmpl | 2 | ||||
-rw-r--r-- | giscanner/docwriter.py | 6 |
4 files changed, 16 insertions, 3 deletions
diff --git a/giscanner/doctemplates/devdocs/Gjs/_index.tmpl b/giscanner/doctemplates/devdocs/Gjs/_index.tmpl index f3d588ae..e53f4558 100644 --- a/giscanner/doctemplates/devdocs/Gjs/_index.tmpl +++ b/giscanner/doctemplates/devdocs/Gjs/_index.tmpl @@ -141,7 +141,7 @@ <tr> <td class="${doc.deprecated_class(s)}"> <a href="#${formatter.make_anchor(s)}">${s.name}</a><!-- no space - -->(${formatter.format_in_parameters(s)}) + -->(${formatter.format_signal_parameters(s)}) </td> </tr> </%doc:introspectable> diff --git a/giscanner/doctemplates/devdocs/Gjs/_method.tmpl b/giscanner/doctemplates/devdocs/Gjs/_method.tmpl index 57520465..3109fd1b 100644 --- a/giscanner/doctemplates/devdocs/Gjs/_method.tmpl +++ b/giscanner/doctemplates/devdocs/Gjs/_method.tmpl @@ -13,10 +13,17 @@ in_params = formatter.get_in_parameters(m) out_params = formatter.get_out_parameters(m) %> - % if in_params: + % if in_params or isinstance(m, ast.Signal): <dt>Parameters:</dt> <dd> <ul> + % if isinstance(m, ast.Signal): + <li> + <strong>${formatter.to_lower_camel_case(m.parent.name)}</strong> + (<code>${m.parent.gi_name}</code>) + — the emitting object + </li> + %endif % for p in in_params: <li> <strong>${p.argname}</strong> diff --git a/giscanner/doctemplates/devdocs/Gjs/_signals.tmpl b/giscanner/doctemplates/devdocs/Gjs/_signals.tmpl index cda46bd5..3c1ff443 100644 --- a/giscanner/doctemplates/devdocs/Gjs/_signals.tmpl +++ b/giscanner/doctemplates/devdocs/Gjs/_signals.tmpl @@ -9,7 +9,7 @@ id="${formatter.make_anchor(s)}"> ${s.name}<!-- no space --></span><!-- - -->(${formatter.format_in_parameters(s)}) + -->(${formatter.format_signal_parameters(s)}) </h3> <dl> <dt>Flags</dt> diff --git a/giscanner/docwriter.py b/giscanner/docwriter.py index b72ab2ac..cd49cea9 100644 --- a/giscanner/docwriter.py +++ b/giscanner/docwriter.py @@ -1274,6 +1274,12 @@ class DevDocsFormatterGjs(DocFormatterGjs): def format_in_parameters(self, node): return ', '.join(p.argname for p in self.get_in_parameters(node)) + def format_signal_parameters(self, node): + emitter = self.to_lower_camel_case(node.parent.name) + in_params = self.format_in_parameters(node) + + return '%s, %s' % (emitter, in_params) if in_params else emitter + LANGUAGES = { "devdocs": { |