summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorAbhijeet Kasurde <akasurde@redhat.com>2020-01-30 21:25:46 +0530
committerMatt Clay <matt@mystile.com>2020-04-14 16:51:21 -0700
commit64d8947f7f2b8450585672370239ffb9e6ec8753 (patch)
treef1be46c28aba5509891ca15a235bf75d1433b7c5 /docs
parent80b9a0a25c5f75e84aefc8f2b293fb1933b154f2 (diff)
downloadansible-64d8947f7f2b8450585672370239ffb9e6ec8753.tar.gz
[2.9] docs: Fixed "Edit on GitHub" link for plugin, cli
Fixed sphinx theme to navigate "Edit on Github" link to locate correct plugin, cli source in GitHub repo. Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com> (cherry picked from commit 2728c2476e27f5e84ec05060a7f5e9cd6ebd43ab)
Diffstat (limited to 'docs')
-rw-r--r--docs/docsite/_themes/sphinx_rtd_theme/breadcrumbs.html4
-rw-r--r--docs/docsite/rst/conf.py2
-rw-r--r--docs/templates/cli_rst.j22
3 files changed, 8 insertions, 0 deletions
diff --git a/docs/docsite/_themes/sphinx_rtd_theme/breadcrumbs.html b/docs/docsite/_themes/sphinx_rtd_theme/breadcrumbs.html
index 7dcdeb34b2..ada446b42f 100644
--- a/docs/docsite/_themes/sphinx_rtd_theme/breadcrumbs.html
+++ b/docs/docsite/_themes/sphinx_rtd_theme/breadcrumbs.html
@@ -46,6 +46,10 @@
<!-- Ansible-specific additions for modules etc -->
{% if pagename.endswith('_module') %}
<a href="https://{{ github_host|default("github.com") }}/{{ github_user }}/{{ github_repo }}/{{ theme_vcs_pageview_mode|default("blob") }}/{{ github_module_version }}{{ meta.get('source', '') }}?description=%23%23%23%23%23%20SUMMARY%0A%3C!---%20Your%20description%20here%20--%3E%0A%0A%0A%23%23%23%23%23%20ISSUE%20TYPE%0A-%20Docs%20Pull%20Request%0A%0A%2Blabel:%20docsite_pr" class="fa fa-github"> {{ _('Edit on GitHub') }}</a>
+ {% elif pagename.startswith('plugins') and meta.get('source', None) %}
+ <a href="https://{{ github_host|default("github.com") }}/{{ github_user }}/{{ github_repo }}/{{ theme_vcs_pageview_mode|default("blob") }}/{{ github_root_dir }}/{{ pagename }}.py?description=%23%23%23%23%23%20SUMMARY%0A%3C!---%20Your%20description%20here%20--%3E%0A%0A%0A%23%23%23%23%23%20ISSUE%20TYPE%0A-%20Docs%20Pull%20Request%0A%0A%2Blabel:%20docsite_pr" class="fa fa-github"> {{ _('Edit on GitHub') }}</a>
+ {% elif pagename.startswith('cli') and meta.get('source', None) %}
+ <a href="https://{{ github_host|default("github.com") }}/{{ github_user }}/{{ github_repo }}/{{ theme_vcs_pageview_mode|default("blob") }}/{{ github_cli_version }}{{ meta.get('source', '') }}?description=%23%23%23%23%23%20SUMMARY%0A%3C!---%20Your%20description%20here%20--%3E%0A%0A%0A%23%23%23%23%23%20ISSUE%20TYPE%0A-%20Docs%20Pull%20Request%0A%0A%2Blabel:%20docsite_pr" class="fa fa-github"> {{ _('Edit on GitHub') }}</a>
{% elif (not 'list_of' in pagename) and (not 'category' in pagename) %}
<a href="https://{{ github_host|default("github.com") }}/{{ github_user }}/{{ github_repo }}/{{ theme_vcs_pageview_mode|default("blob") }}/{{ github_version }}{{ conf_py_path }}{{ pagename }}{{ suffix }}?description=%23%23%23%23%23%20SUMMARY%0A%3C!---%20Your%20description%20here%20--%3E%0A%0A%0A%23%23%23%23%23%20ISSUE%20TYPE%0A-%20Docs%20Pull%20Request%0A%0A%2Blabel:%20docsite_pr" class="fa fa-github"> {{ _('Edit on GitHub') }}</a>
{% endif %}
diff --git a/docs/docsite/rst/conf.py b/docs/docsite/rst/conf.py
index b7adbd40ea..e9d6699c15 100644
--- a/docs/docsite/rst/conf.py
+++ b/docs/docsite/rst/conf.py
@@ -142,6 +142,8 @@ html_context = {
'github_repo': 'ansible',
'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/',
'current_version': version,
'latest_version': '2.9',
# list specifically out of order to make latest work
diff --git a/docs/templates/cli_rst.j2 b/docs/templates/cli_rst.j2
index 824843d86b..0e4c0f1683 100644
--- a/docs/templates/cli_rst.j2
+++ b/docs/templates/cli_rst.j2
@@ -1,3 +1,5 @@
+:source: {{ cli }}.py
+
{% set name = cli_name -%}
{% set name_slug = cli_name -%}