diff options
author | Dick Visser <dick.visser@geant.org> | 2020-02-03 20:11:48 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-03 20:11:48 +0100 |
commit | 5b93a14a0f2474bbab86a41f3f0841a02158eaf5 (patch) | |
tree | 15f9e4d32e980d28987efc35d754e8f7e7c5927e /hacking | |
parent | Temporarily remove AIX from test matrix. (diff) | |
download | ansible-5b93a14a0f2474bbab86a41f3f0841a02158eaf5.tar.xz ansible-5b93a14a0f2474bbab86a41f3f0841a02158eaf5.zip |
Add anchor to each parameter row (#66895)
* Add anchor to each paramater row
* Update docs/templates/plugin.rst.j2
Co-Authored-By: Felix Fontein <felix@fontein.de>
* Insert full keys into plugin docs.
* Added visible links.
Co-authored-by: Felix Fontein <felix@fontein.de>
Diffstat (limited to 'hacking')
-rw-r--r-- | hacking/build_library/build_ansible/command_plugins/plugin_formatter.py | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/hacking/build_library/build_ansible/command_plugins/plugin_formatter.py b/hacking/build_library/build_ansible/command_plugins/plugin_formatter.py index 4fcf99a1c9..6482e71fd7 100644 --- a/hacking/build_library/build_ansible/command_plugins/plugin_formatter.py +++ b/hacking/build_library/build_ansible/command_plugins/plugin_formatter.py @@ -346,11 +346,17 @@ def too_old(added): return added_float < TOO_OLD_TO_BE_NOTABLE -def process_options(module, options): +def process_options(module, options, full_key=None): option_names = [] + if full_key is None: + full_key = [] if options: for (k, v) in iteritems(options): + # Make sure that "full key" is contained + full_key_k = full_key + [k] + v['full_key'] = full_key_k + # Error out if there's no description if 'description' not in v: raise AnsibleError("Missing required description for parameter '%s' in '%s' " % (k, module)) @@ -376,9 +382,9 @@ def process_options(module, options): if 'suboptions' in v and v['suboptions']: if isinstance(v['suboptions'], dict): - process_options(module, v['suboptions']) + process_options(module, v['suboptions'], full_key=full_key_k) elif isinstance(v['suboptions'][0], dict): - process_options(module, v['suboptions'][0]) + process_options(module, v['suboptions'][0], full_key=full_key_k) option_names.append(k) @@ -387,6 +393,25 @@ def process_options(module, options): return option_names +def process_returndocs(returndocs, full_key=None): + if full_key is None: + full_key = [] + + if returndocs: + for (k, v) in iteritems(returndocs): + # Make sure that "full key" is contained + full_key_k = full_key + [k] + v['full_key'] = full_key_k + + # Process suboptions + suboptions = v.get('contains') + if suboptions: + if isinstance(suboptions, dict): + process_returndocs(suboptions, full_key=full_key_k) + elif is_sequence(suboptions): + process_returndocs(suboptions[0], full_key=full_key_k) + + def process_plugins(module_map, templates, outputname, output_dir, ansible_version, plugin_type): for module_index, module in enumerate(module_map): @@ -483,6 +508,7 @@ def process_plugins(module_map, templates, outputname, output_dir, ansible_versi if module_map[module]['returndocs']: try: doc['returndocs'] = yaml.safe_load(module_map[module]['returndocs']) + process_returndocs(doc['returndocs']) except Exception as e: print("%s:%s:yaml error:%s:returndocs=%s" % (fname, module, e, module_map[module]['returndocs'])) doc['returndocs'] = None |