Skip to content

Commit

Permalink
Templates: Cleanup Whitespace (#1060)
Browse files Browse the repository at this point in the history
While not perfect this cuts it down a lot and makes the html output much 
cleaner
  • Loading branch information
Blendify committed Mar 1, 2021
1 parent 331ba4e commit 8ba9c8a
Show file tree
Hide file tree
Showing 4 changed files with 151 additions and 155 deletions.
22 changes: 11 additions & 11 deletions docs/_templates/layout.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{%- extends "!layout.html" %}

{#
{#-

This template exists as a way to implement a version menu without changing what
the theme normally renders the menu on local builds and on builds on Read the
Docs. This is for local testing purposes only.

#}

{% block footer %}
{% if not READTHEDOCS %}
{%- block footer %}
{%- if not READTHEDOCS %}
<div class="rst-versions" data-toggle="rst-versions" role="note" aria-label="{{ _('Versions') }}">
<span class="rst-current-version" data-toggle="rst-current-version">
<span class="fa fa-book"> Read the Docs</span>
Expand All @@ -19,15 +19,15 @@
<div class="rst-other-versions">
<dl>
<dt>{{ _('Versions') }}</dt>
{% if test_versions %}
{% for version in test_versions %}
{%- if test_versions %}
{%- for version in test_versions %}
<dd><a href="#">{{ version }}</a></dd>
{% endfor %}
{% else %}
{%- endfor %}
{%- else %}
<dd><a href="#">latest</a></dd>
<dd><a href="#">1.0</a></dd>
<dd><a href="#">1.1</a></dd>
{% endif %}
{%- endif %}
</dl>
<dl>
<dt>{{ _('Downloads') }}</dt>
Expand All @@ -36,7 +36,7 @@
<dd><a href="#">HTML</a></dd>
</dl>
<dl>
{# Translators: The phrase "Read the Docs" is not translated #}
{#- Translators: The phrase "Read the Docs" is not translated #}
<dt>{{ _('On Read the Docs') }}</dt>
<dd>
<a href="#">{{ _('Project Home') }}</a>
Expand All @@ -51,5 +51,5 @@
</dl>
</div>
</div>
{% endif %}
{% endblock %}
{%- endif %}
{%- endblock %}
101 changes: 50 additions & 51 deletions sphinx_rtd_theme/breadcrumbs.html
Original file line number Diff line number Diff line change
@@ -1,84 +1,83 @@
{# Support for Sphinx 1.3+ page_source_suffix, but don't break old builds. #}
{#- 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 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 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 '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 'bitbucket_url' in meta %}
{%- set display_bitbucket = True %}
{%- endif %}

{% if check_meta and 'gitlab_url' in meta %}
{% set display_gitlab = True %}
{% endif %}
{%- if check_meta and 'gitlab_url' in meta %}
{%- set display_gitlab = True %}
{%- endif %}

{% set display_vcs_links = display_vcs_links if display_vcs_links is defined else True %}
{%- set display_vcs_links = display_vcs_links if display_vcs_links is defined else True %}

<div role="navigation" aria-label="{{ _('Breadcrumbs') }}">

<ul class="wy-breadcrumbs">
{% block breadcrumbs %}
{%- block breadcrumbs %}
<li><a href="{{ pathto(master_doc) }}" class="icon icon-home"></a> &raquo;</li>
{% for doc in parents %}
{%- for doc in parents %}
<li><a href="{{ doc.link|e }}">{{ doc.title }}</a> &raquo;</li>
{% endfor %}
{%- endfor %}
<li>{{ title }}</li>
{% endblock %}
{% block breadcrumbs_aside %}
{%- endblock %}
{%- block breadcrumbs_aside %}
<li class="wy-breadcrumbs-aside">
{% if hasdoc(pagename) and display_vcs_links %}
{% if display_github %}
{% if check_meta and 'github_url' in meta %}
{%- if hasdoc(pagename) and display_vcs_links %}
{%- 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 %}
{%- else %}
<a href="https://{{ github_host|default("github.com") }}/{{ github_user }}/{{ github_repo }}/{{ theme_vcs_pageview_mode or "blob" }}/{{ github_version }}{{ conf_py_path }}{{ pagename }}{{ suffix }}" class="fa fa-github"> {{ _('Edit on GitHub') }}</a>
{% endif %}
{% elif display_bitbucket %}
{% if check_meta and 'bitbucket_url' in meta %}
{%- 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 %}
{%- else %}
<a href="https://bitbucket.org/{{ bitbucket_user }}/{{ bitbucket_repo }}/src/{{ bitbucket_version}}{{ conf_py_path }}{{ pagename }}{{ suffix }}?mode={{ theme_vcs_pageview_mode or "view" }}" class="fa fa-bitbucket"> {{ _('Edit on Bitbucket') }}</a>
{% endif %}
{% elif display_gitlab %}
{% if check_meta and 'gitlab_url' in meta %}
{%- 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 %}
{%- else %}
<a href="https://{{ gitlab_host|default("gitlab.com") }}/{{ gitlab_user }}/{{ gitlab_repo }}/{{ theme_vcs_pageview_mode or "blob" }}/{{ gitlab_version }}{{ conf_py_path }}{{ pagename }}{{ suffix }}" class="fa fa-gitlab"> {{ _('Edit on GitLab') }}</a>
{% endif %}
{% elif show_source and source_url_prefix %}
{%- 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 %}
{%- elif show_source and has_source and sourcename %}
<a href="{{ pathto('_sources/' + sourcename, true)|e }}" rel="nofollow"> {{ _('View page source') }}</a>
{% endif %}
{% endif %}
{%- endif %}
{%- endif %}
</li>
{% endblock %}
{%- endblock %}
</ul>

{% if (theme_prev_next_buttons_location == 'top' or theme_prev_next_buttons_location == 'both') and (next or prev) %}
{%- 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="{{ _('Breadcrumbs') }}">
{% if prev %}
{%- 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" aria-hidden="true"></span> {{ _('Previous') }}</a>
{% endif %}
{% if next %}
{%- endif %}
{%- 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" aria-hidden="true"></span></a>
{% endif %}
{%- endif %}
</div>
{% endif %}
{%- endif %}
<hr/>
</div>
34 changes: 17 additions & 17 deletions sphinx_rtd_theme/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,44 +17,44 @@
<p>
{%- if show_copyright %}
{%- if hasdoc('copyright') %}
{% trans path=pathto('copyright'), copyright=copyright|e %}&#169; <a href="{{ path }}">Copyright</a> {{ copyright }}.{% endtrans %}
{%- trans path=pathto('copyright'), copyright=copyright|e %}&#169; <a href="{{ path }}">Copyright</a> {{ copyright }}.{% endtrans %}
{%- else %}
{% trans copyright=copyright|e %}&#169; Copyright {{ copyright }}.{% endtrans %}
{%- trans copyright=copyright|e %}&#169; Copyright {{ copyright }}.{% endtrans %}
{%- endif %}
{%- endif %}

{%- if build_id and build_url %}
<span class="build">
{# Translators: Build is a noun, not a verb #}
{% trans %}Build{% endtrans %}
{#- Translators: Build is a noun, not a verb -#}
{%- trans %}Build{% endtrans -%}
<a href="{{ build_url }}">{{ build_id }}</a>.
</span>
{%- elif commit %}
<span class="commit">
{# Translators: the phrase "revision" comes from Git, referring to a commit #}
{% trans %}Revision{% endtrans %} <code>{{ commit }}</code>.
{#- Translators: the phrase "revision" comes from Git, referring to a commit #}
{%- trans %}Revision{% endtrans %} <code>{{ commit }}</code>.
</span>
{%- endif %}
{%- if last_updated %}
<span class="lastupdated">
{% trans last_updated=last_updated|e %}Last updated on {{ last_updated }}.{% endtrans %}
{%- trans last_updated=last_updated|e %}Last updated on {{ last_updated }}.{% endtrans %}
</span>
{%- endif %}
{%- endif -%}

</p>
{%- endblock %}
</div>

{%- if show_sphinx %}
{% set sphinx_web = '<a href="https://www.sphinx-doc.org/">Sphinx</a>' %}
{% set readthedocs_web = '<a href="https://readthedocs.org">Read the Docs</a>' %}
{# Translators: the variable "sphinx_web" is a link to the Sphinx project documentation with the text "Sphinx" #}
{% trans sphinx_web=sphinx_web, readthedocs_web=readthedocs_web %}Built with {{ sphinx_web }} using a{% endtrans %}
{# Translators: "theme" refers to a theme for Sphinx, which alters the appearance of the generated documenation #}
{% if show_sphinx %}
{%- set sphinx_web = '<a href="https://www.sphinx-doc.org/">Sphinx</a>' %}
{%- set readthedocs_web = '<a href="https://readthedocs.org">Read the Docs</a>' %}
{#- Translators: the variable "sphinx_web" is a link to the Sphinx project documentation with the text "Sphinx" #}
{%- trans sphinx_web=sphinx_web, readthedocs_web=readthedocs_web %}Built with {{ sphinx_web }} using a{% endtrans %}
{#- Translators: "theme" refers to a theme for Sphinx, which alters the appearance of the generated documenation #}
<a href="https://github.com/readthedocs/sphinx_rtd_theme">{% trans %}theme{% endtrans %}</a>
{# Translators: this is always used as "provided by Read the Docs", and should not imply Read the Docs is an author of the generated documentation. #}
{% trans %}provided by {{ readthedocs_web }}{% endtrans %}.
{%- endif %}
{#- Translators: this is always used as "provided by Read the Docs", and should not imply Read the Docs is an author of the generated documentation. #}
{%- trans %}provided by {{ readthedocs_web }}{% endtrans %}.
{% endif %}

{%- block extrafooter %} {% endblock %}

Expand Down

0 comments on commit 8ba9c8a

Please sign in to comment.