diff options
| author | Xavier Morel <xmo@odoo.com> | 2018-01-10 12:32:54 +0100 |
|---|---|---|
| committer | Xavier Morel <xmo@odoo.com> | 2018-01-10 12:36:58 +0100 |
| commit | f7323dbe2321558f96640d6643a8b593958d8a49 (patch) | |
| tree | 94481626064593d5d776bca02858ac766bf3c28f /doc/_extensions/autojsdoc | |
| parent | cd05c16641ef9e5f84dcb1d4af70a2caab464ecb (diff) | |
[FIX] doc: informal sub-params
Revert 6cb12273e2c1e1385098e38880317ae162dc902e which reverted
08d48b0fff0938e7ac004767dddfab13d3cff30b.
Issue was the support for sub-parameters (aka @param {type} foo.bar)
where the "parent" parameter was not formal (only present in a
function's docstring, but not in the function's parameters list),
subtype creation would fail to find a root parameter to attach the
sub-parameter to.
This has not actually been fixed, but for the specific case where the
formal parameters list is *completely empty* we fall back on a list of
the docstring's parameters, which works well enough for this case.
Diffstat (limited to 'doc/_extensions/autojsdoc')
| -rw-r--r-- | doc/_extensions/autojsdoc/ext/directives.py | 1 | ||||
| -rw-r--r-- | doc/_extensions/autojsdoc/parser/jsdoc.py | 10 |
2 files changed, 9 insertions, 2 deletions
diff --git a/doc/_extensions/autojsdoc/ext/directives.py b/doc/_extensions/autojsdoc/ext/directives.py index 98b3f9e8322..d127e24725b 100644 --- a/doc/_extensions/autojsdoc/ext/directives.py +++ b/doc/_extensions/autojsdoc/ext/directives.py @@ -565,6 +565,7 @@ def extract_subtypes(parent_name, doc): 'name': typename, 'doc': param.doc, '_members': [ + # TODO: add default value (sub.name, jsdoc.PropertyDoc(dict(sub.to_dict(), sourcemodule=doc['sourcemodule']))) for sub in subs ], diff --git a/doc/_extensions/autojsdoc/parser/jsdoc.py b/doc/_extensions/autojsdoc/parser/jsdoc.py index a34a2aa9b83..55ec998c94f 100644 --- a/doc/_extensions/autojsdoc/parser/jsdoc.py +++ b/doc/_extensions/autojsdoc/parser/jsdoc.py @@ -122,8 +122,14 @@ class FunctionDoc(CommentDoc): @property def params(self): tag_texts = self.get_as_list('param') - if self.get('guessed_params') is None: - return [ParamDoc(text) for text in tag_texts] + # turns out guessed_params is *almost* (?) always set to a list, + # if empty list of guessed params fall back to @params + if not self['guessed_params']: + # only get "primary" params (no "." in name) + return [ + p for p in map(ParamDoc, tag_texts) + if '.' not in p.name + ] else: param_dict = {} for text in tag_texts: |
