From eb4dc6c59e5bfbef4d761dd1beef167a1d7e84ac Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Fri, 28 Jul 2023 13:07:43 -0700 Subject: [PATCH] Fix "Edit on GitHub" links for CLI programs (#188) --- docs/docsite/.templates/breadcrumbs.html | 2 +- docs/docsite/sphinx_conf/2.10_conf.py | 3 ++- docs/docsite/sphinx_conf/all_conf.py | 3 ++- docs/docsite/sphinx_conf/ansible_conf.py | 3 ++- docs/docsite/sphinx_conf/core_conf.py | 3 ++- docs/docsite/sphinx_conf/core_lang_conf.py | 3 ++- docs/templates/cli_rst.j2 | 2 +- .../build_ansible/command_plugins/generate_man.py | 3 +-- 8 files changed, 13 insertions(+), 9 deletions(-) diff --git a/docs/docsite/.templates/breadcrumbs.html b/docs/docsite/.templates/breadcrumbs.html index 00e3cef64c..0157624627 100644 --- a/docs/docsite/.templates/breadcrumbs.html +++ b/docs/docsite/.templates/breadcrumbs.html @@ -15,7 +15,7 @@
{% elif check_meta and pagename.startswith('cli') and meta.get('source', None) %} - {{ _('Edit on GitHub') }} + {{ _('Edit on GitHub') }} {% elif (not 'list_of' in pagename) and (not 'category' in pagename) %} {{ _('Edit on GitHub') }} {% endif %} diff --git a/docs/docsite/sphinx_conf/2.10_conf.py b/docs/docsite/sphinx_conf/2.10_conf.py index d42175be20..808dd53ec0 100644 --- a/docs/docsite/sphinx_conf/2.10_conf.py +++ b/docs/docsite/sphinx_conf/2.10_conf.py @@ -156,7 +156,8 @@ html_context = { 'github_version': 'devel/docs/docsite/rst/', 'github_module_version': 'devel/lib/ansible/modules/', 'github_root_dir': 'devel/lib/ansible', - 'github_cli_version': 'devel/lib/ansible/cli/', + 'github_cli_repo': 'ansible', + 'github_cli_version': 'devel', 'current_version': version, 'latest_version': '2.10', # list specifically out of order to make latest work diff --git a/docs/docsite/sphinx_conf/all_conf.py b/docs/docsite/sphinx_conf/all_conf.py index 2e7cca6283..b0c38deff9 100644 --- a/docs/docsite/sphinx_conf/all_conf.py +++ b/docs/docsite/sphinx_conf/all_conf.py @@ -152,7 +152,8 @@ html_context = { 'github_version': 'devel/docs/docsite/rst/', 'github_module_version': 'devel/lib/ansible/modules/', 'github_root_dir': 'devel/lib/ansible', - 'github_cli_version': 'devel/lib/ansible/cli/', + 'github_cli_repo': 'ansible', + 'github_cli_version': 'devel', 'current_version': version, 'latest_version': 'devel', # list specifically out of order to make latest work diff --git a/docs/docsite/sphinx_conf/ansible_conf.py b/docs/docsite/sphinx_conf/ansible_conf.py index 20cc704153..cd5bb020bf 100644 --- a/docs/docsite/sphinx_conf/ansible_conf.py +++ b/docs/docsite/sphinx_conf/ansible_conf.py @@ -162,7 +162,8 @@ html_context = { 'github_version': 'devel/docs/docsite/rst/', 'github_module_version': 'devel/lib/ansible/modules/', 'github_root_dir': 'devel/lib/ansible', - 'github_cli_version': 'devel/lib/ansible/cli/', + 'github_cli_repo': 'ansible', + 'github_cli_version': 'devel', 'current_version': version, 'latest_version': '8', # list specifically out of order to make latest work diff --git a/docs/docsite/sphinx_conf/core_conf.py b/docs/docsite/sphinx_conf/core_conf.py index 6f58632a7d..f6ccf437c5 100644 --- a/docs/docsite/sphinx_conf/core_conf.py +++ b/docs/docsite/sphinx_conf/core_conf.py @@ -205,7 +205,8 @@ html_context = { 'github_version': 'devel/docs/docsite/rst/', 'github_module_version': 'devel/lib/ansible/modules/', 'github_root_dir': 'devel/lib/ansible', - 'github_cli_version': 'devel/lib/ansible/cli/', + 'github_cli_repo': 'ansible', + 'github_cli_version': 'devel', 'current_version': version, 'latest_version': '2.15', # list specifically out of order to make latest work diff --git a/docs/docsite/sphinx_conf/core_lang_conf.py b/docs/docsite/sphinx_conf/core_lang_conf.py index 24facdecba..5bfa8ebc60 100644 --- a/docs/docsite/sphinx_conf/core_lang_conf.py +++ b/docs/docsite/sphinx_conf/core_lang_conf.py @@ -205,7 +205,8 @@ html_context = { 'github_version': 'devel/docs/docsite/rst/', 'github_module_version': 'devel/lib/ansible/modules/', 'github_root_dir': 'devel/lib/ansible', - 'github_cli_version': 'devel/lib/ansible/cli/', + 'github_cli_repo': 'ansible', + 'github_cli_version': 'devel', 'current_version': version, 'latest_version': '2.15', # list specifically out of order to make latest work diff --git a/docs/templates/cli_rst.j2 b/docs/templates/cli_rst.j2 index 8f5a8db337..5257a581c7 100644 --- a/docs/templates/cli_rst.j2 +++ b/docs/templates/cli_rst.j2 @@ -1,4 +1,4 @@ -:source: {{ cli }}.py +:source: {{ source }} {% set name = cli_name -%} {% set name_slug = cli_name -%} diff --git a/hacking/build_library/build_ansible/command_plugins/generate_man.py b/hacking/build_library/build_ansible/command_plugins/generate_man.py index 4228c48b4d..5ee894fb6a 100644 --- a/hacking/build_library/build_ansible/command_plugins/generate_man.py +++ b/hacking/build_library/build_ansible/command_plugins/generate_man.py @@ -129,7 +129,7 @@ def opts_docs(cli_class_name, cli_module_name): # base/common cli info cli_options = opt_doc_list(cli.parser) docs = { - 'cli': cli_module_name, + 'source': f'lib/ansible/cli/{cli_module_name}.py', 'cli_name': cli_name, 'usage': cli.parser.format_usage(), 'short_desc': cli.parser.description, @@ -289,7 +289,6 @@ class GenerateMan(Command): # add rest to vars tvars = allvars[cli_name] tvars['cli_bin_name_list'] = cli_bin_name_list - tvars['cli'] = cli_name if '-i' in tvars['option_names']: tvars['inventory'] = True print('uses inventory')