summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorSandra McCann <samccann@redhat.com>2019-06-05 16:27:27 -0400
committerAlicia Cozine <879121+acozine@users.noreply.github.com>2019-06-05 15:27:27 -0500
commit31fc9f92607ce40edd1084a135aa95be81a2dbd0 (patch)
tree285b6c195ffb3f1d9e45d16346c8b23ba6786148 /docs
parent0b5ab1e041dec7e457f9884fdaeb7a395c22e150 (diff)
downloadansible-31fc9f92607ce40edd1084a135aa95be81a2dbd0.tar.gz
backport 57316 (#57424)
Diffstat (limited to 'docs')
-rw-r--r--docs/docsite/_themes/sphinx_rtd_theme/breadcrumbs.html101
-rw-r--r--docs/docsite/rst/conf.py11
2 files changed, 97 insertions, 15 deletions
diff --git a/docs/docsite/_themes/sphinx_rtd_theme/breadcrumbs.html b/docs/docsite/_themes/sphinx_rtd_theme/breadcrumbs.html
index 0b4eb150bf..bf10e0c229 100644
--- a/docs/docsite/_themes/sphinx_rtd_theme/breadcrumbs.html
+++ b/docs/docsite/_themes/sphinx_rtd_theme/breadcrumbs.html
@@ -1,15 +1,88 @@
-<ul class="wy-breadcrumbs">
- <li><a href="{{ pathto(master_doc) }}">Docs</a> &raquo;</li>
- <li><a href="">{{ title }}</a></li>
- {% if pagename.endswith('_module') %}
- <li class="wy-breadcrumbs-aside">
- <a href="https://github.com/ansible/ansible/edit/devel/lib/ansible/modules/{{ meta.get('source', '') }}?description=%3C!---%20Your%20description%20here%20--%3E%0A%0A%2Blabel:%20docsite_pr" class="icon icon-github"> Edit on GitHub</a>
- </li>
- {% elif (not 'list_of' in pagename) and (not 'category' in pagename) %}
- <li class="wy-breadcrumbs-aside">
- <a href="https://github.com/ansible/ansible/edit/devel/docs/docsite/rst/{{ pagename }}.rst?description=%3C!---%20Your%20description%20here%20--%3E%0A%0A%2Blabel:%20docsite_pr" class="icon icon-github"> Edit on GitHub</a>
- </li>
- {% endif %}
-</ul>
-<hr/>
+{# Support for Sphinx 1.3+ page_source_suffix, but don't break old builds. #}
+
+{% if page_source_suffix %}
+{% set suffix = page_source_suffix %}
+{% else %}
+{% set suffix = source_suffix %}
+{% endif %}
+
+{% if meta is defined and meta is not none %}
+{% set check_meta = True %}
+{% else %}
+{% set check_meta = False %}
+{% endif %}
+
+{% if check_meta and 'github_url' in meta %}
+{% set display_github = True %}
+{% endif %}
+
+{% if check_meta and 'bitbucket_url' in meta %}
+{% set display_bitbucket = True %}
+{% endif %}
+
+{% if check_meta and 'gitlab_url' in meta %}
+{% set display_gitlab = True %}
+{% endif %}
+
+<div role="navigation" aria-label="breadcrumbs navigation">
+
+ <ul class="wy-breadcrumbs">
+ {% block breadcrumbs %}
+ <li><a href="{{ pathto(master_doc) }}">{{ _('Docs') }}</a> &raquo;</li>
+ {% for doc in parents %}
+ <li><a href="{{ doc.link|e }}">{{ doc.title }}</a> &raquo;</li>
+ {% endfor %}
+ <li>{{ title }}</li>
+ {% endblock %}
+ {% block breadcrumbs_aside %}
+ <li class="wy-breadcrumbs-aside">
+ {% if hasdoc(pagename) %}
+ {% if display_github %}
+ {% if check_meta and 'github_url' in meta %}
+ <!-- User defined GitHub URL -->
+ <a href="{{ meta['github_url'] }}" class="fa fa-github"> {{ _('Edit on GitHub') }}</a>
+ {% else %}
+ {% 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 (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 %}
+ {% endif %}
+ {% elif display_bitbucket %}
+ {% if check_meta and 'bitbucket_url' in meta %}
+ <!-- User defined Bitbucket URL -->
+ <a href="{{ meta['bitbucket_url'] }}" class="fa fa-bitbucket"> {{ _('Edit on Bitbucket') }}</a>
+ {% else %}
+ <a href="https://bitbucket.org/{{ bitbucket_user }}/{{ bitbucket_repo }}/src/{{ bitbucket_version}}{{ conf_py_path }}{{ pagename }}{{ suffix }}?mode={{ theme_vcs_pageview_mode|default("view") }}" class="fa fa-bitbucket"> {{ _('Edit on Bitbucket') }}</a>
+ {% endif %}
+ {% elif display_gitlab %}
+ {% if check_meta and 'gitlab_url' in meta %}
+ <!-- User defined GitLab URL -->
+ <a href="{{ meta['gitlab_url'] }}" class="fa fa-gitlab"> {{ _('Edit on GitLab') }}</a>
+ {% else %}
+ <a href="https://{{ gitlab_host|default("gitlab.com") }}/{{ gitlab_user }}/{{ gitlab_repo }}/{{ theme_vcs_pageview_mode|default("blob") }}/{{ gitlab_version }}{{ conf_py_path }}{{ pagename }}{{ suffix }}" class="fa fa-gitlab"> {{ _('Edit on GitLab') }}</a>
+ {% endif %}
+ {% elif show_source and source_url_prefix %}
+ <a href="{{ source_url_prefix }}{{ pagename }}{{ suffix }}">{{ _('View page source') }}</a>
+ {% elif show_source and has_source and sourcename %}
+ <a href="{{ pathto('_sources/' + sourcename, true)|e }}" rel="nofollow"> {{ _('View page source') }}</a>
+ {% endif %}
+ {% endif %}
+ </li>
+ {% endblock %}
+ </ul>
+
+ {% if (theme_prev_next_buttons_location == 'top' or theme_prev_next_buttons_location == 'both') and (next or prev) %}
+ <div class="rst-breadcrumbs-buttons" role="navigation" aria-label="breadcrumb navigation">
+ {% if next %}
+ <a href="{{ next.link|e }}" class="btn btn-neutral float-right" title="{{ next.title|striptags|e }}" accesskey="n">Next <span class="fa fa-arrow-circle-right"></span></a>
+ {% endif %}
+ {% if prev %}
+ <a href="{{ prev.link|e }}" class="btn btn-neutral float-left" title="{{ prev.title|striptags|e }}" accesskey="p"><span class="fa fa-arrow-circle-left"></span> Previous</a>
+ {% endif %}
+ </div>
+ {% endif %}
+ <hr/>
+</div>
diff --git a/docs/docsite/rst/conf.py b/docs/docsite/rst/conf.py
index a44472492e..de27c6d689 100644
--- a/docs/docsite/rst/conf.py
+++ b/docs/docsite/rst/conf.py
@@ -129,7 +129,16 @@ html_short_title = 'Ansible Documentation'
html_theme_options = {
'canonical_url': "https://docs.ansible.com/ansible/latest/",
- 'collapse_navigation': "True"
+ 'collapse_navigation': "True",
+ 'vcs_pageview_mode': 'edit'
+}
+
+html_context = {
+ 'display_github': 'True',
+ 'github_user': 'ansible',
+ 'github_repo': 'ansible',
+ 'github_version': 'devel/docs/docsite/rst/',
+ 'github_module_version': 'devel/lib/ansible/modules/'
}
# The style sheet to use for HTML and HTML Help pages. A file of that name