From 771a3983d26139261bfcd092f5b5f031bafafc77 Mon Sep 17 00:00:00 2001 From: Dag Wieers Date: Thu, 27 Sep 2018 20:25:38 +0200 Subject: [PATCH] Docs: Keep the module index clean (#46155) A lot of modules have a short_description with a trailing dot even though we don't want trailing dots in the index. This change removes it when creating the document index. --- docs/bin/plugin_formatter.py | 2 +- lib/ansible/parsing/plugin_docs.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/bin/plugin_formatter.py b/docs/bin/plugin_formatter.py index 3f627bcf83..ef92ed7280 100755 --- a/docs/bin/plugin_formatter.py +++ b/docs/bin/plugin_formatter.py @@ -689,7 +689,7 @@ def main(): display.vv(key) display.vvvvv(pp.pformat(('record', record))) if record.get('doc', None): - short_desc = record['doc']['short_description'] + short_desc = record['doc']['short_description'].rstrip('.') if short_desc is None: display.warning('short_description for %s is None' % key) short_desc = '' diff --git a/lib/ansible/parsing/plugin_docs.py b/lib/ansible/parsing/plugin_docs.py index f75577d531..11f3f5c987 100644 --- a/lib/ansible/parsing/plugin_docs.py +++ b/lib/ansible/parsing/plugin_docs.py @@ -103,6 +103,7 @@ def read_docstub(filename): capturing = True doc_stub.append(line) - data = AnsibleLoader(r"".join(doc_stub), file_name=filename).get_single_data() + short_description = r''.join(doc_stub).strip().rstrip('.') + data = AnsibleLoader(short_description, file_name=filename).get_single_data() return data